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
+12 -4
View File
@@ -133,6 +133,8 @@ func (m *terminalManager) start(clientID, id, dir string, cmd *exec.Cmd, cols, r
v.paused = true
p.mu.Unlock()
}
// The opener draws it first: it is the active client.
p.viewers.resize(clientID, cols, rows, true)
}
m.wg.Add(1)
go m.supervise(p, cmd, terminal)
@@ -274,17 +276,23 @@ func (m *terminalManager) Resize(id string, cols, rows int) (protocol.TerminalRe
if err != nil {
return protocol.TerminalRecord{}, err
}
if err := p.applySize(cols, rows); err != nil {
return protocol.TerminalRecord{}, err
}
return p.snapshot(false, 0), nil
}
// applySize sets the terminal's PTY to cols x rows (clamped).
func (p *terminalProcess) applySize(cols, rows int) error {
cols, rows = chatShellTerminalSize(cols, rows)
p.mu.Lock()
p.record.Cols, p.record.Rows = cols, rows
terminal := p.pty
p.mu.Unlock()
if terminal != nil {
if err := resizeChatShellTerminal(terminal, cols, rows); err != nil {
return protocol.TerminalRecord{}, err
}
return resizeChatShellTerminal(terminal, cols, rows)
}
return p.snapshot(false, 0), nil
return nil
}
// Output is one terminal with its retained output from byte after on,