pub struct PermissionChecker { /* private fields */ }Expand description
Middleware that checks tool call permissions against a PermissionPolicy.
If the policy returns Deny, the tool call is rejected with ToolError::PermissionDenied.
If the policy returns Ask, the tool call is rejected (external confirmation not handled here).
Implementations§
Source§impl PermissionChecker
impl PermissionChecker
Sourcepub fn new(policy: impl PermissionPolicy + 'static) -> Self
pub fn new(policy: impl PermissionPolicy + 'static) -> Self
Create a new permission checker with the given policy.
Trait Implementations§
Source§impl ToolMiddleware for PermissionChecker
impl ToolMiddleware for PermissionChecker
Source§fn process<'a>(
&'a self,
call: &'a ToolCall,
ctx: &'a ToolContext,
next: Next<'a>,
) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
fn process<'a>( &'a self, call: &'a ToolCall, ctx: &'a ToolContext, next: Next<'a>, ) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
Process a tool call, optionally delegating to the next middleware/tool.
Auto Trait Implementations§
impl Freeze for PermissionChecker
impl !RefUnwindSafe for PermissionChecker
impl Send for PermissionChecker
impl Sync for PermissionChecker
impl Unpin for PermissionChecker
impl UnsafeUnpin for PermissionChecker
impl !UnwindSafe for PermissionChecker
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