#[non_exhaustive]pub enum HookEvent<'a> {
Show 20 variants
TurnStart {
turn_id: TurnId,
},
OnSystemPromptBuilt {
prompt: &'a str,
},
BeforeProviderCall {
messages: &'a [Message],
},
AfterProviderCall {
tokens_in: u32,
tokens_out: u32,
},
OnTextDelta {
text: &'a str,
},
OnToolCallProposed {
call: &'a ToolCall,
},
BeforeToolBatch {
calls: &'a [ToolCall],
},
BeforePermissionCheck {
call: &'a ToolCall,
},
AfterPermissionCheck {
call: &'a ToolCall,
decision: PermissionDecision,
},
BeforeBashSandboxExec {
command: &'a str,
},
AfterBashSandboxExec {
exit: i32,
duration: Duration,
},
BeforeToolCall {
call: &'a ToolCall,
},
AfterToolCall {
call: &'a ToolCall,
result: &'a ToolResult,
},
OnToolResultObserved {
observation: &'a ToolObservation,
},
AfterToolBatch {
results: &'a [ToolResult],
},
OnDoomLoopDetected {
signature: &'a str,
},
OnBudgetExceeded {
kind: BudgetKind,
used: u64,
limit: u64,
},
OnProviderError {
error: &'a ProviderError,
},
OnTurnEnd {
reason: TurnEndReason,
},
TurnComplete {
turn_id: TurnId,
status: TurnStatus,
},
}Expand description
A lifecycle event emitted by the Talos runtime.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TurnStart
The turn has started.
OnSystemPromptBuilt
The system prompt has been assembled.
BeforeProviderCall
Immediately before invoking the provider.
AfterProviderCall
After the provider stream has completed.
OnTextDelta
A text delta was observed.
OnToolCallProposed
A tool call was proposed by the model.
BeforeToolBatch
Immediately before executing a batch of tool calls.
BeforePermissionCheck
Immediately before evaluating permissions for a tool call.
AfterPermissionCheck
Immediately after evaluating permissions for a tool call.
Fields
decision: PermissionDecisionPermission decision returned by the engine.
BeforeBashSandboxExec
Immediately before executing a bash command in the sandbox.
AfterBashSandboxExec
Immediately after sandboxed bash execution completes.
BeforeToolCall
Immediately before invoking a tool.
AfterToolCall
Immediately after invoking a tool.
Fields
result: &'a ToolResultTool result returned by the tool.
OnToolResultObserved
A tool result was observed and added back into the conversation.
Fields
observation: &'a ToolObservationOwned observation payload.
AfterToolBatch
After a batch of tool calls has completed.
Fields
results: &'a [ToolResult]Tool results in input order.
OnDoomLoopDetected
Doom-loop detection fired.
OnBudgetExceeded
A runtime budget was exceeded.
OnProviderError
A provider error occurred.
Fields
error: &'a ProviderErrorProvider error instance.
OnTurnEnd
The provider signaled turn end.
Fields
reason: TurnEndReasonTurn-end reason.
TurnComplete
The turn completed.
Implementations§
Source§impl HookEvent<'_>
impl HookEvent<'_>
Sourcepub fn kind(&self) -> HookEventKind
pub fn kind(&self) -> HookEventKind
Returns the discriminant used for subscription and pre-filtering.
Sourcepub fn is_permission_boundary(&self) -> bool
pub fn is_permission_boundary(&self) -> bool
Returns whether this event is inside the permission read-only boundary.