#[non_exhaustive]pub enum HookEvent {
PreToolUse {
input: PreToolUseInput,
ctx: HookContext,
},
PostToolUse {
input: PostToolUseInput,
ctx: HookContext,
},
UserPromptSubmitted {
input: UserPromptSubmittedInput,
ctx: HookContext,
},
SessionStart {
input: SessionStartInput,
ctx: HookContext,
},
SessionEnd {
input: SessionEndInput,
ctx: HookContext,
},
ErrorOccurred {
input: ErrorOccurredInput,
ctx: HookContext,
},
}Expand description
Events dispatched to SessionHooks::on_hook at CLI lifecycle points.
Each variant carries the typed input for that hook plus the shared
HookContext. The handler returns a matching HookOutput variant
(or HookOutput::None to signal “no hook registered”).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
PreToolUse
Fired before a tool executes.
PostToolUse
Fired after a tool executes.
UserPromptSubmitted
Fired when the user sends a message.
SessionStart
Fired at session creation or resume.
SessionEnd
Fired when the session ends.
ErrorOccurred
Fired when an error occurs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookEvent
impl RefUnwindSafe for HookEvent
impl Send for HookEvent
impl Sync for HookEvent
impl Unpin for HookEvent
impl UnsafeUnpin for HookEvent
impl UnwindSafe for HookEvent
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