Skip to main content

starweaver_runtime/capability/
error.rs

1//! Capability error types.
2
3use starweaver_model::ModelResponse;
4use thiserror::Error;
5
6/// Runtime capability error.
7#[derive(Debug, Error)]
8pub enum CapabilityError {
9    /// Ask the model to retry with this prompt.
10    #[error("model retry requested: {0}")]
11    ModelRetry(String),
12    /// Return this response without calling the model.
13    #[error("model request skipped")]
14    SkipModelRequest(Box<ModelResponse>),
15    /// Capability hook failed.
16    #[error("capability failed: {0}")]
17    Failed(String),
18    /// Runtime work was cancelled cooperatively by the host.
19    #[error("capability cancelled: {reason}")]
20    Cancelled {
21        /// Human-readable cancellation reason.
22        reason: String,
23    },
24}
25
26/// Capability hook result.
27pub type CapabilityResult<T> = Result<T, CapabilityError>;