Skip to main content

AgentSessionEvent

Enum AgentSessionEvent 

Source
pub enum AgentSessionEvent {
Show 24 variants SessionBeforeSwitch { reason: SessionBeforeSwitchReason, target_session_file: Option<String>, }, SessionBeforeFork { entry_id: String, position: SessionBeforeForkPosition, }, SessionStart { reason: SessionStartReason, previous_session_file: Option<String>, }, SessionShutdown { reason: SessionShutdownReason, target_session_file: Option<String>, }, ModelSelect { model: Box<Model>, previous_model: Option<Box<Model>>, source: ModelSelectSource, }, AgentStart, AgentEnd { messages: Vec<AgentMessage>, will_retry: bool, }, TurnStart, TurnEnd { message: AgentMessage, tool_results: Vec<ToolResultMessage>, }, MessageStart { message: AgentMessage, }, MessageUpdate { message: AgentMessage, assistant_message_event: Box<AssistantMessageEvent>, }, MessageEnd { message: AgentMessage, }, ToolExecutionStart { tool_call_id: String, tool_name: String, args: Map<String, Value>, }, ToolExecutionUpdate { tool_call_id: String, tool_name: String, args: Map<String, Value>, partial_result: AgentToolResult, }, ToolExecutionEnd { tool_call_id: String, tool_name: String, result: AgentToolResult, is_error: bool, }, AgentSettled, QueueUpdate { steering: Vec<String>, follow_up: Vec<String>, }, CompactionStart { reason: CompactionReason, }, CompactionEnd { reason: CompactionReason, result: Option<CompactionResult>, aborted: bool, will_retry: bool, error_message: Option<String>, }, EntryAppended { entry: SessionEntry, }, SessionInfoChanged { name: Option<String>, }, ThinkingLevelChanged { level: ModelThinkingLevel, }, AutoRetryStart { attempt: u32, max_attempts: u32, delay_ms: u64, error_message: String, }, AutoRetryEnd { success: bool, attempt: u32, final_error: Option<String>, },
}
Expand description

Session-specific events that extend the core agent event surface.

Wire tags and field names match TypeScript AgentSessionEvent.

Variants§

§

SessionBeforeSwitch

Extensions may cancel a pending session switch.

Fields

§reason: SessionBeforeSwitchReason

Whether this creates a new session or resumes one.

§target_session_file: Option<String>

Target session file for resume/import operations.

§

SessionBeforeFork

Extensions may cancel a pending session fork.

Fields

§entry_id: String

Selected session entry.

§position: SessionBeforeForkPosition

Whether the fork starts before or at the selected entry.

§

SessionStart

Extension-host-facing session start (never routed through emit_public; the public event stream excludes it, matching TS).

Fields

§reason: SessionStartReason

Why this session started.

§previous_session_file: Option<String>

Previously active session file (new/resume/fork).

§

SessionShutdown

Extension-host-facing session shutdown (never routed through emit_public).

Fields

§reason: SessionShutdownReason

Why this session is shutting down.

§target_session_file: Option<String>

Session file replacing this one (new/resume/fork).

§

ModelSelect

A new model was selected.

Fields

§model: Box<Model>

Newly selected model (boxed to keep the enum small; wire unchanged).

§previous_model: Option<Box<Model>>

Previously selected model, absent during initial restoration.

§source: ModelSelectSource

Selection source.

§

AgentStart

A new agent run has started.

§

AgentEnd

The agent run finished; will_retry is true when auto-retry will continue.

Fields

§messages: Vec<AgentMessage>

Messages produced by this run.

§will_retry: bool

Whether session-level auto-retry will continue the run.

§

TurnStart

A turn is about to begin.

§

TurnEnd

A turn finished with an assistant message and any tool results.

Fields

§message: AgentMessage

Assistant message that completed the turn.

§tool_results: Vec<ToolResultMessage>

Tool-result messages for this turn.

§

MessageStart

A transcript message is starting.

Fields

§message: AgentMessage

Message snapshot at start.

§

MessageUpdate

An assistant message was updated during streaming.

Fields

§message: AgentMessage

Latest assistant message snapshot.

§assistant_message_event: Box<AssistantMessageEvent>

Underlying provider stream event.

§

MessageEnd

A transcript message has ended.

Fields

§message: AgentMessage

Final message snapshot.

§

ToolExecutionStart

Tool execution is starting for one tool call.

Fields

§tool_call_id: String

Tool-call identifier.

§tool_name: String

Registered tool name.

§args: Map<String, Value>

Validated tool arguments.

§

ToolExecutionUpdate

Tool execution produced a partial result update.

Fields

§tool_call_id: String

Tool-call identifier.

§tool_name: String

Registered tool name.

§args: Map<String, Value>

Validated tool arguments.

§partial_result: AgentToolResult

Partial tool result.

§

ToolExecutionEnd

Tool execution finished for one tool call.

Fields

§tool_call_id: String

Tool-call identifier.

§tool_name: String

Registered tool name.

§result: AgentToolResult

Final tool result.

§is_error: bool

Whether the result is treated as an error.

§

AgentSettled

Session-level idle after retries / compaction / queued continuations.

§

QueueUpdate

Mirror of pending steering / follow-up queue text for UI.

Fields

§steering: Vec<String>

Pending steering message texts.

§follow_up: Vec<String>

Pending follow-up message texts.

§

CompactionStart

Compaction is starting.

Fields

§reason: CompactionReason

Why compaction was triggered.

§

CompactionEnd

Compaction finished.

Fields

§reason: CompactionReason

Why compaction was triggered.

§result: Option<CompactionResult>

Result when compaction produced a summary.

§aborted: bool

Whether compaction was aborted.

§will_retry: bool

Whether the session will retry after this compaction.

§error_message: Option<String>

Error text when compaction failed.

§

EntryAppended

A session entry was appended.

Fields

§entry: SessionEntry

Appended entry.

§

SessionInfoChanged

Session display name changed.

Fields

§name: Option<String>

New name (None clears).

§

ThinkingLevelChanged

Thinking level changed.

Fields

§level: ModelThinkingLevel

New thinking level.

§

AutoRetryStart

Auto-retry backoff is starting.

Fields

§attempt: u32

Current attempt (1-based).

§max_attempts: u32

Configured max attempts.

§delay_ms: u64

Backoff delay in milliseconds.

§error_message: String

Error that triggered the retry.

§

AutoRetryEnd

Auto-retry finished (success, exhaustion, or cancel).

Fields

§success: bool

Whether a later assistant response succeeded.

§attempt: u32

Attempt count at end.

§final_error: Option<String>

Final error when unsuccessful.

Implementations§

Source§

impl AgentSessionEvent

Source

pub fn from_agent_event(event: AgentEvent, will_retry: bool) -> Self

Convert a core agent event into a session event.

agent_end requires will_retry from the session retry policy.

Source

pub fn type_name(&self) -> &'static str

Wire type discriminant.

Trait Implementations§

Source§

impl Clone for AgentSessionEvent

Source§

fn clone(&self) -> AgentSessionEvent

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 AgentSessionEvent

Source§

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

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

impl<'de> Deserialize<'de> for AgentSessionEvent

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 PartialEq for AgentSessionEvent

Source§

fn eq(&self, other: &AgentSessionEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AgentSessionEvent

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

impl StructuralPartialEq for AgentSessionEvent

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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.
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