pub struct ToolRule {
pub capability: Capability,
pub pattern: Option<String>,
pub action: ToolAction,
pub origin: RuleOrigin,
}Expand description
One tool-policy statement: action for capability, optionally narrowed by pattern.
Rules are kept in profile order, which carries no precedence: of the rules that match a call,
the strictest action wins (deny, then ask, then allow), however narrow a key is.
crate::tool_project::project applies the same order to a native name two rules share, and
gives a rule that a stricter one covers no native name.
Fields§
§capability: Capability§pattern: Option<String>Scope inside capability(...). None for * and mcp, whose scope is the capability.
action: ToolAction§origin: RuleOriginImplementations§
Source§impl ToolRule
impl ToolRule
pub fn from_parsed(parsed: ParsedToolName, action: ToolAction) -> Self
Sourcepub fn from_wire(
capability: &str,
pattern: Option<&str>,
action: ToolAction,
) -> Result<Self, ToolNameParseError>
pub fn from_wire( capability: &str, pattern: Option<&str>, action: ToolAction, ) -> Result<Self, ToolNameParseError>
A rule from its wire shape ({capability, pattern, action}, as agent::read reports
it and Serialize writes it), parsed like the authored key it renders to.
pub fn with_origin(self, origin: RuleOrigin) -> Self
pub fn is_wildcard(&self) -> bool
pub fn is_mcp(&self) -> bool
Trait Implementations§
impl Eq for ToolRule
Source§impl PartialEq for ToolRule
Equality ignores origin: merge_permission_set and push_unique rely on it to fold a
rule that two layers both state into one.
impl PartialEq for ToolRule
Equality ignores origin: merge_permission_set and push_unique rely on it to fold a
rule that two layers both state into one.
Auto Trait Implementations§
impl Forget for ToolRule
impl Freeze for ToolRule
impl Move for ToolRule
impl RefUnwindSafe for ToolRule
impl Send for ToolRule
impl Sync for ToolRulewhere
RawVecInner: Sync,
impl Unpin for ToolRule
impl UnsafeUnpin for ToolRule
impl UnwindSafe for ToolRule
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,
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.