pub mod graph;
pub mod introspection;
pub mod pipeline;
pub mod executor;
pub mod idempotency;
pub mod discovery;
pub mod error {
use thiserror::Error;
#[derive(Debug, Error)]
pub enum StygianError {
#[error("Graph error: {0}")]
Graph(#[from] GraphError),
#[error("Service error: {0}")]
Service(#[from] ServiceError),
#[error("Provider error: {0}")]
Provider(#[from] ProviderError),
#[error("Config error: {0}")]
Config(#[from] ConfigError),
#[error("Rate limit error: {0}")]
RateLimit(#[from] RateLimitError),
#[error("Cache error: {0}")]
Cache(#[from] CacheError),
}
#[derive(Debug, Error)]
pub enum GraphError {
#[error("Graph contains cycle, cannot execute")]
CycleDetected,
#[error("Node not found: {0}")]
NodeNotFound(String),
#[error("Invalid edge: {0}")]
InvalidEdge(String),
#[error("Invalid pipeline: {0}")]
InvalidPipeline(String),
#[error("Execution failed: {0}")]
ExecutionFailed(String),
}
#[derive(Debug, Error)]
pub enum ServiceError {
#[error("Service unavailable: {0}")]
Unavailable(String),
#[error("Service timeout after {0}ms")]
Timeout(u64),
#[error("Invalid response: {0}")]
InvalidResponse(String),
#[error("Authentication failed: {0}")]
AuthenticationFailed(String),
#[error("Rate limited, retry after {retry_after_ms}ms")]
RateLimited {
retry_after_ms: u64,
},
}
#[derive(Debug, Error)]
pub enum ProviderError {
#[error("API error: {0}")]
ApiError(String),
#[error("Invalid credentials")]
InvalidCredentials,
#[error("Token limit exceeded: {0}")]
TokenLimitExceeded(String),
#[error("Model not available: {0}")]
ModelUnavailable(String),
#[error("Content policy violation: {0}")]
ContentPolicyViolation(String),
}
#[derive(Debug, Error)]
pub enum ConfigError {
#[error("Missing required config: {0}")]
MissingConfig(String),
#[error("Invalid config value for '{key}': {reason}")]
InvalidValue {
key: String,
reason: String,
},
#[error("Config file error: {0}")]
FileError(String),
#[error("TOML parse error: {0}")]
ParseError(String),
}
#[derive(Debug, Error)]
pub enum RateLimitError {
#[error("Rate limit exceeded: {0} requests per {1} seconds")]
Exceeded(u32, u32),
#[error("Quota exhausted: {0}")]
QuotaExhausted(String),
#[error("Retry after {0} seconds")]
RetryAfter(u64),
}
#[derive(Debug, Error)]
pub enum CacheError {
#[error("Cache miss: {0}")]
Miss(String),
#[error("Cache write failed: {0}")]
WriteFailed(String),
#[error("Cache read failed: {0}")]
ReadFailed(String),
#[error("Cache eviction failed: {0}")]
EvictionFailed(String),
#[error("Cache corrupted: {0}")]
Corrupted(String),
}
pub type Result<T> = std::result::Result<T, StygianError>;
#[derive(Debug, Error)]
pub enum DomainError {
#[error("Graph contains cycle, cannot execute")]
CycleDetected,
#[error("Invalid pipeline: {0}")]
InvalidPipeline(String),
#[error("Execution failed: {0}")]
ExecutionFailed(String),
#[error("Service error: {0}")]
ServiceError(String),
}
pub type DomainResult<T> = std::result::Result<T, DomainError>;
}