Skip to content

fix(ui): render interactive bang commands via a vt100 screen parser - #546

Merged
yogthos merged 3 commits into
mainfrom
interactive-shell-fixes
Jun 30, 2026
Merged

fix(ui): render interactive bang commands via a vt100 screen parser#546
yogthos merged 3 commits into
mainfrom
interactive-shell-fixes

Conversation

@yogthos

@yogthos yogthos commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

gh auth login's arrow-key menu redraws in place (cursor-up + erase-line + reprint), so stripping escapes and concatenating the text stacked every redraw as new lines. Feed the raw PTY bytes into a vt100::Parser and render its screen grid into the live shell box, so cursor-moving apps update in place. PTY winsize and the parser grid are sized to the real terminal.

Also fixes the side effects of the old approach: the thinking avatar is now Idle while the user drives the shell (Thinking is re-applied only when the agent picks up the captured output on exit), and interrupting a command no longer dumps its partial, escape-stripped capture into the chat log.

Consolidates the PTY shell plumbing into shell_session.rs / pty_relay.rs (deleting shell_exec.rs and shell_interactive.rs) and threads terminal size through shell_session::spawn.

Yogthos added 3 commits June 29, 2026 20:45
gh auth login's arrow-key menu redraws in place (cursor-up + erase-line +
reprint), so stripping escapes and concatenating the text stacked every
redraw as new lines. Feed the raw PTY bytes into a vt100::Parser and render
its screen grid into the live shell box, so cursor-moving apps update in
place. PTY winsize and the parser grid are sized to the real terminal.

Also fixes the side effects of the old approach: the thinking avatar is now
Idle while the user drives the shell (Thinking is re-applied only when the
agent picks up the captured output on exit), and interrupting a command no
longer dumps its partial, escape-stripped capture into the chat log.

Consolidates the PTY shell plumbing into shell_session.rs / pty_relay.rs
(deleting shell_exec.rs and shell_interactive.rs) and threads terminal
size through shell_session::spawn.
shell_session used libc/std::os::unix, so it only compiled on Unix and
broke the windows-default CI build. Gate the PTY path (spawn,
open_pty_pair, set_cooked, set_winsize, the os::unix imports, and the
PTY tests) behind #[cfg(unix)], and add a #[cfg(not(unix))] spawn that
runs the child with piped stdio and forwards combined stdout/stderr as
Output chunks plus a single Exited. Keystrokes aren't forwarded on
non-Unix (no controlling terminal); the rest of the UI event-loop
integration is unchanged, so !cmd/!!cmd still work on Windows, just
non-interactively — matching the pre-PTY behavior.
The #[cfg(not(unix))] kill_group stub was now unused: its only caller
lives inside the #[cfg(unix)] spawn, and the Windows spawn manages its
own kill. Removing it clears the `-D dead-code` error on the windows
build. Also collapse the drain-task closure to one line per rustfmt.
@yogthos
yogthos merged commit 9664a6d into main Jun 30, 2026
14 checks passed
yogthos pushed a commit that referenced this pull request Jun 30, 2026
PTY-backed !/!! bang commands (interactive gh/editors, vt100 in-place
render), /prompt <name> <text> runs the text, write_todo_list backed by
the issue board, clipboard copied tooltip, CI clippy gate, visible failed
MCP servers, stream retry on mid-tool-call chunk timeouts, and bounded DB
loads in agent construction. (#538, #539, #540, #541, #542, #544, #546, #547)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant