pub trait Server: Sync {
Show 21 methods
// Required methods
fn send(
&self,
req: SendMsg,
) -> impl Future<Output = Result<SendResponse>> + Send;
fn stream(
&self,
req: StreamMsg,
) -> impl Stream<Item = Result<StreamEvent>> + Send;
fn ping(&self) -> impl Future<Output = Result<()>> + Send;
fn hub(
&self,
package: String,
action: HubAction,
filters: Vec<String>,
) -> impl Stream<Item = Result<DownloadEvent>> + Send;
fn list_sessions(
&self,
) -> impl Future<Output = Result<Vec<SessionInfo>>> + Send;
fn kill_session(
&self,
session: u64,
) -> impl Future<Output = Result<bool>> + Send;
fn list_tasks(&self) -> impl Future<Output = Result<Vec<TaskInfo>>> + Send;
fn kill_task(
&self,
task_id: u64,
) -> impl Future<Output = Result<bool>> + Send;
fn approve_task(
&self,
task_id: u64,
response: String,
) -> impl Future<Output = Result<bool>> + Send;
fn subscribe_tasks(&self) -> impl Stream<Item = Result<TaskEvent>> + Send;
fn list_downloads(
&self,
) -> impl Future<Output = Result<Vec<DownloadInfo>>> + Send;
fn subscribe_downloads(
&self,
) -> impl Stream<Item = Result<DownloadEvent>> + Send;
fn get_config(&self) -> impl Future<Output = Result<String>> + Send;
fn set_config(
&self,
config: String,
) -> impl Future<Output = Result<()>> + Send;
fn service_query(
&self,
service: String,
query: String,
) -> impl Future<Output = Result<String>> + Send;
fn get_service_schema(
&self,
service: String,
) -> impl Future<Output = Result<String>> + Send;
fn get_all_schemas(
&self,
) -> impl Future<Output = Result<HashMap<String, String>>> + Send;
fn list_services(
&self,
) -> impl Future<Output = Result<Vec<ServiceInfoMsg>>> + Send;
fn set_service_config(
&self,
service: String,
config: String,
) -> impl Future<Output = Result<()>> + Send;
fn reload(&self) -> impl Future<Output = Result<()>> + Send;
// Provided method
fn dispatch(
&self,
msg: ClientMessage,
) -> impl Stream<Item = ServerMessage> + Send + '_ { ... }
}Expand description
Server-side protocol handler.
Each method corresponds to one ClientMessage variant. Implementations
receive typed request structs and return typed responses — no enum matching
required. Streaming operations return impl Stream.
The provided dispatch method routes a raw
ClientMessage to the appropriate handler, returning a stream of
ServerMessages.
Required Methods§
Sourcefn send(
&self,
req: SendMsg,
) -> impl Future<Output = Result<SendResponse>> + Send
fn send( &self, req: SendMsg, ) -> impl Future<Output = Result<SendResponse>> + Send
Handle Send — run agent and return complete response.
Sourcefn stream(
&self,
req: StreamMsg,
) -> impl Stream<Item = Result<StreamEvent>> + Send
fn stream( &self, req: StreamMsg, ) -> impl Stream<Item = Result<StreamEvent>> + Send
Handle Stream — run agent and stream response events.
Sourcefn hub(
&self,
package: String,
action: HubAction,
filters: Vec<String>,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn hub( &self, package: String, action: HubAction, filters: Vec<String>, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
Handle Hub — install or uninstall a hub package.
filters restricts which components to install. Format: "kind:name"
(e.g. "skill:playwright-cli", "mcp:playwright"). Empty = install all.
Sourcefn list_sessions(&self) -> impl Future<Output = Result<Vec<SessionInfo>>> + Send
fn list_sessions(&self) -> impl Future<Output = Result<Vec<SessionInfo>>> + Send
Handle Sessions — list active sessions.
Sourcefn kill_session(
&self,
session: u64,
) -> impl Future<Output = Result<bool>> + Send
fn kill_session( &self, session: u64, ) -> impl Future<Output = Result<bool>> + Send
Handle Kill — close a session by ID.
Sourcefn list_tasks(&self) -> impl Future<Output = Result<Vec<TaskInfo>>> + Send
fn list_tasks(&self) -> impl Future<Output = Result<Vec<TaskInfo>>> + Send
Handle Tasks — list tasks in the task registry.
Sourcefn kill_task(&self, task_id: u64) -> impl Future<Output = Result<bool>> + Send
fn kill_task(&self, task_id: u64) -> impl Future<Output = Result<bool>> + Send
Handle KillTask — cancel a task by ID.
Sourcefn approve_task(
&self,
task_id: u64,
response: String,
) -> impl Future<Output = Result<bool>> + Send
fn approve_task( &self, task_id: u64, response: String, ) -> impl Future<Output = Result<bool>> + Send
Handle Approve — approve a blocked task’s inbox item.
Sourcefn subscribe_tasks(&self) -> impl Stream<Item = Result<TaskEvent>> + Send
fn subscribe_tasks(&self) -> impl Stream<Item = Result<TaskEvent>> + Send
Handle SubscribeTasks — stream task lifecycle events.
Sourcefn list_downloads(
&self,
) -> impl Future<Output = Result<Vec<DownloadInfo>>> + Send
fn list_downloads( &self, ) -> impl Future<Output = Result<Vec<DownloadInfo>>> + Send
Handle Downloads — list downloads in the registry.
Sourcefn subscribe_downloads(
&self,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn subscribe_downloads( &self, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
Handle SubscribeDownloads — stream download lifecycle events.
Sourcefn get_config(&self) -> impl Future<Output = Result<String>> + Send
fn get_config(&self) -> impl Future<Output = Result<String>> + Send
Handle GetConfig — return the full daemon config as JSON.
Sourcefn set_config(&self, config: String) -> impl Future<Output = Result<()>> + Send
fn set_config(&self, config: String) -> impl Future<Output = Result<()>> + Send
Handle SetConfig — replace the daemon config from JSON.
Sourcefn service_query(
&self,
service: String,
query: String,
) -> impl Future<Output = Result<String>> + Send
fn service_query( &self, service: String, query: String, ) -> impl Future<Output = Result<String>> + Send
Handle ServiceQuery — route to a named service.
Sourcefn get_service_schema(
&self,
service: String,
) -> impl Future<Output = Result<String>> + Send
fn get_service_schema( &self, service: String, ) -> impl Future<Output = Result<String>> + Send
Handle GetServiceSchema — return JSON Schema for one service’s config.
Sourcefn get_all_schemas(
&self,
) -> impl Future<Output = Result<HashMap<String, String>>> + Send
fn get_all_schemas( &self, ) -> impl Future<Output = Result<HashMap<String, String>>> + Send
Handle GetAllSchemas — return JSON Schemas for all services.
Sourcefn list_services(
&self,
) -> impl Future<Output = Result<Vec<ServiceInfoMsg>>> + Send
fn list_services( &self, ) -> impl Future<Output = Result<Vec<ServiceInfoMsg>>> + Send
Handle GetServices — list registered services with status.
Provided Methods§
Sourcefn dispatch(
&self,
msg: ClientMessage,
) -> impl Stream<Item = ServerMessage> + Send + '_
fn dispatch( &self, msg: ClientMessage, ) -> impl Stream<Item = ServerMessage> + Send + '_
Dispatch a ClientMessage to the appropriate handler method.
Returns a stream of ServerMessages. Request-response operations
yield exactly one message; streaming operations yield many.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.