Skip to main content

PermissionDecider

Trait PermissionDecider 

Source
pub trait PermissionDecider: Send + Sync {
    // Required methods
    fn decide<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        call: &'life1 ToolCall,
        approval: &'life2 ApprovalRequirement,
    ) -> Pin<Box<dyn Future<Output = PermissionDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn will_auto_approve(
        &self,
        call: &ToolCall,
        approval: &ApprovalRequirement,
    ) -> bool;
}
Expand description

Permission decision interface. TurnRunner calls this when a tool requires approval. Different implementations support interactive (main agent) and automatic (subagent) modes.

Required Methods§

Source

fn decide<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, call: &'life1 ToolCall, approval: &'life2 ApprovalRequirement, ) -> Pin<Box<dyn Future<Output = PermissionDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn will_auto_approve( &self, call: &ToolCall, approval: &ApprovalRequirement, ) -> bool

Quick synchronous check: will this call be auto-approved without user interaction? Used by TurnRunner to skip the ApprovalRequested event (and its associated TUI prompt row) when the PermissionStore already has a session grant or override that will cause decide() to return Allow immediately.

Returning false does not mean the call will be denied — only that it might need interactive approval. Returning true guarantees decide() will return Allow without prompting.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§