Skip to main content

interactive_tui

Function interactive_tui 

Source
pub async fn interactive_tui(
    harness: &AgentHarness,
    event_rx: Option<Receiver<AgentEvent>>,
    args: &Args,
    model_catalog: Vec<Model>,
    initial: Option<String>,
    extra_messages: &[String],
    theme: Option<&str>,
    reload_context: &ReloadContext,
) -> i32
Expand description

TUI-based interactive mode.

event_rx carries the live AgentEvent stream (installed by crate::session::build); when None (e.g. a non-TUI caller reuses this fn), it falls back to a blocking, await-final-text path.

model_catalog is the read-only catalog the /model selector displays.

This implementation mirrors the TypeScript InteractiveMode class: build the layout root once, drain AgentEvents into UI mutations that mirror handleEvent, and dispatch keys from a spawn_blocking crossterm loop (the TuiAltScreen start() handler is a stub). Selectors and autocomplete are layered on via the editor-container swap pattern.