pub enum ServerMessage {
Show 14 variants
Thinking {
content: String,
},
Text {
content: String,
},
ToolUseStart {
tool_name: String,
},
ToolUseDelta(String),
ToolUse {
tool_name: String,
tool_id: String,
input: Value,
},
ToolResult {
tool_id: String,
result: String,
},
ToolResultDelta {
tool_id: String,
delta: String,
},
Usage {
input_tokens: u64,
output_tokens: u64,
cache_creation_5m: Option<u64>,
cache_creation_1h: Option<u64>,
},
Done,
Notice {
text: String,
},
Error {
message: String,
},
System {
message: String,
},
HistoryResponse {
messages: Vec<HistoryEntry>,
},
StatusResponse {
model: String,
thinking: String,
streaming: bool,
session_id: String,
total_input_tokens: u64,
total_output_tokens: u64,
session_cost: f64,
connected_clients: usize,
},
}Expand description
Messages sent from server → client
Variants§
Thinking
Thinking tokens (streamed incrementally)
Text
Text tokens (streamed incrementally)
ToolUseStart
A tool is ABOUT to be invoked (streaming JSON args)
ToolUseDelta(String)
Streaming chunk of the tool’s JSON arguments
ToolUse
A tool was invoked (JSON finished)
ToolResult
Tool execution result
ToolResultDelta
Tool execution incremental delta
Usage
Token usage update
Fields
Done
Streaming complete for this turn
Notice
Out-of-band advisory notice (e.g. cache-TTL downgrade warning). Additive variant — old clients ignore unknown message types.
Error
Error occurred
System
System/info message (command responses, status)
HistoryResponse
Full conversation history (response to History request)
Fields
§
messages: Vec<HistoryEntry>StatusResponse
Server status
Trait Implementations§
Source§impl Clone for ServerMessage
impl Clone for ServerMessage
Source§fn clone(&self) -> ServerMessage
fn clone(&self) -> ServerMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerMessage
impl Debug for ServerMessage
Source§impl<'de> Deserialize<'de> for ServerMessage
impl<'de> Deserialize<'de> for ServerMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ServerMessage
impl RefUnwindSafe for ServerMessage
impl Send for ServerMessage
impl Sync for ServerMessage
impl Unpin for ServerMessage
impl UnsafeUnpin for ServerMessage
impl UnwindSafe for ServerMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more