pub struct PermissionRule {
pub namespace_pattern: String,
pub op: String,
pub agent_pattern: String,
pub decision: RuleDecision,
pub reason: Option<String>,
}Expand description
One row of [[permissions.rules]] from config.toml.
Wire format:
[[permissions.rules]]
namespace_pattern = "secrets/*"
op = "memory_store"
agent_pattern = "ai:*"
decision = "deny"
reason = "ai agents may not write to secrets"namespace_pattern and agent_pattern use a tiny glob
vocabulary: * matches any run of non-/ characters in the
namespace, any run of any character in the agent id. **
matches across / boundaries. An exact string is treated as a
literal match.
op is required and matches the Op::as_str wire form. A
missing op fails the loader.
Pattern specificity (longer literal-prefix wins) is the tie
breaker when multiple rules match the same context — the rule
whose namespace_pattern has the longest non-glob prefix takes
precedence. Within equal namespace specificity, an exact
agent_pattern (no *) beats a wildcard.
Fields§
§namespace_pattern: String§op: String§agent_pattern: String§decision: RuleDecision§reason: Option<String>Trait Implementations§
Source§impl Clone for PermissionRule
impl Clone for PermissionRule
Source§fn clone(&self) -> PermissionRule
fn clone(&self) -> PermissionRule
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 PermissionRule
impl Debug for PermissionRule
Source§impl<'de> Deserialize<'de> for PermissionRule
impl<'de> Deserialize<'de> for PermissionRule
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
Source§impl PartialEq for PermissionRule
impl PartialEq for PermissionRule
Source§fn eq(&self, other: &PermissionRule) -> bool
fn eq(&self, other: &PermissionRule) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for PermissionRule
impl Serialize for PermissionRule
impl StructuralPartialEq for PermissionRule
Auto Trait Implementations§
impl Freeze for PermissionRule
impl RefUnwindSafe for PermissionRule
impl Send for PermissionRule
impl Sync for PermissionRule
impl Unpin for PermissionRule
impl UnsafeUnpin for PermissionRule
impl UnwindSafe for PermissionRule
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
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>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more