walrus_protocol/message/client.rs
1//! Messages sent by the client to the gateway.
2
3use compact_str::CompactString;
4use serde::{Deserialize, Serialize};
5use std::collections::BTreeMap;
6
7/// Messages sent by the client to the gateway.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(tag = "type", rename_all = "snake_case")]
10pub enum ClientMessage {
11 /// Send a message to an agent and receive a complete response.
12 Send {
13 /// Target agent identifier.
14 agent: CompactString,
15 /// Message content.
16 content: String,
17 },
18 /// Send a message to an agent and receive a streamed response.
19 Stream {
20 /// Target agent identifier.
21 agent: CompactString,
22 /// Message content.
23 content: String,
24 },
25 /// Clear the session history for an agent.
26 ClearSession {
27 /// Target agent identifier.
28 agent: CompactString,
29 },
30 /// List all registered agents.
31 ListAgents,
32 /// Get detailed info for a specific agent.
33 AgentInfo {
34 /// Agent name.
35 agent: CompactString,
36 },
37 /// List all memory entries.
38 ListMemory,
39 /// Get a specific memory entry by key.
40 GetMemory {
41 /// Memory key.
42 key: String,
43 },
44 /// Request download of a model's files with progress reporting.
45 Download {
46 /// HuggingFace model ID (e.g. "microsoft/Phi-3.5-mini-instruct").
47 model: CompactString,
48 },
49 /// Reload skills from disk.
50 ReloadSkills,
51 /// Add an MCP server to config and reload.
52 McpAdd {
53 /// Server name.
54 name: CompactString,
55 /// Command to spawn.
56 command: String,
57 /// Command arguments.
58 #[serde(default)]
59 args: Vec<String>,
60 /// Environment variables.
61 #[serde(default)]
62 env: BTreeMap<String, String>,
63 },
64 /// Remove an MCP server from config and reload.
65 McpRemove {
66 /// Server name to remove.
67 name: CompactString,
68 },
69 /// Reload MCP servers from walrus.toml.
70 McpReload,
71 /// List connected MCP servers and their tools.
72 McpList,
73 /// Ping the server (keepalive).
74 Ping,
75}