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:
@@ -65,7 +65,8 @@ const (
|
||||
// ChatShellRunRequest names one session and either a new command or a run.
|
||||
// OperationID is the optional retry identity of chat_shell_share's prompt.
|
||||
// Cols and Rows size a new run's terminal (chat_shell_run) or resize a running
|
||||
// one (chat_shell_resize); Data is chat_shell_input's typed text; After is
|
||||
// one (chat_shell_resize) and may accompany typed chat_shell_input (the size
|
||||
// its client draws at); Data is chat_shell_input's typed text; After is
|
||||
// chat_shell_run_output's resume offset.
|
||||
type ChatShellRunRequest struct {
|
||||
SessionID string `json:"session_id"`
|
||||
@@ -78,6 +79,11 @@ type ChatShellRunRequest struct {
|
||||
After int64 `json:"after,omitempty"`
|
||||
// RunIDs names the runs of chat_shell_dismiss and chat_shell_restore.
|
||||
RunIDs []string `json:"run_ids,omitempty"`
|
||||
// Reply marks chat_shell_input as an automatic answer of the client's
|
||||
// emulator; Activate marks chat_shell_resize as the client focusing the
|
||||
// terminal (see ChatShellInput and ChatShellResize).
|
||||
Reply bool `json:"reply,omitempty"`
|
||||
Activate bool `json:"activate,omitempty"`
|
||||
}
|
||||
|
||||
// ChatShellRunRecord is one operator command and what it produced. Output is
|
||||
|
||||
@@ -13,10 +13,24 @@ const (
|
||||
// (Ctrl-C is "\u0003", Enter is "\r", arrow keys are their escape
|
||||
// sequences); the bytes written are exactly its UTF-8 encoding. Input is
|
||||
// never persisted or logged; the reply carries no body.
|
||||
//
|
||||
// Several clients may draw one terminal; the one that most recently typed
|
||||
// or focused it (marked activate on a resize), or else the first to
|
||||
// attach, is its active client. Reply marks Data
|
||||
// as the client emulator's automatic answer to a terminal query (cursor
|
||||
// position, device attributes) rather than typing: it reaches the process
|
||||
// only from the active client and is otherwise acknowledged and dropped,
|
||||
// so a query gets one answer. Typed input makes its client active; it may
|
||||
// carry Cols and Rows, the size that client draws at, which the terminal
|
||||
// then takes before the input is written.
|
||||
ChatShellInput = "chat_shell_input"
|
||||
// ChatShellResize sets a running terminal command's size (cols, rows); the
|
||||
// process receives SIGWINCH. The last resize from any client wins. The
|
||||
// reply echoes the run.
|
||||
// ChatShellResize reports the size (cols, rows) a client draws a running
|
||||
// terminal command at. The terminal takes the active client's size (the
|
||||
// process receives SIGWINCH); a resize marked activate makes its client
|
||||
// the active one (it focused the terminal). When the active client's
|
||||
// connection closes, the next most recently active client's last size is
|
||||
// applied. A client that does not set the fields behaves as before: its
|
||||
// typing makes it active. The reply echoes the run with the size applied.
|
||||
ChatShellResize = "chat_shell_resize"
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user