pub enum PermissionMode {
Default,
AcceptEdits,
BypassPermissions,
DontAsk,
Plan {
pre_plan_mode: Box<PermissionMode>,
bypass_available: bool,
},
Auto,
}Expand description
The session-wide permission mode, determining runtime behaviour for tool dispatch.
This is separate from the per-tool allow/deny/interactive lists in the layered config — the mode acts as a top-level policy on top of those static rules.
§Serde
This enum supports both the new camelCase names and the old snake_case names for backward compatibility:
| New | Old aliases |
|---|---|
default | allow |
acceptEdits | — |
bypassPermissions | — |
dontAsk | deny, interactive |
plan (string) | plan |
The plan variant also accepts an object form:
{"prePlanMode": "default", "bypassAvailable": false}.
Variants§
Default
Normal mode: follow static allow/deny rules, defer to Passthrough for unknown tools.
AcceptEdits
Auto-allow write tools within the workspace.
BypassPermissions
Skip all rule checks; every tool is allowed.
DontAsk
Deny any tool that is in the interactive list.
Plan
Plan mode: blocks write tools (except exit_plan_mode).
pre_plan_mode stores the mode to restore on exit.
bypass_available allows writes to bypass plan-mode blocking
when the agent was in BypassPermissions before entering plan.
Fields
pre_plan_mode: Box<PermissionMode>The mode that was active before entering plan mode.
Auto
Auto mode: delegate every tool-call decision to an LLM classifier.
The classifier receives the tool name, argument summary, and recent
conversation context and returns {"block": true|false, "reason": "..."}.
A denial tracker prevents runaway loops (3 consecutive / 10 total
denials → all subsequent calls denied).
Trait Implementations§
Source§impl Clone for PermissionMode
impl Clone for PermissionMode
Source§fn clone(&self) -> PermissionMode
fn clone(&self) -> PermissionMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PermissionMode
impl Debug for PermissionMode
Source§impl Default for PermissionMode
impl Default for PermissionMode
Source§fn default() -> PermissionMode
fn default() -> PermissionMode
Source§impl<'de> Deserialize<'de> for PermissionMode
impl<'de> Deserialize<'de> for PermissionMode
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>,
impl Eq for PermissionMode
Source§impl PartialEq for PermissionMode
impl PartialEq for PermissionMode
Source§fn eq(&self, other: &PermissionMode) -> bool
fn eq(&self, other: &PermissionMode) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PermissionMode
impl Serialize for PermissionMode
impl StructuralPartialEq for PermissionMode
Auto Trait Implementations§
impl Freeze for PermissionMode
impl RefUnwindSafe for PermissionMode
impl Send for PermissionMode
impl Sync for PermissionMode
impl Unpin for PermissionMode
impl UnsafeUnpin for PermissionMode
impl UnwindSafe for PermissionMode
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
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
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>
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