pub enum ServerEvent {
Show 26 variants
DaemonStatus {
request_id: String,
status: DaemonStatus,
},
Initialized {
request_id: String,
protocol_version: u32,
server: PeerInfo,
},
SessionStarted {
request_id: String,
session_id: String,
cwd: String,
model: String,
context_max_tokens: usize,
max_server_frame_bytes: usize,
max_transcript_bytes: usize,
max_transcript_items: usize,
max_prompt_history_bytes: usize,
max_prompt_history_items: usize,
},
QueueSnapshot {
request_id: Option<String>,
session_id: String,
seq: u64,
entries: Vec<QueueEntry>,
paused: bool,
},
QueueEnqueued {
request_id: String,
session_id: String,
seq: u64,
entry: QueueEntry,
position: usize,
},
QueueUpdated {
request_id: String,
session_id: String,
seq: u64,
entry: QueueEntry,
},
QueueMoved {
request_id: String,
session_id: String,
seq: u64,
queue_id: String,
position: usize,
revision: u64,
},
QueueRemoved {
request_id: String,
session_id: String,
seq: u64,
queue_id: String,
revision: u64,
},
QueueDequeued {
request_id: String,
session_id: String,
seq: u64,
queue_id: String,
turn_id: String,
},
SessionPaused {
request_id: String,
session_id: String,
seq: u64,
paused: bool,
},
TurnStarted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
origin: Option<TurnOrigin>,
},
AssistantDelta {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
content: String,
},
AssistantCompleted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
content: String,
},
ToolProposed {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
call_id: String,
name: String,
arguments: Value,
},
ApprovalRequested {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
approval_id: String,
call_id: String,
name: String,
risk: String,
cwd: String,
summary: String,
},
ToolStarted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
call_id: String,
name: String,
},
ToolProgress {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
call_id: String,
text: String,
},
ToolCompleted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
call_id: String,
name: String,
success: bool,
output: String,
truncated: bool,
error: Option<ToolErrorKind>,
jobs: Vec<JobChange>,
},
ContextCompacted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
before_tokens: usize,
after_tokens: usize,
removed_messages: usize,
},
SessionTrimmed {
request_id: String,
session_id: String,
seq: u64,
removed_messages: usize,
history_bytes: usize,
},
SessionCleared {
request_id: String,
session_id: String,
seq: u64,
},
TurnCompleted {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
steps: usize,
usage: Usage,
origin: Option<TurnOrigin>,
},
TurnCancelled {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
origin: Option<TurnOrigin>,
},
TurnFailed {
request_id: String,
session_id: String,
turn_id: String,
seq: u64,
code: ErrorCode,
message: String,
origin: Option<TurnOrigin>,
},
Error {
request_id: Option<String>,
code: ErrorCode,
message: String,
fatal: bool,
},
Unknown,
}Expand description
A message from server to client. Serialized as one JSON object per line,
tagged by type (such as turn.completed). Turn events carry the
session’s consecutive seq.
A type this client does not know parses as ServerEvent::Unknown, so
a newer server can add events without breaking older clients; a client
ignores them.
Variants§
DaemonStatus
The answer to a daemon.control status request.
Fields
status: DaemonStatusThe daemon’s state.
Initialized
The answer to initialize.
Fields
protocol_version: u32The PROTOCOL_VERSION the server speaks.
SessionStarted
The answer to session.start, with the limits the client should use.
Fields
QueueSnapshot
The whole queue, sent when a session starts or on request.
Fields
entries: Vec<QueueEntry>Queued prompts in the order they will run.
QueueEnqueued
A prompt was queued behind the running turn.
Fields
entry: QueueEntryThe queued prompt.
QueueUpdated
A queued prompt’s text changed.
Fields
entry: QueueEntryThe queued prompt.
QueueMoved
A queued prompt moved.
Fields
QueueRemoved
A queued prompt was dropped.
Fields
QueueDequeued
A queued prompt left the queue to run as a turn.
Fields
SessionPaused
The queue was held or released.
Fields
TurnStarted
A turn began.
Fields
origin: Option<TurnOrigin>Set when the server started this turn itself, such as to report
finished background work; absent for a client’s own turn.start.
AssistantDelta
Answer text as it streams.
Fields
AssistantCompleted
The model’s complete answer for one step.
Fields
ToolProposed
The model asked to call a tool.
Fields
ApprovalRequested
A tool call waits for a person’s decision.
Fields
ToolStarted
An approved tool call began running.
Fields
ToolProgress
Short status lines from a running tool, at most two events a second per call and 512 bytes each. Display only; not part of the history.
Fields
ToolCompleted
A tool call finished; its output goes to the model.
Fields
error: Option<ToolErrorKind>Why the call failed; absent when it succeeded, and from servers before 0.3.0.
ContextCompacted
Older history was summarized to fit the model’s context window.
Fields
SessionTrimmed
Old turns were removed to keep the session within its history limits.
Fields
SessionCleared
The session’s history and queue were cleared.
Fields
TurnCompleted
A turn finished.
Fields
origin: Option<TurnOrigin>Set when the server started this turn itself, such as to report
finished background work; absent for a client’s own turn.start.
TurnCancelled
A turn was cancelled; its history changes were rolled back.
Fields
origin: Option<TurnOrigin>Set when the server started this turn itself, such as to report
finished background work; absent for a client’s own turn.start.
TurnFailed
A turn failed; its history changes were rolled back.
Fields
origin: Option<TurnOrigin>Set when the server started this turn itself, such as to report
finished background work; absent for a client’s own turn.start.
Error
A request failed, or a connection-level error.
Fields
Unknown
An event this client does not know, from a newer server. Never sent.
Implementations§
Source§impl ServerEvent
impl ServerEvent
Sourcepub fn turn_request_id(&self) -> Option<&str>
pub fn turn_request_id(&self) -> Option<&str>
The submitting request of a turn-scoped event, which identifies the turn to a client that has several turns’ events interleaved.