pub struct ResultMessage {Show 19 fields
pub subtype: String,
pub is_error: bool,
pub result: Option<String>,
pub errors: Option<Vec<Value>>,
pub session_id: Option<String>,
pub total_cost_usd: Option<f64>,
pub ttft_ms: Option<u64>,
pub duration_ms: Option<u64>,
pub usage: Option<UsageSummary>,
pub stop_reason: Option<String>,
pub duration_api_ms: Option<u64>,
pub num_turns: Option<u64>,
pub terminal_reason: Option<String>,
pub structured_output: Option<Value>,
pub permission_denials: Vec<Value>,
pub model_usage: Option<Value>,
pub user_message_uuids: Vec<String>,
pub origin: Option<Value>,
pub extra: HashMap<String, Value>,
}Expand description
Turn complete. Source: chunk-20bv8pca.js:14425–14913
Fields§
§subtype: String“success” | “error_*”. A failed API call still comes as “success”
with is_error: true and the message in result.
is_error: bool§result: Option<String>Final text of the turn, or the error message when is_error.
errors: Option<Vec<Value>>Error details of error_* subtypes.
session_id: Option<String>§total_cost_usd: Option<f64>§ttft_ms: Option<u64>§duration_ms: Option<u64>§usage: Option<UsageSummary>§stop_reason: Option<String>§duration_api_ms: Option<u64>§num_turns: Option<u64>§terminal_reason: Option<String>Why the loop ended (“completed”, …).
structured_output: Option<Value>Output matching Initialize::json_schema.
permission_denials: Vec<Value>Tool calls the permission system denied during the turn.
model_usage: Option<Value>Per-model token and cost breakdown.
user_message_uuids: Vec<String>The prompts (UserMessage::uuid) this turn answered.
origin: Option<Value>Set when the CLI started the turn itself (e.g. {"kind":"task-notification"}
after a background task finished); absent for turns the host prompted.
extra: HashMap<String, Value>Implementations§
Source§impl ResultMessage
impl ResultMessage
pub fn is_success(&self) -> bool
Sourcepub fn answers(&self, uuid: &str) -> bool
pub fn answers(&self, uuid: &str) -> bool
Whether this turn answered the prompt uuid. A prompt the CLI
refuses up front (e.g. budget spent) gets a result but no echo.
Sourcepub fn error_kind(&self) -> TurnErrorKind
pub fn error_kind(&self) -> TurnErrorKind
Category of a failed turn.
Sourcepub fn error_message(&self) -> String
pub fn error_message(&self) -> String
Why the turn failed: for is_error the CLI’s message; for
error_* subtypes the subtype, then its errors details.