pub struct Ruleset {
pub layer: RulesetLayer,
pub trusted_prefixes: Vec<String>,
pub denied_prefixes: Vec<String>,
pub ask_rules: Vec<ToolAskRule>,
}Expand description
A named set of allow/deny prefix rules at a given priority layer.
Fields§
§layer: RulesetLayerPriority layer this ruleset belongs to.
trusted_prefixes: Vec<String>Command prefixes that are allowed without requiring approval.
denied_prefixes: Vec<String>Command prefixes that are always blocked, regardless of trust rules.
ask_rules: Vec<ToolAskRule>Typed rules that mark specific tool invocations as requiring approval.
Implementations§
Source§impl Ruleset
impl Ruleset
Sourcepub fn builtin_default() -> Self
pub fn builtin_default() -> Self
Creates an empty ruleset at the builtin default priority layer.
Sourcepub fn agent(trusted: Vec<String>, denied: Vec<String>) -> Self
pub fn agent(trusted: Vec<String>, denied: Vec<String>) -> Self
Creates an agent-layer ruleset with the given trusted and denied prefixes.
Sourcepub fn user(trusted: Vec<String>, denied: Vec<String>) -> Self
pub fn user(trusted: Vec<String>, denied: Vec<String>) -> Self
Creates a user-layer ruleset with the given trusted and denied prefixes.
Sourcepub fn with_ask_rules(self, ask_rules: Vec<ToolAskRule>) -> Self
pub fn with_ask_rules(self, ask_rules: Vec<ToolAskRule>) -> Self
Attaches typed ask rules to this ruleset and returns it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ruleset
impl<'de> Deserialize<'de> for Ruleset
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 Ruleset
impl RefUnwindSafe for Ruleset
impl Send for Ruleset
impl Sync for Ruleset
impl Unpin for Ruleset
impl UnsafeUnpin for Ruleset
impl UnwindSafe for Ruleset
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