@anthropic-ai/claude-agent-sdk 0.3.268 → 0.3.269
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 +104 -104
- package/browser-sdk.js +50 -50
- package/manifest.json +50 -21
- package/manifest.zst.json +54 -25
- package/package.json +10 -10
- package/sdk-tools.d.ts +16 -1
- package/sdk.d.ts +261 -18
- package/sdk.mjs +78 -78
package/sdk.d.ts
CHANGED
|
@@ -2681,26 +2681,26 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
2681
2681
|
*/
|
|
2682
2682
|
setMaxThinkingTokens(maxThinkingTokens: number | null, thinkingDisplay?: 'summarized' | 'omitted' | null): Promise<void>;
|
|
2683
2683
|
/**
|
|
2684
|
-
* Merge
|
|
2685
|
-
*
|
|
2686
|
-
*
|
|
2687
|
-
* user/project/local settings and below managed policy settings in the
|
|
2688
|
-
* precedence order.
|
|
2684
|
+
* Merge settings into the flag settings layer. This is the inline `settings`
|
|
2685
|
+
* option of `query()`, applied mid-session. Flag settings sit above
|
|
2686
|
+
* user/project/local and below managed policy settings in precedence order.
|
|
2689
2687
|
*
|
|
2690
2688
|
* Successive calls shallow-merge top-level keys — a second call with
|
|
2691
2689
|
* `{permissions: {...}}` replaces the entire `permissions` object from a
|
|
2692
2690
|
* prior call. Pass `null` for a key to clear it from the flag layer and
|
|
2693
2691
|
* fall back to lower-precedence sources (`undefined` is dropped by JSON
|
|
2694
|
-
* serialization and has no effect).
|
|
2695
|
-
*
|
|
2692
|
+
* serialization and has no effect). Four keys instead reset session state
|
|
2693
|
+
* and restore neither a `query()` option nor a settings-file value.
|
|
2694
|
+
* `effortLevel` goes to the model's default effort, `model` to Claude Code's
|
|
2695
|
+
* default model (not `ANTHROPIC_MODEL` or `settings.model`), `agent` to no
|
|
2696
|
+
* main-thread agent, and `ultracode` to off with the current effort kept.
|
|
2696
2697
|
* Only available in streaming input mode.
|
|
2697
2698
|
*
|
|
2698
|
-
* @param settings - A partial settings object to merge into the flag
|
|
2699
|
-
*
|
|
2700
|
-
*
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
* {@link Settings.effortLevel} excludes it for that reason).
|
|
2699
|
+
* @param settings - A partial settings object to merge into the flag
|
|
2700
|
+
* settings. `effortLevel` also accepts `'max'` (never written to settings
|
|
2701
|
+
* files, so the persisted {@link Settings.effortLevel} excludes it): it is
|
|
2702
|
+
* session-only, runs as `'high'` on a model without `'max'` support, and
|
|
2703
|
+
* runs no higher than the organization's effort limit for the model.
|
|
2704
2704
|
*/
|
|
2705
2705
|
applyFlagSettings(settings: {
|
|
2706
2706
|
[K in keyof Settings]?: K extends 'effortLevel' ? EffortLevel | null : Settings[K] | null;
|
|
@@ -2806,6 +2806,7 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
2806
2806
|
usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(opts?: {
|
|
2807
2807
|
skipBehaviors?: boolean;
|
|
2808
2808
|
}): Promise<SDKControlGetUsageResponse>;
|
|
2809
|
+
|
|
2809
2810
|
/**
|
|
2810
2811
|
* Read a file from the session's filesystem for the remote sidebar
|
|
2811
2812
|
* viewer. Path is resolved against cwd and gated by the same
|
|
@@ -3348,7 +3349,7 @@ export declare type SDKAssistantMessage = {
|
|
|
3348
3349
|
session_id: string;
|
|
3349
3350
|
request_id?: string;
|
|
3350
3351
|
/**
|
|
3351
|
-
* Client uuid of the user message this turn is answering (submitMessage options.uuid), stamped on
|
|
3352
|
+
* Client uuid of the user message this turn is answering (submitMessage options.uuid), stamped on an assistant message each time that send changes — the turn's FIRST top-level assistant message (which may carry only a thinking block, or be a synthetic API-error message), and then, for a turn started by a synthetic (meta) prompt, the first assistant message after each queued user message folded in mid-turn (the fold takes the echo over); with --include-partial-messages the turn's first non-ping stream event is stamped too, independently (see SDKPartialAssistantMessage), so the same uuid may appear on both — either binds the reply to the send it answers without waiting for the result; the server keeps the first stamp it sees per uuid. A turn started by a typed prompt keeps that uuid for its whole turn, so it stamps once per frame kind. A meta turn's own uuid is stamped only when the host vouches it is the client event's own (on a hosted session, the uuid the session server persisted: delivered content such as a Slack owner ping, a Slack-bot observation or a client-injected synthetic turn), never for a prompt the CLI minted itself — except that the boot-time rescue turn re-running a turn a worker restart interrupted mid-way stamps the interrupted turn's own last user prompt (with resume_reason), the send that re-run answers; either way a user message folded into a meta turn takes the echo over from it (the rescue turn absorbing messages sent while the session was down; a bot-observation turn absorbing a human's post), and the first reply frame of each kind after that fold carries the folded message's uuid — the first reply that message got. Wrapper-level sibling — never inside `message.content` — so it is not replayed to the model. Absent on every other frame of the turn, on subagent frames (parent_tool_use_id set), on turns that neither had a client uuid nor folded a user message in, and from older producers.
|
|
3352
3353
|
*/
|
|
3353
3354
|
user_message_uuid?: string;
|
|
3354
3355
|
/**
|
|
@@ -3758,6 +3759,151 @@ export declare type SDKControlGetContextUsageResponse = {
|
|
|
3758
3759
|
} | null;
|
|
3759
3760
|
};
|
|
3760
3761
|
|
|
3762
|
+
/**
|
|
3763
|
+
* Returns the hooks listing the CLI's read-only /hooks menu renders: settings-file, session, and plugin hooks grouped by event and matcher, with display-ready strings (control characters revealed) and the policy and safe-mode state the menu banners on. A snapshot at request time; hosts re-request when their surface opens.
|
|
3764
|
+
*/
|
|
3765
|
+
declare type SDKControlGetHooksListingRequest = {
|
|
3766
|
+
subtype: 'get_hooks_listing';
|
|
3767
|
+
};
|
|
3768
|
+
|
|
3769
|
+
/**
|
|
3770
|
+
* The hooks listing the CLI's /hooks menu renders, with display-ready strings.
|
|
3771
|
+
*/
|
|
3772
|
+
declare type SDKControlGetHooksListingResponse = {
|
|
3773
|
+
/**
|
|
3774
|
+
* Events that have at least one listed hook, in the /hooks menu’s lifecycle order.
|
|
3775
|
+
*/
|
|
3776
|
+
events: {
|
|
3777
|
+
/**
|
|
3778
|
+
* Hook event name.
|
|
3779
|
+
*/
|
|
3780
|
+
name: string;
|
|
3781
|
+
/**
|
|
3782
|
+
* One-line summary, as the /hooks event list shows.
|
|
3783
|
+
*/
|
|
3784
|
+
summary: string;
|
|
3785
|
+
/**
|
|
3786
|
+
* Whether hooks on this event can carry a matcher.
|
|
3787
|
+
*/
|
|
3788
|
+
supportsMatcher: boolean;
|
|
3789
|
+
/**
|
|
3790
|
+
* Number of listed hooks.
|
|
3791
|
+
*/
|
|
3792
|
+
hookCount: number;
|
|
3793
|
+
}[];
|
|
3794
|
+
/**
|
|
3795
|
+
* One row per listed hook: events in lifecycle order, matchers in the menu’s priority order.
|
|
3796
|
+
*/
|
|
3797
|
+
hooks: {
|
|
3798
|
+
event: string;
|
|
3799
|
+
/**
|
|
3800
|
+
* Matcher with control characters revealed; '' when the entry has none.
|
|
3801
|
+
*/
|
|
3802
|
+
matcher: string;
|
|
3803
|
+
/**
|
|
3804
|
+
* Raw source name (userSettings, sessionHook, pluginHook, …).
|
|
3805
|
+
*/
|
|
3806
|
+
source: string;
|
|
3807
|
+
/**
|
|
3808
|
+
* User-facing source description.
|
|
3809
|
+
*/
|
|
3810
|
+
sourceLabel: string;
|
|
3811
|
+
pluginName?: string;
|
|
3812
|
+
/**
|
|
3813
|
+
* Hook type (command, prompt, agent, http, mcp_tool, …).
|
|
3814
|
+
*/
|
|
3815
|
+
type: string;
|
|
3816
|
+
/**
|
|
3817
|
+
* List-row label: statusMessage when set, else the identity text; one line, control characters revealed.
|
|
3818
|
+
*/
|
|
3819
|
+
displayText: string;
|
|
3820
|
+
/**
|
|
3821
|
+
* Identity text — the literal command/prompt/URL that runs, control characters revealed.
|
|
3822
|
+
*/
|
|
3823
|
+
commandText: string;
|
|
3824
|
+
/**
|
|
3825
|
+
* Label for commandText (Command, Prompt, URL, …).
|
|
3826
|
+
*/
|
|
3827
|
+
contentLabel: string;
|
|
3828
|
+
/**
|
|
3829
|
+
* If-condition, revealed, when set.
|
|
3830
|
+
*/
|
|
3831
|
+
condition?: string;
|
|
3832
|
+
/**
|
|
3833
|
+
* Timeout in seconds.
|
|
3834
|
+
*/
|
|
3835
|
+
timeout?: number;
|
|
3836
|
+
statusMessage?: string;
|
|
3837
|
+
runsOnce?: boolean;
|
|
3838
|
+
runsInBackground?: boolean;
|
|
3839
|
+
/**
|
|
3840
|
+
* True when the session's mode or policy keeps this hook from running (the policy block and safeMode/bareMode say why); absent on rows that run.
|
|
3841
|
+
*/
|
|
3842
|
+
disabled?: true;
|
|
3843
|
+
/**
|
|
3844
|
+
* The entry as stored (raw matcher, '' when none, and raw hook object; no display escaping) for a host's edit form and as the target it names to `claude edit-hook`. Only on rows from a settings file this session reads and may write. HTTP header values are blanked (headersRedacted); a replace that sends no headers keeps the stored ones.
|
|
3845
|
+
*/
|
|
3846
|
+
editable?: {
|
|
3847
|
+
matcher: string;
|
|
3848
|
+
config: Record<string, unknown>;
|
|
3849
|
+
headersRedacted?: true;
|
|
3850
|
+
};
|
|
3851
|
+
}[];
|
|
3852
|
+
/**
|
|
3853
|
+
* Every hook event in lifecycle order (name, the /hooks summary, whether its hooks take a matcher), for an add-hook form.
|
|
3854
|
+
*/
|
|
3855
|
+
eventCatalog: {
|
|
3856
|
+
name: string;
|
|
3857
|
+
summary: string;
|
|
3858
|
+
supportsMatcher: boolean;
|
|
3859
|
+
}[];
|
|
3860
|
+
policy: {
|
|
3861
|
+
/**
|
|
3862
|
+
* Managed disableAllHooks — nothing runs at all.
|
|
3863
|
+
*/
|
|
3864
|
+
disabledByPolicy: boolean;
|
|
3865
|
+
/**
|
|
3866
|
+
* Managed allowManagedHooksOnly — non-managed hooks are blocked and managed hooks are intentionally not listed.
|
|
3867
|
+
*/
|
|
3868
|
+
managedOnly: boolean;
|
|
3869
|
+
/**
|
|
3870
|
+
* Managed strictPluginOnlyCustomization locks the hooks surface.
|
|
3871
|
+
*/
|
|
3872
|
+
pluginOnly: boolean;
|
|
3873
|
+
/**
|
|
3874
|
+
* Effective disableAllHooks, whatever source set it.
|
|
3875
|
+
*/
|
|
3876
|
+
allDisabled: boolean;
|
|
3877
|
+
/**
|
|
3878
|
+
* Hooks configured in managed settings (they run even under a non-managed disableAllHooks).
|
|
3879
|
+
*/
|
|
3880
|
+
policyHookCount: number;
|
|
3881
|
+
};
|
|
3882
|
+
/**
|
|
3883
|
+
* Present only when the session runs under --safe-mode.
|
|
3884
|
+
*/
|
|
3885
|
+
safeMode?: {
|
|
3886
|
+
managedHooksStillApply: boolean;
|
|
3887
|
+
/**
|
|
3888
|
+
* How to leave safe mode, per its activation source.
|
|
3889
|
+
*/
|
|
3890
|
+
exitHint: string;
|
|
3891
|
+
};
|
|
3892
|
+
/**
|
|
3893
|
+
* Present only under --bare / CLAUDE_CODE_SIMPLE with the hooks surface gated off: settings-file, flag, policy, and plugin hooks never fire there; session hooks still run.
|
|
3894
|
+
*/
|
|
3895
|
+
bareMode?: {
|
|
3896
|
+
/**
|
|
3897
|
+
* How to leave bare mode, per its activation source.
|
|
3898
|
+
*/
|
|
3899
|
+
exitHint: string;
|
|
3900
|
+
};
|
|
3901
|
+
/**
|
|
3902
|
+
* Settings files skipped by the merge — their hooks are neither listed nor running.
|
|
3903
|
+
*/
|
|
3904
|
+
errors?: coreTypes.SDKSettingsParseError[];
|
|
3905
|
+
};
|
|
3906
|
+
|
|
3761
3907
|
/**
|
|
3762
3908
|
* 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.
|
|
3763
3909
|
*/
|
|
@@ -3861,7 +4007,7 @@ export declare type SDKControlGetUsageResponse = {
|
|
|
3861
4007
|
resets_at: string | null;
|
|
3862
4008
|
} | null;
|
|
3863
4009
|
/**
|
|
3864
|
-
* Per-model weekly windows from the server limits[] array, filtered by the overage-included-models allowlist. Additive
|
|
4010
|
+
* Per-model weekly windows from the server limits[] array, filtered by the overage-included-models allowlist. Additive: absent when nothing is known about them (an answer served from cached data, or rows the allowlist hides); an empty array means the endpoint itself answered and listed no per-model weekly window at all for this account, before the allowlist was applied.
|
|
3865
4011
|
*/
|
|
3866
4012
|
model_scoped?: {
|
|
3867
4013
|
/**
|
|
@@ -4114,6 +4260,7 @@ export declare type SDKControlInitializeResponse = {
|
|
|
4114
4260
|
|
|
4115
4261
|
|
|
4116
4262
|
|
|
4263
|
+
|
|
4117
4264
|
};
|
|
4118
4265
|
|
|
4119
4266
|
/**
|
|
@@ -4149,6 +4296,23 @@ declare type SDKControlListModelsRequest = {
|
|
|
4149
4296
|
subtype: 'list_models';
|
|
4150
4297
|
};
|
|
4151
4298
|
|
|
4299
|
+
/**
|
|
4300
|
+
* Requests the session's live permission rules and workspace directories — the same data /permissions lists in the terminal: rules from settings files plus session-only approvals, slash-command grants, and --allowedTools flag rules, each with its source.
|
|
4301
|
+
*/
|
|
4302
|
+
declare type SDKControlListPermissionRulesRequest = {
|
|
4303
|
+
subtype: 'list_permission_rules';
|
|
4304
|
+
};
|
|
4305
|
+
|
|
4306
|
+
/**
|
|
4307
|
+
* Success payload of list_permission_rules.
|
|
4308
|
+
*/
|
|
4309
|
+
export declare type SDKControlListPermissionRulesResponse = {
|
|
4310
|
+
/**
|
|
4311
|
+
* The session's live permission rules state, as list_permission_rules reports it.
|
|
4312
|
+
*/
|
|
4313
|
+
state: SDKControlPermissionRulesState;
|
|
4314
|
+
};
|
|
4315
|
+
|
|
4152
4316
|
/**
|
|
4153
4317
|
* Invokes an MCP tool via the subprocess MCP client without a model turn. No permission check (control channel is trusted, same as other subtypes). SDK-type MCP servers (config.type === "sdk") are rejected — they are caller-provided, so the caller can invoke them directly without the subprocess round-trip. Result content passes through the same processing as model-turn MCP calls. Session expiry is not retried automatically; callers can mcp_reconnect and retry. UrlElicitationRequired (-32042) tries Elicitation hooks; if no hook resolves, the call errors with the URL in the message — open it out-of-band, then retry mcp_call. STAGED calls (input_files/output_files declared) additionally stage lane rows in/out around the call — see the input_files describe. Staged failures come back as a success-subtype response whose staging field carries a typed error_code; subtype:error is emitted only when the call could not be attempted at all (server not connected, kill switch, dispatch failure) and means nothing ran. A target server that is not yet connected is brought up on demand: dispatch runs the deferred plugin/MCP startup resolution (the work a first model turn would have done) and waits up to 30s — shortened by expires_at when that is sooner — for the server to connect before answering "MCP server not connected", so a dispatch that races plugin startup (e.g. after an idle-wake reattach) succeeds instead of failing until a turn runs. Standard RPC semantics: a redelivered request_id supersedes the in-flight run (it is aborted and its response suppressed — exactly one response per request_id); conversion is idempotent, so re-running is safe. Cancellable via control_cancel_request.
|
|
4154
4318
|
*/
|
|
@@ -4295,6 +4459,26 @@ declare type SDKControlPermissionRequest = {
|
|
|
4295
4459
|
|
|
4296
4460
|
};
|
|
4297
4461
|
|
|
4462
|
+
/**
|
|
4463
|
+
* The session's live permission rules state, as list_permission_rules reports it.
|
|
4464
|
+
*/
|
|
4465
|
+
export declare type SDKControlPermissionRulesState = {
|
|
4466
|
+
rules: SDKPermissionRuleEntry[];
|
|
4467
|
+
workspaceDirectories: SDKPermissionWorkspaceDirectory[];
|
|
4468
|
+
/**
|
|
4469
|
+
* The session's original working directory.
|
|
4470
|
+
*/
|
|
4471
|
+
originalCwd: string;
|
|
4472
|
+
/**
|
|
4473
|
+
* True when enterprise managed settings pin allowManagedPermissionRulesOnly: the session applies policy rules only, and rules from other settings files appear with notInEffect set.
|
|
4474
|
+
*/
|
|
4475
|
+
managedOnly: boolean;
|
|
4476
|
+
/**
|
|
4477
|
+
* Settings parse and validation errors, as get_settings reports them. When non-empty, the listed files were skipped — their rules are not in the session and not listed above.
|
|
4478
|
+
*/
|
|
4479
|
+
errors?: coreTypes.SDKSettingsParseError[];
|
|
4480
|
+
};
|
|
4481
|
+
|
|
4298
4482
|
/**
|
|
4299
4483
|
* Read a file from the session filesystem for the remote sidebar viewer. Path is resolved against cwd and gated by the same read-permission rules as the Read tool.
|
|
4300
4484
|
*/
|
|
@@ -4408,6 +4592,14 @@ export declare type SDKControlReloadSkillsResponse = {
|
|
|
4408
4592
|
declare type SDKControlRenameSessionRequest = {
|
|
4409
4593
|
subtype: 'rename_session';
|
|
4410
4594
|
title: string;
|
|
4595
|
+
/**
|
|
4596
|
+
* Who chose the title: 'remote' (the default) for a rename made on claude.ai and relayed to this process, 'host' for one the user made in the hosting application (an IDE), which the CLI counts as a user rename.
|
|
4597
|
+
*/
|
|
4598
|
+
source?: 'remote' | 'host';
|
|
4599
|
+
/**
|
|
4600
|
+
* The session the title is for. When given and this process has since moved to another session (/clear, an in-session resume), the request is refused instead of naming the new session.
|
|
4601
|
+
*/
|
|
4602
|
+
session_id?: string;
|
|
4411
4603
|
};
|
|
4412
4604
|
|
|
4413
4605
|
/**
|
|
@@ -4424,7 +4616,7 @@ export declare type SDKControlRequest = {
|
|
|
4424
4616
|
|
|
4425
4617
|
};
|
|
4426
4618
|
|
|
4427
|
-
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 | SDKControlReloadOutputStylesRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlStopTaskRequest | SDKControlBackgroundTasksRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlUpdateSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
4619
|
+
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 | SDKControlReloadOutputStylesRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlStopTaskRequest | SDKControlBackgroundTasksRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlGetHooksListingRequest | SDKControlUpdateSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest | SDKControlListPermissionRulesRequest;
|
|
4428
4620
|
|
|
4429
4621
|
/**
|
|
4430
4622
|
* 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.
|
|
@@ -4906,7 +5098,7 @@ export declare type SDKPartialAssistantMessage = {
|
|
|
4906
5098
|
session_id: string;
|
|
4907
5099
|
ttft_ms?: number;
|
|
4908
5100
|
/**
|
|
4909
|
-
* Client uuid of the user message this turn is answering (submitMessage options.uuid), stamped on a non-ping stream event each time that send changes: the turn's FIRST non-ping stream event (normally the frame that triggers the turn's initial ack), and, for a turn started by a synthetic (meta) prompt, the first non-ping stream event after each queued user message folded in mid-turn takes the echo over (see SDKAssistantMessage.user_message_uuid for the rule) — so a consumer can bind the reply stream to the send it answers without waiting for the result. A turn started by a typed prompt stamps its first non-ping stream event
|
|
5101
|
+
* Client uuid of the user message this turn is answering (submitMessage options.uuid), stamped on a non-ping stream event each time that send changes: the turn's FIRST non-ping stream event (normally the frame that triggers the turn's initial ack), and, for a turn started by a synthetic (meta) prompt, the first non-ping stream event after each queued user message folded in mid-turn takes the echo over (see SDKAssistantMessage.user_message_uuid for the rule) — so a consumer can bind the reply stream to the send it answers without waiting for the result. A turn started by a typed prompt stamps only its first non-ping stream event; independently, its first complete assistant message is stamped as well (see SDKAssistantMessage.user_message_uuid), so the same uuid may appear on both. Absent on every other stream event of the turn, on turns that neither had a client uuid nor folded a user message in, and from older producers.
|
|
4910
5102
|
*/
|
|
4911
5103
|
user_message_uuid?: string;
|
|
4912
5104
|
/**
|
|
@@ -4926,7 +5118,7 @@ export declare type SDKPermissionDenial = {
|
|
|
4926
5118
|
};
|
|
4927
5119
|
|
|
4928
5120
|
/**
|
|
4929
|
-
* Emitted when a tool call is auto-denied without an interactive permission prompt (e.g. auto-mode classifier, dontAsk mode, headless-agent auto-deny, or a deny rule). With a permission prompt surface (stdio/SDK canUseTool), the 'ask' path surfaces via a can_use_tool control_request and this event covers the 'deny' short-circuit. Without one (bare -p / SDK query() with no canUseTool), 'ask' decisions are terminal, so this event also covers those implicit denials. Best-effort advisory: in rare races a denial can book without a frame or a frame can lack a booking twin — result.permission_denials is the authoritative record. Denials that resolve before canUseTool runs — PreToolUse hook denies,
|
|
5121
|
+
* Emitted when a tool call is auto-denied without an interactive permission prompt (e.g. auto-mode classifier, dontAsk mode, headless-agent auto-deny, or a deny rule). With a permission prompt surface (stdio/SDK canUseTool), the 'ask' path surfaces via a can_use_tool control_request and this event covers the 'deny' short-circuit. Without one (bare -p / SDK query() with no canUseTool), 'ask' decisions are terminal, so this event also covers those implicit denials. Best-effort advisory: in rare races a denial can book without a frame or a frame can lack a booking twin — result.permission_denials is the authoritative record. Denials that resolve before canUseTool runs — PreToolUse hook denies, deny-rule overrides of hook allow/ask decisions, and file-tool calls (Read, Edit, Write) refused by a path-scoped deny rule — are not covered here, and neither is the MCP --permission-prompt-tool surface (the prompt tool is the host there).
|
|
4930
5122
|
*/
|
|
4931
5123
|
export declare type SDKPermissionDeniedMessage = {
|
|
4932
5124
|
type: 'system';
|
|
@@ -4953,6 +5145,53 @@ export declare type SDKPermissionDeniedMessage = {
|
|
|
4953
5145
|
session_id: string;
|
|
4954
5146
|
};
|
|
4955
5147
|
|
|
5148
|
+
/**
|
|
5149
|
+
* The CLI's plain-language reading of a rule (e.g. "Any Bash command starting with npm run"), split into parts so hosts can render the rule-derived fragment the way the terminal does (bold). prefix and suffix are fixed words; emphasis is rule content — apply display hygiene (invisible-character escaping) before rendering it.
|
|
5150
|
+
*/
|
|
5151
|
+
export declare type SDKPermissionRuleDescription = {
|
|
5152
|
+
prefix: string;
|
|
5153
|
+
emphasis?: string;
|
|
5154
|
+
suffix?: string;
|
|
5155
|
+
};
|
|
5156
|
+
|
|
5157
|
+
/**
|
|
5158
|
+
* One permission rule with its provenance and where it lives.
|
|
5159
|
+
*/
|
|
5160
|
+
export declare type SDKPermissionRuleEntry = {
|
|
5161
|
+
behavior: 'allow' | 'deny' | 'ask';
|
|
5162
|
+
/**
|
|
5163
|
+
* Where the rule comes from. Mirrors PermissionRuleSource (permissionRuleLookup.ts PERMISSION_RULE_SOURCES); the parity test in test/cli/headlessControl/listPermissionRules.test.ts keeps the two aligned.
|
|
5164
|
+
*/
|
|
5165
|
+
source: 'userSettings' | 'projectSettings' | 'localSettings' | 'flagSettings' | 'policySettings' | 'cliArg' | 'command' | 'session' | 'toolsNarrowing' | 'mcpServerPolicy' | 'hostCredential';
|
|
5166
|
+
/**
|
|
5167
|
+
* The stored rule string VERBATIM, exactly as the session holds it. Two stored spellings that parse identically each get their own entry. Can carry invisible or control characters by design — escape at display.
|
|
5168
|
+
*/
|
|
5169
|
+
rule: string;
|
|
5170
|
+
/**
|
|
5171
|
+
* Plain-language reading of the rule; absent where the terminal shows no subtitle either.
|
|
5172
|
+
*/
|
|
5173
|
+
description?: SDKPermissionRuleDescription;
|
|
5174
|
+
/**
|
|
5175
|
+
* Where the rule lives: 'persistent' (userSettings/projectSettings/localSettings — saved in a settings file), 'session' (cliArg/session — in memory only, for the rest of this session), or 'readonly' (policySettings/flagSettings/command and every other source — the set the terminal's /permissions treats as read-only). Informational for hosts; this request never changes rules.
|
|
5176
|
+
*/
|
|
5177
|
+
editability: 'persistent' | 'session' | 'readonly';
|
|
5178
|
+
/**
|
|
5179
|
+
* Present (true) when enterprise managed settings pin allowManagedPermissionRulesOnly and this rule, read from a non-policy settings file, is ignored by the session. Such rows are readonly.
|
|
5180
|
+
*/
|
|
5181
|
+
notInEffect?: boolean;
|
|
5182
|
+
};
|
|
5183
|
+
|
|
5184
|
+
/**
|
|
5185
|
+
* One additional working directory in the permission scope.
|
|
5186
|
+
*/
|
|
5187
|
+
export declare type SDKPermissionWorkspaceDirectory = {
|
|
5188
|
+
path: string;
|
|
5189
|
+
/**
|
|
5190
|
+
* Where the directory grant came from: a settings source (e.g. 'localSettings'), 'cliArg' (--add-dir), or 'session' (/add-dir, IDE workspace folders).
|
|
5191
|
+
*/
|
|
5192
|
+
source: string;
|
|
5193
|
+
};
|
|
5194
|
+
|
|
4956
5195
|
/**
|
|
4957
5196
|
* Configuration for loading a plugin.
|
|
4958
5197
|
*/
|
|
@@ -6437,6 +6676,10 @@ export declare interface Settings {
|
|
|
6437
6676
|
* Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).
|
|
6438
6677
|
*/
|
|
6439
6678
|
defaultShell?: 'bash' | 'powershell';
|
|
6679
|
+
/**
|
|
6680
|
+
* Whether the Bash tool shows a diff of the files a Bash command changed (PostToolUse Bash hooks get the changed-file list in tool_response). Set to false to turn that off. Default: on when the Bash tool handles file edits. Only user, flag or policy settings can turn it on outside auto and bypassPermissions modes.
|
|
6681
|
+
*/
|
|
6682
|
+
bashEditDiffEnabled?: boolean;
|
|
6440
6683
|
/**
|
|
6441
6684
|
* How many characters of a successful Bash or PowerShell command's output Claude receives inline (default 30000; values clamp to 4000-128000). Output past this is saved to a file and Claude receives a short preview plus the path. When set, this also replaces BASH_MAX_OUTPUT_LENGTH, which on its own only sizes the read-back window.
|
|
6442
6685
|
*/
|