Merge main into the terminal flow-control branch

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>
This commit is contained in:
2026-11-26 00:03:20 +00:00
148 changed files with 18443 additions and 153 deletions
+11 -3
View File
@@ -20,10 +20,15 @@ const (
// oldest first, without output. The body is optional.
TerminalList = "terminal_list"
// TerminalInput writes Data (UTF-8, control characters included, at most
// ChatShellInputLimit bytes) to a running terminal. No reply body.
// ChatShellInputLimit bytes) to a running terminal. No reply body. Reply
// marks an automatic answer of the client's emulator, which reaches the
// terminal only from its active client; typed input may carry the size
// (cols, rows) the client draws at (as chat_shell_input).
TerminalInput = "terminal_input"
// TerminalResize sets a running terminal's size (cols, rows); the reply
// echoes the terminal.
// TerminalResize reports the size (cols, rows) a client draws a running
// terminal at; the terminal takes its active client's size, and Activate
// makes the sender active (as chat_shell_resize). The opener of a
// terminal is its first active client. The reply echoes the terminal.
TerminalResize = "terminal_resize"
// TerminalOutput reads one terminal with its retained output from the
// absolute byte After on (all of it when After precedes the retained
@@ -90,6 +95,9 @@ type TerminalRequest struct {
// Flow (terminal_open, terminal_output) asks for flow-controlled output:
// the connection acknowledges what it consumed with terminal_ack.
Flow bool `json:"flow,omitempty"`
// Reply (terminal_input) and Activate (terminal_resize): see above.
Reply bool `json:"reply,omitempty"`
Activate bool `json:"activate,omitempty"`
}
// TerminalRecord is one terminal. Output and OutputStart are set only on