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: SessionBeforeSwitchReasonWhether this creates a new session or resumes one.
SessionBeforeFork
Extensions may cancel a pending session fork.
Fields
position: SessionBeforeForkPositionWhether 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: SessionStartReasonWhy this session started.
SessionShutdown
Extension-host-facing session shutdown (never routed through
emit_public).
Fields
reason: SessionShutdownReasonWhy this session is shutting down.
ModelSelect
A new model was selected.
Fields
source: ModelSelectSourceSelection 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.
TurnStart
A turn is about to begin.
TurnEnd
A turn finished with an assistant message and any tool results.
Fields
message: AgentMessageAssistant message that completed the turn.
tool_results: Vec<ToolResultMessage>Tool-result messages for this turn.
MessageStart
A transcript message is starting.
Fields
message: AgentMessageMessage snapshot at start.
MessageUpdate
An assistant message was updated during streaming.
Fields
message: AgentMessageLatest assistant message snapshot.
assistant_message_event: Box<AssistantMessageEvent>Underlying provider stream event.
MessageEnd
A transcript message has ended.
Fields
message: AgentMessageFinal message snapshot.
ToolExecutionStart
Tool execution is starting for one tool call.
Fields
ToolExecutionUpdate
Tool execution produced a partial result update.
Fields
partial_result: AgentToolResultPartial tool result.
ToolExecutionEnd
Tool execution finished for one tool call.
Fields
result: AgentToolResultFinal tool result.
AgentSettled
Session-level idle after retries / compaction / queued continuations.
QueueUpdate
Mirror of pending steering / follow-up queue text for UI.
Fields
CompactionStart
Compaction is starting.
Fields
reason: CompactionReasonWhy compaction was triggered.
CompactionEnd
Compaction finished.
Fields
reason: CompactionReasonWhy compaction was triggered.
result: Option<CompactionResult>Result when compaction produced a summary.
EntryAppended
A session entry was appended.
Fields
entry: SessionEntryAppended entry.
SessionInfoChanged
Session display name changed.
ThinkingLevelChanged
Thinking level changed.
Fields
level: ModelThinkingLevelNew thinking level.
AutoRetryStart
Auto-retry backoff is starting.
Fields
AutoRetryEnd
Auto-retry finished (success, exhaustion, or cancel).
Implementations§
Source§impl AgentSessionEvent
impl AgentSessionEvent
Sourcepub fn from_agent_event(event: AgentEvent, will_retry: bool) -> Self
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.
Trait Implementations§
Source§impl Clone for AgentSessionEvent
impl Clone for AgentSessionEvent
Source§fn clone(&self) -> AgentSessionEvent
fn clone(&self) -> AgentSessionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentSessionEvent
impl Debug for AgentSessionEvent
Source§impl<'de> Deserialize<'de> for AgentSessionEvent
impl<'de> Deserialize<'de> for AgentSessionEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AgentSessionEvent
impl PartialEq for AgentSessionEvent
Source§impl Serialize for AgentSessionEvent
impl Serialize for AgentSessionEvent
impl StructuralPartialEq for AgentSessionEvent
Auto Trait Implementations§
impl Freeze for AgentSessionEvent
impl RefUnwindSafe for AgentSessionEvent
impl Send for AgentSessionEvent
impl Sync for AgentSessionEvent
impl Unpin for AgentSessionEvent
impl UnsafeUnpin for AgentSessionEvent
impl UnwindSafe for AgentSessionEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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