Skip to main content

Module io

Module io 

Source
Expand description

Core message types for Claude communication.

This module defines the primary message structures used in the Claude protocol:

§Message Flow

  1. Create a ClaudeInput with your query
  2. Send it to Claude via a client
  3. Receive ClaudeOutput messages in response
  4. Handle different output types (System, Assistant, Result)

§Example

use claude_codes::{ClaudeInput, ClaudeOutput};

// Create an input message
let input = ClaudeInput::user_message("Hello, Claude!", uuid::Uuid::new_v4());

// Parse an output message
let json = r#"{"type":"assistant","message":{"role":"assistant","content":[]}}"#;
match ClaudeOutput::parse_json(json) {
    Ok(output) => println!("Got: {}", output.message_type()),
    Err(e) => eprintln!("Parse error: {}", e),
}

Structs§

AbandonedBlocks
The cut-short response named by StreamEventMessage::abandoned_blocks.
AdminRequestOffer
An offer to ask the member’s admin for a higher spend limit, from RateLimitInfo::admin_request_offer.
AnthropicError
API error message from Anthropic.
AnthropicErrorDetails
Details of an Anthropic API error.
ApiErrorParams
Parameters of an assistant frame’s api_error, carried as AssistantMessage::api_error_params only for the error kinds that have any (CLI 2.1.274+).
ApiRetryMessage
ApiRetryNoResponse
Timing of a first-byte-timeout retry, carried as ApiRetryMessage::no_response.
ArtifactReadVersion
One artifact version a conversation held before a compaction, carried in CompactMetadata::pre_compact_artifact_read_versions.
AssistantMessage
Assistant message
AssistantMessageContent
Nested message content for assistant messages
AssistantUsage
Usage information for assistant messages
AuthStatusMessage
BackgroundTaskInfo
BackgroundTasksChangedMessage
BatchToolUse
{id, name} of an original Batch* tool_use block, carried in AssistantMessage::batch_tool_uses.
CacheCreationDetails
Detailed cache creation information
Citation
A citation attached to a TextBlock, linking generated text back to a source.
CloudSessionDeltaMessage
system/cloud_session_delta — written only by the headless stream-json client of a cloud-hosted session (the same client that puts cloud_session on its init frames): the session’s status changed between two inits. Only after the first init; at most a few per second; none when nothing differs. An init is always a complete snapshot, so a host that (re)attaches resynchronises from the first init it reads and applies these on top. Display-only (CLI 2.1.260+).
CodeChangePublishedMessage
code_change_published system message — the session is now associated with a published code change (a pull/merge request). Fires on creation and whenever the session contributes to an existing one, so bind on every event; re-emission for the same URL is possible and idempotent. Values are scraped from captured command output — treat them as a binding hint and verify against the forge before routing authenticated requests.
CodeExecutionToolResultBlock
Result from server-side code execution.
CommandInfo
CommandLifecycleMessage
command_lifecycle message — the fate of a queued command (slash command or queued user prompt): queued when the inbound message enters the command queue, started when it drains into a turn, then exactly one terminal state (completed, cancelled, or discarded). Commands enqueued without a client-supplied uuid emit no lifecycle events. Not a strict pairing — a terminal state may arrive for a command_uuid that never emitted started, and internally-enqueued commands skip queued.
CommandsChangedMessage
CompactBoundaryMessage
Compact boundary message - marks where context compaction occurred
CompactMetadata
Metadata about context compaction
ContainerUploadBlock
Container file upload content block.
ContextAgent
An agent definition’s token contribution, in ContextUsage::agents.
ContextCategory
One row of the /context usage-by-category breakdown.
ContextMcpTool
An MCP tool’s token contribution, in ContextUsage::mcp_tools.
ContextMemoryFile
A memory file’s token contribution, in ContextUsage::memory_files.
ContextOverLimit
Why and by how much a ContextUsage exceeds its window.
ContextSkill
A skill’s token contribution, in ContextUsage::skills.
ContextUsage
Structured twin of the /context report, carried as AssistantMessage::context_usage — the data a client needs to render the context-usage card without parsing the markdown table. Evolves additively; a breaking reshape would ship as a sibling field.
ControlCancelRequest
Withdrawal of an in-flight ControlRequest (control_cancel_request).
ControlRequest
Control request from CLI (tool permission requests, hooks, etc.)
ControlRequestMessage
Wrapper for outgoing control requests (includes type tag)
ControlRequestProgressMessage
ControlResponse
Control response to CLI
ControlResponseMessage
Wrapper for outgoing control responses (includes type tag)
ConversationResetMessage
Emitted when the conversation is reset mid-stream (e.g. /clear sent as user input). Identity semantics, measured live against CLI 2.1.232 — two traps here:
DeferredToolUse
Tool use deferred by a terminal result.
DevIntentMessage
system/dev_intent — the conversation, or the git repository it runs in, shows a known kind of development work, for hosts that key tooling on it (Claude Code Desktop opens its iOS Simulator entry point on ios_app). Sent with trigger as its only other payload. Per conversation per process, each kind is sent at most once from conversation evidence and at most once from the project scan: conversation evidence when it first completes, or at startup when a resumed conversation already has it; project evidence (print-mode CLIs only, which is how the Agent SDK starts it) at startup, after each conversation_reset, and at the first message of a conversation whose earlier scan did not find every kind. Either can arrive before system/init. A rewind or compaction never retracts it and only a conversation_reset starts over, so treat each kind as a sticky fact about the conversation: a client that needs only the kind can ignore repeats, and one that needs to know what set it off reads trigger (CLI 2.1.266+; trigger and the project scan from 2.1.273).
ElicitationCompleteMessage
FailedPersistedFile
FallbackBlock
Model fallback content block.
FallbackModel
A model reference inside a FallbackBlock.
FeedbackDraftQueuedMessage
system/feedback_draft_queued — a feedback draft was queued for submission.
FileAttachmentsMissingMessage
system/file_attachments_missing — some files a user message sent by reference (file_attachments) did not arrive where Claude can read them, and Claude was told so; the turn runs on without them. A host can use it to tell the person who sent them. Only sent by a worker connected to Claude Code Remote. Each event states the whole list for its message, so keep the last one per message_uuid (CLI 2.1.290+).
FilesPersistedMessage
FooterIndicator
The server-configured session indicator that the terminal renders as a ◆ <text> pill in the prompt footer, carried on system/init and the initialize response (CLI 2.1.259+).
FrameAudit
The result of auditing a single raw frame for full typed coverage.
GetUsageResponse
Typed payload returned by the CLI get_usage control request.
HandbackReport
A subagent’s delivered hand-back report (TaskNotificationMessage::handback_report).
HookCallbackRequest
Hook callback request
HookProgressMessage
HookResponseMessage
HookStartedMessage
ImageBlock
Image content block (follows Anthropic API structure)
ImageSource
Image source information
InformationalMessage
InitMessage
Init system message data - sent at session start
InitializeRequest
Initialize request (SDK -> CLI)
InputAttachmentsDetail
ResultMessage::input_attachments_detail — what the input_attachments phase did on the turn (CLI 2.1.288+).
InstructionSizeWarningMessage
system/instruction_size_warning — the session’s instruction files (CLAUDE.md files, rules files and the files they import) add up to more than the recommended limit. Numbers only: the host words the warning in the person’s language. Sent to Claude Desktop’s Code tab alone, at most once per process, on a conversation’s first turn after system/init; never stored in the transcript. Safe to ignore (CLI 2.1.288+).
LocalCommandOutcome
What a local-command row reports, carried as AssistantMessage::local_command_outcome so a host can offer a fix instead of relaying the text (CLI 2.1.281+).
LocalCommandOutputMessage
LocalCommandRun
The run that printed a local-command row, carried as AssistantMessage::local_command_run.
McpHttpServerConfig
MCP HTTP server configuration
McpMessageRequest
MCP message request
McpMeta
MCP metadata passed through on user-message wrappers.
McpServerError
An MCP server config entry that failed validation, reported by system init (e.g. a url entry with no type). The affected server is skipped and absent from InitMessage::mcp_servers.
McpSseServerConfig
MCP SSE server configuration
McpStdioServerConfig
MCP stdio server configuration
McpToolResultBlock
MCP tool result content block.
McpToolUseBlock
MCP tool invocation content block.
MemoryPaths
Memory paths reported by system init.
MemoryRecallItem
MemoryRecallMessage
MessageContent
Message content with role
MessageOrigin
Message provenance. The kind field is the stable discriminator; variant specific fields are preserved in extra for forward-compatible access.
MirrorErrorKey
MirrorErrorMessage
MissingFileAttachment
One entry of FileAttachmentsMissingMessage::missing.
ModelRefusalFallbackMessage
ModelRefusalNoFallbackMessage
ModelScopedRateLimit
ModelUsageEntry
Usage and cost for a single model within a session, as found in ResultMessage::model_usage and ResultMessage::model_usage_since_last_result.
NotificationMessage
OutputTokensDetails
Breakdown of a turn’s output tokens, carried in UsageInfo::output_tokens_details.
OveragePeriodUtilization
Spend-cap utilization for an overage billing period.
ParseError
Error type for parsing failures that preserves the raw input.
PeerMessageHoldMessage
system/peer_message_hold — a cross-session (peer) message this session’s receive-side policy held rather than queued, and how that hold resolved. Lets a host show the human that a message arrived but has not reached the model (and may never) instead of nothing at all; the sending session is told separately over its own transport where one exists. Informational only — there is no host-side approval through this frame. Emitted in -p/SDK sessions (CLI 2.1.273+).
PerTurnEffortChangedMessage
system/per_turn_effort_changed — the conversation stopped sending effort per turn, because the server refused its per-turn effort message or a role:"system" message. From the retried request on, an effort change rewrites the cached prefix, for every model, until a later system/init says otherwise. Sent once, when the conversation first turns per-turn effort off, before the retried request’s output; sent again only if the server refuses again after the conversation’s refusals are cleared (for example by /clear or a compaction). It can repeat a false the host already holds. Pairs with InitMessage::per_turn_effort_active (CLI 2.1.281+).
Permission
A permission to grant for “remember this decision” functionality.
PermissionCheckStatusMessage
system/permission_check_status — a tool call has been waiting on its automatic permission check (the auto-mode classifier) for longer than usual, so a host can say the step is being checked instead of showing a silent pause. Every checking is followed by a done for the same tool_use_id; done does not say whether the call was allowed (the tool’s result, permission_denied or a can_use_tool request does). One call can send more than one pair. Display-only and best-effort: also stop showing it at any other frame for this tool_use_id or at the end of the turn (CLI 2.1.292+).
PermissionDenial
A record of a tool permission that was denied during the session.
PermissionDeniedMessage
PermissionRule
A rule within a permission grant.
PermissionSuggestion
A suggested permission for tool approval.
PersistedFile
PluginDiagnostic
Plugin load diagnostic reported by system init.
PluginInfo
Plugin info from the init message
PluginInstallMessage
PreservedMessages
PreservedSegment
PromptSubmitOutcome
How a submitted prompt ended before a model call, carried as InformationalMessage::prompt_submit_outcome (CLI 2.1.300+).
PromptSuggestionMessage
RateLimitEvent
Rate limit event from Claude CLI.
RateLimitInfo
Rate limit status information.
ResourceLink
A file an MCP tool returned by reference — a resource_link content block as carried on McpMeta::resource_links and TaskNotificationMessage::resource_links (CLI 2.1.259+).
ResultMessage
Result message for completed queries
ResumeStoreConfirmDetail
ResultMessage::resume_store_confirm_detail — how the resume_store_confirm phase was spent (CLI 2.1.290+). The four _ms values sum to that phase exactly.
RunnerExit
How the self-hosted runner’s session process terminated, carried on a synthesized failure ResultMessage as ResultMessage::runner_exit (CLI 2.1.266+).
ServerToolUse
Server tool usage information
ServerToolUseBlock
Server-side tool use content block (e.g., web search, code execution).
SessionStateChangedMessage
SessionTitleChangedMessage
system/session_title_changed — the session’s name, for a host that shows it (an IDE editor tab, say). A headless session sends it at startup when the session already has a name, and again after each change to the name (not an AI-generated title), including a rename the host itself sent with rename_session. A cleared name is not sent. The same name can arrive more than once, so treat a repeated name as no change. The frame can arrive before the system/init that first names its session_id (at startup or after /clear); a host that learns the session id from init can hold the name until then (CLI 2.1.285+).
StatusMessage
Status system message - sent during operations like context compaction
StreamEventMessage
SubagentKillCounts
Subagents stopped before finishing, carried in SubagentStats::killed. parent = by another agent through TaskStop; system = by Claude Code itself; user = any other stop.
SubagentRefusalCounts
Agent tool calls refused at a limit, carried in SubagentStats::refused.
SubagentResult
Token, timing, and tool-use accounting for a completed subagent (Task) run.
SubagentRetry
Retry state carried on a ToolProgressMessage while a subagent API call is retried after an error.
SubagentSpawnRequests
Spawn counts by the run_in_background value the model passed, carried in SubagentStats::requested.
SubagentStats
Running totals for subagents started through the Agent tool, carried on result frames (CLI 2.1.239+) as ResultMessage::subagent_stats.
SubagentToolStats
Per-category tool-use counts for a subagent run, from tool_use_result.toolStats.
SubagentUsageRollup
Session-level subagent token rollup — the <subagent_tokens> / <agent_count> line items the Claude CLI renders in its terminal <usage> block.
SummarizeMetadata
Metadata attached when user-visible transcript content summarizes prior messages.
SystemMessage
System message with metadata
TaskNotificationMessage
task_notification system message — emitted once when a background task completes or fails.
TaskPatch
The partial update carried by a TaskUpdatedMessage. Every field is optional because the CLI only sends the keys that changed.
TaskProgressMessage
task_progress system message — emitted periodically as a background agent task executes tools. Not emitted for local_bash tasks.
TaskStartedMessage
task_started system message — emitted once when a background task begins.
TaskUpdatedMessage
task_updated system message — emitted when a background task’s state changes (e.g. transitions to completed). Carries a partial patch of the fields that changed rather than the full task record.
TaskUsage
Cumulative usage statistics for a background task.
TextBlock
Text content block
ThinkingBlock
Thinking content block
ThinkingTokensMessage
thinking_tokens system message — emitted as the model streams extended thinking, reporting the running estimate of thinking tokens consumed.
ToolCaller
Provenance of a ToolUseBlock — identifies who issued the tool call.
ToolPermissionDecision
ToolResultMeta::permission_decision — how a tool call’s permission check ended, as Claude Code’s claude_code.tool.blocked_on_user trace span reports it (CLI 2.1.293+).
ToolPermissionRequest
Tool permission request details
ToolProgressMessage
ToolResultBlock
Tool result content block
ToolResultMeta
Display metadata for a tool_result block carried on the user wrapper.
ToolResultRemedy
The fix a host can offer for what a tool_result reports, stamped from structured producer state (never parsed from the result text), carried as ToolResultMeta::remedy (CLI 2.1.276+). Only the parameters the kind needs are present.
ToolUseBlock
Tool use content block
ToolUseMeta
Display metadata for a tool-use block carried on the assistant wrapper.
ToolUseSummaryMessage
TouchCompareCounts
InputAttachmentsDetail::touch_compare — how the changed_files producer’s compares of touched files (size, then bytes, against what the conversation last saw) ended. Whole numbers; a zero count is left out (CLI 2.1.300+).
TranscriptMessage
Raw preserved record for Claude Code transcript-only message types.
TurnHandoffAvailableMessage
system/turn_handoff_available — emitted once by a cloud worker that accepts the turn_handoff control request, right after it registers, carrying what its registration wrote to external_metadata.turn_handoff. Lets a session client learn the capability from the event stream instead of reading worker state. Durable in the stream: a reader keeps the entry with the newest worker_epoch it has seen and ignores older ones; a worker life that does not accept turn_handoff emits nothing (CLI 2.1.273+).
TurnPreemptedMessage
system/turn_preempted — the CLI itself stopped the running turn so a user’s rapid follow-up message is answered at once, exactly as a priority now message would have (running shell commands are backgrounded, not killed). Sent at the moment of the stop, so it precedes the stopped turn’s result frame (terminal_reason aborted_streaming or aborted_tools) and its members’ cancelled command_lifecycle frames: a host renders that turn as superseded by the follow-up rather than as interrupted, does not resend its messages, and treats only preempted_by_uuid as picked up. At most one per burst. Emitted in -p/SDK sessions only, and only to a consumer that declared rapidFollowupPreempt on its initialize request while the feature’s rollout flag is on (CLI 2.1.273+).
UiFocusMessage
system/ui_focus — a plugin’s $.ui.focus moved the focus ring of a site a remote surface draws onto one of its Buttons, Inputs or Selects: the surface focuses that element if it still draws it. The person’s own moves are never pushed back (CLI 2.1.285+).
UiInvalidateMessage
system/ui_invalidate — a plugin called $.ui.invalidate("ui.render"), or a plugin loaded or reloaded: every tree a remote surface drew through ui_render may be stale, and the surface re-asks each mounted instance. Bumps from one plugin fold to at most one per 100 ms (CLI 2.1.285+).
UiInvalidatedInstance
One stale instance named by UiInvalidateMessage::instances.
UiLogMessage
system/ui_log — one $.ui.log(text) line from a plugin in a headless session: what the REPL appends to its transcript as a dim notice under the plugin’s name. Not sent to the model (CLI 2.1.285+).
UiPane
One placed pane in a UiPanesMessage roster.
UiPanesMessage
system/ui_panes — the pane roster a remote surface draws changed: a plugin opened, retitled or closed a pane, the person showed, focused or closed one, or a placing client attached. Deduplicated: an unchanged roster is not pushed. A pane opened before the stream armed produces none, so read the roster with a ui_panes request on mount (CLI 2.1.285+).
UiScrollMessage
system/ui_scroll — a plugin’s $.ui.scroll moved the window of a site a remote surface draws: the surface scrolls the site’s body there. The person’s own scrolls are never pushed back (CLI 2.1.285+).
UiStatusMessage
system/ui_status — one $.ui.status(text) from a plugin in a headless session: the line the REPL pins under the prompt until the plugin’s next call replaces or clears it. One status line per plugin (CLI 2.1.285+).
UiToastMessage
system/ui_toast — one $.ui.toast(text) from a plugin in a headless session: what the REPL shows on the notification bar under the prompt for a few seconds, under the plugin’s name. Toasts arrive at no fixed rate: CLI 2.1.289 dropped the hooks host’s 2 s spacing (CLI 2.1.285+).
UnifiedRateLimitWindows
Per-window subscription usage, from RateLimitInfo::unified_windows (CLI 2.1.259+). Each window is present only when the account state carries it.
UnifiedWindowUsage
Usage for a single unified rate-limit window, carried in UnifiedRateLimitWindows.
UsageBehavior
UsageBehaviors
UsageCreditOffer
A limited-time offer on usage credits, from RateLimitInfo::usage_credit_offer.
UsageInfo
Usage information for the request.
UsageIteration
Usage for a single API call (“iteration”) within a turn’s tool-use loop.
UsageModelUsage
UsageRateLimitWindow
UsageRateLimits
UsageReport
Structured twin of a /usage result, carried as AssistantMessage::usage_report: the session’s totals, the plan’s usage rows as the server sent them and the extra-usage spend, and nothing else from the usage body (the get_usage control reply carries the rest). Experimental — the shape may change.
UsageReportExtraUsage
Extra-usage (overage) spend for the billing period in a UsageReportRateLimits. Amounts are in minor units of currency (cents for USD).
UsageReportLimit
One server usage row in UsageReportRateLimits::limits.
UsageReportRateLimits
The plan’s usage rows and extra-usage spend in a UsageReport.
UsageReportScope
What a scoped UsageReportLimit row is for.
UsageReportScopeLabel
The server’s display label for a UsageReportScope member.
UsageSession
UserMessage
User message
VcsStateChangedMessage
vcs_state_changed system message — a harness-observed shell command mutated repository state. A cache-invalidation signal, deliberately payload-free beyond classification: consumers re-read state (branch, head, PR status) instead of decoding the event.
WebSearchToolResultBlock
Result from a web search server tool.
WorkerShuttingDownMessage

