Skip to main content

Update

Enum Update 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Trait Implementations§

Source§

impl<S: Debug> Debug for Update<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S = Value> !RefUnwindSafe for Update<S>

§

impl<S = Value> !UnwindSafe for Update<S>

§

impl<S> Freeze for Update<S>
where S: Freeze,

§

impl<S> Send for Update<S>
where S: Send,

§

impl<S> Sync for Update<S>
where S: Sync,

§

impl<S> Unpin for Update<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Update<S>
where S: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more