Expand description
Watch journal: what a running subagent has shown so far, for clients that watch it in its own thread view.
A worker’s real message history only reaches SubagentState when its
turn ends, so a live view can’t be built from it. Instead the worker’s
event loop (tools/subagent/drive.rs) records every presentation event
here, and clients page through it with SessionQuery::SubagentWatch
(since = the next_seq of their previous page). The first page is the
whole run so far; later pages are just what is new.
Bounded on purpose:
- consecutive text / thinking / tool-output deltas coalesce into one entry
— but only into an entry no reader has seen yet (
sealed), so a client paging byseqnever misses an append; - large tool inputs and results are capped per entry;
- past
JOURNAL_MAX_BYTESthe oldest entries drop and readers asking for them gettruncated: true.
Every entry is stamped with when it was recorded (ms on the journal’s own
monotonic clock), and each page says what that clock read when it was
taken (at_ms, now_ms). A client only applies a page when it polls —
only while the view is focused, and the first page is the whole run so
far — so its own arrival times say nothing about when a worker’s tool
started or how long it ran. With the stamps it can place each event in
its own clock and show the same running clock and └─ ok … Ns duration
the main thread shows.
Raw provider error text never enters the journal (same rule as
SubagentState::safe_fail): errors carry only their category label,
and retry notices are not recorded.
Structs§
- Watch
Journal - Bounded, append-only record of a worker’s presentation events.
- Watch
Page - One page of a worker’s journal (
SessionQuery::SubagentWatchreply).
Enums§
- Watch
Event - One presentation event of a worker, in the shape the TUI’s transcript
applies (
stream_handler::apply_transcript_event).
Constants§
- JOURNAL_
MAX_ BYTES - Total retained bytes per worker before the oldest entries drop.
- PAGE_
MAX_ BYTES - Most bytes of events one page returns; the client pages on from
next_seq. - TOOL_
PAYLOAD_ MAX_ BYTES - Cap on one tool input (serialized) or one tool result.