pub struct HookContext {
pub session_id: String,
pub transcript_path: PathBuf,
pub cwd: PathBuf,
pub hook_event_name: HookEvent,
pub tool_name: String,
pub tool_use_id: String,
pub permission_mode: Option<String>,
pub effort: Option<EffortLevel>,
pub agent_id: Option<String>,
pub agent_type: Option<String>,
}Expand description
Mirrors the PreToolUse / PostToolUse payload Claude Code sends to a hook on stdin. Field schema empirically verified against CC 2.1.142 (see docs/architecture.md, Appendix A).
Fields§
§session_id: String§transcript_path: PathBuf§cwd: PathBuf§hook_event_name: HookEvent§tool_name: StringPresent on tool-use events; absent on session-level events like SubagentStop. Default to empty string so the same struct deserializes for both.
tool_use_id: String§permission_mode: Option<String>§effort: Option<EffortLevel>§agent_id: Option<String>Present iff the call came from inside a subagent. This is the routing key.
agent_type: Option<String>Subagent type name (e.g. “general-purpose”). Present iff agent_id is.
Implementations§
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<'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