Skip to main content
The browser receives agent output over two channels that share one frame vocabulary, ChatStreamEvent, defined in web/protocol/src/chat-protocol.ts.

Turn stream: NDJSON over POST

POST /api/chat runs a turn and streams NDJSON frames back on the response. The first frame is a start frame that advertises adapterCapabilities (for example reasoning-summary-v1), which is how optional features are negotiated: clients that don’t recognize a capability simply don’t render the corresponding enhancement. The client validates the shape of every streamed frame but accepts additional fields it does not know yet, so a newer server can add fields without breaking an older client. While a turn is active, the NDJSON stream is authoritative; the SSE handler skips frames for a session whose status is streaming or submitted so nothing renders twice.

Out-of-turn pushes: SSE with replay

GET /api/chat/events?sessionId= opens a Server-Sent Events channel for pushes that happen outside an active turn, such as messages sent by IPython code. Every dispatched frame lands in a per-session in-memory ring buffer with a monotonically increasing integer seq. The buffer keeps at most 500 frames and about 1 MiB of serialized frame data, evicting the oldest frames first. A single frame larger than 1 MiB clears the buffer instead of being stored. On reconnect the client sends Last-Event-ID and the server replays every frame with a greater sequence number. If frames the client missed were evicted or dropped, the server emits a resync-required state frame and the client rehydrates the session with GET /api/chat/session. Sequence numbers persist in sessionStorage, so a page reload resumes the SSE cursor without a server round trip. Sequences are per-session and in-memory; they are not durable across a server restart.

Frame types

Tool naming

The event mapper converts engine tool names to PascalCase frame types with special-casing for IPython and short acronyms: tool-IPython, tool-Bash, tool-Edit, tool-Task, tool-Question, tool-WebSearch, and so on. Tool renderers in web/design/src/components dispatch on part.type, and anything without a dedicated card falls back to a generic tool renderer.

Interactive questions

The browser does not prompt you for input. When a tool-Question frame arrives during a turn, the browser answers it automatically with a skip ({ "kind": "skip" }) through POST /api/chat/question. On the Rust daemon, Fleet does not bind the engine’s extension UI, so confirm/select/input dialogs and notify/setStatus/setWidget updates do not reach the browser.
Last modified on November 20, 2026