pub struct PreToolOutcome {
pub decision: HookDecision,
pub reason: Option<String>,
pub updated_args: Option<Value>,
}Expand description
BP-10: everything a pre-tool hook can say about one call — a decision, a human-readable reason, and (the rewrite half of the row) REPLACEMENT arguments.
Fields§
§decision: HookDecisionThe hook’s verdict — see HookDecision.
reason: Option<String>Why, in words. Fed back to the model on a denial; carried to the approval door otherwise.
updated_args: Option<Value>BP-10 (the “rewrite” half): arguments to run the tool with INSTEAD
of the model’s own. None (the default) leaves the call untouched.
The rewritten arguments are what the permissions engine then
evaluates and what the tool finally receives — a hook cannot
launder a denied command by rewriting it past the gate, because the
gate runs on the REWRITTEN args.
Implementations§
Source§impl PreToolOutcome
impl PreToolOutcome
Sourcepub fn pass() -> PreToolOutcome
pub fn pass() -> PreToolOutcome
No opinion — the pre-BP-10 None return.
Sourcepub fn deny(reason: impl Into<String>) -> PreToolOutcome
pub fn deny(reason: impl Into<String>) -> PreToolOutcome
Refuse the call — the pre-BP-10 Some(reason) return.
Sourcepub fn allow(reason: Option<String>) -> PreToolOutcome
pub fn allow(reason: Option<String>) -> PreToolOutcome
Answer an Ask on the user’s behalf.
Sourcepub fn ask(reason: Option<String>) -> PreToolOutcome
pub fn ask(reason: Option<String>) -> PreToolOutcome
Force the call to the Ask tier.
Sourcepub fn rewrite(args: Value) -> PreToolOutcome
pub fn rewrite(args: Value) -> PreToolOutcome
Run the tool with args instead of the model’s own.
Trait Implementations§
Source§impl Clone for PreToolOutcome
impl Clone for PreToolOutcome
Source§fn clone(&self) -> PreToolOutcome
fn clone(&self) -> PreToolOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more