pub enum ExtensionEvent<'a> {
Show 28 variants
ResourcesDiscover {
cwd: &'a Path,
reason: &'a str,
},
McpServersChange {
servers: &'a [RegisteredMcpServer],
},
SessionStart {
reason: &'a str,
previous_session_file: Option<&'a str>,
},
SessionInfoChanged {
name: Option<&'a str>,
},
SessionBeforeSwitch {
reason: &'a str,
target_session_file: Option<&'a str>,
},
SessionBeforeFork {
entry_id: &'a str,
position: &'a str,
},
SessionBeforeCompact {
preparation: Value,
branch_entries: &'a [&'a FileEntry],
custom_instructions: Option<&'a str>,
reason: CompactionReason,
will_retry: bool,
},
SessionCompact {
compaction_entry: &'a FileEntry,
from_extension: bool,
reason: CompactionReason,
will_retry: bool,
},
SessionCompactFailed {
reason: CompactionReason,
error_message: Option<&'a str>,
aborted: bool,
will_retry: bool,
from_extension: bool,
},
SessionShutdown {
reason: &'a str,
target_session_file: Option<&'a str>,
},
SessionBeforeTree {
preparation: TreePreparation<'a>,
},
SessionTree {
new_leaf_id: Option<&'a str>,
old_leaf_id: Option<&'a str>,
summary_entry: Option<&'a FileEntry>,
from_extension: Option<bool>,
},
Context {
messages: &'a [Message],
},
ContextWithSystem {
messages: &'a [Message],
},
AfterProviderResponse {
status: u16,
headers: &'a IndexMap<String, String>,
},
BeforeAgentStart {
prompt: &'a str,
images: &'a [ImageContent],
system_prompt: &'a str,
system_prompt_options: &'a SystemPromptOptions,
},
AgentBeforeSettle {
outcome: &'a str,
},
AgentSettled,
UiPromptStart(UiPrompt<'a>),
UiPromptEnd(UiPrompt<'a>),
TurnEnd {
turn_index: u64,
message: &'a Message,
tool_results: &'a [Message],
message_entry_id: &'a str,
tool_result_entry_ids: &'a [String],
outcome: &'a str,
},
MessageEnd {
message: &'a Value,
},
ModelSelect {
model: &'a Model,
previous_model: Option<&'a Model>,
source: &'a str,
},
ThinkingLevelSelect {
level: ThinkingLevel,
previous_level: ThinkingLevel,
},
UserBash {
command: &'a str,
exclude_from_context: bool,
cwd: &'a Path,
},
Input {
text: &'a str,
images: &'a [ImageContent],
source: &'a str,
streaming_behavior: Option<StreamingBehavior>,
},
ToolCall {
tool_name: &'a str,
tool_call_id: &'a str,
parent_tool_call_id: Option<&'a str>,
input: &'a Value,
},
ToolResult {
tool_name: &'a str,
tool_call_id: &'a str,
parent_tool_call_id: Option<&'a str>,
input: &'a Value,
content: &'a [ContentBlock],
details: Option<&'a Value>,
structured_content: Option<&'a Value>,
is_error: bool,
usage: Option<&'a Usage>,
},
}Expand description
A pi event for extension handlers. Absent optional fields are left out, as pi leaves them undefined.
Variants§
ResourcesDiscover
McpServersChange
Fields
§
servers: &'a [RegisteredMcpServer]SessionStart
SessionInfoChanged
SessionBeforeSwitch
SessionBeforeFork
SessionBeforeCompact
Fields
§
reason: CompactionReasonSessionCompact
Fields
§
reason: CompactionReasonSessionCompactFailed
Fields
§
reason: CompactionReasonSessionShutdown
SessionBeforeTree
Fields
§
preparation: TreePreparation<'a>SessionTree
Fields
Context
ContextWithSystem
AfterProviderResponse
BeforeAgentStart
AgentBeforeSettle
AgentSettled
UiPromptStart(UiPrompt<'a>)
UiPromptEnd(UiPrompt<'a>)
TurnEnd
Fields
MessageEnd
ModelSelect
ThinkingLevelSelect
UserBash
Input
ToolCall
Fields
ToolResult
Implementations§
Trait Implementations§
Source§impl<'a> Debug for ExtensionEvent<'a>
impl<'a> Debug for ExtensionEvent<'a>
Auto Trait Implementations§
impl<'a> Freeze for ExtensionEvent<'a>
impl<'a> RefUnwindSafe for ExtensionEvent<'a>
impl<'a> Send for ExtensionEvent<'a>
impl<'a> Sync for ExtensionEvent<'a>
impl<'a> Unpin for ExtensionEvent<'a>
impl<'a> UnsafeUnpin for ExtensionEvent<'a>
impl<'a> UnwindSafe for ExtensionEvent<'a>
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
Mutably borrows from an owned value. Read more