pub struct BashRiskHooks;Expand description
Always-on catastrophic-shell guard. Stateless — a unit struct is the entire type.
Implementations§
Source§impl BashRiskHooks
impl BashRiskHooks
Trait Implementations§
Source§impl Default for BashRiskHooks
impl Default for BashRiskHooks
Source§impl Hooks for BashRiskHooks
impl Hooks for BashRiskHooks
Source§fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Some(reason) iff this is a bash call whose command is catastrophic;
None (allow) otherwise — the hot path.
Source§fn transform_tool_input<'life0, 'life1, 'async_trait>(
&'life0 self,
_call: &'life1 mut ToolCall,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transform_tool_input<'life0, 'life1, 'async_trait>(
&'life0 self,
_call: &'life1 mut ToolCall,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
May mutate the tool call’s arguments before it is executed (e.g. to
rewrite a bash command through
rtk). Mutations are what actually
executes, so before_tool_call/after_tool_call observe the rewrite.Source§fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_call: &'life1 ToolCall,
_out: &'life2 mut ToolOutput,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_call: &'life1 ToolCall,
_out: &'life2 mut ToolOutput,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Runs after every tool execution; may mutate the output before it is
recorded and sent to the LLM.
Source§fn before_inbound<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_from: Option<&'life1 SessionId>,
_request: &'life2 mut Request,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn before_inbound<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_from: Option<&'life1 SessionId>,
_request: &'life2 mut Request,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Policy for an inbound peer message (an A2A
Notify/Interrupt/Wake):
the mirror of Hooks::before_tool_call. May rewrite the request in
place (the rewrite is what is delivered); Some(reason) drops it — the
reason is returned to the sender when it is an ask. A message dropped
here never reaches the context or starts a turn.Source§fn transform_context<'life0, 'life1, 'async_trait>(
&'life0 self,
_msgs: &'life1 mut Vec<AgentMessage>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transform_context<'life0, 'life1, 'async_trait>(
&'life0 self,
_msgs: &'life1 mut Vec<AgentMessage>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Runs at every turn start, after steering is drained, before streaming.
Source§fn should_stop_after_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 [AgentMessage],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn should_stop_after_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 [AgentMessage],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Checked after tool execution completes; true ends the run with
StopReason::Stop.
Source§fn after_run<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 [AgentMessage],
_stop: StopReason,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_run<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 [AgentMessage],
_stop: StopReason,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Runs once when a
run finishes, with the final context and why it
stopped. The A2A auto-report rides this (a worker forwards its result to
its orchestrator); a no-op by default.Auto Trait Implementations§
impl Freeze for BashRiskHooks
impl RefUnwindSafe for BashRiskHooks
impl Send for BashRiskHooks
impl Sync for BashRiskHooks
impl Unpin for BashRiskHooks
impl UnsafeUnpin for BashRiskHooks
impl UnwindSafe for BashRiskHooks
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