On an insecure origin the Webapp has no mediaDevices, so dictation and live voice reported the generic "This runtime does not support microphone recording." The Webapp now says to open it over HTTPS or through an SSH tunnel to 127.0.0.1, like the bot screen does. Native Desktop keeps the old text.
Insecure contexts expose no navigator.mediaDevices. Dictation guards
for that and says "This runtime does not support microphone recording",
but GPT-Live voice conversation called getUserMedia unguarded after
opening a peer connection, so the toast showed a raw "Cannot read
properties of undefined (reading 'getUserMedia')".
Fail before opening the peer with a NotSupportedError, which micError
now maps to the same "microphone unsupported" copy. Barge-in gets the
same guard: its monitor no longer reaches for the missing API (its
catch had swallowed the TypeError, so it was silently inert before).
Refs #93508 (review P3)
(cherry picked from commit da5e6f68394dd921fbffbc7150403b19af501ac3)
Over plain HTTP from another machine the bot screen viewer could not
attach: it asked the bot for a viewer first, then hashed the minted id
with crypto.subtle, which insecure contexts lack, so the pane showed
"Cannot read properties of undefined (reading 'digest')". noVNC needs a
secure context as well.
Without crypto.subtle, never request a viewer and show a readable
notice that bot screens need HTTPS or an SSH tunnel to 127.0.0.1
(all four plugin locales). Installing and starting the screen are
untouched; the docs list the viewer as HTTPS-only.
Refs #93508 (review P3)
(cherry picked from commit cdff1dca7861d22f2363615d951bfaa85aef6825)
Preview reads, Save and media tickets sent the tab's session_id with the window's profile. A Bot or pooled chat can belong to another profile, and the gateway looks a session up only in the profile the request names, so a file main read for that chat answered 404. The file facade and the media stream now resolve the session's owner through the store's session-owner lookup (sessionFileOwnerScope) and send the id with that profile, plus its connection when it is not the ambient one. When no owner is known they send no session at all and use the window's profile, as main did.
Passing the tab's session to LocalFilePreview grew PreviewPane past its
FUNC_LINES cap (314 > 312 on main). The artifact-or-file body moves into a
small PreviewDocumentBody component; what renders is unchanged.
/api/fs/write-text resolved its path with _fs_path alone: no session and no
container mapping. A preview of /workspace/note.txt read the session's
sandbox copy, but Save wrote the gateway host's /workspace/note.txt, which
is normally missing (400) and is never the file that was read.
write-text takes an optional session_id and resolves through the same
_fs_download_path read-text uses (#143655), with decode_fallback off so a
write never lands on a decoded twin of its name. writeDesktopFileText takes
the same optional session scope, and the preview Save passes the tab's
session. A session another profile owns is a 404 and nothing is written; a
symlink out of the sandbox is not followed. Native local saves are
unchanged.
Audit: write-text is the only renderer path that saves a file it read.
mkdir, the managed uploads and the image paste write into the managed root
or the upload staging folders, never a session's /workspace.
/api/fs/read-text took no session, so a Docker session's text preview read
the profile's shared /workspace copy. A file: URL naming a container path
(file:///workspace/x) was never translated at all: read-text answered 404
and a file: clip streamed the shared copy even with a session.
read-text takes an optional session_id and resolves through
_fs_download_path (#143655), as download does. _agent_fs_path translates the
path a POSIX file: URL names, so the URL spelling maps like the bare path;
the .. and symlink refusals still apply. readDesktopFileText and
readDesktopFileDataUrl take an optional session scope that a gateway read
sends and a local (native) read ignores; a preview tab passes the session
that owns it, and a chat link passes its transcript's session.
The browser stream bridge sent only the path and profile, so a ticket for
/workspace/clip.mp4 resolved in the profile's shared sandbox. A session
bound to a host workspace runs in its own <base>:ws:<digest> container, so
its clip was missing or another session's copy played.
getGatewayFileStreamUrl takes an optional sessionId, the transcript player
and tool media slots pass their session, and /api/files/stream maps a
session_id through _fs_download_path (#143655) for a cookie-authenticated
request too. A session the profile does not own is a 404, and a symlink or
.. out of the sandbox is not translated. Native Desktop has no stream bridge
and is unchanged.
A shell that exited while no tab was attached still left an expired
tab. On redial HostTerminalRegistry.resolve refused the dead session
before PtySession.attach could send the exit reason, and once the reaper
had removed the session the route only knew the token was gone. Both
cases closed with the generic expiry reason, which keeps the tab and
offers a new shell.
The registry now raises TerminalExited (a TerminalExpired) for a dead
session that is still registered. The server always removes a session
before closing it, so only the shell's own exit leaves a dead one
behind. When the reaper takes a shell that exited, the registry
remembers its token and owner identity for the retention TTL, at most
64 of them, and a redial by that identity also gets TerminalExited.
The route closes it with 4410 and 'Process exited', the close an
attached tab gets. Deleted profiles, expiry and explicit closes keep
the generic reason.
The browser tab reads that close before the handshake too. A redial
reports a process exit, and resuming a saved shell (a remount or a
page reload) rejects with the 'exited' signal, which closes the tab.
_admit, _read_frames, the constants block and the import block are not
touched.
The new route test runs a real shell that exits after its tab has
detached, before and after the reaper runs. At aba0914d8c96 both cases
fail with 'Terminal or profile expired; open a new terminal'.
After a trimmed replay the browser sends a resize one row away and then
the real size, so the foreground program redraws. The host terminal pump
applied both at once, and a program that reads the size late can handle
both SIGWINCHes after the size is back where it was. Node reports a
stdout 'resize' only when the size it reads has changed, and Hermes' TUI
redraws on that event, so nothing redrew: on a real PTY a Node 26 child
got the signals and reported no resize.
A resize back to the size before the previous one now waits until the
program has written output since that one (a program that redraws on a
resize does), or one second for a program that does not. Other resizes,
including a drag's, are applied at once as before. The POSIX bridge reads
the PTY size with TIOCGWINSZ; a bridge that cannot report it (ConPTY)
never waits.
Known limit: output the program wrote before the step but read after it
counts as an answer, so a program printing continuously can still miss
the step.
Dropping files into a terminal typed each path with POSIX single quotes
unless the shell name contained powershell, pwsh or cmd, or was fish, csh
or tcsh. nu, xonsh, elvish and an SSH tab's remote shell have other
quoting rules, so a name could end the quotes there. In cmd with delayed
expansion on, !NAME! inside the double quotes still expanded and a lone !
was dropped. The substring match also gave cmd quoting to any shell whose
path held "cmd".
The quoter now matches the shell's program name (no directory, no .exe,
no login dash) and names the POSIX shells it quotes for: sh, ash, bash,
dash, ksh, mksh and zsh. A shell it does not name gets a path only when
the path is a plain word every shell reads literally; any other path is
left out and a warning names it and the shell. In cmd a path holding !
is left out the same way: nothing tells the terminal whether delayed
expansion is on, and no quoting keeps ! literal both ways.
The quoter is shared, so native Desktop changes too (a custom shell or an
SSH tab). Its POSIX fallback had the same bug.
The tests read the typed text with a tokenizer for each named shell's
rules (POSIX, csh, fish, PowerShell, cmd with and without delayed
expansion).
Refs #144648 (WA-7)
Refs #144704
Typing `exit` (or Ctrl-D) in a browser terminal left the tab open with
"Terminal expired or exited. Press Enter to create a new shell." Native
Desktop closes the tab when its shell exits.
The server closes the socket with 4410 both when the shell exits and when
it ends the shell itself (retention expiry, a deleted profile, the gateway
stopping), and the browser read every 4410 on a persistent shell as
`expired`.
A shell that exits by itself now closes with the reason "Process exited"
(the drain's EOF, and an attach to a shell that died while detached). The
browser reports that close as a process exit, so the session hook removes
the tab the way it does in native Desktop. A 4410 without the reason still
shows the expired message and keeps the tab. The dashboard chat only logs
the close reason, so it is unchanged.
Refs #144648 (WA-6)
Refs #144704
Reattaching a browser terminal whose full-screen program (vim, htop,
hermes --tui) had written more than 1 MiB on the alternate screen painted
fragments of its output, and nothing redrew until the window was resized
or Ctrl-L was pressed.
The reattach replay is the last 1 MiB of output, which then starts
mid-way through the program's screen updates. The resume RESIZE repeats
the unchanged size, and an unchanged TIOCSWINSZ sends no SIGWINCH (checked
on a real PTY: 0 signals; a one-row step and back: 1).
When the server reports a trimmed replay, the browser now steps the size
one row away before sending the real size, so the foreground program
redraws as after a window resize. No input reaches the program (host
shells must not get Ctrl-L), and the replay contract is unchanged. Known
limit: modes set before the trimmed tail (alternate screen, mouse
tracking) are not restored.
Refs #93508 (review P3)
(cherry picked from commit b6de9130b9873b23c0af5b76814efa1fd29e01ee)
The same refused drop showed as an error in a message being edited and as a warning in the main composer. The bounded summary is now a warning in both; upload failures after staging stay errors.
Each reason ends with a period and the warning joins items with '; ', so it read '…instead.; Could not attach…' and '…instead.; and 5 more'. A reason another item or the count follows now loses its trailing period; the last reason and the detail keep theirs.
In the browser, Attach → Files… with a file over 16 MiB rejected inside selectDesktopPaths and nothing caught it, so the user saw nothing. pickContextPaths now reports the refusal under a new "Attach failed" title, as pickImages does.
The oversize reason no longer carries the filename (2bd8355307ff), and the edit composer passed the staging error straight to notifyError, so an oversized file dropped into a message being edited said only 'The file is larger than 16 MiB...' and several such files gave identical errors. The edit composer now collects staging failures and reports them in one dropWarning error toast, as the main composer does: each name is shown, shortened past 48 characters, the limit stays, and the full names ride in the detail. Upload failures after staging are reported as before. No new strings.
Capping the warning at three failures did not bound its length: three long names or paths were still joined in full. Names over 48 characters are now shortened with a middle ellipsis, the warning stops naming failures past 240 characters and counts the rest, and the full list rides in the detail whenever anything is shortened or left out. The formatting moves to drop-warning.ts.
The oversize reason carried the filename, so a name of about 150 characters pushed it past readableError's 180-character cap and the drop warning lost the limit. The reason no longer includes the name; the drop warning already adds it.
use-composer-actions.test.ts had grown past 1,000 lines. The three drop-warning tests (rejected folders, failed uploads, the bounded large-drop warning) move unchanged into use-composer-actions.drop-warnings.test.ts.
A drop of many failing items joined every failure into one toast message, which grows off screen because the message body does not scroll. Name the first three, count the rest with a localized 'and N more', and keep the full list in the notification's collapsible detail, which now scrolls inside its height cap.
In the browser, a picked or dropped file over 16 MiB went to
/api/chat/file-upload and came back as "Upload request is too large",
which doesn't say what the limit is. A picked image over the limit showed
nothing at all: pickImages left the rejected pick as an unhandled
rejection.
The browser keeps its 16 MiB limit. Native Desktop's 25 MiB is the cap on
/api/chat/image-upload, but a browser send reads a staged file back
through /api/fs/read-data-url, which stops at WEBAPP_ATTACHMENT_MAX_BYTES
(16 MiB), so a larger image could never be sent. stageBrowserFile now
refuses a file over the limit before uploading it, with a message that
names the limit, and pickImages reports a refused pick as an "Image
attach failed" error.
Refs #144648 (WA-2)
Refs #144704
A drop on the composer warned about a failed item only when nothing in the
drop attached, and then only about the last failure. In a mixed drop (a
file that stages plus a folder, or a file over the upload limit) the
failed items vanished without a word.
attachDroppedItems now collects every failure and shows them in one
"Drop files" warning whenever any item failed, alongside the chips for
the items that did attach.
Refs #144648 (WA-1)
Refs #144704
In the browser Webapp, a folder dropped on the composer (or the chat area,
or a message being edited) showed a copy cursor, attached nothing and said
nothing.
The browser bridge has no host path for a dropped File, and the drop
extractor discarded a directory without one before any composer saw it.
The extractor now keeps a path-less folder with its File, so it takes the
same attach pipeline as other unsupported drops. Staging refuses it with
a reason ("Folders can't be attached by dropping them. Use Attach >
Folder… instead."), shown as the usual "Could not attach <name>" drop
warning in the composer and as an error toast in the edit composer. A
folder never takes the image path. Folders with a path (Electron) still
become @folder: refs.
Refs #93508 (review P3)
(cherry picked from commit 52f0b3fadceda6f11cca9644a8af5351051eb358)
Native local profiles share the primary socket too (multiplex-only routing,
case 6). A primary reconnect republishes the primary's own unflagged local
descriptor while the picked profile stays selected, and the local-mode
shortcut then sent an unnamed poll answered for the launch profile. Drop the
shortcut: any descriptor that isn't the selected profile's own asks main for
the selected profile's shared route. The selected profile's own descriptor
still sends {} with no extra call.
A reconnect re-resolves the socket's own route and republishes the
primary's descriptor (sharedPrimary false), while the picked profile stays
selected. The no-session live-status poll read only that descriptor, so it
went back to asking the launch profile.
When the published remote descriptor isn't the selected profile's own, the
poll now asks main for the selected profile's route with the same check
requestGatewayForProfile routes by (sharedPrimaryRoute, now exported). With
a session open, or on a local descriptor, it asks nothing new and sends
what it sent before.
Refs #144648 (WA-10)
With no session open, the sidebar's session.active_list poll goes out on
the active socket and names no profile. A profile picked on top of the
shared primary socket (a Webapp tab's live pick or ?profile= boot, a
native global remote) is only a view of that socket, so the gateway
answered for its own profile and the sidebar dots showed that profile's
turns instead of the selected one's.
The poll now names the selected profile when the active connection is
sharedPrimary and no session is open. With a session open the request is
unchanged: the session RPC dispatcher still routes it to the session's
owner.
Refs #144648 (WA-10)
Refs #144705
A live profile pick in the Webapp records the profile in the tab's
?profile= with history.replaceState(null, ...), which wiped
react-router's HashRouter entry state (idx, key and navigation state) for
the current entry, so later back/forward deltas and that entry's location
state were lost.
profile.remember now passes the current history.state through and only
changes the URL.
Refs #93508 (review P3)
(cherry picked from commit 8c245c6f1133d3c2bf33e46c11472660e4730212)
A <base> inserted before <html><head ...> opened an implicit head, so the parser ignored the authored <head> start tag and dropped its attributes (a page reaching document.getElementById on its head threw). The base now goes right after the page's <head> start tag, else its <html> tag, else after a leading doctype.
A srcdoc document takes its parent's base URL, here the wrapper's blob: URL, so href="#sec" resolved to blob:...#sec and the opaque-origin frame could not navigate. A page without its own <base> now gets <base href="about:srcdoc">, inserted after any leading doctype so the page keeps standards mode. The sandbox and attribute escaping are unchanged.
cancelRun dropped every subagent row (clearSessionSubagents), on the
assumption that Stop cancels them all. Stop now ends only the turn, so it
prunes finished rows and keeps running/queued ones; the stopped turn's own
children leave with the next roster snapshot. Without this a surviving
background subagent vanished from the Subagents frame until the next 5 s
poll brought it back.
cancelRun() (Stop, and "send now" on a queued message while busy) called
resetSessionBackground(), which issues process.kill for every running
background process in the session. A plain interrupt keeps the timeline,
and the gateway's session.interrupt deliberately leaves
terminal(background=true) processes running, so the renderer was killing
work the backend contract says must survive (e.g. a dev server started
several turns earlier).
- cancelRun: drop resetSessionBackground().
- reloadFromMessage (regenerate): it truncates history through
prompt.submit just like restore/edit, but never reset background state,
so processes spawned by the discarded turns stayed live. It now clears
todos, resets background (killing running processes) and clears preview
artifacts before the re-run, matching restoreToMessage / editMessage.
Tests (use-prompt-actions/index.test.tsx): cancelRun sends
session.interrupt and no process.kill and the running row survives;
reloadFromMessage and restoreToMessage kill the running process and clear
the rows. The cancel and reload cases fail on main and pass with this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The salvaged browser Export profile notice built its reason in English.
Move it to profiles.exportNeedsHost in every bundled locale, keeping the
host-side command (hermes profile export <name>) verbatim.
Refs #144648 (WA-4)
Refs #144704
In the browser Webapp, Export profile (profile menu and command palette)
did nothing: no dialog, no file, no message.
The export flow returns as soon as the bridge has no selectSavePath, and
the browser bridge never provides one.
It now reports this the way the flow reports any failed export: the
localized "Failed to export profile" title, with the reason and the
host-side command (hermes profile export <name>). This is the smaller
safe option: a browser export would have to serve the server's managed
export directory, which holds a secret-bearing archive, through the file
download route, and that path is unverified. Electron export with the
native dialog is unchanged.
Refs #93508 (review P3)
(cherry picked from commit f87d3d2fcc81fcbfffce7a6f8a12cfb0474e40bd)
"Open in browser" in the Webapp wrapped the page in a sandboxed iframe
whose src was a base64 data URL. Chromium refuses to navigate a frame
to a URL over 2 MiB, so any page above about 1.5 MB (default Plotly,
Bokeh and Folium exports) opened as a blank tab with no error.
Carry the page through srcdoc instead: decoded as UTF-8, as the data
URL's charset forced, and escaped for a double-quoted attribute (&
first, then ", < and >). Not a second blob URL, which would be an
app-origin page running agent HTML outside its sandbox. The frame keeps
sandbox="allow-scripts" only (opaque origin: no storage, popups or top
navigation) and no-referrer. The pinned data-URL assertion in
browser-desktop-bridge.test.ts now asserts the escaped srcdoc instead.
Refs #93508 (review W10)
(cherry picked from commit f8785ad7de00642b5ff55e5e6dafc09697e1884d)
Found in review of #143607 by @dokterdok.
Automatic image previews now share one renderer-wide queue of two
downloads, served in request order. A preview that leaves the viewport,
is hidden or unmounts before its turn gives up its place without a
request, and a file already downloading is joined instead of being
requested again. The manual Download button stays outside the cap.
Refs #143547
CI JS & TS checks: apps/desktop src/i18n/overlay-completeness.test.ts failed because errorCodes.session_read_only had no entry in the eight catalogs that carry error cards (ar, de, es, fr, ja, ru, zh, zh-hant). Added the title and body to each beside cron_session_read_only.
Refs #143547
session/list now includes editor threads stored as local rows, sessions report
model and reasoning config options, and prompt.cancel on a started turn stops it
in the same call.
Rows ACP-23, ACP-24.
Refs #143547
Co-authored-by: Felipe Cardoso <felipe.cardoso@hotmail.it>
Co-authored-by: omega <omega.ai@keihatsu.de>
Review F1 (P2): since the agentless breakdown is accepted, a breakdown with categories but context_max 0 overwrote the meter header with zeros (40k/100k became 110 tok, popover 0 / 0). The header now takes the breakdown figures only when it knows a window, otherwise the session's own streamed usage, never the merged global. The popover still gets the categories.
Refs #143547
A reasoning change during a turn returned session_busy and Desktop rolled it
back. It now shares the deferred model-pick slot and commits at the next turn
boundary; Desktop shows the existing "applies from your next message" notice.
Row MP-24 (reasoning half).
Refs #143547
Adds Rename and Disband to the gateway group header, the @ picker in the
composer, paste and drag-and-drop attachments, and inline previews for small
images. The restored-send notice now shows only for a send restored from the
journal.
Rows HR-15, HR-16, HR-20, HR-23 (client half).
Refs #143547
Co-authored-by: HootRock <wtr1274970944@163.com>
Co-authored-by: Maziay <Maziyarkolagar@gmail.com>