Enums§

AdminRequestOfferState
State of an AdminRequestOffer.
ApiErrorMedia
The kind of block the API refused (ApiErrorParams::media).
ApiErrorMediaReason
Why the API refused an image or document (ApiErrorParams::media_reason).
ApiErrorProvider
The API provider whose credentials failed (ApiErrorParams::provider).
ApiErrorRemedy
How to repair failed provider credentials (ApiErrorParams::remedy).
ApiErrorType
Known Anthropic API error types.
ApiKeySource
How the API key was sourced for the session.
AskUserQuestionResponseError
Errors that can occur when building an AskUserQuestion response via ToolPermissionRequest::answer_questions.
AssistantErrorKind
API error category attached to assistant wrapper frames.
ClaudeInput
Top-level enum for all possible Claude input messages.
ClaudeOutput
Top-level enum for all possible Claude output messages
CommandLifecycleState
Lifecycle state carried by a CommandLifecycleMessage.
CommandWakeupSource
Which scheduler fired a command, from CommandLifecycleMessage::wakeup_source.
CompactionTrigger
What triggered a context compaction.
ContentBlock
Content blocks for messages
ControlRequestPayload
Control request payload variants
ControlResponsePayload
Control response payload
ConversationResetTrigger
What discarded the conversation (ConversationResetMessage::trigger, CLI 2.1.281+).
DevIntentKind
The kind of development a DevIntentMessage reports. Open set: the CLI says “more kinds will be added; ignore a kind you do not recognize”, so unrecognized values deserialize to DevIntentKind::Unknown.
DevIntentTrigger
The evidence a DevIntentMessage detection fired on. Open set: the CLI says “more values will be added; ignore one you do not recognize”, so unrecognized values deserialize to DevIntentTrigger::Unknown.
FastModeDisabledReason
Why fast mode can’t serve right now, carried on result frames and system/init (CLI 2.1.219+). Absent when nothing blocks fast mode.
ImageSourceType
Encoding type for image source data.
InitPermissionMode
Permission mode reported in init messages.
KnownSystemEvent
Owned typed view over any known system message subtype.
LocalCommandOutcomeKind
The outcome a local-command row reports (LocalCommandOutcome::kind). New kinds are additive; the CLI itself drops the whole outcome when it meets a kind it does not know, so treat Unknown as absent.
McpServerConfig
MCP Server configuration types
MediaType
MIME type for image content.
MessageRole
Known message roles.
OutputStyle
Output formatting style for the session.
OverageDisabledReason
Why overage billing is disabled.
OverageStatus
Whether overage billing was accepted or rejected.
PeerMessageHoldCause
Why the receive-side policy parked a peer message (PeerMessageHoldMessage::cause, state held only). The *Setting causes are a standing crossSessionInbound: "hold"; ModeMismatch and NoModeAsserted are the permission-mode parity holds (the sender runs in a different permission class, or asserted none while this session bypasses permissions).
PeerMessageHoldOutcome
How a peer-message hold ended (PeerMessageHoldMessage::outcome, state dropped only).
PeerMessageHoldState
Lifecycle state carried by a PeerMessageHoldMessage.
PeerMessageLane
Which ingress delivered the message a PeerMessageHoldMessage reports.
PermissionBehavior
The behavior of a permission rule.
PermissionCheckStatus
Phase of a PermissionCheckStatusMessage.
PermissionDecisionOutcome
ToolPermissionDecision::decision.
PermissionDecisionReasonType
ToolPermissionDecision::reason_type — the kind of reason a self-decided permission check gave.
PermissionDeniedReasonCode
An actionable reason behind a system/permission_denied frame (PermissionDeniedMessage::decision_reason_code).
PermissionDestination
Where a permission applies.
PermissionModeName
Named permission modes that can be set via setMode.
PermissionResult
Result of a permission decision
PermissionType
The type of a permission grant.
PromptSubmitOutcomeKind
PromptSubmitOutcome::kind — what ended a submitted prompt.
RateLimitErrorCode
Error code carried on a rate limit event when a request was refused.
RateLimitScope
Which spend limit blocked a request when it is not the member’s own cap (RateLimitInfo::limit_scope).
RateLimitStatus
Current rate limit disposition.
RateLimitWindow
The time window a rate limit applies to.
RefusalFallbackScope
Scope of a refusal-fallback model swap, carried by ModelRefusalFallbackMessage::scope. Open — new scopes may ship on the wire ahead of schema updates.
RemedyFeature
The feature a feature_disabled / policy_denied remedy names (ToolResultRemedy::feature).
RemedyFeatureCause
Why a feature is off for a feature_disabled remedy (ToolResultRemedy::cause).
RemedyLoginProvider
Whose login a remedy names (ToolResultRemedy::provider).
RemedyPolicyKind
The verdict behind a policy_denied remedy (ToolResultRemedy::policy_kind).
ResultSubtype
Result subtypes
RunnerExitPhase
Which phase the runner’s session process was in when it exited, in RunnerExit::phase. Open set — unrecognized values deserialize to RunnerExitPhase::Unknown.
StartupFailureReason
Why Claude Code refused to start, carried as ResultMessage::startup_failure_reason so a host can offer the fix instead of a retry (CLI 2.1.274+).
StatusMessageStatus
Status of an ongoing operation (e.g., context compaction).
StopReason
Reason why the assistant stopped generating.
StreamPostQueuedBehind
What the first stream POST of a turn was queued behind, carried as ResultMessage::first_stream_post_queued_behind (CLI 2.1.278+). Internal timing instrumentation; the CLI does not describe the values.
SystemSubtype
Known system message subtypes.
TaskEndReason
Why a TaskNotificationMessage ended other than through an ordinary completion, failure, or stop. Open set: unrecognized values deserialize to TaskEndReason::Unknown.
TaskHandback
How a subagent’s hand-back report reached its caller (TaskNotificationMessage::handback).
TaskStatus
Completion status of a background task.
TaskType
The kind of background task.
ToolResultContent
Tool result content type
ToolResultRemedyKind
What a host can fix for a tool result (ToolResultRemedy::kind).
TurnStartResumeKind
What a turn was given to settle before its own prompt, carried as ResultMessage::turn_start_resume_kind (CLI 2.1.287+). A turn given more than one reports the first in this order.
UiSiteComponent
The site a UiScrollMessage or UiFocusMessage addresses.
UsageCreditOfferKind
Kind of a UsageCreditOffer.
VcsMutationKind
Mutation class carried by a VcsStateChangedMessage.
ViewMode
The session’s transcript view, carried as InitMessage::view_mode (CLI 2.1.281+).

Functions§

assert_fully_wrapped
Panic with a detailed report unless raw is fully wrapped.
audit_frame
Audit a single raw frame (one parsed JSONL line) for full typed coverage.