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:
@@ -99,13 +99,13 @@ func TestChatShellRunStreamsToEveryWatcherAndPersists(t *testing.T) {
|
||||
if final.Status != protocol.ChatShellRunExited || final.ExitCode == nil || *final.ExitCode != 3 || final.EndedAt < final.StartedAt {
|
||||
t.Fatalf("final record = %+v", final)
|
||||
}
|
||||
if output != dir+"\nout\nerr\n" {
|
||||
t.Fatalf("streamed output = %q", output)
|
||||
if output != dir+"\r\nout\r\nerr\r\n" || !final.Terminal || final.Cols != protocol.ChatShellTerminalDefaultCols || final.Rows != protocol.ChatShellTerminalDefaultRows {
|
||||
t.Fatalf("streamed output = %q, final %+v", output, final)
|
||||
}
|
||||
}
|
||||
writeChat(t, ctx, conns[1], protocol.Message{Type: protocol.ChatShellRuns, ID: "list", ChatQuery: &protocol.ChatQuery{SessionID: "ses_1"}})
|
||||
list := readShellFrame(t, ctx, conns[1], func(m protocol.Message) bool { return m.ID == "list" })
|
||||
if len(list.ChatShellRuns) != 1 || list.ChatShellRuns[0].Output != dir+"\nout\nerr\n" || *list.ChatShellRuns[0].ExitCode != 3 {
|
||||
if len(list.ChatShellRuns) != 1 || list.ChatShellRuns[0].Output != dir+"\r\nout\r\nerr\r\n" || list.ChatShellRuns[0].Text != "" || *list.ChatShellRuns[0].ExitCode != 3 {
|
||||
t.Fatalf("persisted runs = %+v", list)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user