pub enum ExtensionEvent {
Startup {
version: String,
session_file: Option<String>,
},
AgentStart {
session_id: String,
},
AgentEnd {
session_id: String,
messages: Vec<Message>,
error: Option<String>,
},
TurnStart {
session_id: String,
turn_index: usize,
},
TurnEnd {
session_id: String,
turn_index: usize,
message: AssistantMessage,
tool_results: Vec<ToolResultMessage>,
},
ToolCall {
tool_name: String,
tool_call_id: String,
input: Value,
},
ToolResult {
tool_name: String,
tool_call_id: String,
input: Value,
content: Vec<ContentBlock>,
details: Option<Value>,
is_error: bool,
},
SessionBeforeSwitch {
current_session: Option<String>,
target_session: String,
},
SessionBeforeFork {
current_session: Option<String>,
fork_entry_id: String,
},
Input {
content: String,
attachments: Vec<ImageContent>,
},
}Expand description
Events that can be dispatched to extension handlers.
The serialized representation is tagged with type in snake_case, matching
the string event name used by JS hooks (e.g. "tool_call").
Variants§
Startup
Agent startup (once per session).
AgentStart
Before first API call in a run.
AgentEnd
After agent loop ends.
TurnStart
Before provider.stream() call.
TurnEnd
After response processed.
ToolCall
Before tool execution (can block).
ToolResult
After tool execution (can modify result).
Fields
§
content: Vec<ContentBlock>SessionBeforeSwitch
Before session switch (can cancel).
SessionBeforeFork
Before session fork (can cancel).
Input
Before processing user input (can transform).
Implementations§
Source§impl ExtensionEvent
impl ExtensionEvent
Sourcepub const fn event_name(&self) -> &'static str
pub const fn event_name(&self) -> &'static str
Get the event name for dispatch.
Trait Implementations§
Source§impl Clone for ExtensionEvent
impl Clone for ExtensionEvent
Source§fn clone(&self) -> ExtensionEvent
fn clone(&self) -> ExtensionEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtensionEvent
impl Debug for ExtensionEvent
Auto Trait Implementations§
impl Freeze for ExtensionEvent
impl RefUnwindSafe for ExtensionEvent
impl Send for ExtensionEvent
impl Sync for ExtensionEvent
impl Unpin for ExtensionEvent
impl UnsafeUnpin for ExtensionEvent
impl UnwindSafe for ExtensionEvent
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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>
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 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>
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 moreSource§impl<T> ModelDump for Twhere
T: Serialize,
impl<T> ModelDump for Twhere
T: Serialize,
Source§fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
Serialize a model to a JSON value. Read more
Source§fn model_dump_json(&self) -> Result<String, Error>
fn model_dump_json(&self) -> Result<String, Error>
Serialize a model to a JSON string with default options.
Source§fn model_dump_json_pretty(&self) -> Result<String, Error>
fn model_dump_json_pretty(&self) -> Result<String, Error>
Serialize a model to a pretty-printed JSON string.
Source§fn model_dump_json_with_options(
&self,
options: DumpOptions,
) -> Result<String, Error>
fn model_dump_json_with_options( &self, options: DumpOptions, ) -> Result<String, Error>
Serialize a model to a JSON string with full options support. Read more