pub struct ToolPolicy {
pub rules: HashMap<String, ToolConstraint>,
pub default: ToolDefaultPolicy,
}Expand description
Which tools, with what limits.
Fields§
§rules: HashMap<String, ToolConstraint>§default: ToolDefaultPolicyImplementations§
Source§impl ToolPolicy
impl ToolPolicy
pub fn open() -> Self
Sourcepub fn allows_without_approval(&self, tool_name: &str) -> bool
pub fn allows_without_approval(&self, tool_name: &str) -> bool
Whether a tool is executable without any further approval step.
Sourcepub fn requires_approval(&self, tool_name: &str) -> bool
pub fn requires_approval(&self, tool_name: &str) -> bool
Whether this tool requires an explicit approval step before execution.
Sourcepub fn constraint(&self, tool_name: &str) -> Option<&ToolConstraint>
pub fn constraint(&self, tool_name: &str) -> Option<&ToolConstraint>
Access the configured rule for a specific tool, if one exists.
Sourcepub fn is_tool_allowed(&self, tool_name: &str) -> bool
pub fn is_tool_allowed(&self, tool_name: &str) -> bool
Backward-compatible helper retained for existing callers.
Trait Implementations§
Source§impl Clone for ToolPolicy
impl Clone for ToolPolicy
Source§fn clone(&self) -> ToolPolicy
fn clone(&self) -> ToolPolicy
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 Debug for ToolPolicy
impl Debug for ToolPolicy
Source§impl Default for ToolPolicy
impl Default for ToolPolicy
Source§impl<'de> Deserialize<'de> for ToolPolicy
impl<'de> Deserialize<'de> for ToolPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolPolicy
impl RefUnwindSafe for ToolPolicy
impl Send for ToolPolicy
impl Sync for ToolPolicy
impl Unpin for ToolPolicy
impl UnsafeUnpin for ToolPolicy
impl UnwindSafe for ToolPolicy
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