pub struct CapabilitySet {
pub allowed_tools: HashSet<String>,
pub denied_tools: HashSet<String>,
pub allowed_state_keys: HashSet<String>,
pub max_actions: Option<u32>,
}Expand description
Capability set defining what an agent is allowed to do.
Fields§
§allowed_tools: HashSet<String>If set, only these tools are allowed. Empty = all tools allowed.
denied_tools: HashSet<String>These tools are always denied (overrides allowed_tools).
allowed_state_keys: HashSet<String>If set, only these state keys can be read/written. Empty = all keys allowed.
max_actions: Option<u32>Maximum actions per proposal. None = unlimited.
Implementations§
Source§impl CapabilitySet
impl CapabilitySet
pub fn new() -> Self
pub fn allow_tool(self, tool: &str) -> Self
pub fn deny_tool(self, tool: &str) -> Self
pub fn allow_state_key(self, key: &str) -> Self
pub fn with_max_actions(self, max: u32) -> Self
Sourcepub fn tool_allowed(&self, tool: &str) -> bool
pub fn tool_allowed(&self, tool: &str) -> bool
Check if a tool is permitted.
Sourcepub fn state_key_allowed(&self, key: &str) -> bool
pub fn state_key_allowed(&self, key: &str) -> bool
Check if a state key is permitted.
Sourcepub fn actions_within_budget(&self, count: u32) -> bool
pub fn actions_within_budget(&self, count: u32) -> bool
Check if action count is within budget.
Trait Implementations§
Source§impl Clone for CapabilitySet
impl Clone for CapabilitySet
Source§fn clone(&self) -> CapabilitySet
fn clone(&self) -> CapabilitySet
Returns a duplicate of the value. Read more
1.0.0 · 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 CapabilitySet
impl Debug for CapabilitySet
Source§impl Default for CapabilitySet
impl Default for CapabilitySet
Source§fn default() -> CapabilitySet
fn default() -> CapabilitySet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CapabilitySet
impl<'de> Deserialize<'de> for CapabilitySet
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 CapabilitySet
impl RefUnwindSafe for CapabilitySet
impl Send for CapabilitySet
impl Sync for CapabilitySet
impl Unpin for CapabilitySet
impl UnsafeUnpin for CapabilitySet
impl UnwindSafe for CapabilitySet
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,
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