Skip to main content

PermissionsApprovalHandler

Trait PermissionsApprovalHandler 

Source
pub trait PermissionsApprovalHandler: Send + Sync {
    // Required method
    fn ask(&self, req: &ApprovalRequest<'_>) -> ApprovalOutcome;
}
Expand description

The non-interactive decision seam a CLI/TUI/SDK embedder implements. The engine (crate::agent::Agent’s gate) calls Self::ask ONLY when the rule engine has already resolved a call to Decision::AskDeny short-circuits before ever reaching a handler (a hard floor, never consulted), and Allow never needs one. No handler installed (the default) denies every Ask — fail-closed, the same posture Config::approval_handler’s doc comment already documents for the pre-P5-1 gate (“absent handler denies, so an OnRequest/Untrusted policy is fail-closed” — agent.rs).

Required Methods§

Source

fn ask(&self, req: &ApprovalRequest<'_>) -> ApprovalOutcome

Render a decision for req. Implementations that need to block on user input (a real TUI prompt) do so here; a scripted/headless implementation (tests, CI, an --auto-approve flag) returns immediately.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§