use tokio::sync::broadcast;
use crate::core::types::AgentEvent;
use crate::core::error::AgentError;
use super::config::DaemonConfig;
pub struct DaemonSession {
config: DaemonConfig,
session_id: Option<String>,
tx: broadcast::Sender<AgentEvent>,
}
impl DaemonSession {
pub async fn connect(config: DaemonConfig) -> Result<Self, AgentError> {
let (tx, _) = broadcast::channel(256);
Ok(Self {
config,
session_id: None,
tx,
})
}
pub fn subscribe(&self) -> broadcast::Receiver<AgentEvent> {
self.tx.subscribe()
}
pub async fn send_prompt(&self, _prompt: &str) -> Result<(), AgentError> {
Err(AgentError::SpawnFailed(
"DaemonSession::send_prompt not yet implemented".into(),
))
}
pub fn session_id(&self) -> Option<&str> {
self.session_id.as_deref()
}
pub fn config(&self) -> &DaemonConfig {
&self.config
}
pub async fn kill(&self) -> Result<(), AgentError> {
Ok(())
}
}