fix(ui): render interactive bang commands via a vt100 screen parser - #546
Merged
Conversation
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
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.