Expand description
Interactive mode for pi-cli.
Full-screen terminal UI with a streaming transcript, an editor, a live
status indicator, and tool-execution display. Mirrors the TypeScript
packages/coding-agent/src/modes/interactive/interactive-mode.ts event→UI
mapping (handleEvent), driven by the live AgentEvent stream the harness
emits via the BroadcastEmitter installed in crate::session.
Key architecture facts (see docs/tui-gap-analysis.md):
TuiAltScreen::start()andshow_overlayare stubs, so this module owns aspawn_blockingcrosstermread()loop for key dispatch and atokio::spawntask that drainsbroadcast::Receiver<AgentEvent>into UI mutations.- The layout root is built ONCE at startup (mirrors the TS
fullscreenLayoutRoot); per-message we mutate onlychat_container/status_container/autocomplete_containerchildren and callrequest_render(false)so the differential renderer repaints just the changed rows. - Selectors (
/model/session/theme) are implemented by swapping theeditor_containerchild (the TSshowSelectorswap pattern,interactive-mode.ts:4354-4377) — theshow_overlaystub is avoided entirely. Anactive_selectorstate field holds the liveSelectList; while it isSomethe key loop routes to it first and restores the editor on done/cancel.
Functions§
- interactive_
tui - TUI-based interactive mode.
- is_
tui_ supported - Check if the terminal supports TUI mode.