@anthropic-ai/claude-agent-sdk 0.3.248 → 0.3.251
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.d.ts +8 -1
- package/bridge.mjs +82 -82
- package/browser-sdk.js +62 -50
- package/manifest.json +19 -20
- package/manifest.zst.json +23 -24
- package/package.json +10 -10
- package/sdk-tools.d.ts +9 -1
- package/sdk.d.ts +121 -6
- package/sdk.mjs +77 -76
package/manifest.json
CHANGED
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
3
|
-
"commit": "
|
|
4
|
-
"buildDate": "2026-08-
|
|
2
|
+
"version": "2.1.251",
|
|
3
|
+
"commit": "37534ac596d80cefb02d272f036adba4ba055d2c",
|
|
4
|
+
"buildDate": "2026-08-28T15:09:02Z",
|
|
5
5
|
"platforms": {
|
|
6
6
|
"darwin-arm64": {
|
|
7
7
|
"binary": "claude",
|
|
8
|
-
"checksum": "
|
|
9
|
-
"size":
|
|
8
|
+
"checksum": "625869b01e0050f260b2980fac248fd9cef9e462612bded4ec9d3d49ff8969a5",
|
|
9
|
+
"size": 197171680
|
|
10
10
|
},
|
|
11
11
|
"darwin-x64": {
|
|
12
12
|
"binary": "claude",
|
|
13
|
-
"checksum": "
|
|
14
|
-
"size":
|
|
13
|
+
"checksum": "44221d72a3f35772faa85ad9a36a678084a516f720e64b45e26eb9015315500b",
|
|
14
|
+
"size": 205778256
|
|
15
15
|
},
|
|
16
16
|
"linux-arm64": {
|
|
17
17
|
"binary": "claude",
|
|
18
|
-
"checksum": "
|
|
19
|
-
"size":
|
|
18
|
+
"checksum": "65445bd4dd042079cc3fa43791b561370a05c8599e8ec47580e25a81050abbdd",
|
|
19
|
+
"size": 213835016
|
|
20
20
|
},
|
|
21
21
|
"linux-x64": {
|
|
22
22
|
"binary": "claude",
|
|
23
|
-
"checksum": "
|
|
24
|
-
"size":
|
|
23
|
+
"checksum": "fd5f10ff0eb58daec04900466b143ea98aab50abf208a422bc008eaec13f61f7",
|
|
24
|
+
"size": 214326616
|
|
25
25
|
},
|
|
26
26
|
"linux-arm64-musl": {
|
|
27
27
|
"binary": "claude",
|
|
28
|
-
"checksum": "
|
|
29
|
-
"size":
|
|
28
|
+
"checksum": "165f6236abf5b0c42892b164c2299c82023421805e0c3eaddf925a3195513f84",
|
|
29
|
+
"size": 206648896
|
|
30
30
|
},
|
|
31
31
|
"linux-x64-musl": {
|
|
32
32
|
"binary": "claude",
|
|
33
|
-
"checksum": "
|
|
34
|
-
"size":
|
|
33
|
+
"checksum": "5056970c13f46dd2bff2c44dd2a7f766553a63392615412d5711278264730e07",
|
|
34
|
+
"size": 208301944
|
|
35
35
|
},
|
|
36
36
|
"win32-x64": {
|
|
37
37
|
"binary": "claude.exe",
|
|
38
|
-
"checksum": "
|
|
39
|
-
"size":
|
|
38
|
+
"checksum": "8d1229a281281b98fd2dee72b3253a704be4fce4d45207200cd32a9bb5a6c909",
|
|
39
|
+
"size": 217360032
|
|
40
40
|
},
|
|
41
41
|
"win32-arm64": {
|
|
42
42
|
"binary": "claude.exe",
|
|
43
|
-
"checksum": "
|
|
44
|
-
"size":
|
|
43
|
+
"checksum": "89e91fed2dc6f6278fa1e179e6401c0a1c252fe80c57ee47f17f10f7f7b4e99c",
|
|
44
|
+
"size": 208465056
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"sdkCompat": {
|
|
48
48
|
"testedWrapperVersions": [
|
|
49
|
-
"0.3.211",
|
|
50
49
|
"0.3.212",
|
|
51
50
|
"0.3.214",
|
|
52
51
|
"0.3.215",
|
package/manifest.zst.json
CHANGED
|
@@ -1,60 +1,59 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
3
|
-
"commit": "
|
|
4
|
-
"buildDate": "2026-08-
|
|
2
|
+
"version": "2.1.251",
|
|
3
|
+
"commit": "37534ac596d80cefb02d272f036adba4ba055d2c",
|
|
4
|
+
"buildDate": "2026-08-28T15:10:11Z",
|
|
5
5
|
"platforms": {
|
|
6
6
|
"darwin-arm64": {
|
|
7
7
|
"binary": "claude.zst",
|
|
8
|
-
"checksum": "
|
|
9
|
-
"size":
|
|
8
|
+
"checksum": "210734be9179176b23affc9c73e052c05ca592b953cc6e010e3e0e2902050b51",
|
|
9
|
+
"size": 64283955,
|
|
10
10
|
"bundle": {
|
|
11
|
-
"checksum": "
|
|
12
|
-
"size":
|
|
11
|
+
"checksum": "5876dfd928b5a79fe88ec57f83b7d4570f45e2f53d350b92d5b0486589682eff",
|
|
12
|
+
"size": 64288372
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"darwin-x64": {
|
|
16
16
|
"binary": "claude.zst",
|
|
17
|
-
"checksum": "
|
|
18
|
-
"size":
|
|
17
|
+
"checksum": "963c354c27be8b26cf79002cb3ae3047c5845ac606ca5200e942c51fc334319d",
|
|
18
|
+
"size": 68304834,
|
|
19
19
|
"bundle": {
|
|
20
|
-
"checksum": "
|
|
21
|
-
"size":
|
|
20
|
+
"checksum": "b2561617e3aac9cd17c91b63dea9491739ec0b285bdff645c2d65f96d754532d",
|
|
21
|
+
"size": 68308558
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"linux-arm64": {
|
|
25
25
|
"binary": "claude.zst",
|
|
26
|
-
"checksum": "
|
|
27
|
-
"size":
|
|
26
|
+
"checksum": "f346c1c7928584f276d6c9d55a5c03271b9c10b19039fc5758902038188056ff",
|
|
27
|
+
"size": 73724308
|
|
28
28
|
},
|
|
29
29
|
"linux-x64": {
|
|
30
30
|
"binary": "claude.zst",
|
|
31
|
-
"checksum": "
|
|
32
|
-
"size":
|
|
31
|
+
"checksum": "dd621ed8ba147167e710b4aa365f63c3b88e9558883a2fa5871b5e2a9d03606d",
|
|
32
|
+
"size": 74367641
|
|
33
33
|
},
|
|
34
34
|
"linux-arm64-musl": {
|
|
35
35
|
"binary": "claude.zst",
|
|
36
|
-
"checksum": "
|
|
37
|
-
"size":
|
|
36
|
+
"checksum": "f30748ee286e154fbdb96810481fd1cfe37e424cb0f1d8a839322a6ef28d9467",
|
|
37
|
+
"size": 72202451
|
|
38
38
|
},
|
|
39
39
|
"linux-x64-musl": {
|
|
40
40
|
"binary": "claude.zst",
|
|
41
|
-
"checksum": "
|
|
42
|
-
"size":
|
|
41
|
+
"checksum": "44ce287c5c05a3f01b13c88b2fe591ada447db025ffd1a5bfb9b6000ca53175a",
|
|
42
|
+
"size": 72859628
|
|
43
43
|
},
|
|
44
44
|
"win32-x64": {
|
|
45
45
|
"binary": "claude.exe.zst",
|
|
46
|
-
"checksum": "
|
|
47
|
-
"size":
|
|
46
|
+
"checksum": "af850d03d36de22b414ff4ccc314b37c58fc95c13ea2975051e42f14dcf62832",
|
|
47
|
+
"size": 76778696
|
|
48
48
|
},
|
|
49
49
|
"win32-arm64": {
|
|
50
50
|
"binary": "claude.exe.zst",
|
|
51
|
-
"checksum": "
|
|
52
|
-
"size":
|
|
51
|
+
"checksum": "411b5bf888a6bd75293a58c88edffa2f45f85b1d8aedd73054b90b697d653f66",
|
|
52
|
+
"size": 73553174
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"sdkCompat": {
|
|
56
56
|
"testedWrapperVersions": [
|
|
57
|
-
"0.3.211",
|
|
58
57
|
"0.3.212",
|
|
59
58
|
"0.3.214",
|
|
60
59
|
"0.3.215",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropic-ai/claude-agent-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.251",
|
|
4
4
|
"main": "sdk.mjs",
|
|
5
5
|
"types": "sdk.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"zod": "^4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.
|
|
61
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.
|
|
62
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.
|
|
63
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.
|
|
66
|
-
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.
|
|
67
|
-
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.
|
|
60
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.251",
|
|
61
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.251",
|
|
62
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.251",
|
|
63
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.251",
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.251",
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.251",
|
|
66
|
+
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.251",
|
|
67
|
+
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.251"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"sdk.mjs",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"manifest.json",
|
|
81
81
|
"manifest.zst.json"
|
|
82
82
|
],
|
|
83
|
-
"claudeCodeVersion": "2.1.
|
|
83
|
+
"claudeCodeVersion": "2.1.251"
|
|
84
84
|
}
|
package/sdk-tools.d.ts
CHANGED
|
@@ -435,13 +435,17 @@ export type ArtifactOutput =
|
|
|
435
435
|
capabilities?: unknown;
|
|
436
436
|
stored?: {
|
|
437
437
|
contract: string;
|
|
438
|
+
preferredContract?: string;
|
|
438
439
|
capabilities?: {
|
|
439
440
|
[k: string]: unknown;
|
|
440
441
|
};
|
|
442
|
+
carried?: boolean;
|
|
443
|
+
read?: string;
|
|
441
444
|
};
|
|
442
445
|
warnings?: string[];
|
|
443
446
|
contract?: string;
|
|
444
447
|
updated?: boolean;
|
|
448
|
+
audience?: string;
|
|
445
449
|
liveSubscription?: string;
|
|
446
450
|
}
|
|
447
451
|
| {
|
|
@@ -665,7 +669,7 @@ export interface AgentInput {
|
|
|
665
669
|
*/
|
|
666
670
|
subagent_type?: string;
|
|
667
671
|
/**
|
|
668
|
-
* Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model,
|
|
672
|
+
* Optional model override for this agent. Takes precedence over the agent definition's model frontmatter and the configured default subagent model. If omitted, uses the agent definition's model, else the default (inherits from the parent unless a default subagent model is configured). Ignored for subagent_type: "fork" — forks always inherit the parent model.
|
|
669
673
|
*/
|
|
670
674
|
model?: "sonnet" | "opus" | "haiku" | "fable";
|
|
671
675
|
/**
|
|
@@ -3086,6 +3090,10 @@ export interface ArtifactInput {
|
|
|
3086
3090
|
* Short human-readable name for this version, max 60 chars (e.g. "fixed-background"). Shown in the version picker. Not a description — keep it to a few words.
|
|
3087
3091
|
*/
|
|
3088
3092
|
label?: string;
|
|
3093
|
+
/**
|
|
3094
|
+
* publish only: what changed in this version — a few sentences on what is new or reworked, shown beside `label` in the version picker. Optional; leave it out when nothing is worth noting.
|
|
3095
|
+
*/
|
|
3096
|
+
note?: string;
|
|
3089
3097
|
/**
|
|
3090
3098
|
* Existing artifact URL to update in place. Pass whenever the user wants to update an artifact this conversation did not publish — "update my artifact", "keep the same link", a pasted artifact URL — and find the URL with action: "list" or ask the user for the link if you don't have it; without this, the publish creates a separate artifact instead of updating the existing one. Omit for new artifacts and same-conversation redeploys. Must be an artifact the user owns. For 'read' and the other url-addressed actions: the artifact to act on.
|
|
3091
3099
|
*/
|
package/sdk.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare type AgentDefinition = {
|
|
|
53
53
|
*/
|
|
54
54
|
prompt: string;
|
|
55
55
|
/**
|
|
56
|
-
* Model alias (e.g. 'fable', 'opus', 'sonnet', 'haiku') or full model ID (e.g. 'claude-fable-5').
|
|
56
|
+
* Model alias (e.g. 'fable', 'opus', 'sonnet', 'haiku') or full model ID (e.g. 'claude-fable-5'). 'inherit' uses the main model; if omitted, uses the default subagent model when one is configured, else the main model
|
|
57
57
|
*/
|
|
58
58
|
model?: string;
|
|
59
59
|
mcpServers?: AgentMcpServerSpec[];
|
|
@@ -112,7 +112,7 @@ export declare type AgentInfo = {
|
|
|
112
112
|
*/
|
|
113
113
|
description: string;
|
|
114
114
|
/**
|
|
115
|
-
* Model
|
|
115
|
+
* Model this agent uses: an alias or model ID, or 'inherit' for the parent's model. If omitted, uses the default subagent model when one is configured, else the parent's model
|
|
116
116
|
*/
|
|
117
117
|
model?: string;
|
|
118
118
|
};
|
|
@@ -395,6 +395,8 @@ declare namespace coreTypes {
|
|
|
395
395
|
PermissionUpdateDestination,
|
|
396
396
|
PermissionUpdate,
|
|
397
397
|
PostCompactHookInput,
|
|
398
|
+
PostModelSwitchHookInput,
|
|
399
|
+
PostModelSwitchHookSpecificOutput,
|
|
398
400
|
PostToolBatchHookInput,
|
|
399
401
|
PostToolBatchHookSpecificOutput,
|
|
400
402
|
PostToolBatchToolCall,
|
|
@@ -403,6 +405,8 @@ declare namespace coreTypes {
|
|
|
403
405
|
PostToolUseHookInput,
|
|
404
406
|
PostToolUseHookSpecificOutput,
|
|
405
407
|
PreCompactHookInput,
|
|
408
|
+
PreModelSwitchHookInput,
|
|
409
|
+
PreModelSwitchHookSpecificOutput,
|
|
406
410
|
PreToolUseHookInput,
|
|
407
411
|
PreToolUseHookSpecificOutput,
|
|
408
412
|
RewindFilesResult,
|
|
@@ -846,7 +850,7 @@ export declare type GetSubagentMessagesOptions = {
|
|
|
846
850
|
sessionStore?: SessionStore;
|
|
847
851
|
};
|
|
848
852
|
|
|
849
|
-
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', 'DirectoryAdded', 'MessageDisplay'];
|
|
853
|
+
export declare const HOOK_EVENTS: readonly ['PreToolUse', 'PostToolUse', 'PostToolUseFailure', 'PostToolBatch', 'Notification', 'UserPromptSubmit', 'UserPromptExpansion', 'SessionStart', 'SessionEnd', 'Stop', 'StopFailure', 'SubagentStart', 'SubagentStop', 'PreCompact', 'PostCompact', 'PreModelSwitch', 'PostModelSwitch', 'PermissionRequest', 'PermissionDenied', 'Setup', 'TeammateIdle', 'TaskCreated', 'TaskCompleted', 'Elicitation', 'ElicitationResult', 'ConfigChange', 'WorktreeCreate', 'WorktreeRemove', 'InstructionsLoaded', 'CwdChanged', 'FileChanged', 'DirectoryAdded', 'MessageDisplay'];
|
|
850
854
|
|
|
851
855
|
/**
|
|
852
856
|
* Hook callback function for responding to events during execution.
|
|
@@ -865,9 +869,9 @@ export declare interface HookCallbackMatcher {
|
|
|
865
869
|
timeout?: number;
|
|
866
870
|
}
|
|
867
871
|
|
|
868
|
-
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' | 'DirectoryAdded' | 'MessageDisplay';
|
|
872
|
+
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'Notification' | 'UserPromptSubmit' | 'UserPromptExpansion' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PostCompact' | 'PreModelSwitch' | 'PostModelSwitch' | 'PermissionRequest' | 'PermissionDenied' | 'Setup' | 'TeammateIdle' | 'TaskCreated' | 'TaskCompleted' | 'Elicitation' | 'ElicitationResult' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'InstructionsLoaded' | 'CwdChanged' | 'FileChanged' | 'DirectoryAdded' | 'MessageDisplay';
|
|
869
873
|
|
|
870
|
-
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 | DirectoryAddedHookInput | MessageDisplayHookInput;
|
|
874
|
+
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PostToolBatchHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PreModelSwitchHookInput | PostModelSwitchHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput | DirectoryAddedHookInput | MessageDisplayHookInput;
|
|
871
875
|
|
|
872
876
|
export declare type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
|
|
873
877
|
|
|
@@ -2318,6 +2322,52 @@ export declare type PostCompactHookInput = BaseHookInput & {
|
|
|
2318
2322
|
compact_summary: string;
|
|
2319
2323
|
};
|
|
2320
2324
|
|
|
2325
|
+
export declare type PostModelSwitchHookInput = (BaseHookInput & {
|
|
2326
|
+
hook_event_name: 'PostModelSwitch';
|
|
2327
|
+
}) & {
|
|
2328
|
+
/**
|
|
2329
|
+
* Resolved model id the session was running before the switch
|
|
2330
|
+
*/
|
|
2331
|
+
from_model: string;
|
|
2332
|
+
/**
|
|
2333
|
+
* Resolved model id the session runs after the switch
|
|
2334
|
+
*/
|
|
2335
|
+
to_model: string;
|
|
2336
|
+
/**
|
|
2337
|
+
* What was asked for (alias such as "opus", a full id, or null for "default")
|
|
2338
|
+
*/
|
|
2339
|
+
requested_model: string | null;
|
|
2340
|
+
/**
|
|
2341
|
+
* command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE); auto: automatic fallback or other programmatic change; resume: model restored while resuming a session
|
|
2342
|
+
*/
|
|
2343
|
+
source: 'command' | 'picker' | 'sdk' | 'auto' | 'resume';
|
|
2344
|
+
/**
|
|
2345
|
+
* Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
2346
|
+
*/
|
|
2347
|
+
context_tokens: number;
|
|
2348
|
+
/**
|
|
2349
|
+
* Whether the current model's prompt cache is likely still warm (a switch then forfeits it)
|
|
2350
|
+
*/
|
|
2351
|
+
prompt_cache_warm: boolean;
|
|
2352
|
+
cache_ttl: '5m' | '1h';
|
|
2353
|
+
/**
|
|
2354
|
+
* Estimated cost of re-caching context_tokens on to_model at its cache-write rate — the managed modelPricing when set, otherwise list price; excludes the response
|
|
2355
|
+
*/
|
|
2356
|
+
estimated_cache_write_usd: number;
|
|
2357
|
+
/**
|
|
2358
|
+
* configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed
|
|
2359
|
+
*/
|
|
2360
|
+
pricing: 'configured' | 'catalog' | 'default';
|
|
2361
|
+
};
|
|
2362
|
+
|
|
2363
|
+
export declare type PostModelSwitchHookSpecificOutput = {
|
|
2364
|
+
hookEventName: 'PostModelSwitch';
|
|
2365
|
+
/**
|
|
2366
|
+
* Reaches the model with the next request the new model serves
|
|
2367
|
+
*/
|
|
2368
|
+
additionalContext?: string;
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2321
2371
|
/**
|
|
2322
2372
|
* 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.
|
|
2323
2373
|
*/
|
|
@@ -2391,6 +2441,53 @@ export declare type PreCompactHookInput = BaseHookInput & {
|
|
|
2391
2441
|
custom_instructions: string | null;
|
|
2392
2442
|
};
|
|
2393
2443
|
|
|
2444
|
+
export declare type PreModelSwitchHookInput = (BaseHookInput & {
|
|
2445
|
+
hook_event_name: 'PreModelSwitch';
|
|
2446
|
+
}) & {
|
|
2447
|
+
/**
|
|
2448
|
+
* Resolved model id the session was running before the switch
|
|
2449
|
+
*/
|
|
2450
|
+
from_model: string;
|
|
2451
|
+
/**
|
|
2452
|
+
* Resolved model id the session runs after the switch
|
|
2453
|
+
*/
|
|
2454
|
+
to_model: string;
|
|
2455
|
+
/**
|
|
2456
|
+
* What was asked for (alias such as "opus", a full id, or null for "default")
|
|
2457
|
+
*/
|
|
2458
|
+
requested_model: string | null;
|
|
2459
|
+
/**
|
|
2460
|
+
* command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE)
|
|
2461
|
+
*/
|
|
2462
|
+
source: 'command' | 'picker' | 'sdk';
|
|
2463
|
+
/**
|
|
2464
|
+
* Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
2465
|
+
*/
|
|
2466
|
+
context_tokens: number;
|
|
2467
|
+
/**
|
|
2468
|
+
* Whether the current model's prompt cache is likely still warm (a switch then forfeits it)
|
|
2469
|
+
*/
|
|
2470
|
+
prompt_cache_warm: boolean;
|
|
2471
|
+
cache_ttl: '5m' | '1h';
|
|
2472
|
+
/**
|
|
2473
|
+
* Estimated cost of re-caching context_tokens on to_model at its cache-write rate — the managed modelPricing when set, otherwise list price; excludes the response
|
|
2474
|
+
*/
|
|
2475
|
+
estimated_cache_write_usd: number;
|
|
2476
|
+
/**
|
|
2477
|
+
* configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed
|
|
2478
|
+
*/
|
|
2479
|
+
pricing: 'configured' | 'catalog' | 'default';
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2482
|
+
export declare type PreModelSwitchHookSpecificOutput = {
|
|
2483
|
+
hookEventName: 'PreModelSwitch';
|
|
2484
|
+
/**
|
|
2485
|
+
* Same contract as PreToolUse: allow proceeds (skipping the interactive cache-miss confirm), deny cancels the switch, ask asks the user to confirm (a headless session refuses instead)
|
|
2486
|
+
*/
|
|
2487
|
+
permissionDecision?: 'allow' | 'deny' | 'ask';
|
|
2488
|
+
permissionDecisionReason?: string;
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2394
2491
|
export declare type PreToolUseHookInput = BaseHookInput & {
|
|
2395
2492
|
hook_event_name: 'PreToolUse';
|
|
2396
2493
|
tool_name: string;
|
|
@@ -3154,6 +3251,7 @@ export declare type SDKAssistantMessage = {
|
|
|
3154
3251
|
|
|
3155
3252
|
|
|
3156
3253
|
|
|
3254
|
+
|
|
3157
3255
|
};
|
|
3158
3256
|
|
|
3159
3257
|
export declare type SDKAssistantMessageError = 'authentication_failed' | 'oauth_org_not_allowed' | 'account_on_hold' | 'billing_error' | 'rate_limit' | 'overloaded' | 'invalid_request' | 'model_not_found' | 'server_error' | 'unknown' | 'max_output_tokens';
|
|
@@ -3821,6 +3919,7 @@ export declare type SDKControlInitializeResponse = {
|
|
|
3821
3919
|
|
|
3822
3920
|
|
|
3823
3921
|
|
|
3922
|
+
|
|
3824
3923
|
};
|
|
3825
3924
|
|
|
3826
3925
|
/**
|
|
@@ -5249,6 +5348,22 @@ export declare type SessionStartHookInput = BaseHookInput & {
|
|
|
5249
5348
|
agent_type?: string;
|
|
5250
5349
|
model?: string;
|
|
5251
5350
|
session_title?: string;
|
|
5351
|
+
/**
|
|
5352
|
+
* resume/fork: seconds since the resumed transcript's last assistant response
|
|
5353
|
+
*/
|
|
5354
|
+
seconds_since_last_response?: number;
|
|
5355
|
+
/**
|
|
5356
|
+
* resume/fork: the resumed transcript's last response input + cache_read + cache_creation + output tokens (for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
5357
|
+
*/
|
|
5358
|
+
context_tokens?: number;
|
|
5359
|
+
/**
|
|
5360
|
+
* resume/fork: seconds_since_last_response exceeds the prompt-cache TTL, so the first request re-caches context_tokens
|
|
5361
|
+
*/
|
|
5362
|
+
prompt_cache_likely_expired?: boolean;
|
|
5363
|
+
/**
|
|
5364
|
+
* resume/fork: estimated cost of re-caching context_tokens on the session model — the managed modelPricing when set, otherwise list price; excludes the response
|
|
5365
|
+
*/
|
|
5366
|
+
estimated_cache_write_usd?: number;
|
|
5252
5367
|
};
|
|
5253
5368
|
|
|
5254
5369
|
export declare type SessionStartHookSpecificOutput = {
|
|
@@ -8143,7 +8258,7 @@ export declare type SyncHookJSONOutput = {
|
|
|
8143
8258
|
reason?: string;
|
|
8144
8259
|
|
|
8145
8260
|
|
|
8146
|
-
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PostToolBatchHookSpecificOutput | StopHookSpecificOutput | SubagentStopHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput | MessageDisplayHookSpecificOutput;
|
|
8261
|
+
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | PreModelSwitchHookSpecificOutput | PostModelSwitchHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PostToolBatchHookSpecificOutput | StopHookSpecificOutput | SubagentStopHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput | MessageDisplayHookSpecificOutput;
|
|
8147
8262
|
};
|
|
8148
8263
|
|
|
8149
8264
|
/**
|