Skip to main content

ApprovalGate

Trait ApprovalGate 

Source
pub trait ApprovalGate: Send + Sync {
    // Required method
    fn request<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tool: &'life1 str,
        params: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = ApprovalDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn request_action<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _call_id: &'life1 str,
        tool: &'life2 str,
        params: &'life3 Value,
    ) -> Pin<Box<dyn Future<Output = ApprovalDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn before_dispatch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _call_id: &'life1 str,
        _tool: &'life2 str,
        _params: &'life3 Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn after_dispatch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        _call_id: &'life1 str,
        _tool: &'life2 str,
        _params: &'life3 Value,
        _ok: bool,
        _receipt: &'life4 Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait { ... }
}
Expand description

The human-in-the-loop seam. Consulted by the loop before running a gated_tools action. Implementations: a terminal stdin prompt (REPL / one-shot) or the chat approval_pending → park → resolve flow. When no gate is wired, a gated action is denied with an actionable message.

Required Methods§

Source

fn request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tool: &'life1 str, params: &'life2 Value, ) -> Pin<Box<dyn Future<Output = ApprovalDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provided Methods§

Source

fn request_action<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _call_id: &'life1 str, tool: &'life2 str, params: &'life3 Value, ) -> Pin<Box<dyn Future<Output = ApprovalDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn before_dispatch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _call_id: &'life1 str, _tool: &'life2 str, _params: &'life3 Value, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Durable write-ahead dispatch marker for an approved consequential action. A failure is fail-closed: the runtime must not execute.

Source

fn after_dispatch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _call_id: &'life1 str, _tool: &'life2 str, _params: &'life3 Value, _ok: bool, _receipt: &'life4 Value, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Durable terminal action receipt. If this append fails, the prior dispatched record remains and resume classifies it indeterminate.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§