pub struct AgentPermissions {
pub agent_name: String,
pub allowed_tools: HashSet<String>,
pub allowed_paths: Vec<String>,
pub denied_paths: Vec<String>,
pub network_access: bool,
pub max_execution_time_secs: u64,
pub max_memory_mb: u64,
pub can_fork: bool,
}Expand description
Permissions for a single agent (least-privilege defaults).
Fields§
§agent_name: StringAgent name.
allowed_tools: HashSet<String>Allowed tool names.
allowed_paths: Vec<String>Allowed path glob patterns.
denied_paths: Vec<String>Denied path glob patterns (takes precedence).
network_access: boolNetwork access.
max_execution_time_secs: u64Max execution time in seconds (0 = unlimited).
max_memory_mb: u64Max memory in MB (0 = unlimited).
can_fork: boolCan spawn sub-agents.
Implementations§
Source§impl AgentPermissions
impl AgentPermissions
Sourcepub fn for_new_agent(agent_name: &str) -> Self
pub fn for_new_agent(agent_name: &str) -> Self
Create default permissions for a new agent.
Sourcepub fn allow_tool(&mut self, tool: &str)
pub fn allow_tool(&mut self, tool: &str)
Allow a tool.
Sourcepub fn allow_path(&mut self, path: &str)
pub fn allow_path(&mut self, path: &str)
Allow a path pattern (dedup).
Sourcepub fn enable_network(&mut self)
pub fn enable_network(&mut self)
Enable network access.
Sourcepub fn enable_forking(&mut self)
pub fn enable_forking(&mut self)
Enable agent forking.
Sourcepub fn is_path_denied(&self, path: &str) -> bool
pub fn is_path_denied(&self, path: &str) -> bool
Check if a path matches any denied pattern.
Sourcepub fn is_path_allowed(&self, path: &str) -> bool
pub fn is_path_allowed(&self, path: &str) -> bool
Check if a path matches any allowed pattern.
Trait Implementations§
Source§impl Clone for AgentPermissions
impl Clone for AgentPermissions
Source§fn clone(&self) -> AgentPermissions
fn clone(&self) -> AgentPermissions
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 AgentPermissions
impl Debug for AgentPermissions
Source§impl Default for AgentPermissions
impl Default for AgentPermissions
Source§impl<'de> Deserialize<'de> for AgentPermissions
impl<'de> Deserialize<'de> for AgentPermissions
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 AgentPermissions
impl RefUnwindSafe for AgentPermissions
impl Send for AgentPermissions
impl Sync for AgentPermissions
impl Unpin for AgentPermissions
impl UnsafeUnpin for AgentPermissions
impl UnwindSafe for AgentPermissions
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