pub struct ToolAskRule {
pub tool: String,
pub command: Option<String>,
pub path: Option<String>,
pub action: PermissionAction,
}Expand description
Typed rule that controls whether a tool invocation is denied, allowed, or requires approval.
The action field governs what happens when this rule matches:
"deny"— the tool call is blocked outright (highest priority)."ask"— the approval prompt is forced (default, backward compatible)."allow"— the tool call proceeds without asking.
Deny always wins over ask, which wins over allow. Command-prefix-based
deny and allow rules are promoted into the execution-policy engine’s
denied_prefixes / trusted_prefixes for arity-aware matching;
path-only rules are evaluated separately.
Fields§
§tool: StringName of the tool this rule applies to (e.g. "exec_shell", "edit_file").
command: Option<String>Optional command prefix to match against (uses arity-aware matching).
path: Option<String>Optional file path pattern to match against.
action: PermissionActionAction when this rule matches. Default: "ask" (backward compatible).
Implementations§
Source§impl ToolAskRule
impl ToolAskRule
Sourcepub fn new(tool: impl Into<String>) -> ToolAskRule
pub fn new(tool: impl Into<String>) -> ToolAskRule
Creates a new ask rule matching any invocation of the given tool.
Sourcepub fn exec_shell(command: impl Into<String>) -> ToolAskRule
pub fn exec_shell(command: impl Into<String>) -> ToolAskRule
Creates an ask rule for exec_shell matching a specific command prefix.
Trait Implementations§
Source§impl Clone for ToolAskRule
impl Clone for ToolAskRule
Source§fn clone(&self) -> ToolAskRule
fn clone(&self) -> ToolAskRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolAskRule
impl Debug for ToolAskRule
Source§impl<'de> Deserialize<'de> for ToolAskRule
impl<'de> Deserialize<'de> for ToolAskRule
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolAskRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolAskRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ToolAskRule
Source§impl PartialEq for ToolAskRule
impl PartialEq for ToolAskRule
Source§impl Serialize for ToolAskRule
impl Serialize for ToolAskRule
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ToolAskRule
Auto Trait Implementations§
impl Freeze for ToolAskRule
impl RefUnwindSafe for ToolAskRule
impl Send for ToolAskRule
impl Sync for ToolAskRule
impl Unpin for ToolAskRule
impl UnsafeUnpin for ToolAskRule
impl UnwindSafe for ToolAskRule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.