pub enum ClientMessage {
DaemonControl {
request_id: String,
command: DaemonCommand,
},
Initialize {
request_id: String,
protocol_version: u32,
client: PeerInfo,
},
SessionStart {
request_id: String,
cwd: String,
provider: Option<String>,
model: Option<String>,
base_url: Option<String>,
no_tools: Option<bool>,
delegation_depth: Option<u32>,
channel: Option<String>,
auto_approve: Option<bool>,
},
SessionAttach {
request_id: String,
session_id: String,
cwd: String,
},
TurnStart {
request_id: String,
session_id: String,
prompt: String,
attachments: Vec<Attachment>,
},
QueueUpdate {
request_id: String,
session_id: String,
queue_id: String,
revision: u64,
prompt: String,
},
QueueMove {
request_id: String,
session_id: String,
queue_id: String,
revision: u64,
before_queue_id: Option<String>,
},
QueueRemove {
request_id: String,
session_id: String,
queue_id: String,
revision: u64,
},
SessionPause {
request_id: String,
session_id: String,
paused: bool,
},
TurnCancel {
request_id: String,
session_id: String,
turn_id: String,
},
ApprovalResolve {
request_id: String,
session_id: String,
approval_id: String,
approved: bool,
},
SessionClear {
request_id: String,
session_id: String,
},
}Expand description
A message from client to server. Serialized as one JSON object per line,
tagged by type (such as turn.start).
Variants§
DaemonControl
Control the daemon itself (status, reload, channels, delegations, restarts). Only the daemon socket accepts it.
Fields
command: DaemonCommandWhat to do.
Initialize
The first message on every connection.
Fields
protocol_version: u32The PROTOCOL_VERSION the client speaks.
SessionStart
Start a session in a workspace. Each connection has at most one.
Fields
delegation_depth: Option<u32>Delegation depth of the client, when it is itself a delegated agent (such as a nested SCV). Tools started from the session count from it, so the depth limit holds across processes.
channel: Option<String>The chat channel this session answers on, as its users name it
(such as WeChat or Feishu). The user reads short plain-text
replies there and never sees tool calls, so the server tells the
model; a chat client also delivers files the model attaches to
its reply, so a session with tools offers CHAT_ATTACH_TOOL.
At most MAX_CHANNEL_NAME_BYTES, without control characters.
SessionAttach
Attach to an existing session. Not supported: sessions belong to the connection that started them.
Fields
TurnStart
Send a prompt. It starts a turn at once, or queues behind the running one.
Fields
attachments: Vec<Attachment>Files that come with the prompt, at most MAX_TURN_ATTACHMENTS.
The server lists them for the model and shows it images directly
when the model accepts image input.
QueueUpdate
Replace the text of a queued prompt.
Fields
QueueMove
Reorder a queued prompt.
Fields
QueueRemove
Drop a queued prompt.
Fields
SessionPause
Hold or release the queue; a running turn is not affected.
Fields
TurnCancel
Stop the running turn.
Fields
ApprovalResolve
Answer an approval.requested event.
Fields
SessionClear
Forget the session’s history and queue.
Implementations§
Source§impl ClientMessage
impl ClientMessage
Sourcepub fn initialize(
request_id: impl Into<String>,
client_name: impl Into<String>,
) -> Self
pub fn initialize( request_id: impl Into<String>, client_name: impl Into<String>, ) -> Self
The initialize request every client sends first, declaring this
release’s PROTOCOL_VERSION.
Sourcepub fn request_id(&self) -> &str
pub fn request_id(&self) -> &str
The client-chosen ID that answering events carry.