Run chat shell commands in a pseudo-terminal with typed input and resize

Commands start in a PTY (creack/pty; macOS and Linux) of the client's size
with TERM=xterm-256color in their own session. chat_shell_input writes typed
UTF-8 text in order through a bounded queue; chat_shell_resize sets the size.
Output stays the raw terminal stream with byte offsets as sequence numbers,
chat_shell_run_output resumes from an offset, and a plain-text rendering is
persisted for Copy output and Send to agent. Input is never stored or logged.
This commit is contained in:
2026-11-09 19:57:46 +00:00
parent 8ca5a1fdda
commit 355b722a1d
20 changed files with 865 additions and 54 deletions
+4 -1
View File
@@ -250,7 +250,10 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
if err := wsjson.Read(connCtx, conn, &request); err != nil {
return
}
log.Printf("command received: client=%s type=%q id=%q pipeline=%d version=%d", r.RemoteAddr, request.Type, request.ID, request.PipelineID, request.Version)
if request.Type != protocol.ChatShellInput && request.Type != protocol.ChatShellResize {
// Keystrokes would be one line each; their data is never logged.
log.Printf("command received: client=%s type=%q id=%q pipeline=%d version=%d", r.RemoteAddr, request.Type, request.ID, request.PipelineID, request.Version)
}
if request.Type == protocol.Submit && !options.AllowAuthoring {
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "pipeline authoring is disabled on this execution server; ask the operator to publish through an explicitly enabled authoring server"})
continue