agnosai 1.1.0

Provider-agnostic AI orchestration framework
Documentation
use std::sync::Arc;

use dashmap::DashMap;

use crate::core::AgentDefinition;
use crate::llm::AuditChain;
use crate::orchestrator::Orchestrator;
use crate::orchestrator::approval::ApprovalGate;
use crate::server::auth::AuthConfig;
use crate::server::sse::EventBus;
use crate::tools::ToolRegistry;

/// Shared application state accessible from all route handlers.
pub struct AppState {
    /// Crew orchestrator.
    pub orchestrator: Orchestrator,
    /// Registered tool instances.
    pub tools: Arc<ToolRegistry>,
    /// Authentication configuration.
    pub auth: AuthConfig,
    /// SSE event bus for crew streaming.
    pub events: EventBus,
    /// Shared HTTP client for outbound requests (A2A callbacks, etc.).
    pub http_client: reqwest::Client,
    /// Cryptographic audit chain for tamper-proof event logging.
    pub audit: Arc<AuditChain>,
    /// Human-in-the-loop approval gate for task results.
    pub approval_gate: ApprovalGate,
    /// Agent definitions created via the API.
    pub definitions: DashMap<String, AgentDefinition>,
}

/// Thread-safe shared reference to application state.
pub type SharedState = Arc<AppState>;