1use std::path::PathBuf;
8
9pub trait Host: Send + Sync + Clone {
11 fn dispatch_ask_user(
13 &self,
14 args: &str,
15 session_id: Option<u64>,
16 ) -> impl std::future::Future<Output = String> + Send {
17 let _ = (args, session_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 session_cwd(&self, _session_id: u64) -> Option<PathBuf> {
34 None
35 }
36
37 fn on_agent_event(&self, _agent: &str, _session_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_session_cwd(
53 &self,
54 _session: u64,
55 _cwd: PathBuf,
56 ) -> impl std::future::Future<Output = ()> + Send {
57 async {}
58 }
59
60 fn clear_session_state(&self, _session: u64) -> impl std::future::Future<Output = ()> + Send {
62 async {}
63 }
64
65 fn subscribe_events(
68 &self,
69 ) -> Option<tokio::sync::broadcast::Receiver<wcore::protocol::message::AgentEventMsg>> {
70 None
71 }
72
73 fn dispatch_custom_tool(
76 &self,
77 name: &str,
78 _args: &str,
79 _agent: &str,
80 _session_id: Option<u64>,
81 ) -> impl std::future::Future<Output = String> + Send {
82 async move { format!("tool not available: {name}") }
83 }
84}
85
86#[derive(Clone)]
88pub struct NoHost;
89
90impl Host for NoHost {}