pub struct HooksBuilder {
inner: Hooks,
}Expand description
Builder for Hooks.
Fields§
§inner: HooksImplementations§
Source§impl HooksBuilder
impl HooksBuilder
Sourcepub fn default_timeout_secs(self, secs: u64) -> Self
pub fn default_timeout_secs(self, secs: u64) -> Self
Override the per-hook timeout (seconds) emitted in the
initialize control_request. The CLI uses this to decide how
long to wait on each hook_callback reply before giving up and
emitting a control_cancel_request. Default when unset is
120 seconds. Lower it for scenarios
that deliberately provoke cancellation; raise it for
long-running callbacks (e.g. LLM sub-calls inside a hook).
Sourcepub fn pre_tool_use<C>(self, matcher: impl Into<String>, callback: C) -> Selfwhere
C: HookCallback<PreToolUseInput> + 'static,
pub fn pre_tool_use<C>(self, matcher: impl Into<String>, callback: C) -> Selfwhere
C: HookCallback<PreToolUseInput> + 'static,
Register a PreToolUse hook. matcher is a glob against tool names
("*" matches all); pass "Bash" to match only the Bash tool.
Sourcepub fn post_tool_use<C>(self, matcher: impl Into<String>, callback: C) -> Selfwhere
C: HookCallback<PostToolUseInput> + 'static,
pub fn post_tool_use<C>(self, matcher: impl Into<String>, callback: C) -> Selfwhere
C: HookCallback<PostToolUseInput> + 'static,
Register a PostToolUse hook.
Sourcepub fn user_prompt_submit<C>(self, callback: C) -> Selfwhere
C: HookCallback<UserPromptSubmitInput> + 'static,
pub fn user_prompt_submit<C>(self, callback: C) -> Selfwhere
C: HookCallback<UserPromptSubmitInput> + 'static,
Register a UserPromptSubmit hook.
Sourcepub fn stop<C>(self, callback: C) -> Selfwhere
C: HookCallback<StopInput> + 'static,
pub fn stop<C>(self, callback: C) -> Selfwhere
C: HookCallback<StopInput> + 'static,
Register a Stop hook.
Sourcepub fn subagent_stop<C>(self, callback: C) -> Selfwhere
C: HookCallback<SubagentStopInput> + 'static,
pub fn subagent_stop<C>(self, callback: C) -> Selfwhere
C: HookCallback<SubagentStopInput> + 'static,
Register a SubagentStop hook.
Sourcepub fn pre_compact<C>(self, callback: C) -> Selfwhere
C: HookCallback<PreCompactInput> + 'static,
pub fn pre_compact<C>(self, callback: C) -> Selfwhere
C: HookCallback<PreCompactInput> + 'static,
Register a PreCompact hook.
Sourcepub fn post_tool_use_failure<C>(
self,
matcher: impl Into<String>,
callback: C,
) -> Selfwhere
C: HookCallback<PostToolUseFailureInput> + 'static,
pub fn post_tool_use_failure<C>(
self,
matcher: impl Into<String>,
callback: C,
) -> Selfwhere
C: HookCallback<PostToolUseFailureInput> + 'static,
Register a PostToolUseFailure hook. matcher follows the same
tool-name glob semantics as Self::pre_tool_use / Self::post_tool_use.
Sourcepub fn notification<C>(self, callback: C) -> Selfwhere
C: HookCallback<NotificationInput> + 'static,
pub fn notification<C>(self, callback: C) -> Selfwhere
C: HookCallback<NotificationInput> + 'static,
Register a Notification hook.
Sourcepub fn subagent_start<C>(self, callback: C) -> Selfwhere
C: HookCallback<SubagentStartInput> + 'static,
pub fn subagent_start<C>(self, callback: C) -> Selfwhere
C: HookCallback<SubagentStartInput> + 'static,
Register a SubagentStart hook.
Sourcepub fn permission_request<C>(
self,
matcher: impl Into<String>,
callback: C,
) -> Selfwhere
C: HookCallback<PermissionRequestInput> + 'static,
pub fn permission_request<C>(
self,
matcher: impl Into<String>,
callback: C,
) -> Selfwhere
C: HookCallback<PermissionRequestInput> + 'static,
Register a PermissionRequest hook (observational; matcher globs
against tool names the same way as Self::pre_tool_use).