ClaudeCode.Message.Result (ClaudeCode v0.1.0)
View SourceRepresents a result message from the Claude CLI.
Result messages are the final message in a conversation, containing the final response, timing information, token usage, and cost.
Matches the official SDK schema for successful results:
{
type: "result",
subtype: "success",
duration_ms: float,
duration_api_ms: float,
is_error: boolean,
num_turns: int,
result: string,
session_id: string,
total_cost_usd: float
}
And for error results:
{
type: "result",
subtype: "error_max_turns" | "error_during_execution",
duration_ms: float,
duration_api_ms: float,
is_error: boolean,
num_turns: int,
session_id: string,
total_cost_usd: float
}
Summary
Functions
Creates a new Result message from JSON data.
Type guard to check if a value is a Result message.
Types
@type t() :: %ClaudeCode.Message.Result{ duration_api_ms: float(), duration_ms: float(), is_error: boolean(), num_turns: non_neg_integer(), result: String.t(), session_id: ClaudeCode.Types.session_id(), subtype: ClaudeCode.Types.result_subtype(), total_cost_usd: float(), type: :result, usage: ClaudeCode.Types.usage() }