#[non_exhaustive]pub enum Update<S = Value> {
Message(MessageUpdate),
Messages(Vec<Message>),
State(S),
Reasoning(ReasoningUpdate),
Subagent(SubagentUpdate),
Interrupt(Interrupt),
Error(Error),
Done(RunEnd),
}Expand description
Something a view should react to.
One Update is one redraw. S is the caller’s state type; it is
serde_json::Value unless a Session is asked for something better.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Message(MessageUpdate)
A message was created, appended to, or completed.
Messages(Vec<Message>)
MESSAGES_SNAPSHOT replaced the conversation. Messages may have
disappeared, so redraw all of it.
State(S)
The application state changed, and here it is in the caller’s type.
Carries no association with whatever was open when it arrived — a tool call, a message — because the wire carries none either. Where it lands in the stream is the only nesting there is; see the module docs.
Reasoning(ReasoningUpdate)
Reasoning text arrived. Kept separate from the reply.
Subagent(SubagentUpdate)
A subagent was announced, resumed, finished, suspended or failed.
The lifecycle only: what a subagent says arrives as ordinary
Update::Messages and Update::Reasonings whose messages carry
its subagent_run_id, so a view groups by that and uses this for the
group’s header and status. See Session::subagents.
Interrupt(Interrupt)
The run paused and needs a human. Answer it with
Session::resume — one update per pending interrupt.
Error(Error)
Something went wrong: a malformed stream, a patch that would not apply,
a transport failure, a RUN_ERROR.
Not necessarily fatal — a run survives a patch it could not apply. When
it is fatal, the matching Update::Done follows.
Done(RunEnd)
The run ended, and how. Always the last update of a run, on every path out: the agent finishing, the agent failing, and the transport dying mid-sentence.