pub enum HookEvent {
SessionStart,
UserPromptSubmit,
PreToolUse,
PostToolUse,
PostToolUseFailure,
SubagentStart,
SubagentStop,
Stop,
PreCompact,
SessionEnd,
}Expand description
Lifecycle events that can trigger hooks.
Variants§
SessionStart
Fired when a new session starts.
UserPromptSubmit
Fired when the user submits a prompt.
PreToolUse
Fired before a tool is executed.
PostToolUse
Fired after a tool executes successfully.
PostToolUseFailure
Fired after a tool execution fails.
SubagentStart
Fired when a subagent is spawned.
SubagentStop
Fired when a subagent finishes.
Stop
Fired when the agent decides to stop.
PreCompact
Fired before context compaction.
SessionEnd
Fired when the session ends.
Implementations§
Source§impl HookEvent
impl HookEvent
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
The string name used in config files (e.g., “PreToolUse”).
Sourcepub fn from_config_str(s: &str) -> Option<Self>
pub fn from_config_str(s: &str) -> Option<Self>
Parse from the string name used in config files.
Sourcepub fn is_tool_event(&self) -> bool
pub fn is_tool_event(&self) -> bool
Whether this is a tool-related event.
Sourcepub fn is_subagent_event(&self) -> bool
pub fn is_subagent_event(&self) -> bool
Whether this is a subagent-related event.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HookEvent
impl<'de> Deserialize<'de> for HookEvent
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for HookEvent
impl Eq for HookEvent
impl StructuralPartialEq for HookEvent
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