Public declaration syntax from forge-rs/crates/forge-collab/src/error.rs Original source SHA-256: 7f866e40eff44ce1155559a9308dcf036219e70d2f6359af9a38445d230c495b Function bodies and constant values are omitted. This is not the complete implementation. Source line 29 #[derive(Debug, Error)] pub enum CollabError { /// The specified collaboration session does not exist. /// /// This is returned when an operation references a session ID that has /// not been created or has already been garbage-collected after reaching /// a terminal state. /// /// See ANVIL Spec section 11.2 -- Collaboration Session. #[error("collaboration session '{session_id}' not found (see ANVIL Spec section 11.2)")] SessionNotFound { /// The session ID that was not found. session_id: String, }, /// A session with the given ID is already in the Active state. /// /// Duplicate session activation is not permitted. Sessions must be /// dissolved before a new session with the same logical purpose is created. /// /// See ANVIL Spec section 11.2 -- Collaboration Session. #[error( "collaboration session '{session_id}' is already active (see ANVIL Spec section 11.2)" )] SessionAlreadyActive { /// The session ID that is already active. session_id: String, }, /// The session exceeded its configured timeout duration. /// /// Sessions with a `timeout_seconds` value will automatically transition /// to the `TimedOut` terminal state when the deadline passes. /// /// See ANVIL Spec section 11.2 -- Collaboration Session. #[error("collaboration session '{session_id}' timed out (see ANVIL Spec section 11.2)")] SessionTimedOut { /// The session ID that timed out. session_id: String, }, /// An invalid session state transition was attempted. /// /// The collaboration session state machine defines exactly which transitions /// are valid from each state. This error is returned when a transition /// violates the state machine rules. /// /// See ANVIL Spec section 11.2 -- Session State Machine. #[error("invalid session transition from '{from}' to '{to}' (see ANVIL Spec section 11.2)")] InvalidSessionTransition { /// The current session state. from: String, /// The target state that was attempted. to: String, }, /// The agent is not a participant in the specified session. /// /// Only agents that have joined a session can perform operations within /// that session (read/write context, receive tasks, send interrupts). /// /// See ANVIL Spec section 11.2 -- Session Participation. #[error("agent '{agent_did}' is not a participant in session '{session_id}' (see ANVIL Spec section 11.2)")] NotAParticipant { /// The agent DID that is not a participant. agent_did: String, /// The session ID the agent attempted to interact with. session_id: String, }, /// The specified delegated task does not exist. /// /// This is returned when an operation references a task ID that has /// not been created or has been completed and removed. /// /// See ANVIL Spec section 11.3 -- Delegated Task. #[error("delegated task '{task_id}' not found (see ANVIL Spec section 11.3)")] TaskNotFound { /// The task ID that was not found. task_id: String, }, /// The task is already assigned to another agent. /// /// A delegated task can only be assigned to one worker at a time. /// The existing assignment must be cancelled before re-assignment. /// /// See ANVIL Spec section 11.3 -- Delegated Task. #[error("delegated task '{task_id}' is already assigned to '{assignee}' (see ANVIL Spec section 11.3)")] TaskAlreadyAssigned { /// The task ID that is already assigned. task_id: String, /// The DID of the agent currently assigned to the task. assignee: String, }, /// The agent's capabilities do not match the task requirements. /// /// Task assignment validates that the target agent supports the required /// task type, tools, and has sufficient capacity. /// /// See ANVIL Spec section 11.6 -- Agent Capability Profile. #[error("capability mismatch for task type '{task_type}' and agent '{agent_did}': {reason} (see ANVIL Spec section 11.6)")] CapabilityMismatch { /// The task type that was not supported. task_type: String, /// The agent DID that lacks the capability. agent_did: String, /// A human-readable explanation of the mismatch. reason: String, }, /// The specified key was not found in the shared context. /// /// Context reads return this when the key has not been written to /// the session's shared context store. /// /// See ANVIL Spec section 11.4 -- Shared Context. #[error("context key '{key}' not found (see ANVIL Spec section 11.4)")] ContextKeyNotFound { /// The key that was not found. key: String, }, /// The agent does not have permission to access the specified context key. /// /// Context entries can have visibility restrictions based on session scope, /// role, or specific agent DID. /// /// See ANVIL Spec section 11.4 -- Shared Context. #[error("agent '{agent_did}' does not have permission to access context key '{key}' (see ANVIL Spec section 11.4)")] ContextPermissionDenied { /// The context key the agent attempted to access. key: String, /// The agent DID that was denied access. agent_did: String, }, /// The interrupt was rejected by the target agent. /// /// Agents may reject interrupts if they are in a state that does not /// permit interruption (e.g., in a critical section) or if the interrupt /// type is not supported. /// /// See ANVIL Spec section 11.5 -- Interrupts. #[error("interrupt '{interrupt_id}' rejected: {reason} (see ANVIL Spec section 11.5)")] InterruptRejected { /// The interrupt ID that was rejected. interrupt_id: String, /// A human-readable explanation of the rejection. reason: String, }, /// A task delegation operation failed. /// /// This is a general delegation failure covering scenarios such as /// no eligible workers, constraint violations, or internal errors /// during the delegation flow. /// /// See ANVIL Spec section 11.3 -- Delegated Task. #[error("delegation failed: {reason} (see ANVIL Spec section 11.3)")] DelegationFailed { /// A human-readable explanation of the failure. reason: String, }, /// The agent attempted an action that violates its assigned role. /// /// For example, a Worker attempting to decompose tasks (a Coordinator /// action) or a Peer attempting to assign tasks. /// /// See ANVIL Spec section 11.1 -- Collaboration Roles. #[error("role violation: agent '{agent_did}' with role '{role}' cannot perform action '{action}' (see ANVIL Spec section 11.1)")] RoleViolation { /// The agent DID that violated its role. agent_did: String, /// The role the agent holds. role: String, /// The action the agent attempted. action: String, }, } Source line 212 pub type CollabResult = Result;