Expand description
Permission-policy helpers that wrap an existing handler::SessionHandler.
Permission-policy helpers that compose with an existing
SessionHandler.
These wrap an inner handler and override only permission requests,
forwarding every other event (tool calls, user input, elicitation,
session events) to the inner handler. Use them when you have a custom
tool handler — typically a ToolHandlerRouter —
but want a one-line policy for permission prompts.
For a full handler that approves or denies everything, see
ApproveAllHandler and
DenyAllHandler.
§Example
let router = ToolHandlerRouter::new(vec![], Arc::new(ApproveAllHandler));
// Inherit the router's tool dispatch but auto-approve all permission prompts:
let handler = permission::approve_all(Arc::new(router));Functions§
- approve_
all - Wrap
innerso that everyHandlerEvent::PermissionRequestis auto-approved. All other events are forwarded toinner. - approve_
if - Wrap
innerwith a closure-based policy:predicateis called for each permission request;trueapproves,falsedenies. All other events are forwarded toinner. - deny_
all - Wrap
innerso that everyHandlerEvent::PermissionRequestis auto-denied. All other events are forwarded toinner.