pub struct HookOutput {
pub should_continue: bool,
pub hook_specific_output: Option<HookSpecificOutput>,
}Expand description
The complete hook output sent to an agent via stdout.
Fields§
§should_continue: bool§hook_specific_output: Option<HookSpecificOutput>Implementations§
Source§impl HookOutput
impl HookOutput
Sourcepub fn allow(reason: Option<String>, context: Option<String>) -> Self
pub fn allow(reason: Option<String>, context: Option<String>) -> Self
Create an “allow” response for PreToolUse - bypasses permission system.
Sourcepub fn deny(reason: String, context: Option<String>) -> Self
pub fn deny(reason: String, context: Option<String>) -> Self
Create a “deny” response for PreToolUse - prevents tool execution.
Sourcepub fn ask(reason: Option<String>, context: Option<String>) -> Self
pub fn ask(reason: Option<String>, context: Option<String>) -> Self
Create an “ask” response for PreToolUse - prompts user for confirmation.
Sourcepub fn approve_permission(updated_input: Option<Value>) -> Self
pub fn approve_permission(updated_input: Option<Value>) -> Self
Approve a permission request on behalf of the user.
Sourcepub fn deny_permission(message: String, interrupt: bool) -> Self
pub fn deny_permission(message: String, interrupt: bool) -> Self
Deny a permission request on behalf of the user.
Sourcepub fn set_updated_input(&mut self, updated_input: Value)
pub fn set_updated_input(&mut self, updated_input: Value)
Set the updated_input field on a PreToolUse response. This rewrites the tool input before the agent executes it.
Sourcepub fn session_start(additional_context: Option<String>) -> Self
pub fn session_start(additional_context: Option<String>) -> Self
Create a SessionStart response with optional context about the session setup.
Sourcepub fn post_tool_use(additional_context: Option<String>) -> Self
pub fn post_tool_use(additional_context: Option<String>) -> Self
Create a PostToolUse response with optional advisory context.
Sourcepub fn continue_execution() -> Self
pub fn continue_execution() -> Self
Continue execution without making a decision (for informational hooks).
Sourcepub fn write_to(&self, writer: impl Write) -> Result<()>
pub fn write_to(&self, writer: impl Write) -> Result<()>
Write response to any writer (for testability).
Sourcepub fn write_stdout(&self) -> Result<()>
pub fn write_stdout(&self) -> Result<()>
Write response to stdout (convenience wrapper for production).
Trait Implementations§
Source§impl Clone for HookOutput
impl Clone for HookOutput
Source§fn clone(&self) -> HookOutput
fn clone(&self) -> HookOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HookOutput
impl Debug for HookOutput
Source§impl PartialEq for HookOutput
impl PartialEq for HookOutput
Source§fn eq(&self, other: &HookOutput) -> bool
fn eq(&self, other: &HookOutput) -> bool
self and other values to be equal, and is used by ==.