pub struct ResultMessage {Show 32 fields
pub subtype: ResultSubtype,
pub is_error: bool,
pub duration_ms: u64,
pub duration_api_ms: u64,
pub ttft_ms: Option<u64>,
pub ttft_stream_ms: Option<u64>,
pub time_to_request_ms: Option<u64>,
pub time_to_request_from_spawn_ms: Option<u64>,
pub warm_spare_claimed: Option<bool>,
pub time_origin_ms: Option<u64>,
pub request_sent_wall_ms: Option<f64>,
pub user_message_uuid: Option<String>,
pub user_message_uuids: Vec<String>,
pub queued_turn_count: Option<u64>,
pub num_turns: i32,
pub result: Option<String>,
pub session_id: String,
pub total_cost_usd: f64,
pub usage: Option<UsageInfo>,
pub permission_denials: Vec<PermissionDenial>,
pub errors: Vec<String>,
pub uuid: Option<String>,
pub api_error_status: Option<u16>,
pub stop_reason: Option<String>,
pub terminal_reason: Option<String>,
pub fast_mode_state: Option<String>,
pub fast_mode_disabled_reason: Option<FastModeDisabledReason>,
pub model_usage: Option<BTreeMap<String, ModelUsageEntry>>,
pub subagent_stats: Option<SubagentStats>,
pub structured_output: Option<Value>,
pub deferred_tool_use: Option<DeferredToolUse>,
pub origin: Option<MessageOrigin>,
}Expand description
Result message for completed queries
Fields§
§subtype: ResultSubtype§is_error: bool§duration_ms: u64§duration_api_ms: u64§ttft_ms: Option<u64>Time to first token, in milliseconds.
ttft_stream_ms: Option<u64>Time to first streamed token, in milliseconds.
time_to_request_ms: Option<u64>Time from session start until the first request was issued, in milliseconds.
time_to_request_from_spawn_ms: Option<u64>Time from spawning a worker/spare until the first request was issued, in milliseconds.
warm_spare_claimed: Option<bool>Whether a warm spare process was claimed for this request.
time_origin_ms: Option<u64>Epoch-ish timestamp origin used by CLI timing instrumentation.
request_sent_wall_ms: Option<f64>Wall-clock epoch milliseconds when the API request was sent (fractional; from CLI timing instrumentation).
user_message_uuid: Option<String>Wire uuid of the user message this result answers.
user_message_uuids: Vec<String>Client uuids of every user message whose prompt this turn consumed, in
consumption order — all members of a prompt batch the host merged into
this one turn, plus any queued user message folded into the running
turn between tool rounds. Always contains user_message_uuid; at most
64 entries. Absent on delivery-failure/zeroed results and from CLIs
before 2.1.259 (fall back to user_message_uuid).
queued_turn_count: Option<u64>User-initiated sends still waiting in the command queue when this result was produced. Greater than 0 means at least one more user turn follows without further input, barring cancellation. Absent on fatal startup results, on surfaces without a command queue, and from CLIs before 2.1.259.
num_turns: i32§result: Option<String>§session_id: String§total_cost_usd: f64§usage: Option<UsageInfo>§permission_denials: Vec<PermissionDenial>Tools that were blocked due to permission denials during the session
errors: Vec<String>Error messages when is_error is true.
Contains human-readable error strings (e.g., “No conversation found with session ID: …”). This allows typed access to error conditions without needing to serialize to JSON and search.
uuid: Option<String>§api_error_status: Option<u16>HTTP status code when the result is an API error (e.g., 429, 500, 529)
stop_reason: Option<String>Why generation stopped (e.g., end_turn, max_tokens)
terminal_reason: Option<String>Why the session ended (e.g., “completed”)
fast_mode_state: Option<String>Fast mode toggle state (e.g., “off”)
fast_mode_disabled_reason: Option<FastModeDisabledReason>Why fast mode can’t serve right now. Absent when nothing blocks it.
A paused-after-rate-limit run is not reported here; it rides
fast_mode_state as "cooldown".
model_usage: Option<BTreeMap<String, ModelUsageEntry>>Per-model cost breakdown, keyed by model name (e.g. "claude-opus-4-8").
subagent_stats: Option<SubagentStats>Subagents started through the Agent tool in this session, as running
totals. Cumulative like modelUsage: read the latest result rather
than summing across results. Absent from CLIs before 2.1.239.
structured_output: Option<Value>Structured-output payload returned by the model, when enabled.
deferred_tool_use: Option<DeferredToolUse>Deferred tool-use termination payload.
origin: Option<MessageOrigin>Provenance of the message/run.
Trait Implementations§
Source§impl Clone for ResultMessage
impl Clone for ResultMessage
Source§fn clone(&self) -> ResultMessage
fn clone(&self) -> ResultMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more