@anthropic-ai/claude-agent-sdk 0.3.232 → 0.3.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bridge.mjs +76 -76
- package/browser-sdk.js +48 -48
- package/manifest.json +19 -20
- package/manifest.zst.json +23 -24
- package/package.json +10 -10
- package/sdk-tools.d.ts +68 -3
- package/sdk.d.ts +111 -25
- package/sdk.mjs +72 -72
package/sdk.d.ts
CHANGED
|
@@ -121,7 +121,10 @@ export declare type AgentMcpServerSpec = string | Record<string, McpServerConfig
|
|
|
121
121
|
|
|
122
122
|
export declare type AnyZodRawShape = ZodRawShape | ZodRawShape_2;
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Where the credential used for API requests came from: 'ANTHROPIC_API_KEY' (environment variable), 'apiKeyHelper' (the configured helper command), '/login managed key' (an API key created and stored by /login with an Anthropic Console account), or 'none' (no API key in use - e.g. claude.ai OAuth login, a bearer token, or a third-party cloud provider). 'user' | 'project' | 'org' | 'temporary' | 'oauth' are legacy members that current CLIs never emit; they remain only so the type stays backward compatible.
|
|
126
|
+
*/
|
|
127
|
+
export declare type ApiKeySource = 'ANTHROPIC_API_KEY' | 'apiKeyHelper' | '/login managed key' | 'none' | 'user' | 'project' | 'org' | 'temporary' | 'oauth';
|
|
125
128
|
|
|
126
129
|
export declare type AsyncHookJSONOutput = {
|
|
127
130
|
async: true;
|
|
@@ -276,9 +279,18 @@ export declare type ConfigChangeHookInput = BaseHookInput & {
|
|
|
276
279
|
*/
|
|
277
280
|
export declare type ConfigScope = 'local' | 'user' | 'project';
|
|
278
281
|
|
|
282
|
+
/**
|
|
283
|
+
* The request failed or was rejected (unknown subtype, invalid arguments, or an error while handling it).
|
|
284
|
+
*/
|
|
279
285
|
declare type ControlErrorResponse = {
|
|
280
286
|
subtype: 'error';
|
|
287
|
+
/**
|
|
288
|
+
* The request_id of the control_request this answers.
|
|
289
|
+
*/
|
|
281
290
|
request_id: string;
|
|
291
|
+
/**
|
|
292
|
+
* Human-readable failure description.
|
|
293
|
+
*/
|
|
282
294
|
error: string;
|
|
283
295
|
/**
|
|
284
296
|
* Permission requests still awaiting a response. Sent on the `initialize` response so a client joining an already-initialized session learns about in-flight prompts.
|
|
@@ -290,9 +302,18 @@ declare type ControlErrorResponse = {
|
|
|
290
302
|
pending_user_dialog_requests?: SDKControlRequest[];
|
|
291
303
|
};
|
|
292
304
|
|
|
305
|
+
/**
|
|
306
|
+
* The request was handled.
|
|
307
|
+
*/
|
|
293
308
|
declare type ControlResponse = {
|
|
294
309
|
subtype: 'success';
|
|
310
|
+
/**
|
|
311
|
+
* The request_id of the control_request this answers.
|
|
312
|
+
*/
|
|
295
313
|
request_id: string;
|
|
314
|
+
/**
|
|
315
|
+
* The success payload, shaped as documented for the answered request's subtype; absent or {} for requests that are merely acknowledged.
|
|
316
|
+
*/
|
|
296
317
|
response?: Record<string, unknown>;
|
|
297
318
|
/**
|
|
298
319
|
* Permission requests still awaiting a response. Sent on the `initialize` response so a client joining an already-initialized session learns about in-flight prompts.
|
|
@@ -627,9 +648,9 @@ export declare type ElicitationResultHookSpecificOutput = {
|
|
|
627
648
|
content?: Record<string, unknown>;
|
|
628
649
|
};
|
|
629
650
|
|
|
630
|
-
export declare const EXIT_REASONS: readonly ['clear', 'resume', 'logout', 'prompt_input_exit', 'other'
|
|
651
|
+
export declare const EXIT_REASONS: readonly ['clear', 'resume', 'logout', 'prompt_input_exit', 'other'];
|
|
631
652
|
|
|
632
|
-
export declare type ExitReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other'
|
|
653
|
+
export declare type ExitReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other';
|
|
633
654
|
|
|
634
655
|
/**
|
|
635
656
|
* Why fast mode can't serve right now. Absent when nothing blocks it (a request may still choose standard speed). A paused-after-rate-limit run is not here; it rides fast_mode_state as 'cooldown'.
|
|
@@ -1823,6 +1844,7 @@ export declare type Options = {
|
|
|
1823
1844
|
* Applies to both foreground and background subagents. Defaults to false.
|
|
1824
1845
|
*/
|
|
1825
1846
|
agentProgressSummaries?: boolean;
|
|
1847
|
+
|
|
1826
1848
|
/**
|
|
1827
1849
|
* Session ID to resume. Loads the conversation history from the specified session.
|
|
1828
1850
|
*/
|
|
@@ -3018,8 +3040,14 @@ export declare type SDKAPIRetryMessage = {
|
|
|
3018
3040
|
session_id: string;
|
|
3019
3041
|
};
|
|
3020
3042
|
|
|
3043
|
+
/**
|
|
3044
|
+
* An assistant message. While a response streams the CLI emits one assistant message per completed content block, so several consecutive assistant messages can share message.id and each carries just that block in message.content; on those, message.stop_reason is null and message.usage is not final — the turn's stop reason and total usage arrive on the result message. parent_tool_use_id is non-null when the message was produced inside a subagent started by that tool_use.
|
|
3045
|
+
*/
|
|
3021
3046
|
export declare type SDKAssistantMessage = {
|
|
3022
3047
|
type: 'assistant';
|
|
3048
|
+
/**
|
|
3049
|
+
* Shaped like an Anthropic Messages API Message object (role "assistant"): id, model, content blocks (text, thinking, tool_use, ...), stop_reason and usage. When streamed, content typically holds the single block this message delivers and stop_reason is still null — see SDKAssistantMessage. See the Messages API reference for the block types.
|
|
3050
|
+
*/
|
|
3023
3051
|
message: BetaMessage;
|
|
3024
3052
|
parent_tool_use_id: string | null;
|
|
3025
3053
|
error?: SDKAssistantMessageError;
|
|
@@ -3255,10 +3283,13 @@ declare type SDKControlCancelAsyncMessageRequest = {
|
|
|
3255
3283
|
};
|
|
3256
3284
|
|
|
3257
3285
|
/**
|
|
3258
|
-
*
|
|
3286
|
+
* Tells the other side that the sender no longer needs the answer to one of its own in-flight control_requests (for example a pending can_use_tool prompt after the turn was interrupted, or one that another client already answered). Either side may send it for a request it originated. The sender stops waiting at once and ignores any control_response that still arrives for that request_id; a receiver that can abort the work does so and may still reply (typically with an error), otherwise it simply completes the request. There is no reply to the cancel itself.
|
|
3259
3287
|
*/
|
|
3260
3288
|
declare type SDKControlCancelRequest = {
|
|
3261
3289
|
type: 'control_cancel_request';
|
|
3290
|
+
/**
|
|
3291
|
+
* The request_id of the control_request being withdrawn.
|
|
3292
|
+
*/
|
|
3262
3293
|
request_id: string;
|
|
3263
3294
|
};
|
|
3264
3295
|
|
|
@@ -3404,13 +3435,6 @@ export declare type SDKControlGetContextUsageResponse = {
|
|
|
3404
3435
|
} | null;
|
|
3405
3436
|
};
|
|
3406
3437
|
|
|
3407
|
-
/**
|
|
3408
|
-
* Read the session's current plan-mode plan. Unlike read_file, the caller does not need to know the plan file's path — the worker resolves its own plan slug. Never creates a plan slug or file.
|
|
3409
|
-
*/
|
|
3410
|
-
declare type SDKControlGetPlanRequest = {
|
|
3411
|
-
subtype: 'get_plan';
|
|
3412
|
-
};
|
|
3413
|
-
|
|
3414
3438
|
/**
|
|
3415
3439
|
* Requests the formatted session cost summary (the same text /usage prints in non-interactive mode). Used by the thin-client /usage dialog to show the remote container cost instead of the local $0.00.
|
|
3416
3440
|
*/
|
|
@@ -3645,13 +3669,6 @@ export declare type SDKControlGetUsageResponse = {
|
|
|
3645
3669
|
} | null;
|
|
3646
3670
|
};
|
|
3647
3671
|
|
|
3648
|
-
/**
|
|
3649
|
-
* Requests the workspace git diff for the thin-client /diff dialog. The worker resolves one base ref for both stats and hunks (working tree vs HEAD, falling back to branch-vs-default-merge-base when the tree is clean) and applies the standard caps (5s git timeout, 50 files, 1MB/file).
|
|
3650
|
-
*/
|
|
3651
|
-
declare type SDKControlGetWorkspaceDiffRequest = {
|
|
3652
|
-
subtype: 'get_workspace_diff';
|
|
3653
|
-
};
|
|
3654
|
-
|
|
3655
3672
|
/**
|
|
3656
3673
|
* Initializes the SDK session with hooks, MCP servers, and agent configuration.
|
|
3657
3674
|
*/
|
|
@@ -3692,6 +3709,7 @@ declare type SDKControlInitializeRequest = {
|
|
|
3692
3709
|
* Dialog kinds (request_user_dialog `dialog_kind` values) this consumer's onUserDialog can actually render. The CLI treats ABSENCE as 'cannot display' and fails closed: without the kind declared here, a dialog-gated flow degrades to its no-dialog behavior (for 'refusal_fallback_prompt', the classic refusal error) instead of parking a dialog the consumer may mishandle. First-attached-client-wins on multi-client sessions; later initializes do not change it.
|
|
3693
3710
|
*/
|
|
3694
3711
|
supportedDialogKinds?: string[];
|
|
3712
|
+
|
|
3695
3713
|
};
|
|
3696
3714
|
|
|
3697
3715
|
/**
|
|
@@ -3719,6 +3737,7 @@ export declare type SDKControlInitializeResponse = {
|
|
|
3719
3737
|
|
|
3720
3738
|
|
|
3721
3739
|
|
|
3740
|
+
|
|
3722
3741
|
};
|
|
3723
3742
|
|
|
3724
3743
|
/**
|
|
@@ -3805,11 +3824,14 @@ declare type SDKControlMcpCallRequest = {
|
|
|
3805
3824
|
};
|
|
3806
3825
|
|
|
3807
3826
|
/**
|
|
3808
|
-
*
|
|
3827
|
+
* Carries one MCP JSON-RPC message for an SDK-hosted MCP server (one named in initialize.sdkMcpServers or added later with mcp_set_servers). Flows in both directions: the CLI sends it to the client to reach the in-process server, and the client sends it to the CLI to deliver that server's own messages. When the client answers, the success response carries the server's JSON-RPC reply under mcp_response; the CLI acknowledges a client-sent one with an empty success.
|
|
3809
3828
|
*/
|
|
3810
3829
|
declare type SDKControlMcpMessageRequest = {
|
|
3811
3830
|
subtype: 'mcp_message';
|
|
3812
3831
|
server_name: string;
|
|
3832
|
+
/**
|
|
3833
|
+
* A JSON-RPC 2.0 message as defined by the Model Context Protocol (request, notification, or response object).
|
|
3834
|
+
*/
|
|
3813
3835
|
message: JSONRPCMessage;
|
|
3814
3836
|
};
|
|
3815
3837
|
|
|
@@ -3974,13 +3996,19 @@ declare type SDKControlRenameSessionRequest = {
|
|
|
3974
3996
|
title: string;
|
|
3975
3997
|
};
|
|
3976
3998
|
|
|
3999
|
+
/**
|
|
4000
|
+
* Envelope for a control-protocol request, sent by either side on the same stream as the messages. The receiver normally answers with exactly one control_response carrying the same request_id (a few request types document when no answer is sent), and a requester ignores responses for request_ids it is not waiting on. Each request type's own documentation says which side sends it and what its success response carries.
|
|
4001
|
+
*/
|
|
3977
4002
|
export declare type SDKControlRequest = {
|
|
3978
4003
|
type: 'control_request';
|
|
4004
|
+
/**
|
|
4005
|
+
* Chosen by the sender, unique among its in-flight requests; the control_response (and any control_cancel_request) for this request echoes it.
|
|
4006
|
+
*/
|
|
3979
4007
|
request_id: string;
|
|
3980
4008
|
request: SDKControlRequestInner;
|
|
3981
4009
|
};
|
|
3982
4010
|
|
|
3983
|
-
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlSetColorRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetSessionCostRequest | SDKControlListModelsRequest | SDKControlGetUsageRequest | SDKControlGetBinaryVersionRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest |
|
|
4011
|
+
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlSetColorRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetSessionCostRequest | SDKControlListModelsRequest | SDKControlGetUsageRequest | SDKControlGetBinaryVersionRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlRegisterRepoRootRequest | SDKControlReloadPluginsRequest | SDKControlReloadSkillsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlStopTaskRequest | SDKControlBackgroundTasksRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
3984
4012
|
|
|
3985
4013
|
/**
|
|
3986
4014
|
* Progress for a long-running client-originated control_request (currently only side_question), correlated by request_id. status 'started' means the worker accepted the request and launched the work; 'api_retry' carries the same retry counters as SDKAPIRetryMessage and is present only for that status.
|
|
@@ -4007,7 +4035,7 @@ export declare type SDKControlRequestProgressMessage = {
|
|
|
4007
4035
|
declare type SDKControlRequestUserDialogRequest = {
|
|
4008
4036
|
subtype: 'request_user_dialog';
|
|
4009
4037
|
/**
|
|
4010
|
-
* Identifier for the dialog the host should render. Open string union — new kinds may be added without bumping the protocol;
|
|
4038
|
+
* Identifier for the dialog the host should render. Open string union — new kinds may be added without bumping the protocol. A kind is only sent in sessions where some attached client declared it in initialize.supportedDialogKinds (declare exactly the kinds you can render); on multi-client transports the request still reaches every attached client. A host that receives a kind it did not declare must not answer it (an error-subtype response is discarded and the dialog stays pending) — never with {behavior: "cancelled"}, which is a real settlement treated as the user dismissing the dialog. An unanswered dialog is cancelled by the CLI after its dialog deadline.
|
|
4011
4039
|
*/
|
|
4012
4040
|
dialog_kind: string;
|
|
4013
4041
|
/**
|
|
@@ -4017,6 +4045,9 @@ declare type SDKControlRequestUserDialogRequest = {
|
|
|
4017
4045
|
tool_use_id?: string;
|
|
4018
4046
|
};
|
|
4019
4047
|
|
|
4048
|
+
/**
|
|
4049
|
+
* Envelope for the single reply to a control_request, sent by whichever side received the request.
|
|
4050
|
+
*/
|
|
4020
4051
|
export declare type SDKControlResponse = {
|
|
4021
4052
|
type: 'control_response';
|
|
4022
4053
|
response: ControlResponse | ControlErrorResponse;
|
|
@@ -4138,6 +4169,9 @@ export declare type SDKFilesPersistedEvent = {
|
|
|
4138
4169
|
*/
|
|
4139
4170
|
declare type SDKHookCallbackMatcher = {
|
|
4140
4171
|
matcher?: string;
|
|
4172
|
+
/**
|
|
4173
|
+
* Opaque ids chosen by the client, one per hook function it registered for this matcher. When the hook fires the CLI sends a hook_callback control request carrying one of these ids as callback_id; the client maps it back to its function.
|
|
4174
|
+
*/
|
|
4141
4175
|
hookCallbackIds: string[];
|
|
4142
4176
|
timeout?: number;
|
|
4143
4177
|
};
|
|
@@ -4214,7 +4248,7 @@ export declare type SDKInformationalMessage = {
|
|
|
4214
4248
|
};
|
|
4215
4249
|
|
|
4216
4250
|
/**
|
|
4217
|
-
*
|
|
4251
|
+
* Liveness heartbeat with no payload. Either side may send it at any time (the CLI emits it periodically, for example while a long-running control request is in progress); receivers must ignore it.
|
|
4218
4252
|
*/
|
|
4219
4253
|
declare type SDKKeepAliveMessage = {
|
|
4220
4254
|
type: 'keep_alive';
|
|
@@ -4270,6 +4304,9 @@ export declare type SDKMemoryRecallMessage = {
|
|
|
4270
4304
|
session_id: string;
|
|
4271
4305
|
};
|
|
4272
4306
|
|
|
4307
|
+
/**
|
|
4308
|
+
* Every conversational and informational message the CLI emits on its output stream, discriminated by type (and subtype for system/result messages). Consumers should ignore types and subtypes they do not recognize: the set grows over time.
|
|
4309
|
+
*/
|
|
4273
4310
|
export declare type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKAPIRetryMessage | SDKControlRequestProgressMessage | SDKModelRefusalFallbackMessage | SDKModelRefusalNoFallbackMessage | SDKLocalCommandOutputMessage | SDKHookStartedMessage | SDKHookProgressMessage | SDKHookResponseMessage | SDKPluginInstallMessage | SDKToolProgressMessage | SDKAuthStatusMessage | SDKTaskNotificationMessage | SDKTaskStartedMessage | SDKTaskUpdatedMessage | SDKTaskProgressMessage | SDKBackgroundTasksChangedMessage | SDKThinkingTokensMessage | SDKSessionStateChangedMessage | SDKWorkerShuttingDownMessage | SDKCommandsChangedMessage | SDKNotificationMessage | SDKFilesPersistedEvent | SDKToolUseSummaryMessage | SDKMemoryRecallMessage | SDKRateLimitEvent | SDKElicitationCompleteMessage | SDKPermissionDeniedMessage | SDKPromptSuggestionMessage | SDKMirrorErrorMessage | SDKInformationalMessage | SDKConversationResetMessage;
|
|
4274
4311
|
|
|
4275
4312
|
/**
|
|
@@ -4283,6 +4320,10 @@ export declare type SDKMessageOrigin = {
|
|
|
4283
4320
|
} | {
|
|
4284
4321
|
kind: 'peer';
|
|
4285
4322
|
from: string;
|
|
4323
|
+
/**
|
|
4324
|
+
* The SENDING session's permission class as declared by the host that injects this message on local stdin ('bypass' for sessions that run tools without asking, 'prompting' otherwise). Lets the recipient deliver a same-class message immediately while a cross-class or undeclared sender is still held at a recipient that runs without asking. Honored only from the injecting host on local stdin; absent when the host does not declare it.
|
|
4325
|
+
*/
|
|
4326
|
+
fromMode?: 'bypass' | 'prompting';
|
|
4286
4327
|
/**
|
|
4287
4328
|
* Sender display name, normalized by the harness: Unicode control, format, surrogate, and line/paragraph-separator code points stripped (categories Cc/Cf/Cs/Zl/Zp — covers bidi controls, zero-width characters, and tag characters), trimmed, at most 64 code points (+ ellipsis, never splitting a surrogate pair). Sender-asserted display text (the addressable identity is `from`) — render it as reported speech, but no client-side character sanitization is needed. Absent when the wire is not exactly one harness-formed envelope and on messages from older senders.
|
|
4288
4329
|
*/
|
|
@@ -4359,6 +4400,7 @@ export declare type SDKModelRefusalFallbackMessage = {
|
|
|
4359
4400
|
* The refusal category ('cyber', 'bio', …): stop_details.category from the refused API response (client lane), or the fallback block's server-gated trigger.category (server lane). Open string — new categories ship on the wire ahead of schema updates. null when neither source carried a category (normal, not an error). Absent when emitted by an older CLI.
|
|
4360
4401
|
*/
|
|
4361
4402
|
api_refusal_category?: string | null;
|
|
4403
|
+
|
|
4362
4404
|
/**
|
|
4363
4405
|
* stop_details.explanation from the refused API response (client lane only — the server-lane trigger carries no explanation). Unstable human prose — display only, never parse. null/absent when the response carried none, and always null on server-lane banners.
|
|
4364
4406
|
*/
|
|
@@ -4407,8 +4449,14 @@ export declare type SDKNotificationMessage = {
|
|
|
4407
4449
|
session_id: string;
|
|
4408
4450
|
};
|
|
4409
4451
|
|
|
4452
|
+
/**
|
|
4453
|
+
* An incremental streaming event for the assistant message being generated, emitted only when partial messages are requested (--include-partial-messages). The complete assistant message still follows as its own message.
|
|
4454
|
+
*/
|
|
4410
4455
|
export declare type SDKPartialAssistantMessage = {
|
|
4411
4456
|
type: 'stream_event';
|
|
4457
|
+
/**
|
|
4458
|
+
* One Anthropic Messages API streaming event (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop) as defined for the streaming Messages API.
|
|
4459
|
+
*/
|
|
4412
4460
|
event: BetaRawMessageStreamEvent;
|
|
4413
4461
|
parent_tool_use_id: string | null;
|
|
4414
4462
|
uuid: UUID;
|
|
@@ -4556,6 +4604,9 @@ export declare type SDKResultError = {
|
|
|
4556
4604
|
session_id: string;
|
|
4557
4605
|
};
|
|
4558
4606
|
|
|
4607
|
+
/**
|
|
4608
|
+
* The outcome of a turn. The CLI emits exactly one result message per turn, after that turn's assistant, user and stream_event messages; treat it as the turn-complete signal (informational system messages such as task notifications, session state changes or prompt suggestions may still follow it). subtype "success" carries the final assistant text in result — or, with is_error true, the error text when the turn ended on an API error; the error subtypes say why the turn stopped early. In single-prompt (non-streaming-input) mode the process exits after the turn.
|
|
4609
|
+
*/
|
|
4559
4610
|
export declare type SDKResultMessage = SDKResultSuccess | SDKResultError;
|
|
4560
4611
|
|
|
4561
4612
|
export declare type SDKResultSuccess = {
|
|
@@ -4683,14 +4734,21 @@ export declare type SDKStatusMessage = {
|
|
|
4683
4734
|
permissionMode?: PermissionMode;
|
|
4684
4735
|
compact_result?: 'success' | 'failed';
|
|
4685
4736
|
compact_error?: string;
|
|
4737
|
+
|
|
4686
4738
|
uuid: UUID;
|
|
4687
4739
|
session_id: string;
|
|
4688
4740
|
};
|
|
4689
4741
|
|
|
4742
|
+
/**
|
|
4743
|
+
* Session metadata the CLI emits at the start of each turn, normally ahead of every other message of that turn: session_id, model, working directory, tools, MCP servers, slash commands, permission mode, and the capabilities list for feature detection.
|
|
4744
|
+
*/
|
|
4690
4745
|
export declare type SDKSystemMessage = {
|
|
4691
4746
|
type: 'system';
|
|
4692
4747
|
subtype: 'init';
|
|
4693
4748
|
agents?: string[];
|
|
4749
|
+
/**
|
|
4750
|
+
* Where the credential used for API requests came from: 'ANTHROPIC_API_KEY' (environment variable), 'apiKeyHelper' (the configured helper command), '/login managed key' (an API key created and stored by /login with an Anthropic Console account), or 'none' (no API key in use - e.g. claude.ai OAuth login, a bearer token, or a third-party cloud provider). 'user' | 'project' | 'org' | 'temporary' | 'oauth' are legacy members that current CLIs never emit; they remain only so the type stays backward compatible.
|
|
4751
|
+
*/
|
|
4694
4752
|
apiKeySource: ApiKeySource;
|
|
4695
4753
|
betas?: string[];
|
|
4696
4754
|
claude_code_version: string;
|
|
@@ -4726,6 +4784,10 @@ export declare type SDKSystemMessage = {
|
|
|
4726
4784
|
|
|
4727
4785
|
fast_mode_state?: FastModeState;
|
|
4728
4786
|
fast_mode_disabled_reason?: FastModeDisabledReason;
|
|
4787
|
+
/**
|
|
4788
|
+
* The effort level the session will send on its next request — after env overrides, session state, org caps and model-support downgrades; the same value get_settings reports as applied.effort. null when no effort parameter will be sent (a model without effort, CLAUDE_CODE_EFFORT_LEVEL=unset, or an internal numeric budget). Present on Remote Control bridge init frames (terminal- and Desktop/VS Code-hosted sessions); absent on hosts that do not publish it and on CLIs that predate the field. Re-emitted inits carry the current value — the newest frame wins.
|
|
4789
|
+
*/
|
|
4790
|
+
effort?: ('low' | 'medium' | 'high' | 'xhigh' | 'max') | null;
|
|
4729
4791
|
/**
|
|
4730
4792
|
* Protocol capabilities this CLI supports, so SDK consumers can feature-detect instead of version-sniffing. Open set — ignore unknown values; check each capability for exactly the behavior you use. 'interrupt_receipt_v1' = the interrupt control_response success payload carries still_queued (uuids of async user messages that survive the interrupt). 'interrupt_cancel_queued_v1' = the interrupt control_request honors cancel_queued:true (queued and pending-dispatch commands are cancelled alongside the abort, listed on the response's cancelled field; still_queued is always empty — including any uuid that was mid-fold at the interrupt instant, since this request also aborts and the fold never delivers it). 'queued_notifications' = the CLI accepts inbound queued_notification stream messages and drains them via ReadNotifications (the CCR backend reads this from the persisted init event to decide whether it may send them). Absent on older CLIs.
|
|
4731
4793
|
*/
|
|
@@ -4733,6 +4795,8 @@ export declare type SDKSystemMessage = {
|
|
|
4733
4795
|
|
|
4734
4796
|
|
|
4735
4797
|
|
|
4798
|
+
|
|
4799
|
+
|
|
4736
4800
|
uuid: UUID;
|
|
4737
4801
|
session_id: string;
|
|
4738
4802
|
};
|
|
@@ -4862,8 +4926,14 @@ export declare type SDKToolUseSummaryMessage = {
|
|
|
4862
4926
|
|
|
4863
4927
|
};
|
|
4864
4928
|
|
|
4929
|
+
/**
|
|
4930
|
+
* A user-role message. A client writes one to the CLI to submit a prompt (this starts a turn); the CLI emits them for user-role content it adds to the conversation itself, chiefly the tool_result blocks answering the assistant's tool_use blocks.
|
|
4931
|
+
*/
|
|
4865
4932
|
export declare type SDKUserMessage = {
|
|
4866
4933
|
type: 'user';
|
|
4934
|
+
/**
|
|
4935
|
+
* An Anthropic Messages API user message: a MessageParam with role "user" whose content is a string or an array of content blocks (text, image, document, tool_result, ...). See the Messages API reference for the block types.
|
|
4936
|
+
*/
|
|
4867
4937
|
message: MessageParam;
|
|
4868
4938
|
parent_tool_use_id: string | null;
|
|
4869
4939
|
isSynthetic?: boolean;
|
|
@@ -4896,6 +4966,7 @@ export declare type SDKUserMessage = {
|
|
|
4896
4966
|
|
|
4897
4967
|
|
|
4898
4968
|
|
|
4969
|
+
|
|
4899
4970
|
uuid?: UUID;
|
|
4900
4971
|
session_id?: string;
|
|
4901
4972
|
/**
|
|
@@ -4910,6 +4981,9 @@ export declare type SDKUserMessage = {
|
|
|
4910
4981
|
|
|
4911
4982
|
export declare type SDKUserMessageReplay = {
|
|
4912
4983
|
type: 'user';
|
|
4984
|
+
/**
|
|
4985
|
+
* An Anthropic Messages API user message: a MessageParam with role "user" whose content is a string or an array of content blocks (text, image, document, tool_result, ...). See the Messages API reference for the block types.
|
|
4986
|
+
*/
|
|
4913
4987
|
message: MessageParam;
|
|
4914
4988
|
parent_tool_use_id: string | null;
|
|
4915
4989
|
isSynthetic?: boolean;
|
|
@@ -4942,6 +5016,7 @@ export declare type SDKUserMessageReplay = {
|
|
|
4942
5016
|
|
|
4943
5017
|
|
|
4944
5018
|
|
|
5019
|
+
|
|
4945
5020
|
uuid: UUID;
|
|
4946
5021
|
session_id: string;
|
|
4947
5022
|
isReplay: true;
|
|
@@ -5277,6 +5352,10 @@ export declare interface Settings {
|
|
|
5277
5352
|
* Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely.
|
|
5278
5353
|
*/
|
|
5279
5354
|
cleanupPeriodDays?: number;
|
|
5355
|
+
/**
|
|
5356
|
+
* Set to false to turn off syncing of the skills you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced skills (~/.claude/skills/synced) can no longer be run, are hidden from every session started afterwards, and are moved to ~/.claude/skills/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced skills are blocked and hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced skills are available in every session, re-synced every 10 minutes, and removed when you disable them on claude.ai. Only applies when signed in with your Claude account.
|
|
5357
|
+
*/
|
|
5358
|
+
syncClaudeAiSkills?: boolean;
|
|
5280
5359
|
/**
|
|
5281
5360
|
* Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost.
|
|
5282
5361
|
*/
|
|
@@ -6018,7 +6097,7 @@ export declare interface Settings {
|
|
|
6018
6097
|
};
|
|
6019
6098
|
};
|
|
6020
6099
|
/**
|
|
6021
|
-
* Alias for extraKnownMarketplaces: this key is read exactly as if it were spelled extraKnownMarketplaces. Do not set both in one file — if both appear, this key is ignored with a warning. Claude Code may rewrite this key as extraKnownMarketplaces when it updates the file. Clients older than this alias ignore it
|
|
6100
|
+
* Alias for extraKnownMarketplaces: this key is read exactly as if it were spelled extraKnownMarketplaces. Do not set both in one file — if both appear, this key is ignored with a warning. Claude Code may rewrite this key as extraKnownMarketplaces when it updates the file. Clients older than this alias ignore it, so prefer extraKnownMarketplaces while older Claude Code versions still share the same settings.
|
|
6022
6101
|
*/
|
|
6023
6102
|
additionalMarketplaces?: {
|
|
6024
6103
|
[k: string]: {
|
|
@@ -7439,6 +7518,10 @@ export declare interface Settings {
|
|
|
7439
7518
|
* When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead.
|
|
7440
7519
|
*/
|
|
7441
7520
|
switchModelsOnFlag?: boolean;
|
|
7521
|
+
/**
|
|
7522
|
+
* When a claude.ai usage limit stops your session, wait for the limit to reset and continue the task automatically. When off, the limit dialog offers the wait as a choice instead.
|
|
7523
|
+
*/
|
|
7524
|
+
autoContinueAtUsageLimit?: boolean;
|
|
7442
7525
|
/**
|
|
7443
7526
|
* Auto-scroll the conversation view to bottom (fullscreen mode only)
|
|
7444
7527
|
*/
|
|
@@ -7653,6 +7736,9 @@ export declare function startup(_params?: {
|
|
|
7653
7736
|
initializeTimeoutMs?: number;
|
|
7654
7737
|
}): Promise<WarmQuery>;
|
|
7655
7738
|
|
|
7739
|
+
/**
|
|
7740
|
+
* Everything the CLI writes to its output stream (stdout in stream-json mode): exactly one StdoutMessage per line, as a single JSON object. Besides the SDKMessage members this includes the control protocol - control requests the CLI originates, control responses to the client's requests, cancellations and keep-alives.
|
|
7741
|
+
*/
|
|
7656
7742
|
declare type StdoutMessage = coreTypes.SDKMessage | coreTypes.SDKActiveGoalMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage;
|
|
7657
7743
|
|
|
7658
7744
|
export declare type StopFailureHookInput = BaseHookInput & {
|
|
@@ -7987,9 +8073,9 @@ export declare type UserPromptSubmitHookInput = BaseHookInput & {
|
|
|
7987
8073
|
hook_event_name: 'UserPromptSubmit';
|
|
7988
8074
|
prompt: string;
|
|
7989
8075
|
/**
|
|
7990
|
-
* Who authored/injected the prompt: `user` = submitted from the interactive composer, `sdk` = non-interactive entrypoint (`-p` / Agent SDK), `loop_wakeup` = dynamic /loop wakeup, `schedule_wakeup` = scheduled-task fire (CronCreate/routine), `system` = other machine-injected turns (peer/channel messages, task notifications, auto-continuation). Currently only set for Anthropic-internal sessions while the field is trialed; external payloads omit it.
|
|
8076
|
+
* Who authored/injected the prompt: `user` = submitted from the interactive composer, `sdk` = non-interactive entrypoint (`-p` / Agent SDK), `loop_wakeup` = dynamic /loop wakeup, `schedule_wakeup` = scheduled-task fire (CronCreate/routine), `system` = other machine-injected turns (peer/channel messages, task notifications, auto-continuation), `poll_event` = the poll-event channel enqueue-time pass (the hook fires when the host submits an event, before its delivery ack exists — a blocking verdict rejects the event). Currently only set for Anthropic-internal sessions while the field is trialed; external payloads omit it.
|
|
7991
8077
|
*/
|
|
7992
|
-
source?: 'user' | 'sdk' | 'system' | 'loop_wakeup' | 'schedule_wakeup';
|
|
8078
|
+
source?: 'user' | 'sdk' | 'system' | 'loop_wakeup' | 'schedule_wakeup' | 'poll_event';
|
|
7993
8079
|
session_title?: string;
|
|
7994
8080
|
};
|
|
7995
8081
|
|