pub struct HookContext {
pub event: HookEvent,
pub tool_name: Option<String>,
pub tool_args: Option<Value>,
pub tool_result: Option<String>,
pub is_error: Option<bool>,
pub session_id: Option<String>,
pub session_cwd: Option<PathBuf>,
pub extra: Option<Value>,
}Expand description
Payload passed to a hook. Serialised to JSON on the script’s stdin.
Fields§
§event: HookEventEvent being fired.
tool_name: Option<String>Tool name (PreToolUse/PostToolUse/SubagentStop).
tool_args: Option<Value>Tool arguments (PreToolUse). For PostToolUse the input is omitted to
keep the payload small; consumers that need it can match by tool_name.
tool_result: Option<String>Tool result content (PostToolUse).
is_error: Option<bool>Whether the result was an error (PostToolUse).
session_id: Option<String>Identifier of the owning session.
session_cwd: Option<PathBuf>CWD of the owning session.
extra: Option<Value>Escape hatch for future fields without breaking the contract.
Trait Implementations§
Source§impl Clone for HookContext
impl Clone for HookContext
Source§fn clone(&self) -> HookContext
fn clone(&self) -> HookContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 HookContext
impl Debug for HookContext
Source§impl Default for HookContext
impl Default for HookContext
Source§fn default() -> HookContext
fn default() -> HookContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for HookContext
impl<'de> Deserialize<'de> for HookContext
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
Auto Trait Implementations§
impl Freeze for HookContext
impl RefUnwindSafe for HookContext
impl Send for HookContext
impl Sync for HookContext
impl Unpin for HookContext
impl UnsafeUnpin for HookContext
impl UnwindSafe for HookContext
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