1use std::path::PathBuf;
8
9pub trait Host: Send + Sync + Clone {
11 fn dispatch_ask_user(
13 &self,
14 args: &str,
15 conversation_id: Option<u64>,
16 ) -> impl std::future::Future<Output = String> + Send {
17 let _ = (args, conversation_id);
18 async { "ask_user is not available in this runtime mode".to_owned() }
19 }
20
21 fn dispatch_delegate(
23 &self,
24 args: &str,
25 agent: &str,
26 ) -> impl std::future::Future<Output = String> + Send {
27 let _ = (args, agent);
28 async { "delegate is not available in this runtime mode".to_owned() }
29 }
30
31 fn conversation_cwd(&self, _conversation_id: u64) -> Option<PathBuf> {
34 None
35 }
36
37 fn on_agent_event(&self, _agent: &str, _conversation_id: u64, _event: &wcore::AgentEvent) {}
40
41 fn reply_to_ask(
44 &self,
45 _session: u64,
46 _content: String,
47 ) -> impl std::future::Future<Output = anyhow::Result<bool>> + Send {
48 async { Ok(false) }
49 }
50
51 fn set_conversation_cwd(
53 &self,
54 _conversation: u64,
55 _cwd: PathBuf,
56 ) -> impl std::future::Future<Output = ()> + Send {
57 async {}
58 }
59
60 fn clear_conversation_state(
62 &self,
63 _conversation: u64,
64 ) -> impl std::future::Future<Output = ()> + Send {
65 async {}
66 }
67
68 fn subscribe_events(
71 &self,
72 ) -> Option<tokio::sync::broadcast::Receiver<wcore::protocol::message::AgentEventMsg>> {
73 None
74 }
75
76 fn dispatch_custom_tool(
79 &self,
80 name: &str,
81 _args: &str,
82 _agent: &str,
83 _conversation_id: Option<u64>,
84 ) -> impl std::future::Future<Output = String> + Send {
85 async move { format!("tool not available: {name}") }
86 }
87}
88
89#[derive(Clone)]
91pub struct NoHost;
92
93impl Host for NoHost {}