pub enum ServerMessage {
Show 15 variants
Ack(AckPayload),
RunEvent(RunEventPayload),
RunLog(RunLogPayload),
Assistant(AssistantPayload),
Thinking(ThinkingPayload),
ToolUse(ToolUsePayload),
ToolResult(ToolResultPayload),
Cost(CostPayload),
Status(StatusPayload),
Error(ErrorPayload),
McpNotification(McpNotificationPayload),
Skill(SkillPayload),
Evolution(EvolutionPayload),
Injected(InjectedPayload),
Retry(RetryPayload),
}Expand description
Outgoing message from server to client.
Tagged by "type" — each variant carries only its own typed fields.
Variants§
Ack(AckPayload)
Immediate acknowledgement that a valid client input frame was received.
RunEvent(RunEventPayload)
RunLog(RunLogPayload)
Assistant(AssistantPayload)
AI assistant response text
Thinking(ThinkingPayload)
AI thinking/reasoning content (separate from assistant response)
ToolUse(ToolUsePayload)
Tool execution notification (AI intends to use tool)
ToolResult(ToolResultPayload)
Tool execution result (after execution)
Cost(CostPayload)
Cost and token usage information
Status(StatusPayload)
Status/info message (non-critical)
Error(ErrorPayload)
Error message
McpNotification(McpNotificationPayload)
Notification received from an MCP server (e.g. progress, log messages)
Skill(SkillPayload)
Skill lifecycle event (activate / use / forget) — emitted for structured output
Evolution(EvolutionPayload)
Generated behavior lifecycle event (candidate / trial / promote / rollback).
Injected(InjectedPayload)
A message injected into the session loop by a non-user source (scheduled timer, background agent, skill, …). Emitted just before the AI processes it so clients can render the trigger.
Retry(RetryPayload)
A provider call is being retried after a transient failure. Mid-turn
progress, never a turn boundary (see RetryPayload).
Implementations§
Source§impl ServerMessage
impl ServerMessage
pub fn error(message: String) -> Self
pub fn error_for_request(message: String, request_id: Option<String>) -> Self
pub fn ack(client_msg: &ClientMessage) -> Self
pub fn status(message: String, session_id: Option<String>) -> Self
Sourcepub fn command_status(
message: String,
session_id: Option<String>,
data: Value,
) -> Self
pub fn command_status( message: String, session_id: Option<String>, data: Value, ) -> Self
A command-completion status. Unlike status() (which is also used for the
connection handshake), this carries data — clients distinguish a finished
command from a data-less handshake ack purely by the presence of data. Without
it, an interactive /done (and any plain Handled command) is misread as the
handshake and the client hangs on “working” because the turn never finalizes.
pub fn skill( action: impl Into<String>, name: impl Into<String>, trigger: Option<String>, session_id: impl Into<String>, ) -> Self
pub fn evolution( action: impl Into<String>, id: impl Into<String>, name: impl Into<String>, kind: impl Into<String>, state: impl Into<String>, scope: Value, session_id: impl Into<String>, ) -> Self
Sourcepub fn retry(event: &RetryEvent, session_id: Option<String>) -> Self
pub fn retry(event: &RetryEvent, session_id: Option<String>) -> Self
The notice for one provider retry (see RetryPayload).
Trait Implementations§
Source§impl Clone for ServerMessage
impl Clone for ServerMessage
Source§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>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more