In the browser a frame rasterises on the thread that parses output, so a
stream drawn at 60 frames a second spends half its time drawing. With
deferShows (the web default) output written less than a gap after the
last show is shown when the gap has passed; output after a quiet spell
(an echo) still shows at once. Natively frames rasterise on their own
thread and written output keeps showing at once. The stream bench
measures the stream without its final 600 ms wait for frame timings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- On the web a turn yields through a MessageChannel task: a chain of
zero-length timers is clamped to 4 ms each, which left the emulator
idle for a third of a burst.
- Slices are cut to what the measured speed writes in the budget left,
so a turn ends near 6 ms however costly the output is to parse; the
first write takes 4 Ki units to measure.
- Writes no longer notify the view each: the feed shows the emulator's
state once everything queued is written, and while output still waits
after a turn at most every 32 ms, so a flood draws its final state per
frame instead of a frame per turn.
- Stream bench: producer follows a flow window (256 KiB past drawn, 32 KiB
frames, rate by elapsed time), reports time spent parsing, ?show=each
for the old per-write notify; tool/perf/terminal_stream_profile.mjs
prints a CPU profile of one workload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Emulator (vendored xterm):
- Widths follow glibc wcwidth on generated Unicode 16 tables
(tool/gen_unicode_tables.py); combining marks, variation selectors,
ZWJ sequences, skin tones, flags and Hangul jamo join the previous cell,
stored as interned clusters (CellContent.clusterFlag) and drawn and
copied whole. U+FE0F and flags take two columns, as modern terminals
do; a wide character never starts in the last column.
- Box drawing, block elements and Powerline separators are drawn as
geometry filling the cell; rows are whole pixels high.
- Backgrounds merge per colour; each line is a picture reused until the
line changes (BufferLine.version); a line drawn unchanged settles into
one laid out paragraph with a span per style. TerminalStyle and
TerminalTheme compare by value.
App: bundled Symbols Nerd Font Mono subset (568 KiB, MIT) as the
terminal's first fallback, loaded on first use; line height 1.1;
?terminalUnicode=1 fixture showcase; bench gains a progress workload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A headless xterm-compatible emulator (internal/termstate) follows each
machine terminal's PTY output under the same lock as the 1 MiB tail. A
terminal_output from before the retained tail (new page, reload, gap)
now gets output_snapshot: an escape stream that resets the client and
restores scrollback (1000 lines), main screen, the alternate screen when
in use (via ?1049h so the program's exit brings the shell back), saved
cursors, tabs, scroll region, cursor incl. pending wrap, modes (mouse
tracking/encoding, bracketed paste, DECCKM, keypad, autowrap, origin,
focus, ...), charsets, pen and title, as of output_end; frames continue
there. Reads inside the tail stay raw.
No Go library was adequate: charmbracelet/x/vt and vito/midterm scroll at
0.2-4 MB/s and hide modes/pen/region; vt10x is unmaintained. termstate
runs at 160-200 MB/s.
The app treats a snapshot reply as a replay without the dropped-output
line, and every replay now starts with RIS so stale modes end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved keeping both sides: main's active-client rules, input
lane, reply marking and key input, and this branch's flow control,
acknowledgements, subscriptions and sliced emulator feed. terminal_ack
joins the terminal lane; the feed marks each live slice it writes as
drawing, so the emulator's answers still go to onReply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Machine terminals no longer skip output for live viewers. Each connection's
subscription is a cursor into the 1 MiB retained tail, drained by the
connection's writer as soon as the PTY reader writes (no 50 ms tick; a
streaming frame gathers for at most 2 ms). A subscription opened with
flow: true gets window (256 KiB) in its reply and acknowledges drawn output
with terminal_ack; while one is full the reader stops reading the PTY, so
the program waits. A subscription full for 3 s without acking stops holding
the terminal and later sees a gap; a gone connection drops its
subscriptions. Clients that never ask for flow keep the old pacing (newest
64 KiB per 50 ms). terminal_open/terminal_output replies precede the frames
that follow them, which start exactly at the reply's output_end.
Chat shell runs share the buffer code: output is pushed as it arrives,
oldest first, while the chat's watchers keep short queues; 256 KiB unpushed
stops the reader, and watchers behind for 3 s get the old pacing.
The app asks for flow, takes offsets from the server (frame end, reply
output_end) instead of re-encoded text length, acks per quarter window, and
writes replays and bursts into the emulator in slices that yield to the
event loop (ChatShellTerminalFeed, shared with chat shells).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Several clients drawing one terminal (machine terminal or chat terminal
command) no longer interfere. The server tracks, per terminal, the
connections drawing it, most recently active first: the active client
(the opener, then whoever last typed or focused it) owns the PTY size and
is the only one whose emulator's automatic query answers reach the
process; other clients' answers are acknowledged and dropped, and their
sizes recorded but not applied. When the active connection closes the next
most recent client's size is applied.
Protocol (backwards compatible; all new fields optional):
- terminal_input / chat_shell_input: reply (emulator answer), cols/rows
(the typist's size, applied before the input).
- terminal_resize / chat_shell_resize: activate (the client focused it).
Latency: PipelinesClient sends terminal_input, terminal_resize,
chat_shell_input and chat_shell_resize at once rather than behind the
previous request's reply. The server reads those onto a per-connection
terminal lane handled in order beside the ordinary request loop, and
terminal_open (up to 5 s waiting for su) now runs off the read loop.
Client: ChatShellTerminalSession routes what the emulator emits while
drawing output to onReply and reports focus through activate();
ChatShellInputPipe keeps answers and typing in separate requests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Live terminals no longer reflow (xterm.dart 4.0.0 left the cursor on the
wrong row); narrowing cuts and erases cells past the width, rows scroll
into scrollback keeping the cursor row; finished output still reflows.
- App-side key encoding before xterm.dart's defaults: Alt as Meta (ESC +
the typed character), Ctrl symbol table, xterm modifier parameter for
arrows/Home/End/PgUp/PgDn/Ins/Del/F-keys, DECCKM and DECKPAM, Alt+BS.
- Settings > Appearance > Terminal: Use Option as Meta key (Macs, on).
- Inside a focused terminal only Cmd+T and Ctrl+` toggle it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without one, CircularProgressIndicator looks its controller up on every
frame, walking the widget tree for the ambient Theme (89 ms over a
streamed reply at 4K). AppSpinner is the stock indicator with its own
controller and the stock period.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
Keep the existing Material terminal and chat-shell behavior while removing live Cupertino widgets, icon metadata, and alternate-host branches. Retain only the documented optional compatibility parameters until remaining callers migrate.
A browser keeps Ctrl+Shift+C for its developer tools, so on Linux and
Windows web nothing copied. With text selected Ctrl+C now copies it (and
clears the selection) instead of interrupting the process; Ctrl+Insert
copies too, and a finished run's read-only output answers the copy keys.
The terminal's options menu names the key.
A dialog only in the tiled app on a wide layout: a phone keeps its
full-screen page (run 304 had turned it into a sheet and rewritten the
tests), and a floating window opens it as a page of that window so a diff
or command output it opens stays in the window.
Present chat turn and shell-history detail surfaces through the shared adaptive popup helpers so desktop uses dialogs while phone layouts retain bottom sheets. Update focused tests and document the verified behavior.
On Android and iOS a tap on a terminal (a chat command card or the terminal
panel) now opens the soft keyboard and typing goes to the process, with no
autocorrect. Desktop keeps raw key events. Desktop keyboard tests now run
as macOS, since tests default to Android.
Terminals are marked as typing surfaces. While one has focus, the chat's
"/ jumps to the composer", the Search tab's Escape, Ctrl+/, Ctrl+1…9 and
Ctrl+Shift+arrow pane moves leave the key to the terminal, like they do for
text fields.
Dismissed shell runs leave the transcript and fold into a "N commands"
chip in the footer of the first answer at or after each run (the last
answer for newer runs, or a row of its own without any answer). The chip
opens the turn sheet (wide) or a full-screen page (narrow) listing the
commands; each opens its output read-only with Copy output, Send to agent
and Restore.
On a wide conversation the answer's Copy button moves out of the footer
into a 48 px gutter left of the reading column (chatCopyGutter), shown on
hover or focus on desktops and always on touch; narrow widths keep it in
the footer.
Finished command cards get a Dismiss button and the chat's More menu a
Dismiss all finished commands entry. Dismissal applies to every client of
the chat; a SnackBar (Material) or transient notice (Cupertino) offers Undo
for 5 s. Running commands cannot be dismissed until they end.
Finished terminals are sized synchronously from their rows at the view's
width (the post-frame fit made the transcript re-anchor forever); blank rows
xterm.dart keeps when rewrapping are dropped; desktop typing uses key events;
the composer leaves Cmd/Ctrl-V to a focused terminal; Ctrl-A reaches the
process. The probe fixture gains coloured terminal runs and an interactive
login. Notes record behaviour, protocol, security and verification.
The card's output area is now an xterm.dart emulator kept per run by the
controller: it is fed the raw stream in order, takes typing and paste while
the command runs (with a key toolbar and a soft-keyboard field on touch
platforms), resizes the process to its layout, opens printed links, shrinks
finished runs to their output and opens full screen. A reconnect resumes from
the byte the card holds; Copy output copies the server's plain text.
Show Expand only when output can overflow and drop the final newline from
the drawn output. The full-app probe lists shell runs with ?shell=1 so the
cards, Shell mode and Run command dialog can be captured in Chrome.
A draft starting with ! shows a Shell mode indicator and runs through
chat_shell_run instead of being sent to the agent; the chat's actions menu
gains Run command. Each run is a terminal-style card among the turns with
live output, Stop, its exit status, Copy output and Send to agent.