pub struct HookConfig {
pub event: HookEvent,
pub tool_match: String,
pub command: String,
pub block_on_failure: bool,
pub feedback: bool,
pub timeout_secs: u64,
}Expand description
A single shell hook attached to tool execution.
[[hooks]]
event = "pre_tool"
match = "bash" # tool name; `*` or `prefix*` / `*suffix`
command = "echo check"
block_on_failure = true # pre_tool / user_prompt_submit: non-zero exit refuses
feedback = false # stdout of a successful hook goes to the model
timeout_secs = 30Environment for the command: WHYCODES_HOOK_EVENT, WHYCODES_TOOL_NAME,
WHYCODES_TOOL_INPUT (JSON), WHYCODES_TOOL_ID, WHYCODES_SESSION_ID,
WHYCODES_WORKING_DIR. Post-tool also sets WHYCODES_TOOL_IS_ERROR and
WHYCODES_TOOL_OUTPUT (truncated). Lifecycle events add their own
variables (WHYCODES_PROMPT, WHYCODES_RESPONSE, WHYCODES_SUBAGENT_*).
Fields§
§event: HookEventpre_tool, pre_tool_transform, post_tool, session_start,
user_prompt_submit, stop, pre_compact, or subagent_stop.
tool_match: StringTool name pattern. Default * (all tools).
command: StringShell command (run via sh -c / cmd /C).
block_on_failure: boolWhen true on pre_tool / user_prompt_submit, a non-zero exit refuses
the tool call / the turn.
feedback: boolWhen true, a successful hook’s stdout is shown to the model: appended
to the tool result (post_tool) or to the user turn (session_start,
user_prompt_submit). Ignored for other events.
timeout_secs: u64Kill the hook after this many seconds. Default 30.
Trait Implementations§
Source§impl Clone for HookConfig
impl Clone for HookConfig
Source§impl Debug for HookConfig
impl Debug for HookConfig
Source§impl Default for HookConfig
impl Default for HookConfig
Source§impl<'de> Deserialize<'de> for HookConfig
impl<'de> Deserialize<'de> for HookConfig
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>,
Auto Trait Implementations§
impl Freeze for HookConfig
impl RefUnwindSafe for HookConfig
impl Send for HookConfig
impl Sync for HookConfig
impl Unpin for HookConfig
impl UnsafeUnpin for HookConfig
impl UnwindSafe for HookConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more