@anthropic-ai/claude-agent-sdk 0.2.117 → 0.2.119
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/assistant.mjs +90 -90
- package/bridge.mjs +61 -61
- package/browser-sdk.js +22 -22
- package/manifest.json +19 -19
- package/manifest.zst.json +23 -23
- package/package.json +10 -10
- package/sdk-tools.d.ts +0 -21
- package/sdk.d.ts +298 -55
- package/sdk.mjs +42 -42
package/sdk.d.ts
CHANGED
|
@@ -325,6 +325,9 @@ declare namespace coreTypes {
|
|
|
325
325
|
PermissionUpdateDestination,
|
|
326
326
|
PermissionUpdate,
|
|
327
327
|
PostCompactHookInput,
|
|
328
|
+
PostToolBatchHookInput,
|
|
329
|
+
PostToolBatchHookSpecificOutput,
|
|
330
|
+
PostToolBatchToolCall,
|
|
328
331
|
PostToolUseFailureHookInput,
|
|
329
332
|
PostToolUseFailureHookSpecificOutput,
|
|
330
333
|
PostToolUseHookInput,
|
|
@@ -554,6 +557,29 @@ export declare type FileChangedHookSpecificOutput = {
|
|
|
554
557
|
watchPaths?: string[];
|
|
555
558
|
};
|
|
556
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Fold a batch of appended entries into the running summary for `key`.
|
|
562
|
+
*
|
|
563
|
+
* Stores call this from inside `append()` to keep a {@link SessionSummaryEntry}
|
|
564
|
+
* sidecar up to date without re-reading the transcript. `prev` is the previous
|
|
565
|
+
* summary for the same key (or `undefined` for the first append). The returned
|
|
566
|
+
* `data` blob is opaque to the store — persist it verbatim.
|
|
567
|
+
*
|
|
568
|
+
* Set-once fields (`isSidechain`, `createdAt`, `cwd`, `firstPrompt`) freeze on
|
|
569
|
+
* first sight; last-wins fields (`customTitle`, `aiTitle`, `lastPrompt`,
|
|
570
|
+
* `summaryHint`, `gitBranch`, `tag`) overwrite on every appearance.
|
|
571
|
+
*
|
|
572
|
+
* `mtime` is NOT derived from entry timestamps — the adapter MUST stamp it at
|
|
573
|
+
* persist time using the same clock it uses for `listSessions().mtime`. Pass
|
|
574
|
+
* it via `options.mtime`; when omitted, the previous summary's `mtime` is
|
|
575
|
+
* preserved (use this only when re-folding the same sidecar without a new
|
|
576
|
+
* persist). See {@link SessionSummaryEntry.mtime} for the contract.
|
|
577
|
+
* @alpha
|
|
578
|
+
*/
|
|
579
|
+
export declare function foldSessionSummary(prev: SessionSummaryEntry | undefined, key: SessionKey, entries: SessionStoreEntry[], options?: {
|
|
580
|
+
mtime?: number;
|
|
581
|
+
}): SessionSummaryEntry;
|
|
582
|
+
|
|
557
583
|
/**
|
|
558
584
|
* Fork a session into a new branch with fresh UUIDs.
|
|
559
585
|
*
|
|
@@ -684,7 +710,7 @@ export declare type GetSubagentMessagesOptions = {
|
|
|
684
710
|
sessionStore?: SessionStore;
|
|
685
711
|
};
|
|
686
712
|
|
|
687
|
-
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged"];
|
|
713
|
+
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged"];
|
|
688
714
|
|
|
689
715
|
/**
|
|
690
716
|
* Hook callback function for responding to events during execution.
|
|
@@ -703,9 +729,9 @@ export declare interface HookCallbackMatcher {
|
|
|
703
729
|
timeout?: number;
|
|
704
730
|
}
|
|
705
731
|
|
|
706
|
-
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'Notification' | 'UserPromptSubmit' | 'UserPromptExpansion' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PostCompact' | 'PermissionRequest' | 'PermissionDenied' | 'Setup' | 'TeammateIdle' | 'TaskCreated' | 'TaskCompleted' | 'Elicitation' | 'ElicitationResult' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'InstructionsLoaded' | 'CwdChanged' | 'FileChanged';
|
|
732
|
+
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'Notification' | 'UserPromptSubmit' | 'UserPromptExpansion' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PostCompact' | 'PermissionRequest' | 'PermissionDenied' | 'Setup' | 'TeammateIdle' | 'TaskCreated' | 'TaskCompleted' | 'Elicitation' | 'ElicitationResult' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'InstructionsLoaded' | 'CwdChanged' | 'FileChanged';
|
|
707
733
|
|
|
708
|
-
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput;
|
|
734
|
+
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PostToolBatchHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput;
|
|
709
735
|
|
|
710
736
|
export declare type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
|
|
711
737
|
|
|
@@ -774,6 +800,8 @@ export declare type InferShape<T extends AnyZodRawShape> = {
|
|
|
774
800
|
export declare class InMemorySessionStore implements SessionStore {
|
|
775
801
|
private store;
|
|
776
802
|
private mtimes;
|
|
803
|
+
private summaries;
|
|
804
|
+
private lastMtime;
|
|
777
805
|
private keyToString;
|
|
778
806
|
append(key: SessionKey, entries: SessionStoreEntry[]): Promise<void>;
|
|
779
807
|
load(key: SessionKey): Promise<SessionStoreEntry[] | null>;
|
|
@@ -781,6 +809,7 @@ export declare class InMemorySessionStore implements SessionStore {
|
|
|
781
809
|
sessionId: string;
|
|
782
810
|
mtime: number;
|
|
783
811
|
}>>;
|
|
812
|
+
listSessionSummaries(projectKey: string): Promise<SessionSummaryEntry[]>;
|
|
784
813
|
delete(key: SessionKey): Promise<void>;
|
|
785
814
|
listSubkeys(key: {
|
|
786
815
|
projectKey: string;
|
|
@@ -1314,6 +1343,7 @@ export declare type Options = {
|
|
|
1314
1343
|
* When true, `SDKPartialAssistantMessage` events will be emitted during streaming.
|
|
1315
1344
|
*/
|
|
1316
1345
|
includePartialMessages?: boolean;
|
|
1346
|
+
|
|
1317
1347
|
/**
|
|
1318
1348
|
* Controls Claude's thinking/reasoning behavior.
|
|
1319
1349
|
*
|
|
@@ -1415,6 +1445,13 @@ export declare type Options = {
|
|
|
1415
1445
|
* - `'dontAsk'` - Don't prompt for permissions, deny if not pre-approved
|
|
1416
1446
|
*/
|
|
1417
1447
|
permissionMode?: PermissionMode;
|
|
1448
|
+
/**
|
|
1449
|
+
* Custom workflow instructions for plan mode. When `permissionMode` is
|
|
1450
|
+
* `'plan'`, this string replaces the default code-implementation workflow
|
|
1451
|
+
* body in the plan-mode system reminder. The CLI still wraps it with the
|
|
1452
|
+
* read-only enforcement preamble and the ExitPlanMode protocol footer.
|
|
1453
|
+
*/
|
|
1454
|
+
planModeInstructions?: string;
|
|
1418
1455
|
/**
|
|
1419
1456
|
* Must be set to `true` when using `permissionMode: 'bypassPermissions'`.
|
|
1420
1457
|
* This is a safety measure to ensure intentional bypassing of permissions.
|
|
@@ -1542,13 +1579,36 @@ export declare type Options = {
|
|
|
1542
1579
|
* ```
|
|
1543
1580
|
*/
|
|
1544
1581
|
settings?: string | Settings;
|
|
1582
|
+
/**
|
|
1583
|
+
* Policy-tier settings supplied by the spawning parent process. Merged into
|
|
1584
|
+
* the managed-settings layer below IT-controlled sources (server / MDM /
|
|
1585
|
+
* managed-settings.json) but above HKCU. Honors policy-only keys such as
|
|
1586
|
+
* `sandbox.network.allowManagedDomainsOnly`.
|
|
1587
|
+
*
|
|
1588
|
+
* Intended for embedding applications (e.g. desktop apps) that derive
|
|
1589
|
+
* lockdown settings from their own enterprise configuration and need to
|
|
1590
|
+
* enforce them on the spawned subprocess without writing root-owned files.
|
|
1591
|
+
*
|
|
1592
|
+
* Unlike `settings`, this option is loaded into the managed (policy) layer
|
|
1593
|
+
* rather than the user-controlled flag layer, so user/project settings
|
|
1594
|
+
* cannot widen restrictions set here.
|
|
1595
|
+
*
|
|
1596
|
+
* @example
|
|
1597
|
+
* ```typescript
|
|
1598
|
+
* managedSettings: {
|
|
1599
|
+
* sandbox: { network: { allowManagedDomainsOnly: true } }
|
|
1600
|
+
* }
|
|
1601
|
+
* ```
|
|
1602
|
+
*/
|
|
1603
|
+
managedSettings?: Settings;
|
|
1545
1604
|
/**
|
|
1546
1605
|
* Control which filesystem settings to load.
|
|
1547
1606
|
* - `'user'` - Global user settings (`~/.claude/settings.json`)
|
|
1548
1607
|
* - `'project'` - Project settings (`.claude/settings.json`)
|
|
1549
1608
|
* - `'local'` - Local settings (`.claude/settings.local.json`)
|
|
1550
1609
|
*
|
|
1551
|
-
* When omitted
|
|
1610
|
+
* When omitted, all sources are loaded (matches CLI defaults).
|
|
1611
|
+
* Pass `[]` to disable filesystem settings (SDK isolation mode).
|
|
1552
1612
|
* Must include `'project'` to load CLAUDE.md files.
|
|
1553
1613
|
*/
|
|
1554
1614
|
settingSources?: SettingSource[];
|
|
@@ -1775,6 +1835,26 @@ export declare type PostCompactHookInput = BaseHookInput & {
|
|
|
1775
1835
|
compact_summary: string;
|
|
1776
1836
|
};
|
|
1777
1837
|
|
|
1838
|
+
/**
|
|
1839
|
+
* Hook input for the PostToolBatch event. Fired once after every tool call in a batch has resolved, before the next model request. PostToolUse fires per-tool and may run concurrently for parallel tool calls; PostToolBatch fires exactly once with the full batch.
|
|
1840
|
+
*/
|
|
1841
|
+
export declare type PostToolBatchHookInput = BaseHookInput & {
|
|
1842
|
+
hook_event_name: 'PostToolBatch';
|
|
1843
|
+
tool_calls: PostToolBatchToolCall[];
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
export declare type PostToolBatchHookSpecificOutput = {
|
|
1847
|
+
hookEventName: 'PostToolBatch';
|
|
1848
|
+
additionalContext?: string;
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
export declare type PostToolBatchToolCall = {
|
|
1852
|
+
tool_name: string;
|
|
1853
|
+
tool_input: unknown;
|
|
1854
|
+
tool_use_id: string;
|
|
1855
|
+
tool_response?: unknown;
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1778
1858
|
export declare type PostToolUseFailureHookInput = BaseHookInput & {
|
|
1779
1859
|
hook_event_name: 'PostToolUseFailure';
|
|
1780
1860
|
tool_name: string;
|
|
@@ -1782,6 +1862,10 @@ export declare type PostToolUseFailureHookInput = BaseHookInput & {
|
|
|
1782
1862
|
tool_use_id: string;
|
|
1783
1863
|
error: string;
|
|
1784
1864
|
is_interrupt?: boolean;
|
|
1865
|
+
/**
|
|
1866
|
+
* Tool execution time in milliseconds. Excludes permission-prompt and hook time.
|
|
1867
|
+
*/
|
|
1868
|
+
duration_ms?: number;
|
|
1785
1869
|
};
|
|
1786
1870
|
|
|
1787
1871
|
export declare type PostToolUseFailureHookSpecificOutput = {
|
|
@@ -1795,6 +1879,10 @@ export declare type PostToolUseHookInput = BaseHookInput & {
|
|
|
1795
1879
|
tool_input: unknown;
|
|
1796
1880
|
tool_response: unknown;
|
|
1797
1881
|
tool_use_id: string;
|
|
1882
|
+
/**
|
|
1883
|
+
* Tool execution time in milliseconds. Excludes permission-prompt and hook time.
|
|
1884
|
+
*/
|
|
1885
|
+
duration_ms?: number;
|
|
1798
1886
|
};
|
|
1799
1887
|
|
|
1800
1888
|
export declare type PostToolUseHookSpecificOutput = {
|
|
@@ -2283,6 +2371,13 @@ declare type SDKControlFileSuggestionsRequest = {
|
|
|
2283
2371
|
query: string;
|
|
2284
2372
|
};
|
|
2285
2373
|
|
|
2374
|
+
/**
|
|
2375
|
+
* Requests the responder's CLI binary version. Used by /version in --remote mode so the thin client can show both its own and the remote container's version.
|
|
2376
|
+
*/
|
|
2377
|
+
declare type SDKControlGetBinaryVersionRequest = {
|
|
2378
|
+
subtype: 'get_binary_version';
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2286
2381
|
/**
|
|
2287
2382
|
* Requests a breakdown of current context window usage by category.
|
|
2288
2383
|
*/
|
|
@@ -2385,6 +2480,13 @@ export declare type SDKControlGetContextUsageResponse = {
|
|
|
2385
2480
|
} | null;
|
|
2386
2481
|
};
|
|
2387
2482
|
|
|
2483
|
+
/**
|
|
2484
|
+
* 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.
|
|
2485
|
+
*/
|
|
2486
|
+
declare type SDKControlGetSessionCostRequest = {
|
|
2487
|
+
subtype: 'get_session_cost';
|
|
2488
|
+
};
|
|
2489
|
+
|
|
2388
2490
|
/**
|
|
2389
2491
|
* Returns the effective merged settings and the raw per-source settings.
|
|
2390
2492
|
*/
|
|
@@ -2402,6 +2504,10 @@ declare type SDKControlInitializeRequest = {
|
|
|
2402
2504
|
jsonSchema?: Record<string, unknown>;
|
|
2403
2505
|
systemPrompt?: string[];
|
|
2404
2506
|
appendSystemPrompt?: string;
|
|
2507
|
+
/**
|
|
2508
|
+
* Custom workflow body for the plan-mode system reminder. Replaces the default code-implementation phases; the CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer.
|
|
2509
|
+
*/
|
|
2510
|
+
planModeInstructions?: string;
|
|
2405
2511
|
|
|
2406
2512
|
/**
|
|
2407
2513
|
* When true, omit per-user dynamic sections (working directory, auto-memory path) from the cached system prompt and re-inject them as the first user message. Lets cross-user prompt caching hit on a static system prompt prefix. Tradeoff: the model sees this context slightly later in the prompt, so steering on the working directory and memory location is marginally less authoritative. Has no effect when a custom (non-preset) system prompt is in use.
|
|
@@ -2418,6 +2524,7 @@ declare type SDKControlInitializeRequest = {
|
|
|
2418
2524
|
skills?: string[];
|
|
2419
2525
|
promptSuggestions?: boolean;
|
|
2420
2526
|
agentProgressSummaries?: boolean;
|
|
2527
|
+
forwardSubagentText?: boolean;
|
|
2421
2528
|
};
|
|
2422
2529
|
|
|
2423
2530
|
/**
|
|
@@ -2576,7 +2683,7 @@ export declare type SDKControlRequest = {
|
|
|
2576
2683
|
request: SDKControlRequestInner;
|
|
2577
2684
|
};
|
|
2578
2685
|
|
|
2579
|
-
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlReloadPluginsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlChannelEnableRequest | SDKControlEndSessionRequest | SDKControlMcpAuthenticateRequest | SDKControlMcpClearAuthRequest | SDKControlMcpOAuthCallbackUrlRequest | SDKControlClaudeAuthenticateRequest | SDKControlClaudeOAuthCallbackRequest | SDKControlClaudeOAuthWaitForCompletionRequest | SDKControlRemoteControlRequest | SDKControlGenerateSessionTitleRequest | SDKControlSideQuestionRequest | SDKControlUltrareviewLaunchRequest | SDKControlMessageRatedRequest | SDKControlOAuthTokenRefreshRequest | SDKControlStopTaskRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
2686
|
+
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlSetColorRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetSessionCostRequest | SDKControlGetBinaryVersionRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlReloadPluginsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlChannelEnableRequest | SDKControlEndSessionRequest | SDKControlMcpAuthenticateRequest | SDKControlMcpClearAuthRequest | SDKControlMcpOAuthCallbackUrlRequest | SDKControlClaudeAuthenticateRequest | SDKControlClaudeOAuthCallbackRequest | SDKControlClaudeOAuthWaitForCompletionRequest | SDKControlRemoteControlRequest | SDKControlGenerateSessionTitleRequest | SDKControlSideQuestionRequest | SDKControlUltrareviewLaunchRequest | SDKControlMessageRatedRequest | SDKControlOAuthTokenRefreshRequest | SDKControlStopTaskRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
2580
2687
|
|
|
2581
2688
|
/**
|
|
2582
2689
|
* Requests the SDK consumer to render a tool-driven blocking dialog and return the user choice. Used by tools that previously rendered Ink JSX via setToolJSX with an onDone callback.
|
|
@@ -2617,6 +2724,14 @@ declare type SDKControlSeedReadStateRequest = {
|
|
|
2617
2724
|
mtime: number;
|
|
2618
2725
|
};
|
|
2619
2726
|
|
|
2727
|
+
/**
|
|
2728
|
+
* Sets the session accent color. Accepts an agent color name or "default" to reset.
|
|
2729
|
+
*/
|
|
2730
|
+
declare type SDKControlSetColorRequest = {
|
|
2731
|
+
subtype: 'set_color';
|
|
2732
|
+
color: string;
|
|
2733
|
+
};
|
|
2734
|
+
|
|
2620
2735
|
/**
|
|
2621
2736
|
* Sets the maximum number of thinking tokens for extended thinking.
|
|
2622
2737
|
*/
|
|
@@ -2752,7 +2867,7 @@ declare type SDKKeepAliveMessage = {
|
|
|
2752
2867
|
};
|
|
2753
2868
|
|
|
2754
2869
|
/**
|
|
2755
|
-
* Output from a local slash command (e.g. /voice, /
|
|
2870
|
+
* Output from a local slash command (e.g. /voice, /usage). Displayed as assistant-style text in the transcript.
|
|
2756
2871
|
*/
|
|
2757
2872
|
export declare type SDKLocalCommandOutputMessage = {
|
|
2758
2873
|
type: 'system';
|
|
@@ -2822,7 +2937,7 @@ export declare type SDKMessageOrigin = {
|
|
|
2822
2937
|
};
|
|
2823
2938
|
|
|
2824
2939
|
/**
|
|
2825
|
-
* Emitted when SessionStore.append() rejects or times out for a transcript-mirror batch. The batch is dropped
|
|
2940
|
+
* Emitted when SessionStore.append() rejects or times out for a transcript-mirror batch after bounded retry (3 attempts with short backoff; timeouts are not retried). The batch is then dropped; this surfaces the failure so consumers are not silent on data loss.
|
|
2826
2941
|
*/
|
|
2827
2942
|
export declare type SDKMirrorErrorMessage = {
|
|
2828
2943
|
type: 'system';
|
|
@@ -2927,7 +3042,7 @@ export declare type SDKRateLimitInfo = {
|
|
|
2927
3042
|
utilization?: number;
|
|
2928
3043
|
overageStatus?: 'allowed' | 'allowed_warning' | 'rejected';
|
|
2929
3044
|
overageResetsAt?: number;
|
|
2930
|
-
overageDisabledReason?: 'overage_not_provisioned' | 'org_level_disabled' | 'org_level_disabled_until' | 'out_of_credits' | 'seat_tier_level_disabled' | 'member_level_disabled' | 'seat_tier_zero_credit_limit' | 'group_zero_credit_limit' | 'member_zero_credit_limit' | 'org_service_level_disabled' | '
|
|
3045
|
+
overageDisabledReason?: 'overage_not_provisioned' | 'org_level_disabled' | 'org_level_disabled_until' | 'out_of_credits' | 'seat_tier_level_disabled' | 'member_level_disabled' | 'seat_tier_zero_credit_limit' | 'group_zero_credit_limit' | 'member_zero_credit_limit' | 'org_service_level_disabled' | 'no_limits_configured' | 'fetch_error' | 'unknown';
|
|
2931
3046
|
isUsingOverage?: boolean;
|
|
2932
3047
|
surpassedThreshold?: number;
|
|
2933
3048
|
};
|
|
@@ -3075,7 +3190,9 @@ export declare type SDKSessionOptions = {
|
|
|
3075
3190
|
cwd?: string;
|
|
3076
3191
|
/**
|
|
3077
3192
|
* Which settings sources to load (CLAUDE.md, `.claude/settings.json`).
|
|
3078
|
-
* Defaults to `[]
|
|
3193
|
+
* Defaults to `[]`: no project/user settings are loaded unless specified.
|
|
3194
|
+
* Note that `query()` has the opposite default and loads all sources when
|
|
3195
|
+
* this is omitted.
|
|
3079
3196
|
*/
|
|
3080
3197
|
settingSources?: SettingSource[];
|
|
3081
3198
|
/**
|
|
@@ -3111,6 +3228,13 @@ export declare type SDKSessionOptions = {
|
|
|
3111
3228
|
* - `'dontAsk'` - Don't prompt for permissions, deny if not pre-approved
|
|
3112
3229
|
*/
|
|
3113
3230
|
permissionMode?: PermissionMode;
|
|
3231
|
+
/**
|
|
3232
|
+
* Custom workflow instructions for plan mode. When `permissionMode` is
|
|
3233
|
+
* `'plan'`, this string replaces the default code-implementation workflow
|
|
3234
|
+
* body in the plan-mode system reminder. The CLI still wraps it with the
|
|
3235
|
+
* read-only enforcement preamble and the ExitPlanMode protocol footer.
|
|
3236
|
+
*/
|
|
3237
|
+
planModeInstructions?: string;
|
|
3114
3238
|
};
|
|
3115
3239
|
|
|
3116
3240
|
/**
|
|
@@ -3184,6 +3308,7 @@ export declare type SDKSystemMessage = {
|
|
|
3184
3308
|
|
|
3185
3309
|
fast_mode_state?: FastModeState;
|
|
3186
3310
|
|
|
3311
|
+
|
|
3187
3312
|
uuid: UUID;
|
|
3188
3313
|
session_id: string;
|
|
3189
3314
|
};
|
|
@@ -3418,8 +3543,16 @@ export declare type SessionStore = {
|
|
|
3418
3543
|
* Within a single process, persist entries in append-call order; across
|
|
3419
3544
|
* concurrent processes, order is by storage commit time, not call time.
|
|
3420
3545
|
*
|
|
3421
|
-
*
|
|
3422
|
-
*
|
|
3546
|
+
* Most entries carry a stable `uuid`. Adapters SHOULD treat `uuid` as an
|
|
3547
|
+
* idempotency key (upsert / ignore-duplicate) so that retries and
|
|
3548
|
+
* `importSessionToStore()` replays do not create duplicate rows. Entries
|
|
3549
|
+
* without a `uuid` (e.g. titles, tags, mode markers) should be appended
|
|
3550
|
+
* without dedup.
|
|
3551
|
+
*
|
|
3552
|
+
* Rejection is retried (3 attempts total) with short backoff; timeouts
|
|
3553
|
+
* (60s) are not retried since the in-flight call may still land. After
|
|
3554
|
+
* the final failure the batch is dropped and a `mirror_error` system
|
|
3555
|
+
* message is emitted. The subprocess continues unaffected.
|
|
3423
3556
|
*/
|
|
3424
3557
|
append(key: SessionKey, entries: SessionStoreEntry[]): Promise<void>;
|
|
3425
3558
|
/**
|
|
@@ -3446,6 +3579,22 @@ export declare type SessionStore = {
|
|
|
3446
3579
|
sessionId: string;
|
|
3447
3580
|
mtime: number;
|
|
3448
3581
|
}>>;
|
|
3582
|
+
/**
|
|
3583
|
+
* Return incrementally-maintained summaries for all sessions in one call.
|
|
3584
|
+
*
|
|
3585
|
+
* Stores should maintain these via {@link foldSessionSummary} inside
|
|
3586
|
+
* `append()`. When implemented, `listSessions({ sessionStore })` reads
|
|
3587
|
+
* all summary metadata in a single round-trip; when undefined, it falls
|
|
3588
|
+
* back to `listSessions()` + per-session `load()`.
|
|
3589
|
+
*
|
|
3590
|
+
* @remarks
|
|
3591
|
+
* Stores that maintain summaries inside `append()` MUST serialize sidecar
|
|
3592
|
+
* writes if `append()` calls can race for the same session — e.g., wrap the
|
|
3593
|
+
* read-fold-write in a transaction/CAS or hold a per-session lock.
|
|
3594
|
+
* `foldSessionSummary` is pure; concurrency control is the store's responsibility.
|
|
3595
|
+
* @alpha
|
|
3596
|
+
*/
|
|
3597
|
+
listSessionSummaries?(projectKey: string): Promise<SessionSummaryEntry[]>;
|
|
3449
3598
|
/**
|
|
3450
3599
|
* Delete a session. Optional — if undefined, deletion is a no-op
|
|
3451
3600
|
* (appropriate for WORM/append-only backends like S3).
|
|
@@ -3482,6 +3631,31 @@ export declare type SessionStoreEntry = {
|
|
|
3482
3631
|
[k: string]: unknown;
|
|
3483
3632
|
};
|
|
3484
3633
|
|
|
3634
|
+
/**
|
|
3635
|
+
* Incrementally-maintained session summary.
|
|
3636
|
+
*
|
|
3637
|
+
* Stores update this on {@link SessionStore.append} via
|
|
3638
|
+
* {@link foldSessionSummary} and return the full set from
|
|
3639
|
+
* {@link SessionStore.listSessionSummaries}. Adapters never re-read
|
|
3640
|
+
* previously appended entries.
|
|
3641
|
+
* @alpha
|
|
3642
|
+
*/
|
|
3643
|
+
export declare type SessionSummaryEntry = {
|
|
3644
|
+
sessionId: string;
|
|
3645
|
+
/**
|
|
3646
|
+
* Storage write time of the sidecar on the adapter. Must share a clock
|
|
3647
|
+
* source with the `mtime` returned by `listSessions()` for this session —
|
|
3648
|
+
* typically file mtime, S3 LastModified, Postgres `updated_at`, or whatever
|
|
3649
|
+
* native timestamp the adapter surfaces. Do not derive from entry ISO
|
|
3650
|
+
* timestamps — entry timestamps and storage write times can differ by
|
|
3651
|
+
* batching and network latency, and conflating them defeats the staleness
|
|
3652
|
+
* check.
|
|
3653
|
+
*/
|
|
3654
|
+
mtime: number;
|
|
3655
|
+
/** Opaque SDK-owned state. Stores MUST persist verbatim and MUST NOT interpret. */
|
|
3656
|
+
data: Record<string, unknown>;
|
|
3657
|
+
};
|
|
3658
|
+
|
|
3485
3659
|
/**
|
|
3486
3660
|
* AUTO-GENERATED - DO NOT EDIT
|
|
3487
3661
|
*
|
|
@@ -3538,6 +3712,10 @@ export declare interface Settings {
|
|
|
3538
3712
|
* Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost.
|
|
3539
3713
|
*/
|
|
3540
3714
|
skillListingBudgetFraction?: number;
|
|
3715
|
+
/**
|
|
3716
|
+
* When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect.
|
|
3717
|
+
*/
|
|
3718
|
+
wslInheritsWindowsSettings?: boolean;
|
|
3541
3719
|
/**
|
|
3542
3720
|
* Environment variables to set for Claude Code sessions
|
|
3543
3721
|
*/
|
|
@@ -3809,6 +3987,41 @@ export declare interface Settings {
|
|
|
3809
3987
|
* If true, hook runs once and is removed after execution
|
|
3810
3988
|
*/
|
|
3811
3989
|
once?: boolean;
|
|
3990
|
+
} | {
|
|
3991
|
+
/**
|
|
3992
|
+
* MCP tool hook type
|
|
3993
|
+
*/
|
|
3994
|
+
type: 'mcp_tool';
|
|
3995
|
+
/**
|
|
3996
|
+
* Name of an already-configured MCP server to invoke
|
|
3997
|
+
*/
|
|
3998
|
+
server: string;
|
|
3999
|
+
/**
|
|
4000
|
+
* Name of the tool on that server to call
|
|
4001
|
+
*/
|
|
4002
|
+
tool: string;
|
|
4003
|
+
/**
|
|
4004
|
+
* Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").
|
|
4005
|
+
*/
|
|
4006
|
+
input?: {
|
|
4007
|
+
[k: string]: unknown;
|
|
4008
|
+
};
|
|
4009
|
+
/**
|
|
4010
|
+
* Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.
|
|
4011
|
+
*/
|
|
4012
|
+
if?: string;
|
|
4013
|
+
/**
|
|
4014
|
+
* Timeout in seconds for this specific tool call
|
|
4015
|
+
*/
|
|
4016
|
+
timeout?: number;
|
|
4017
|
+
/**
|
|
4018
|
+
* Custom status message to display in spinner while hook runs
|
|
4019
|
+
*/
|
|
4020
|
+
statusMessage?: string;
|
|
4021
|
+
/**
|
|
4022
|
+
* If true, hook runs once and is removed after execution
|
|
4023
|
+
*/
|
|
4024
|
+
once?: boolean;
|
|
3812
4025
|
})[];
|
|
3813
4026
|
}[];
|
|
3814
4027
|
};
|
|
@@ -3873,6 +4086,10 @@ export declare interface Settings {
|
|
|
3873
4086
|
*/
|
|
3874
4087
|
refreshInterval?: number;
|
|
3875
4088
|
};
|
|
4089
|
+
/**
|
|
4090
|
+
* URL template for PR links in the footer badge and inline messages. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"
|
|
4091
|
+
*/
|
|
4092
|
+
prUrlTemplate?: string;
|
|
3876
4093
|
/**
|
|
3877
4094
|
* Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin
|
|
3878
4095
|
*/
|
|
@@ -4005,20 +4222,6 @@ export declare interface Settings {
|
|
|
4005
4222
|
* Custom NPM registry URL (defaults to using system default, likely npmjs.org)
|
|
4006
4223
|
*/
|
|
4007
4224
|
registry?: string;
|
|
4008
|
-
} | {
|
|
4009
|
-
source: 'pip';
|
|
4010
|
-
/**
|
|
4011
|
-
* Python package name as it appears on PyPI
|
|
4012
|
-
*/
|
|
4013
|
-
package: string;
|
|
4014
|
-
/**
|
|
4015
|
-
* Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)
|
|
4016
|
-
*/
|
|
4017
|
-
version?: string;
|
|
4018
|
-
/**
|
|
4019
|
-
* Custom PyPI registry URL (defaults to using system default, likely pypi.org)
|
|
4020
|
-
*/
|
|
4021
|
-
registry?: string;
|
|
4022
4225
|
} | {
|
|
4023
4226
|
source: 'url';
|
|
4024
4227
|
/**
|
|
@@ -4207,20 +4410,6 @@ export declare interface Settings {
|
|
|
4207
4410
|
* Custom NPM registry URL (defaults to using system default, likely npmjs.org)
|
|
4208
4411
|
*/
|
|
4209
4412
|
registry?: string;
|
|
4210
|
-
} | {
|
|
4211
|
-
source: 'pip';
|
|
4212
|
-
/**
|
|
4213
|
-
* Python package name as it appears on PyPI
|
|
4214
|
-
*/
|
|
4215
|
-
package: string;
|
|
4216
|
-
/**
|
|
4217
|
-
* Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)
|
|
4218
|
-
*/
|
|
4219
|
-
version?: string;
|
|
4220
|
-
/**
|
|
4221
|
-
* Custom PyPI registry URL (defaults to using system default, likely pypi.org)
|
|
4222
|
-
*/
|
|
4223
|
-
registry?: string;
|
|
4224
4413
|
} | {
|
|
4225
4414
|
source: 'url';
|
|
4226
4415
|
/**
|
|
@@ -4399,20 +4588,6 @@ export declare interface Settings {
|
|
|
4399
4588
|
* Custom NPM registry URL (defaults to using system default, likely npmjs.org)
|
|
4400
4589
|
*/
|
|
4401
4590
|
registry?: string;
|
|
4402
|
-
} | {
|
|
4403
|
-
source: 'pip';
|
|
4404
|
-
/**
|
|
4405
|
-
* Python package name as it appears on PyPI
|
|
4406
|
-
*/
|
|
4407
|
-
package: string;
|
|
4408
|
-
/**
|
|
4409
|
-
* Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)
|
|
4410
|
-
*/
|
|
4411
|
-
version?: string;
|
|
4412
|
-
/**
|
|
4413
|
-
* Custom PyPI registry URL (defaults to using system default, likely pypi.org)
|
|
4414
|
-
*/
|
|
4415
|
-
registry?: string;
|
|
4416
4591
|
} | {
|
|
4417
4592
|
source: 'url';
|
|
4418
4593
|
/**
|
|
@@ -4795,6 +4970,70 @@ export declare interface Settings {
|
|
|
4795
4970
|
* Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").
|
|
4796
4971
|
*/
|
|
4797
4972
|
pluginTrustMessage?: string;
|
|
4973
|
+
/**
|
|
4974
|
+
* Color theme for the UI
|
|
4975
|
+
*/
|
|
4976
|
+
theme?: ('auto' | 'dark' | 'light' | 'light-daltonized' | 'dark-daltonized' | 'light-ansi' | 'dark-ansi') | string;
|
|
4977
|
+
/**
|
|
4978
|
+
* Key binding mode for the prompt input
|
|
4979
|
+
*/
|
|
4980
|
+
editorMode?: 'normal' | 'vim';
|
|
4981
|
+
/**
|
|
4982
|
+
* Show full tool output instead of truncated summaries
|
|
4983
|
+
*/
|
|
4984
|
+
verbose?: boolean;
|
|
4985
|
+
/**
|
|
4986
|
+
* Preferred OS notification channel
|
|
4987
|
+
*/
|
|
4988
|
+
preferredNotifChannel?: 'auto' | 'iterm2' | 'iterm2_with_bell' | 'terminal_bell' | 'kitty' | 'ghostty' | 'notifications_disabled';
|
|
4989
|
+
/**
|
|
4990
|
+
* Automatically compact conversation when context fills
|
|
4991
|
+
*/
|
|
4992
|
+
autoCompactEnabled?: boolean;
|
|
4993
|
+
/**
|
|
4994
|
+
* Auto-scroll the conversation view to bottom (fullscreen mode only)
|
|
4995
|
+
*/
|
|
4996
|
+
autoScrollEnabled?: boolean;
|
|
4997
|
+
/**
|
|
4998
|
+
* Snapshot files before edits so /rewind can restore them
|
|
4999
|
+
*/
|
|
5000
|
+
fileCheckpointingEnabled?: boolean;
|
|
5001
|
+
/**
|
|
5002
|
+
* Show "Cooked for Nm Ns" after each assistant turn
|
|
5003
|
+
*/
|
|
5004
|
+
showTurnDuration?: boolean;
|
|
5005
|
+
/**
|
|
5006
|
+
* Stamp each assistant message with its arrival time
|
|
5007
|
+
*/
|
|
5008
|
+
showMessageTimestamps?: boolean;
|
|
5009
|
+
/**
|
|
5010
|
+
* Emit OSC 9;4 progress sequences during long operations
|
|
5011
|
+
*/
|
|
5012
|
+
terminalProgressBarEnabled?: boolean;
|
|
5013
|
+
/**
|
|
5014
|
+
* Enable the todo / task tracking panel
|
|
5015
|
+
*/
|
|
5016
|
+
todoFeatureEnabled?: boolean;
|
|
5017
|
+
/**
|
|
5018
|
+
* How spawned teammates execute (tmux, in-process, auto)
|
|
5019
|
+
*/
|
|
5020
|
+
teammateMode?: 'auto' | 'tmux' | 'in-process';
|
|
5021
|
+
/**
|
|
5022
|
+
* Start Remote Control bridge automatically each session
|
|
5023
|
+
*/
|
|
5024
|
+
remoteControlAtStartup?: boolean;
|
|
5025
|
+
/**
|
|
5026
|
+
* Mirror local sessions to claude.ai as view-only (no remote control)
|
|
5027
|
+
*/
|
|
5028
|
+
autoUploadSessions?: boolean;
|
|
5029
|
+
/**
|
|
5030
|
+
* Push to mobile when a permission prompt or question is waiting
|
|
5031
|
+
*/
|
|
5032
|
+
inputNeededNotifEnabled?: boolean;
|
|
5033
|
+
/**
|
|
5034
|
+
* Allow Claude to push proactive mobile notifications
|
|
5035
|
+
*/
|
|
5036
|
+
agentPushNotifEnabled?: boolean;
|
|
4798
5037
|
[k: string]: unknown;
|
|
4799
5038
|
}
|
|
4800
5039
|
|
|
@@ -4829,6 +5068,10 @@ export declare type SlashCommand = {
|
|
|
4829
5068
|
* Hint for skill arguments (e.g., "<file>")
|
|
4830
5069
|
*/
|
|
4831
5070
|
argumentHint: string;
|
|
5071
|
+
/**
|
|
5072
|
+
* Alternate names that resolve to this command (e.g., /cost and /stats both resolve to /usage)
|
|
5073
|
+
*/
|
|
5074
|
+
aliases?: string[];
|
|
4832
5075
|
};
|
|
4833
5076
|
|
|
4834
5077
|
/**
|
|
@@ -4901,7 +5144,7 @@ export declare function startup(_params?: {
|
|
|
4901
5144
|
initializeTimeoutMs?: number;
|
|
4902
5145
|
}): Promise<WarmQuery>;
|
|
4903
5146
|
|
|
4904
|
-
declare type StdoutMessage = coreTypes.SDKMessage | coreTypes.SDKPostTurnSummaryMessage | coreTypes.SDKTranscriptMirrorMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage;
|
|
5147
|
+
declare type StdoutMessage = coreTypes.SDKMessage | coreTypes.SDKPostTurnSummaryMessage | coreTypes.SDKTaskSummaryMessage | coreTypes.SDKTranscriptMirrorMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage;
|
|
4905
5148
|
|
|
4906
5149
|
export declare type StopFailureHookInput = BaseHookInput & {
|
|
4907
5150
|
hook_event_name: 'StopFailure';
|
|
@@ -4954,7 +5197,7 @@ export declare type SyncHookJSONOutput = {
|
|
|
4954
5197
|
systemMessage?: string;
|
|
4955
5198
|
reason?: string;
|
|
4956
5199
|
|
|
4957
|
-
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput;
|
|
5200
|
+
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PostToolBatchHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput;
|
|
4958
5201
|
};
|
|
4959
5202
|
|
|
4960
5203
|
/**
|