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 /// The action itself returned an error.
7 #[error("task error: {0}")]
8 ActionFailed(String),
9 /// A capability was required but could not be obtained.
10 #[error("capability error: {0}")]
11 Capability(#[from] typesec_core::policy::CapabilityError),
12 /// The supplied capability has expired.
13 #[error("capability expired: {0}")]
14 CapabilityExpired(#[from] typesec_core::CapabilityUseError),
15 /// The supplied capability does not cover this agent or resource instance.
16 #[error("capability mismatch: {0}")]
17 CapabilityMismatch(String),
18}
19
20/// The result type for task execution.
21pub type TaskResult<T = ()> = Result<T, TaskError>;