pub struct HookOutput {
pub continue_: Option<bool>,
pub suppress_output: Option<bool>,
pub stop_reason: Option<String>,
pub decision: Option<HookDecision>,
pub system_message: Option<String>,
pub reason: Option<String>,
pub hook_specific_output: Option<Value>,
}Expand description
Hook result — the same JSON a shell hook prints on stdout. Source: binary hook-output schema (continue, suppressOutput, stopReason, decision, systemMessage, reason, hookSpecificOutput).
Fields§
§continue_: Option<bool>false stops the whole agent loop.
suppress_output: Option<bool>Hide stdout from the transcript (default: false).
stop_reason: Option<String>Message shown when continue is false.
decision: Option<HookDecision>approve or block.
system_message: Option<String>Warning shown to the user.
reason: Option<String>Reason fed back to the model when decision is block.
hook_specific_output: Option<Value>Event-specific output; must carry hookEventName.
Implementations§
Source§impl HookOutput
impl HookOutput
Sourcepub fn block(reason: impl Into<String>) -> Self
pub fn block(reason: impl Into<String>) -> Self
Block the action; reason is shown to the model.
Sourcepub fn with_context(event: HookEventKind, context: impl Into<String>) -> Self
pub fn with_context(event: HookEventKind, context: impl Into<String>) -> Self
Inject additionalContext for the given event. Only events where
HookEventKind::accepts_additional_context holds carry it; for any
other the CLI rejects the output, so this logs a warning.
Sourcepub fn watch_paths(
event: HookEventKind,
paths: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn watch_paths( event: HookEventKind, paths: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Register watchPaths for FileChanged hooks (valid for CwdChanged / FileChanged).