You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TASK] Refactor the chat TUI to render its agent runs through the AG-UI protocol #1713
The chat TUI does not render its own agent runs through the AG-UI protocol. This came up while exposing the next-step suggestion on the AG-UI run state (#1710, PR #1712): the serve worker, the daemon binding and any AG-UI client share one event model, but the in-process TUI maps agentdomain.ChatEvents through its own handlers in internal/presentation/tui/handlers, a second mapping the two views have to keep in sync by hand.
What the code shows today:
The chat TUI's in-process runs are rendered event by event by the handlers under internal/presentation/tui/handlers (for example chat_handler.go). None of those packages imports internal/protocols/agui.
The TUI only touches AG-UI as a wire client when it follows a daemon thread: internal/presentation/tui/daemonthread/thread.go uses agui.Conn and frames as raw payloads it never decodes into the run model.
The headless side renders the same agent events with internal/presentation/headless/run_encoder.go on top of internal/protocols/agui/run.go, which is already a complete mapping: text, reasoning, tool calls and results, usage, todos, background tasks, interrupts and activities.
The refactor would make the TUI consume the AG-UI event stream for its own runs (or at least share the single mapping in internal/presentation/headless and internal/protocols/agui), so a feature like the next-step suggestion lands for every view at once, instead of once in the TUI handlers and once in the AG-UI encoder.
Acceptance Criteria
The chat TUI's in-process rendering shares one event mapping with the serve worker and the daemon binding, driven by internal/protocols/agui/run.go (or the RunEncoder), instead of a parallel switch over agentdomain.ChatEvent in the TUI handlers
Client-only consumption (the daemon thread following the binding) is preserved, including its framing and reconnect behavior
The TUI's per-view extras that have no AG-UI event (focus, input state, theme) stay in the TUI - the refactor moves the run rendering, not the chat UI itself
The AG-UI output docs (docs/ag-ui-output.md) stay accurate after the change
Activity
refactor(agui): decode a run's frames back into typed events (#1719)
refactor(agent): remove the dead computer-use pause events (#1721)
feat(agui): report a cancelled tool call and conversation optimization (
refactor(tui): reduce AG-UI frames in the TUI over typed events (#1724)
feat(chat): render a local chat's runs through AG-UI behind an opt-in (…
fix(agent): run a tool batch only once every approval is answered (#1727
feat(chat): render a local chat's runs through AG-UI by default (#1728)