This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
from line 447
447447| `pathToClaudeCodeExecutable` | `string` | Auto-resolved from bundled native binary | Path to Claude Code executable. Only needed if optional dependencies were skipped during install or your platform isn't in the supported set |
448448| `permissionMode` | [`PermissionMode`](#permissionmode) | `'default'` | Permission mode for the session |
449449| `permissionPromptToolName` | `string` | `undefined` | MCP tool name for permission prompts |
450| `permissionPrompts` | `'host' \| 'none'` | `'host'` | Who answers permission prompts: `'host'` routes them to your [`canUseTool`](#canusetool) callback or the `permissionPromptToolName` tool, and `'none'` [denies the calls that would have prompted](/docs/en/agent-sdk/permissions#how-permissions-are-evaluated). Requires Claude Code v2.1.259 or later |
450451| `persistSession` | `boolean` | `true` | When `false`, disables session persistence to disk. Sessions cannot be resumed later |
451452| `planModeInstructions` | `string` | `undefined` | Custom workflow instructions for plan mode. When `permissionMode` is `'plan'`, this string replaces the default plan-mode workflow body. The CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer |
452453| `plugins` | [`SdkPluginConfig`](#sdkpluginconfig)`[]` | `[]` | Load custom plugins from local paths. See [Plugins](/docs/en/agent-sdk/plugins) for details |
from line 1180
11791180 timestamp?: string;
11801181 context_usage?: SDKContextUsage;
11811182 user_message_uuid?: string;
1183 user_message_uuids?: string[];
11821184};
11831185```
11841186
from line 1190
11881190
11891191`aborted` is `true` when an interrupt or abort truncated the assistant message before the stream completed: the message has no `stop_reason` and the content may end mid-word. The field is absent on normally completed messages. It requires Agent SDK v0.3.214 or later.
11901192
1191Claude Code sets `user_message_uuid` on the turn's first assistant message, under the conditions in [`user_message_uuid`](#user_message_uuid).
1193Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn's first assistant message, under the conditions in [`user_message_uuid`](#user_message_uuid).
11921194
11931195`timestamp` is the ISO 8601 time when the message's content finished generating on the process that produced it. The value comes from that machine's clock, so use it for display only and don't order messages by it. One API turn can produce several assistant messages that share a `message.id`, each with its own `timestamp`. When the field is absent, fall back to the time you received the message.
11941196
from line 1263
12611263 ttft_ms?: number;
12621264 ttft_stream_ms?: number;
12631265 user_message_uuid?: string;
1266 user_message_uuids?: string[];
12641267 request_sent_wall_ms?: number;
12651268 first_content_frame_ms?: number;
12661269 first_stream_post_ms?: number;
from line 1302
12991302 queued_turn_count?: number;
13001303 errors: string[];
13011304 user_message_uuid?: string;
1305 user_message_uuids?: string[];
13021306 terminal_reason?: TerminalReason;
13031307 fast_mode_state?: FastModeState;
13041308 fast_mode_disabled_reason?: FastModeDisabledReason;
from line 1316
13121316* `ttft_ms`: time to first token in milliseconds, measured when the first complete assistant message arrives. Present on the success arm only.
13131317* `ttft_stream_ms`: time in milliseconds until the first `message_start` stream event, when the response stream opens. Lower than `ttft_ms`; the gap between the two is time spent streaming the first message. Present on the success arm only.
13141318* `user_message_uuid`: the `uuid` of the message you sent that started this turn. See [`user_message_uuid`](#user_message_uuid) for which results carry it.
1319* `user_message_uuids`: the `uuid`s of every message you sent that Claude Code answered in this turn. See [`user_message_uuids`](#user_message_uuids).
13151320* `request_sent_wall_ms`: epoch milliseconds at which Claude Code dispatched the API request, for joins against server-side timestamps. Present on the success arm only, together with `user_message_uuid`, when `is_error` is false.
13161321* `first_content_frame_ms`: time in milliseconds until the first `content_block_start` or `content_block_delta` stream event, counting thinking blocks as content. Present on the success arm only, when `is_error` is false. Requires Agent SDK v0.3.260 or later.
13171322* `first_stream_post_ms`, `first_stream_post_ack_ms`, `first_stream_post_wall_ms`: timings for uploading the turn's first stream event. Claude Code records them only in sessions it streams to claude.ai, such as [cloud sessions](/docs/en/claude-code-on-the-web), and the results `query()` yields don't carry them. Requires Agent SDK v0.3.260 or later.
from line 1353
13481353
13491354#### `user_message_uuid`
13501355
1351The `uuid` of the [`SDKUserMessage`](#sdkusermessage) that started the turn, echoed so you can match Claude Code's reply to the message you sent. Claude Code echoes it only if you set `uuid` on that message. The field is optional on `SDKUserMessage`, and a string prompt passed to `query()` carries none. When you set it, Claude Code echoes it on these frames:
1356The `uuid` of the [`SDKUserMessage`](#sdkusermessage) that started the turn, echoed so you can match Claude Code's reply to the message you sent. Claude Code echoes it only if you set `uuid` on that message. The field is optional on `SDKUserMessage`, and a string prompt passed to `query()` carries none.
13521357
1353* **The result**: on the success arm with `is_error` false, together with `request_sent_wall_ms`, which requires Agent SDK v0.3.216 or later. On an error result that answers a message you sent, Claude Code echoes the field alone, which requires Agent SDK v0.3.246 or later.
1358When you send several messages close together, Claude Code can merge them into one turn. The field then carries only the last message's `uuid`. To match the reply to any of the merged messages, use [`user_message_uuids`](#user_message_uuids).
1359
1360When you set `uuid`, Claude Code echoes it on three kinds of frame:
1361
1362* **The result**: on the success arm with `is_error` false, together with `request_sent_wall_ms`, which requires Agent SDK v0.3.216 or later. Claude Code also echoes it on an error result that answers a message you sent, which requires Agent SDK v0.3.246 or later.
13541363* **The turn's first reply**: the first [assistant message](#sdkassistantmessage), or with `includePartialMessages` the first [stream event](#sdkpartialassistantmessage) whose `event.type` isn't `ping`, so you can bind the reply before the result arrives. When a turn streams nothing, Claude Code sets it on the first assistant message instead. One reply frame per turn carries it. Requires Agent SDK v0.3.246 or later.
13551364* **Every [`thinking_tokens`](#sdkthinkingtokensmessage) frame of the turn**: so you can attribute thinking progress to the message you sent without waiting for the turn's first reply. Requires Agent SDK v0.3.260 or later.
13561365
from line 1368
13591368* Later assistant messages and stream events of the same turn
13601369* Subagent frames
13611370* Synthetic turns, such as scheduled ones
1362* Results with no single triggering message, such as the zeroed result after a crashed worker process
1371* Results that answer no message you sent, such as the zeroed result after a crashed worker process
13631372
1373#### `user_message_uuids`
1374
1375The `uuid`s of every message you sent that Claude Code answered in this turn. When you send several messages close together, Claude Code can merge them into one turn, and `user_message_uuid` then names only the last of them. To match the reply to any of the merged messages, look for that message's `uuid` anywhere in this list. Requires Agent SDK v0.3.259 or later.
1376
1377Claude Code sets the list together with `user_message_uuid` on the turn's first reply and on the result. For the full set of frames that carry `user_message_uuid`, and the version each requires, see [`user_message_uuid`](#user_message_uuid). The list always contains `user_message_uuid` and holds at most 64 entries. A message you send while the turn is running that Claude Code picks up between tool calls appears only in the result's list.
1378
1379When a first reply or result carries `user_message_uuid` without the list, it came from an earlier Claude Code version, so fall back to the single field.
1380
13641381#### `queued_turn_count`
13651382
13661383The number of messages you sent with [`origin: { kind: "human" }`](#sdkmessageorigin) that are still waiting in the command queue when Claude Code produced the result. Requires Agent SDK v0.3.242 or later.
from line 1447
14301447 session_id: string;
14311448 ttft_ms?: number; // Time to first token in ms, present only on message_start events
14321449 user_message_uuid?: string; // Present on at most one stream event per turn
1450 user_message_uuids?: string[];
14331451};
14341452```
14351453
1436Claude Code sets `user_message_uuid` on one stream event per turn, under the conditions in [`user_message_uuid`](#user_message_uuid).
1454Claude Code sets `user_message_uuid` and `user_message_uuids` on one stream event per turn, under the conditions in [`user_message_uuid`](#user_message_uuid).
14371455
14381456### `SDKCompactBoundaryMessage`
14391457
from line 1521
15031521
15041522Stream event emitted when the permission system denies a tool call without an interactive prompt. Use it to render the denial in your UI as it happens, rather than only observing the `is_error` tool result that follows. Which denials it reports depends on how the run handles permission prompts:
15051523
1506* **With a [`canUseTool`](#canusetool) callback**: permission prompts go to your callback, and this event reports the denials Claude Code decides on its own without calling it.
1524* **With a [`canUseTool`](#canusetool) callback** and the default [`permissionPrompts: 'host'`](#options): permission prompts go to your callback, and this event reports the denials Claude Code decides on its own without calling it.
15071525* **With neither**: a bare `-p` run, or `query()` that sets neither `canUseTool` nor `permissionPromptToolName`, denies any tool call that would have prompted, and this event reports those denials as well as the ones Claude Code decides on its own. Before v2.1.223, Claude Code didn't emit this event in runs without a callback.
1508* **With an MCP prompt tool**, set with `permissionPromptToolName` or the [`--permission-prompt-tool`](/docs/en/cli-reference#cli-flags) flag: Claude Code doesn't emit this event at all, not even for the rule denials it decides on its own.
1526* **With an MCP prompt tool**, set with `permissionPromptToolName` or the [`--permission-prompt-tool`](/docs/en/cli-reference#cli-flags) flag, and the default `permissionPrompts: 'host'`: Claude Code doesn't emit this event at all, not even for the rule denials it decides on its own.
1527* **With [`permissionPrompts: 'none'`](#options)**: Claude Code denies the calls that would have prompted, even when `canUseTool` or an MCP prompt tool is also set, and this event reports those denials as well as the ones Claude Code decides on its own. Requires Claude Code v2.1.259 or later.
15091528
15101529In every configuration, this event skips any denial decided on the `PreToolUse` hook path, whether the hook denied the call itself or a deny rule overrode the hook's allow or ask decision. The event is also best-effort: occasionally Claude Code records a denial without emitting this event, so `permission_denials` on the [result message](#sdkresultmessage) is the authoritative record.
15111530
from line 3530
35113530 newLines: number;
35123531 lines: string[];
35133532 }>;
3514 originalFile: string | null;
3515 gitDiff?: {
3516 filename: string;
3517 status: "modified" | "added";
3518 additions: number;
3519 deletions: number;
3520 changes: number;
3521 patch: string;
3522 repository?: string | null;
3523 };
3524 userModified?: boolean;
3525};
3526```
3527
3528Returns the write result with structured diff information. What `originalFile` and `structuredPatch` hold depends on the write:
3529
3530* For a newly created file, `originalFile` is null and `structuredPatch` is empty
3531* On an overwrite, `originalFile` carries the previous content, except when that content is larger than about 10 MB: Claude Code then skips the diff and returns `originalFile` null and `structuredPatch` empty
3532* `structuredPatch` is also empty when the write changed nothing or the diff timed out
3533
3534### Glob
3535
3536**Tool name:** `Glob`
3537
3538```typescript theme={null}
3539type GlobOutput = {
3540 durationMs: number;
3541 numFiles: number;
3542 filenames: string[];
3543 truncated: boolean;
3544 totalMatches?: number;
3545 countIsComplete?: boolean;
3546};
3547```
3548
3549Returns file paths matching the glob pattern, sorted by modification time.
3550
3551`totalMatches` and `countIsComplete` require Claude Code v2.1.191 or later. `totalMatches` reports the number of matching files before truncation. When `countIsComplete` is false, `totalMatches` is a lower bound because the underlying search truncated its own output.
3552
3553### Grep
3554
3555**Tool name:** `Grep`
3556
3557```typescript theme={null}
3558type GrepOutput = {
3559 mode?: "content" | "files_with_matches" | "count";
3560 numFiles: number;
3561 filenames: string[];
3562 content?: string;
3563 numLines?: number;
3564 numMatches?: number;
3565 totalFiles?: number;
3566 totalLines?: number;
3567 appliedLimit?: number;
3568 appliedOffset?: number;
3569};
3570```
3571
3572Returns search results. The shape varies by `mode`: file list, content with matches, or match counts. In `count` mode, `numFiles` and `numMatches` are totals over the full result set, not the paginated slice. Before v2.1.208, a `head_limit` or `offset` that truncated the listed entries also truncated those totals.
3573
3574`totalFiles` requires Claude Code v2.1.208 or later and reports the total number of results before `head_limit` and `offset` pagination in `files_with_matches` mode. `totalLines` requires Claude Code v2.1.210 or later and reports the total number of lines before pagination in `content` mode.
3575
3576### TaskStop
3577
3578**Tool name:** `TaskStop`
3579
3580```typescript theme={null}
3581type TaskStopOutput = {
3582 message: string;
3583 task_id: string;
3584 task_type: string;
3585 command?: string;
3586};
3587```
3588
3589Returns confirmation after stopping the background task.
3590
3591### NotebookEdit
3592
3593**Tool name:** `NotebookEdit`
3594
3595```typescript theme={null}
3596type NotebookEditOutput = {
3597 new_source: string;
3598 old_source?: string;
3599 cell_id?: string;
3600 cell_type: "code" | "markdown";
3601 language: string;
3602 edit_mode: string;
3603 error?: string;
3604 notebook_path: string;
3605 original_file: string;
3606 updated_file: string;
3607};
3608```
3609
3610Returns the result of the notebook edit with original and updated file contents.
3611
3612### WebFetch
3613
3614**Tool name:** `WebFetch`
3615
3616```typescript theme={null}
3617type WebFetchOutput = {
3618 bytes: number;
3619 code: number;
3620 codeText: string;
3621 result: string;
3622 durationMs: number;
3623 url: strin
3533 originalFile: string | nu