use std::path::PathBuf;
pub trait Host: Send + Sync + Clone {
fn dispatch_ask_user(
&self,
args: &str,
session_id: Option<u64>,
) -> impl std::future::Future<Output = String> + Send {
let _ = (args, session_id);
async { "ask_user is not available in this runtime mode".to_owned() }
}
fn dispatch_delegate(
&self,
args: &str,
agent: &str,
) -> impl std::future::Future<Output = String> + Send {
let _ = (args, agent);
async { "delegate is not available in this runtime mode".to_owned() }
}
fn session_cwd(&self, _session_id: u64) -> Option<PathBuf> {
None
}
fn on_agent_event(&self, _agent: &str, _session_id: u64, _event: &wcore::AgentEvent) {}
fn reply_to_ask(
&self,
_session: u64,
_content: String,
) -> impl std::future::Future<Output = anyhow::Result<bool>> + Send {
async { Ok(false) }
}
fn set_session_cwd(
&self,
_session: u64,
_cwd: PathBuf,
) -> impl std::future::Future<Output = ()> + Send {
async {}
}
fn clear_session_state(&self, _session: u64) -> impl std::future::Future<Output = ()> + Send {
async {}
}
fn subscribe_events(
&self,
) -> Option<tokio::sync::broadcast::Receiver<wcore::protocol::message::AgentEventMsg>> {
None
}
fn dispatch_custom_tool(
&self,
name: &str,
_args: &str,
_agent: &str,
_session_id: Option<u64>,
) -> impl std::future::Future<Output = String> + Send {
async move { format!("tool not available: {name}") }
}
}
#[derive(Clone)]
pub struct NoHost;
impl Host for NoHost {}