rsclaw 0.0.1-alpha.1

rsclaw: High-performance AI agent (BETA). Optimized for M4 Max and 2GB VPS. 100% compatible with openclaw
Documentation
use super::http::HttpChannel;
use super::ws::WsChannel;
use crate::agent::AgentManager;
use std::sync::Arc;
use tokio::sync::RwLock;

/// Channel manager for coordinating multiple channels.
pub struct ChannelManager {
    agent_manager: Arc<RwLock<AgentManager>>,
    http_channel: Arc<HttpChannel>,
    ws_channel: Arc<WsChannel>,
}

impl ChannelManager {
    /// Create a new channel manager.
    pub fn new(agent_manager: Arc<RwLock<AgentManager>>) -> Self {
        Self {
            agent_manager: agent_manager.clone(),
            http_channel: Arc::new(HttpChannel::new(agent_manager.clone())),
            ws_channel: Arc::new(WsChannel::new(agent_manager)),
        }
    }

    /// Get the HTTP channel.
    pub fn http(&self) -> Arc<HttpChannel> {
        self.http_channel.clone()
    }

    /// Get the WebSocket channel.
    pub fn ws(&self) -> Arc<WsChannel> {
        self.ws_channel.clone()
    }

    /// Get the agent manager.
    pub fn agent_manager(&self) -> Arc<RwLock<AgentManager>> {
        self.agent_manager.clone()
    }
}