Documentation
¶
Overview ¶
TUI — a full-screen terminal interface (Charm bubbletea/bubbles/lipgloss).
Step 3 of the front-end plan. Like the dashboard, the TUI is an event-bus subscriber; unlike the dashboard, it also OWNS the terminal, so when -tui is active the stdout subscriber is silenced (agent.SilenceStdout(true)) to avoid fighting the render loop.
Architecture note: bubbletea runs its own event loop and owns stdin, which is incompatible with the blocking readInput()/runTurn() REPL loop. So the TUI is a SEPARATE MODE selected by -tui: runTUI replaces the REPL loop entirely. A submitted prompt runs runTurn in a goroutine; bus events and turn completion flow back into the model as tea.Msgs via Program.Send.
Known gaps (deliberate, to keep this shippable — see the plan):
- Input is a plain bubbles/textinput: no Tab-completion, history, !shell, @file, or """ multi-line yet. The REPL keeps those; the TUI gets them in a follow-up. Core loop (type prompt → watch panes stream) works.
- Slash commands aren't routed through the TUI yet (they run in the REPL).
Rich input for the TUI — history, tab-completion, multi-line, and the !shell / @file / /command affordances the REPL has.
The REPL gets these from x/term's line editor; bubbletea's textinput is bare, so we layer them here. Completion reuses the REPL's completeLine and replCommands (single source of truth for the command list). History reads the same ~/.agent/history file the REPL persists, so recall is shared across both front-ends.
What's handled here (logic, unit-tested):
- history ring: up/down recall, shared file
- tab completion: delegates to completeLine
- multi-line: a """ line toggles a multi-line buffer
- prefix routing: !shell, @file, /command classified for the caller
The keybindings are wired in tui.go's Update; this file is the testable core so the behavior is verified even though the live feel isn't.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.