Commit Graph

5 Commits

Author SHA1 Message Date
alan 2889d59119 App: replace a silent socket instead of hanging; blink the terminal cursor on a timer; keep one markdown cache entry per streamed reply
A socket that outlived a sleep or network change looked open, so every
queued request waited its own 30 s timeout behind the last until the page
was reopened. The client now replaces a socket whose request times out
unheard (or after two timeouts in a row), and probes it with a ping after
a quiet spell or on returning to the foreground.

The terminal's blinking cursor ran a Ticker (a frame every vsync); a 530 ms
timer now flips it. Streamed deltas no longer flood the markdown cache and
evict finished answers.

Adds tool/perf/idle_session_bench.mjs (idle frames, long-session heap,
snapshot census) and notes/perf-hangs-idle.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 20:47:22 +00:00
alan c3458d8a7f Terminals: one active client per terminal; keystrokes skip the request queue
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>
2026-11-25 23:37:16 +00:00
alan b2e5606c84 Add ordered websocket address fallback 2026-10-24 02:31:21 +01:00
alan 1e4ecea823 fix(app): harden socket lifecycle and expand transport regressions 2026-10-21 13:28:59 +01:00
alan c262f77501 feat(app): add Flutter websocket transport 2026-10-21 13:24:11 +01:00