pub struct HookDef {
pub action: HookAction,
pub timeout_secs: u64,
pub fail_closed: bool,
}Expand description
A single hook definition.
Hooks are fired at specific lifecycle points. The action field determines
whether the hook runs a shell command or dispatches to an MCP server tool.
§Examples
[[hooks.cwd_changed]]
type = "command"
command = "echo changed to $ZEPH_NEW_CWD"
timeout_secs = 10
fail_closed = falseFields§
§action: HookActionThe action to execute: shell command or MCP tool call.
timeout_secs: u64Maximum seconds to wait for the hook before timing out. Default: 30.
fail_closed: boolWhen true, a non-zero exit code or timeout aborts the remaining hooks in the same
sequence (no further hooks in the list run). When false (default), errors are logged
and the next hook in the sequence continues.
Note: in pre_tool_use and post_tool_use contexts this field controls hook-chain
execution only — it does not block the tool call itself. Hook dispatch is always
fail-open at the agent level; the tool executes regardless of hook outcomes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HookDef
impl<'de> Deserialize<'de> for HookDef
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 HookDef
impl RefUnwindSafe for HookDef
impl Send for HookDef
impl Sync for HookDef
impl Unpin for HookDef
impl UnsafeUnpin for HookDef
impl UnwindSafe for HookDef
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