Skip to main content

typesec_agent/
executor.rs

1//! Task execution infrastructure.
2
3/// Error type for task execution failures.
4#[derive(Debug, thiserror::Error)]
5pub enum TaskError {
6    /// No registered tool has the requested name.
7    #[error("unknown tool: {0}")]
8    UnknownTool(String),
9    /// The action itself returned an error.
10    #[error("task error: {0}")]
11    ActionFailed(String),
12    /// A capability was required but could not be obtained.
13    #[error("capability error: {0}")]
14    Capability(#[from] typesec_core::policy::CapabilityError),
15    /// The supplied capability has expired.
16    #[error("capability expired: {0}")]
17    CapabilityExpired(#[from] typesec_core::CapabilityUseError),
18    /// The supplied capability does not cover this agent or resource instance.
19    #[error("capability mismatch: {0}")]
20    CapabilityMismatch(String),
21}
22
23/// The result type for task execution.
24pub type TaskResult<T = ()> = Result<T, TaskError>;