a3s_code_core/capability/
scope_error.rs1use thiserror::Error;
2
3#[derive(Clone, Debug, Error, Eq, PartialEq)]
5pub enum CapabilityScopeError {
6 #[error("Capability scope identifier is invalid: {reason}")]
7 InvalidScopeId { reason: &'static str },
8 #[error("Capability lifecycle name is invalid: {reason}")]
9 InvalidLifecycleName { reason: &'static str },
10 #[error("Capability execution limit '{field}' must be positive")]
11 InvalidExecutionLimit { field: &'static str },
12 #[error("Capability scope field '{field}' exceeds its bound of {max}")]
13 BoundExceeded { field: &'static str, max: usize },
14 #[error("Capability '{capability}' is repeated in one ceiling")]
15 DuplicateCeilingCapability { capability: String },
16 #[error("Capability '{capability}' is not present in catalog '{catalog_digest}'")]
17 CapabilityOutsideCatalog {
18 capability: String,
19 catalog_digest: String,
20 },
21 #[error("Capability ceiling belongs to another immutable catalog")]
22 CeilingCatalogMismatch,
23 #[error("Child capability scope broadens parent ceiling dimension '{dimension}'")]
24 CeilingExpansion { dimension: &'static str },
25 #[error("Catalog requires an exact A3S Use generation lease for Run admission")]
26 MissingUseGenerationLease,
27 #[error("Catalog has no A3S Use generation but Run admission supplied a Use lease")]
28 UnexpectedUseGenerationLease,
29 #[error(
30 "A3S Use Run lease does not match the catalog cursor (generation {expected_generation} vs {actual_generation}, capability revision mismatch: {revision_mismatch}, Registry revision mismatch: {registry_revision_mismatch})"
31 )]
32 UseGenerationLeaseMismatch {
33 expected_generation: u64,
34 actual_generation: u64,
35 revision_mismatch: bool,
36 registry_revision_mismatch: bool,
37 },
38 #[error("Capability scope '{scope_id}' is no longer active")]
39 ScopeInactive { scope_id: String },
40 #[error("Tool invocation has no active Agent Turn capability scope")]
41 AgentTurnScopeUnavailable,
42 #[error("Capability scope '{scope_id}' no longer accepts lifecycle registrations")]
43 SupervisorClosed { scope_id: String },
44 #[error("Capability scope requires an active Tokio runtime")]
45 TokioRuntimeUnavailable,
46 #[error("Capability supervisor task identity is exhausted")]
47 TaskIdentityExhausted,
48 #[error("Capability supervisor child identity is exhausted")]
49 ChildIdentityExhausted,
50 #[error("Capability child scope '{scope_id}' is already active")]
51 DuplicateChildScope { scope_id: String },
52}