pub struct ToolExecutionAuthorization { /* private fields */ }Expand description
A concrete, path-bound authorization for one tool operation.
Permission-aware composition roots create this value only after resolving
Allow/Ask/Deny. File tools compare the normalized path and operation
before allowing an invocation to leave the workspace boundary. Calling a
file tool through [AgentTool::execute] does not provide this capability.
Implementations§
Source§impl ToolExecutionAuthorization
impl ToolExecutionAuthorization
Sourcepub fn for_path(
tool_name: impl Into<String>,
nature: ToolNature,
workspace_root: &Path,
resource: &str,
scope: ToolAuthorizationScope,
) -> Result<Self>
pub fn for_path( tool_name: impl Into<String>, nature: ToolNature, workspace_root: &Path, resource: &str, scope: ToolAuthorizationScope, ) -> Result<Self>
Creates a path-bound authorization using the workspace as the base for relative resources.
Existing paths and their nearest existing ancestor are canonicalized, so a later symlink change cannot silently reuse an authorization for a different target.
Returns whether this authorization exactly covers a requested path and operation.
Sourcepub fn normalized_path(&self) -> &Path
pub fn normalized_path(&self) -> &Path
Returns the normalized path carried by this authorization.
Sourcepub fn scope(&self) -> ToolAuthorizationScope
pub fn scope(&self) -> ToolAuthorizationScope
Returns the approval scope that produced this authorization.
Trait Implementations§
Source§impl Clone for ToolExecutionAuthorization
impl Clone for ToolExecutionAuthorization
Source§fn clone(&self) -> ToolExecutionAuthorization
fn clone(&self) -> ToolExecutionAuthorization
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more