use std::path::PathBuf;
pub trait Host: Send + Sync + Clone {
fn dispatch_ask_user(
&self,
args: &str,
conversation_id: Option<u64>,
) -> impl std::future::Future<Output = Result<String, String>> + Send {
let _ = (args, conversation_id);
async { Err("ask_user is not available in this runtime mode".to_owned()) }
}
fn dispatch_delegate(
&self,
args: &str,
agent: &str,
) -> impl std::future::Future<Output = Result<String, String>> + Send {
let _ = (args, agent);
async { Err("delegate is not available in this runtime mode".to_owned()) }
}
fn conversation_cwd(&self, _conversation_id: u64) -> Option<PathBuf> {
None
}
fn on_agent_event(&self, _agent: &str, _conversation_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_conversation_cwd(
&self,
_conversation: u64,
_cwd: PathBuf,
) -> impl std::future::Future<Output = ()> + Send {
async {}
}
fn clear_conversation_state(
&self,
_conversation: 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,
_conversation_id: Option<u64>,
) -> impl std::future::Future<Output = Result<String, String>> + Send {
async move { Err(format!("tool not available: {name}")) }
}
}
#[derive(Clone)]
pub struct NoHost;
impl Host for NoHost {}