#[non_exhaustive]pub struct Permissions {
pub read_only: bool,
pub allowed_commands: Option<HashSet<String>>,
pub sensitive_commands: HashSet<String>,
pub confirmation_token: Option<String>,
}Available on crate feature
agent only.Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.read_only: boolWhen true (the default), every mutating tool is denied.
allowed_commands: Option<HashSet<String>>When set, commands outside this set are denied.
sensitive_commands: HashSet<String>Commands that need arguments.confirmation to match confirmation_token.
confirmation_token: Option<String>The confirmation value for sensitive commands.
Implementations§
Source§impl Permissions
impl Permissions
Sourcepub fn read_write() -> Self
pub fn read_write() -> Self
Allow reads and writes.
Sourcepub fn allow_commands<I, S>(self, commands: I) -> Self
pub fn allow_commands<I, S>(self, commands: I) -> Self
Allow only these commands.
Sourcepub fn confirm<I, S>(self, commands: I, token: impl Into<String>) -> Self
pub fn confirm<I, S>(self, commands: I, token: impl Into<String>) -> Self
Require a confirmation value for these commands.
Sourcepub fn require_confirmation<I, S>(self, commands: I) -> Self
pub fn require_confirmation<I, S>(self, commands: I) -> Self
Require confirmation for these commands without configuring a value.
Every call is refused with ConfirmationRequired until a
token is configured, which is the safe default for --read-write without a secret.
Trait Implementations§
Source§impl Clone for Permissions
impl Clone for Permissions
Source§impl Debug for Permissions
impl Debug for Permissions
Auto Trait Implementations§
impl Forget for Permissions
impl Freeze for Permissions
impl Move for Permissions
impl RefUnwindSafe for Permissions
impl Send for Permissions
impl Sync for Permissions
impl Unpin for Permissions
impl UnsafeUnpin for Permissionswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Permissions
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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