Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
Show 22 variants AgentStart, TurnStart, MessageStart { message: AgentMessage, }, MessageUpdate { message: AgentMessage, }, MessageEnd { message: AgentMessage, }, ToolExecutionStart { call_id: String, name: String, }, ToolExecutionUpdate { call_id: String, name: String, partial: String, }, ToolExecutionEnd { call_id: String, name: String, output: String, is_error: bool, diff: Option<String>, path: Option<String>, duration_ms: Option<u64>, }, TurnEnd { message: AgentMessage, }, Compaction { summarized: usize, kept: usize, }, CompactionSkipped { reason: String, }, Retrying { attempt: u32, max: u32, reason: String, }, MessageReceived { from: SessionId, content: String, }, Error { message: String, }, Ack, Stopped { stop_reason: StopReason, }, SideAnswer { text: String, usage: Option<Usage>, }, History { messages: Vec<AgentMessage>, }, Sessions { sessions: Vec<SessionInfo>, }, Spawned { worker: SessionId, }, Todo { todos: Vec<TodoItem>, }, AgentEnd,
}

Variants§

§

AgentStart

§

TurnStart

§

MessageStart

Fields

§

MessageUpdate

Fields

§

MessageEnd

Fields

§

ToolExecutionStart

Fields

§call_id: String
§name: String
§

ToolExecutionUpdate

Fields

§call_id: String
§name: String
§partial: String
§

ToolExecutionEnd

Fields

§call_id: String
§name: String
§output: String
§is_error: bool
§diff: Option<String>

UI-only unified diff (see ToolOutput::diff); absent when there is nothing to show, or on an older peer that predates the field.

§path: Option<String>

UI-only path of the changed file (see ToolOutput::path); absent when the tool touched no file, or on an older peer.

§duration_ms: Option<u64>

Wall-clock duration of the tool call in milliseconds — execute plus its after_tool_call hook. UI-only, like diff/path: it rides this event but never enters ToolOutput/the model’s context. None on an older peer, or a call that never ran (blocked by a hook, or a dead sink).

§

TurnEnd

Fields

§

Compaction

Auto-compaction summarized summarized older messages, keeping kept.

Fields

§summarized: usize
§kept: usize
§

CompactionSkipped

Best-effort auto-compaction was attempted (the context was near the ceiling) but did NOT complete — a summarizer/stream failure. The run continues. Deliberately NOT AgentEvent::Error, whose contract is a stream-level failure: a TUI renders Error as a failed run, so routing a best-effort compaction miss through it would falsely mark the run failed. reason is the summarizer’s error text, for display only — never fed back to the model and never fatal. Purely additive on the wire ({"type":"compaction_skipped","reason":…}), so crate::protocol::PROTOCOL_VERSION need not bump.

Fields

§reason: String
§

Retrying

The adapter retried a failed connect after a transient error.

Fields

§attempt: u32
§max: u32
§reason: String
§

MessageReceived

A peer delivered a message to this session (Request::Notify/ Interrupt/Wake). from is the sender’s address (§5.2 — the human is crate::protocol::USER); streamed, so a UI can surface an inbound message. Not a reply.

Fields

§content: String
§

Error

Stream-level failure. A fatal-class failure (bad request, auth, schema) ends the run with StopReason::Error; a transient-class failure that exhausted its retries (or landed mid-stream) is fed back to the model and the loop continues, still bounded by a consecutive-error cap.

Fields

§message: String
§

Ack

Reply: a request with no richer answer succeeded (e.g. SetModel). Never streamed — it answers one request, correlated by the transport (an in-process reply channel today, the envelope’s reply_to on the wire).

§

Stopped

Reply: the run finished, with why it stopped. Answers a Submit. Never streamed (see AgentEvent::Ack).

Fields

§stop_reason: StopReason
§

SideAnswer

Reply: a tool-free side answer to a Request::SideAsk (/btw). Never streamed (see AgentEvent::Ack). Carries the answer text and the turn’s usage (for a /usage-style readout); styling is the front-end’s.

Fields

§text: String
§usage: Option<Usage>
§

History

Reply: the conversation so far, answering a Request::GetHistory. Never streamed (see AgentEvent::Ack).

Fields

§messages: Vec<AgentMessage>
§

Sessions

Reply: the sessions a server serves, in serve order (root first), each with the model the server knows for it (crate::protocol::SessionInfo). Answers a crate::protocol::Request::ListSessions. Never streamed (see AgentEvent::Ack).

Fields

§sessions: Vec<SessionInfo>
§

Spawned

Reply: a peer defined a worker and returns its address, answering a crate::protocol::Request::Define. Never streamed (see AgentEvent::Ack).

The field is worker, not id: the envelope already carries a top-level id (the request it replies to), and a flattened duplicate key would not deserialize.

Fields

§worker: SessionId
§

Todo

The todo checklist, streamed on every write (mirror Compaction / Retrying: a plain state payload the UI reduces). The field is todos, not id: the envelope already carries a top-level id and a flattened duplicate key would not deserialize.

Fields

§todos: Vec<TodoItem>
§

AgentEnd

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AgentEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self> ⓘ

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

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoToolOutput for T
where T: Serialize + 'static,

Source§

fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>

Convert this value without routing structured data through a string.
Source§

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

Source§

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
Source§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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