use std::sync::Arc; use crate::agent::AgentError; use crate::storage::{SessionRecord, SessionStore}; #[derive(Clone)] pub(crate) struct CliSessionService { store: Arc, } impl CliSessionService { pub(crate) fn new(store: Arc) -> Self { Self { store } } /// 创建指定通道的会话 pub(crate) fn create_with_channel( &self, channel_name: &str, title: Option<&str>, ) -> Result { self.store .create_session(channel_name, title) .map_err(|err| AgentError::Other(format!("create session error: {}", err))) } }