pub struct HookResult {
pub action: HookAction,
pub additional_context: Option<String>,
pub updated_input: Option<Value>,
pub system_message: Option<String>,
pub suppress_output: bool,
pub permission_decision: Option<PermissionDecision>,
pub permission_decision_reason: Option<String>,
}Expand description
Rich result returned by a hook dispatch, containing the primary action as well as optional structured metadata for the caller to consume.
Fields§
§action: HookActionPrimary decision.
additional_context: Option<String>Extra context to inject into the next LLM system prompt.
updated_input: Option<Value>Override tool arguments (meaningful only for PreToolCall).
system_message: Option<String>User-facing warning message.
suppress_output: boolWhen true, suppress the hook’s raw stdout from the transcript.
permission_decision: Option<PermissionDecision>Explicit permission decision (overrides normal permission check).
permission_decision_reason: Option<String>Reason for the permission decision (for audit logging).
Implementations§
Source§impl HookResult
impl HookResult
Sourcepub fn continue_default() -> Self
pub fn continue_default() -> Self
Shorthand for the default “do nothing” result.
Sourcepub fn from_fail_mode(
mode: HookFailMode,
reason: &str,
event: &HookEvent,
) -> Self
pub fn from_fail_mode( mode: HookFailMode, reason: &str, event: &HookEvent, ) -> Self
Produce a hook result based on the fail mode.
Open(default): returnsContinue— preserves pre-Goal-281 fail-open behavior for notification hooks.Closed: for gating events (PreToolCall,UserPromptSubmit,PermissionRequest) returnsError(reason)so the agent sees the failure as a rejection. For all other event types (notification hooks likePostToolCall,SessionStart, etc.) returnsContinuesince a notification failure shouldn’t block.
Trait Implementations§
Source§impl Clone for HookResult
impl Clone for HookResult
Source§impl Debug for HookResult
impl Debug for HookResult
Auto Trait Implementations§
impl Freeze for HookResult
impl RefUnwindSafe for HookResult
impl Send for HookResult
impl Sync for HookResult
impl Unpin for HookResult
impl UnsafeUnpin for HookResult
impl UnwindSafe for HookResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.