Skip to main content

ClientMessage

Enum ClientMessage 

Source
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>,
        chat: Option<ChatLog>,
    },
    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

§request_id: String

Chosen by the client; the events that answer this message carry it.

§command: DaemonCommand

What to do.

§

Initialize

The first message on every connection.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§protocol_version: u32

The PROTOCOL_VERSION the client speaks.

§client: PeerInfo

Who is connecting.

§

SessionStart

Start a session in a workspace. Each connection has at most one.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§cwd: String

The workspace directory.

§provider: Option<String>

Provider profile to use instead of the configured default.

§model: Option<String>

Model to use instead of the configured default.

§base_url: Option<String>

Provider endpoint to use instead of the configured one.

§no_tools: Option<bool>

Start the session without tools.

§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.

§auto_approve: Option<bool>

The client approves every approval request of this session without asking anyone. Background jobs, which outlive the turn that could carry their requests, then get the same answer; otherwise they get only what the approval policy grants unasked.

§chat: Option<ChatLog>

The chat log of the conversation this session answers: the server starts the session with the log’s open episode and, with tools, lets the model search the rest. A chat client sends it for its account owner’s direct chat.

§

SessionAttach

Attach to an existing session. Not supported: sessions belong to the connection that started them.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§cwd: String

The workspace directory.

§

TurnStart

Send a prompt. It starts a turn at once, or queues behind the running one.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§prompt: String

The user’s text.

§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

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§queue_id: String

The queued prompt.

§revision: u64

The entry’s current revision; a stale one is refused.

§prompt: String

The user’s text.

§

QueueMove

Reorder a queued prompt.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§queue_id: String

The queued prompt.

§revision: u64

The entry’s current revision; a stale one is refused.

§before_queue_id: Option<String>

Move before this entry; None moves it to the end.

§

QueueRemove

Drop a queued prompt.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§queue_id: String

The queued prompt.

§revision: u64

The entry’s current revision; a stale one is refused.

§

SessionPause

Hold or release the queue; a running turn is not affected.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§paused: bool

Whether queued prompts wait instead of starting.

§

TurnCancel

Stop the running turn.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§turn_id: String

The turn to cancel.

§

ApprovalResolve

Answer an approval.requested event.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

§approval_id: String

The approval request being answered.

§approved: bool

Whether the call may run.

§

SessionClear

Forget the session’s history and queue.

Fields

§request_id: String

Chosen by the client; the events that answer this message carry it.

§session_id: String

The session, as session.started named it.

Implementations§

Source§

impl ClientMessage

Source

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.

Source

pub fn request_id(&self) -> &str

The client-chosen ID that answering events carry.

Trait Implementations§

Source§

impl Clone for ClientMessage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ClientMessage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ClientMessage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ClientMessage

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ClientMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.