#[non_exhaustive]pub enum DelegationMode {
Disabled,
ExplicitRequestOnly,
Proactive,
}Expand description
Tri-state control over whether the main agent may spawn sub-agents, and who may trigger it
(spec 042-subagent-delegation-mode-parity, issue #5857).
Orthogonal to SubAgentConfig::enabled, which remains the outer kill switch: when
enabled = false, the effective mode is always DelegationMode::Disabled regardless of
this field’s value (FR-002). Also orthogonal to PermissionMode — that governs what a
spawned sub-agent may do; this governs whether a spawn may happen at all and who may
trigger it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Disabled
No spawn may proceed from any code path (slash command, orchestration planner/scheduler,
scheduled task). Read-only operations (/agent list, definition inspection, status
queries) remain available.
ExplicitRequestOnly
Only spawns attributable to a direct, explicit user action (e.g. /agent spawn) are
permitted; spawns originating from autonomous planner/scheduler decision-making are
rejected.
Proactive
Both explicit and autonomous spawn paths are permitted, subject to the pre-existing
constraints (max_concurrent, max_spawn_depth, permission grants, worktree isolation).
Matches the subsystem’s behavior prior to this field’s introduction.
Implementations§
Source§impl DelegationMode
impl DelegationMode
Sourcepub fn permits_explicit(self) -> bool
pub fn permits_explicit(self) -> bool
Whether a spawn/resume attempt attributable to a direct, explicit user action (e.g.
/agent spawn, /agent resume, /subagent spawn) is permitted under this mode.
Expressed as an allow-list (Proactive and ExplicitRequestOnly match; every other
value, including any future #[non_exhaustive] variant, does not) rather than a
deny-list (self != Disabled), so it fails closed automatically on a variant this
crate doesn’t yet recognize instead of silently permitting it. Shared by every
origin-agnostic “is this explicit action even allowed at all” check — the ACP
/subagent spawn gate and SubAgentManager::resume — so the two enforcement points
cannot drift out of sync with each other. Does not cover Autonomous-origin spawns;
SubAgentManager::spawn’s own origin-aware gate handles that distinction directly.
§Examples
use zeph_config::DelegationMode;
assert!(DelegationMode::Proactive.permits_explicit());
assert!(DelegationMode::ExplicitRequestOnly.permits_explicit());
assert!(!DelegationMode::Disabled.permits_explicit());Trait Implementations§
Source§impl Clone for DelegationMode
impl Clone for DelegationMode
Source§fn clone(&self) -> DelegationMode
fn clone(&self) -> DelegationMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DelegationMode
Source§impl Debug for DelegationMode
impl Debug for DelegationMode
Source§impl Default for DelegationMode
impl Default for DelegationMode
Source§fn default() -> DelegationMode
fn default() -> DelegationMode
Source§impl<'de> Deserialize<'de> for DelegationMode
impl<'de> Deserialize<'de> for DelegationMode
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 DelegationMode
Source§impl PartialEq for DelegationMode
impl PartialEq for DelegationMode
Source§impl Serialize for DelegationMode
impl Serialize for DelegationMode
impl StructuralPartialEq for DelegationMode
Auto Trait Implementations§
impl Freeze for DelegationMode
impl RefUnwindSafe for DelegationMode
impl Send for DelegationMode
impl Sync for DelegationMode
impl Unpin for DelegationMode
impl UnsafeUnpin for DelegationMode
impl UnwindSafe for DelegationMode
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§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.