pub struct ToolScopeSandboxAspect { /* private fields */ }Expand description
Sandbox aspect that enforces a per-session tool allowlist.
Implementations§
Source§impl ToolScopeSandboxAspect
impl ToolScopeSandboxAspect
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty sandbox. Sessions must call allow before any
guarded join points fire for them.
Sourcepub fn allow<I, S>(&self, session: impl Into<SessionId>, tools: I)
pub fn allow<I, S>(&self, session: impl Into<SessionId>, tools: I)
Declare the full allowlist for a session, replacing any prior set.
Sourcepub fn bind(&self, call: ToolCall) -> u64
pub fn bind(&self, call: ToolCall) -> u64
Bind a tool call to the next guarded invocation. The host wraps
each dispatch with bind … proceed … release. The
returned key is opaque; pass it to release.
Sourcepub fn is_allowed(&self, session: &str, tool: &str) -> bool
pub fn is_allowed(&self, session: &str, tool: &str) -> bool
Inspect whether a (session, tool) pair would be admitted.
Trait Implementations§
Source§impl Aspect for ToolScopeSandboxAspect
impl Aspect for ToolScopeSandboxAspect
Source§fn around(
&self,
pjp: ProceedingJoinPoint<'_>,
) -> Result<Box<dyn Any>, AspectError>
fn around( &self, pjp: ProceedingJoinPoint<'_>, ) -> Result<Box<dyn Any>, AspectError>
Advice that wraps the entire target function execution. Read more
Source§fn after(&self, _ctx: &JoinPoint, _result: &(dyn Any + 'static))
fn after(&self, _ctx: &JoinPoint, _result: &(dyn Any + 'static))
Advice executed after the target function completes successfully. Read more
Source§fn after_error(&self, _ctx: &JoinPoint, _error: &AspectError)
fn after_error(&self, _ctx: &JoinPoint, _error: &AspectError)
Advice executed when the target function encounters an error. Read more
Source§impl Clone for ToolScopeSandboxAspect
impl Clone for ToolScopeSandboxAspect
Source§fn clone(&self) -> ToolScopeSandboxAspect
fn clone(&self) -> ToolScopeSandboxAspect
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ToolScopeSandboxAspect
impl Default for ToolScopeSandboxAspect
Source§fn default() -> ToolScopeSandboxAspect
fn default() -> ToolScopeSandboxAspect
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ToolScopeSandboxAspect
impl !RefUnwindSafe for ToolScopeSandboxAspect
impl Send for ToolScopeSandboxAspect
impl Sync for ToolScopeSandboxAspect
impl Unpin for ToolScopeSandboxAspect
impl UnsafeUnpin for ToolScopeSandboxAspect
impl !UnwindSafe for ToolScopeSandboxAspect
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