starweaver-runtime 0.2.0

Agent-loop graph and runtime executor primitives for Starweaver
Documentation
//! Capability error types.

use starweaver_model::ModelResponse;
use thiserror::Error;

/// Runtime capability error.
#[derive(Debug, Error)]
pub enum CapabilityError {
    /// Ask the model to retry with this prompt.
    #[error("model retry requested: {0}")]
    ModelRetry(String),
    /// Return this response without calling the model.
    #[error("model request skipped")]
    SkipModelRequest(Box<ModelResponse>),
    /// Capability hook failed.
    #[error("capability failed: {0}")]
    Failed(String),
    /// Runtime work was cancelled cooperatively by the host.
    #[error("capability cancelled: {reason}")]
    Cancelled {
        /// Human-readable cancellation reason.
        reason: String,
    },
}

/// Capability hook result.
pub type CapabilityResult<T> = Result<T, CapabilityError>;