Skip to main content

ResultMessage

Struct ResultMessage 

Source
pub struct ResultMessage {
Show 37 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 first_content_frame_ms: Option<u64>, pub first_stream_post_ms: Option<u64>, pub first_stream_post_ack_ms: Option<u64>, pub first_stream_post_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>, pub runner_exit: Option<RunnerExit>,
}
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).

§first_content_frame_ms: Option<u64>

Time until the first content frame of the stream arrived, in milliseconds (CLI 2.1.260+ timing instrumentation).

§first_stream_post_ms: Option<u64>

Time until the first stream POST was issued, in milliseconds (CLI 2.1.260+).

§first_stream_post_ack_ms: Option<u64>

Time until the first stream POST was acknowledged, in milliseconds (CLI 2.1.260+).

§first_stream_post_wall_ms: Option<f64>

Wall-clock epoch milliseconds when the first stream POST was issued (fractional; CLI 2.1.260+).

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

§runner_exit: Option<RunnerExit>

Set by the self-hosted runner on the result it synthesizes when the session process fails to start or exits abnormally. Absent on normal results and on CLIs before 2.1.266.

Trait Implementations§

Source§

impl Clone for ResultMessage

Source§

fn clone(&self) -> ResultMessage

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 ResultMessage

Source§

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

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

impl<'de> Deserialize<'de> for ResultMessage

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 Serialize for ResultMessage

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

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.