pub trait Client: Send {
Show 16 methods
// Required methods
fn request(
&mut self,
msg: ClientMessage,
) -> impl Future<Output = Result<ServerMessage>> + Send;
fn request_stream(
&mut self,
msg: ClientMessage,
) -> impl Stream<Item = Result<ServerMessage>> + Send + '_;
// Provided methods
fn send(
&mut self,
req: SendRequest,
) -> impl Future<Output = Result<SendResponse>> + Send { ... }
fn stream(
&mut self,
req: StreamRequest,
) -> impl Stream<Item = Result<StreamEvent>> + Send + '_ { ... }
fn clear_session(
&mut self,
req: ClearSessionRequest,
) -> impl Future<Output = Result<SessionCleared>> + Send { ... }
fn list_agents(&mut self) -> impl Future<Output = Result<AgentList>> + Send { ... }
fn agent_info(
&mut self,
req: AgentInfoRequest,
) -> impl Future<Output = Result<AgentDetail>> + Send { ... }
fn list_memory(&mut self) -> impl Future<Output = Result<MemoryList>> + Send { ... }
fn get_memory(
&mut self,
req: GetMemoryRequest,
) -> impl Future<Output = Result<MemoryEntry>> + Send { ... }
fn download(
&mut self,
req: DownloadRequest,
) -> impl Stream<Item = Result<DownloadEvent>> + Send + '_ { ... }
fn reload_skills(
&mut self,
) -> impl Future<Output = Result<SkillsReloaded>> + Send { ... }
fn mcp_add(
&mut self,
req: McpAddRequest,
) -> impl Future<Output = Result<McpAdded>> + Send { ... }
fn mcp_remove(
&mut self,
req: McpRemoveRequest,
) -> impl Future<Output = Result<McpRemoved>> + Send { ... }
fn mcp_reload(&mut self) -> impl Future<Output = Result<McpReloaded>> + Send { ... }
fn mcp_list(&mut self) -> impl Future<Output = Result<McpServerList>> + Send { ... }
fn ping(&mut self) -> impl Future<Output = Result<()>> + Send { ... }
}Expand description
Client-side protocol interface.
Implementors provide two transport primitives — request
for request-response and request_stream for
streaming operations. All typed methods are provided defaults that delegate
to these primitives.
Required Methods§
Sourcefn request(
&mut self,
msg: ClientMessage,
) -> impl Future<Output = Result<ServerMessage>> + Send
fn request( &mut self, msg: ClientMessage, ) -> impl Future<Output = Result<ServerMessage>> + Send
Send a ClientMessage and receive a single ServerMessage.
Sourcefn request_stream(
&mut self,
msg: ClientMessage,
) -> impl Stream<Item = Result<ServerMessage>> + Send + '_
fn request_stream( &mut self, msg: ClientMessage, ) -> impl Stream<Item = Result<ServerMessage>> + Send + '_
Send a ClientMessage and receive a stream of ServerMessages.
This is a raw transport primitive — the stream reads indefinitely.
Callers must detect the terminal sentinel (e.g. StreamEnd,
DownloadEnd) and stop consuming. The typed streaming methods
handle this automatically.
Provided Methods§
Sourcefn send(
&mut self,
req: SendRequest,
) -> impl Future<Output = Result<SendResponse>> + Send
fn send( &mut self, req: SendRequest, ) -> impl Future<Output = Result<SendResponse>> + Send
Send a message to an agent and receive a complete response.
Sourcefn stream(
&mut self,
req: StreamRequest,
) -> impl Stream<Item = Result<StreamEvent>> + Send + '_
fn stream( &mut self, req: StreamRequest, ) -> impl Stream<Item = Result<StreamEvent>> + Send + '_
Send a message to an agent and receive a streamed response.
Sourcefn clear_session(
&mut self,
req: ClearSessionRequest,
) -> impl Future<Output = Result<SessionCleared>> + Send
fn clear_session( &mut self, req: ClearSessionRequest, ) -> impl Future<Output = Result<SessionCleared>> + Send
Clear the session history for an agent.
Sourcefn list_agents(&mut self) -> impl Future<Output = Result<AgentList>> + Send
fn list_agents(&mut self) -> impl Future<Output = Result<AgentList>> + Send
List all registered agents.
Sourcefn agent_info(
&mut self,
req: AgentInfoRequest,
) -> impl Future<Output = Result<AgentDetail>> + Send
fn agent_info( &mut self, req: AgentInfoRequest, ) -> impl Future<Output = Result<AgentDetail>> + Send
Get detailed info for a specific agent.
Sourcefn list_memory(&mut self) -> impl Future<Output = Result<MemoryList>> + Send
fn list_memory(&mut self) -> impl Future<Output = Result<MemoryList>> + Send
List all memory entries.
Sourcefn get_memory(
&mut self,
req: GetMemoryRequest,
) -> impl Future<Output = Result<MemoryEntry>> + Send
fn get_memory( &mut self, req: GetMemoryRequest, ) -> impl Future<Output = Result<MemoryEntry>> + Send
Get a specific memory entry by key.
Sourcefn download(
&mut self,
req: DownloadRequest,
) -> impl Stream<Item = Result<DownloadEvent>> + Send + '_
fn download( &mut self, req: DownloadRequest, ) -> impl Stream<Item = Result<DownloadEvent>> + Send + '_
Download a model’s files with progress reporting.
Sourcefn reload_skills(
&mut self,
) -> impl Future<Output = Result<SkillsReloaded>> + Send
fn reload_skills( &mut self, ) -> impl Future<Output = Result<SkillsReloaded>> + Send
Reload skills from disk.
Sourcefn mcp_add(
&mut self,
req: McpAddRequest,
) -> impl Future<Output = Result<McpAdded>> + Send
fn mcp_add( &mut self, req: McpAddRequest, ) -> impl Future<Output = Result<McpAdded>> + Send
Add an MCP server.
Sourcefn mcp_remove(
&mut self,
req: McpRemoveRequest,
) -> impl Future<Output = Result<McpRemoved>> + Send
fn mcp_remove( &mut self, req: McpRemoveRequest, ) -> impl Future<Output = Result<McpRemoved>> + Send
Remove an MCP server.
Sourcefn mcp_reload(&mut self) -> impl Future<Output = Result<McpReloaded>> + Send
fn mcp_reload(&mut self) -> impl Future<Output = Result<McpReloaded>> + Send
Reload MCP servers from config.
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.