@anthropic-ai/claude-agent-sdk 0.2.141 → 0.3.142
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 +79 -79
- package/bridge.mjs +64 -64
- package/browser-sdk.js +22 -22
- package/manifest.json +19 -19
- package/manifest.zst.json +23 -23
- package/package.json +10 -10
- package/sdk.d.ts +60 -138
- package/sdk.mjs +47 -47
package/manifest.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
3
|
-
"commit": "
|
|
4
|
-
"buildDate": "2026-05-
|
|
2
|
+
"version": "2.1.142",
|
|
3
|
+
"commit": "880324aad10dc75b18dbac2782d9dfee7cbb1578",
|
|
4
|
+
"buildDate": "2026-05-14T16:45:24Z",
|
|
5
5
|
"platforms": {
|
|
6
6
|
"darwin-arm64": {
|
|
7
7
|
"binary": "claude",
|
|
8
|
-
"checksum": "
|
|
9
|
-
"size":
|
|
8
|
+
"checksum": "772021afa051160b97e04d379738df84d4cacd311e8c199a325fb013b3eaa448",
|
|
9
|
+
"size": 207126432
|
|
10
10
|
},
|
|
11
11
|
"darwin-x64": {
|
|
12
12
|
"binary": "claude",
|
|
13
|
-
"checksum": "
|
|
14
|
-
"size":
|
|
13
|
+
"checksum": "d00bc6fb38d0837ce811cc862a3b6822795b33dbce8361703b1e5e903bd240fd",
|
|
14
|
+
"size": 209640592
|
|
15
15
|
},
|
|
16
16
|
"linux-arm64": {
|
|
17
17
|
"binary": "claude",
|
|
18
|
-
"checksum": "
|
|
19
|
-
"size":
|
|
18
|
+
"checksum": "767b13fc28763ca9d663b00f90e501f134b356f1b72dcf0eea59b7e3bed86411",
|
|
19
|
+
"size": 232502920
|
|
20
20
|
},
|
|
21
21
|
"linux-x64": {
|
|
22
22
|
"binary": "claude",
|
|
23
|
-
"checksum": "
|
|
24
|
-
"size":
|
|
23
|
+
"checksum": "1249a1dadfe2d48f320bd4e1b657a1a0d82435da76deb11ce509822407cf24ec",
|
|
24
|
+
"size": 232625872
|
|
25
25
|
},
|
|
26
26
|
"linux-arm64-musl": {
|
|
27
27
|
"binary": "claude",
|
|
28
|
-
"checksum": "
|
|
29
|
-
"size":
|
|
28
|
+
"checksum": "43834a6c50954deb6ddb1b49937d15ccae71fbdb3d370e26a461e12c50c122ba",
|
|
29
|
+
"size": 225357656
|
|
30
30
|
},
|
|
31
31
|
"linux-x64-musl": {
|
|
32
32
|
"binary": "claude",
|
|
33
|
-
"checksum": "
|
|
34
|
-
"size":
|
|
33
|
+
"checksum": "c645dc32d250a54bb8399630f0ffa88b4ee44ba8e6461e33ed95b2f64f836ea9",
|
|
34
|
+
"size": 227019824
|
|
35
35
|
},
|
|
36
36
|
"win32-x64": {
|
|
37
37
|
"binary": "claude.exe",
|
|
38
|
-
"checksum": "
|
|
39
|
-
"size":
|
|
38
|
+
"checksum": "0778b1c607ee3282ba8ea3f0c684edb05f597454cc0d21386a84576b5434b1c7",
|
|
39
|
+
"size": 228456096
|
|
40
40
|
},
|
|
41
41
|
"win32-arm64": {
|
|
42
42
|
"binary": "claude.exe",
|
|
43
|
-
"checksum": "
|
|
44
|
-
"size":
|
|
43
|
+
"checksum": "95a966b0729f9f7c28c68df3d63e7f5ac6ac72abab209392800e9a40292f3bfc",
|
|
44
|
+
"size": 224420000
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
package/manifest.zst.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
3
|
-
"commit": "
|
|
4
|
-
"buildDate": "2026-05-
|
|
2
|
+
"version": "2.1.142",
|
|
3
|
+
"commit": "880324aad10dc75b18dbac2782d9dfee7cbb1578",
|
|
4
|
+
"buildDate": "2026-05-14T16:52:01Z",
|
|
5
5
|
"platforms": {
|
|
6
6
|
"darwin-arm64": {
|
|
7
7
|
"binary": "claude.zst",
|
|
8
|
-
"checksum": "
|
|
9
|
-
"size":
|
|
8
|
+
"checksum": "0f691f77c8f4d1e7a13813c10d8de3f611c486a24fb8a2f33470b785064f8718",
|
|
9
|
+
"size": 42921902,
|
|
10
10
|
"bundle": {
|
|
11
|
-
"checksum": "
|
|
12
|
-
"size":
|
|
11
|
+
"checksum": "9e0823cd0d41df7bfa8d3f0864f3c8bb52cc4787aa495c0088afbcc8c7261058",
|
|
12
|
+
"size": 42924662
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"darwin-x64": {
|
|
16
16
|
"binary": "claude.zst",
|
|
17
|
-
"checksum": "
|
|
18
|
-
"size":
|
|
17
|
+
"checksum": "958d1a9d396a23819ef413c94510619499b3ab04cc4968a6cea7c334999272ea",
|
|
18
|
+
"size": 44836769,
|
|
19
19
|
"bundle": {
|
|
20
|
-
"checksum": "
|
|
21
|
-
"size":
|
|
20
|
+
"checksum": "f3dd24e6cc318032c795fe12c4f259de64a70b58409c187cc231e39f65453595",
|
|
21
|
+
"size": 44841630
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"linux-arm64": {
|
|
25
25
|
"binary": "claude.zst",
|
|
26
|
-
"checksum": "
|
|
27
|
-
"size":
|
|
26
|
+
"checksum": "75c7af4adb9bbd7b48b407d005cdad790a6ecb00e7e6b6de6c2b0c4acafcf81f",
|
|
27
|
+
"size": 50714165
|
|
28
28
|
},
|
|
29
29
|
"linux-x64": {
|
|
30
30
|
"binary": "claude.zst",
|
|
31
|
-
"checksum": "
|
|
32
|
-
"size":
|
|
31
|
+
"checksum": "7a9f89138613c26b815054bf009a086ed76f1c8c8265484090072d900f10d278",
|
|
32
|
+
"size": 51328541
|
|
33
33
|
},
|
|
34
34
|
"linux-arm64-musl": {
|
|
35
35
|
"binary": "claude.zst",
|
|
36
|
-
"checksum": "
|
|
37
|
-
"size":
|
|
36
|
+
"checksum": "76acedae2ff83dc06e5dc38066bd0fa42ca76c18a9aabb8e63742c01a07f5dfd",
|
|
37
|
+
"size": 49338045
|
|
38
38
|
},
|
|
39
39
|
"linux-x64-musl": {
|
|
40
40
|
"binary": "claude.zst",
|
|
41
|
-
"checksum": "
|
|
42
|
-
"size":
|
|
41
|
+
"checksum": "e6425d37a4cc099cfd1b1b13298c0f2067302decfd8542d0c12c5eb5df435ac6",
|
|
42
|
+
"size": 50052852
|
|
43
43
|
},
|
|
44
44
|
"win32-x64": {
|
|
45
45
|
"binary": "claude.exe.zst",
|
|
46
|
-
"checksum": "
|
|
47
|
-
"size":
|
|
46
|
+
"checksum": "1183b899719c41f41f3f57fb8580e50845ee645c1878e29744138b8e459d897e",
|
|
47
|
+
"size": 52050022
|
|
48
48
|
},
|
|
49
49
|
"win32-arm64": {
|
|
50
50
|
"binary": "claude.exe.zst",
|
|
51
|
-
"checksum": "
|
|
52
|
-
"size":
|
|
51
|
+
"checksum": "ca544b53e4fb45d12bd30f214de6ee85859ec9f89c7e14942bdcfb4a1db576f4",
|
|
52
|
+
"size": 50320973
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropic-ai/claude-agent-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.142",
|
|
4
4
|
"main": "sdk.mjs",
|
|
5
5
|
"types": "sdk.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"zod": "^4.0.0"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.
|
|
59
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.
|
|
60
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.
|
|
61
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.
|
|
62
|
-
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.
|
|
63
|
-
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.
|
|
58
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.142",
|
|
59
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.142",
|
|
60
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.142",
|
|
61
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.142",
|
|
62
|
+
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.142",
|
|
63
|
+
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.142",
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.142",
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.142"
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
68
68
|
"sdk.mjs",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"manifest.json",
|
|
79
79
|
"manifest.zst.json"
|
|
80
80
|
],
|
|
81
|
-
"claudeCodeVersion": "2.1.
|
|
81
|
+
"claudeCodeVersion": "2.1.142"
|
|
82
82
|
}
|
package/sdk.d.ts
CHANGED
|
@@ -635,7 +635,7 @@ export declare type ForkSessionOptions = SessionMutationOptions & {
|
|
|
635
635
|
* Result of a fork operation.
|
|
636
636
|
*/
|
|
637
637
|
export declare type ForkSessionResult = {
|
|
638
|
-
/** New session UUID. Resumable via `
|
|
638
|
+
/** New session UUID. Resumable via `query({ options: { resume: sessionId } })`. */
|
|
639
639
|
sessionId: string;
|
|
640
640
|
};
|
|
641
641
|
|
|
@@ -954,7 +954,7 @@ export declare type McpHttpServerConfig = {
|
|
|
954
954
|
headers?: Record<string, string>;
|
|
955
955
|
tools?: McpServerToolPolicy[];
|
|
956
956
|
/**
|
|
957
|
-
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even
|
|
957
|
+
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even though MCP startup is otherwise non-blocking by default, since the tools must be present when the turn-1 prompt is built.
|
|
958
958
|
*/
|
|
959
959
|
alwaysLoad?: boolean;
|
|
960
960
|
};
|
|
@@ -1059,7 +1059,7 @@ export declare type McpSSEServerConfig = {
|
|
|
1059
1059
|
headers?: Record<string, string>;
|
|
1060
1060
|
tools?: McpServerToolPolicy[];
|
|
1061
1061
|
/**
|
|
1062
|
-
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even
|
|
1062
|
+
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even though MCP startup is otherwise non-blocking by default, since the tools must be present when the turn-1 prompt is built.
|
|
1063
1063
|
*/
|
|
1064
1064
|
alwaysLoad?: boolean;
|
|
1065
1065
|
};
|
|
@@ -1070,7 +1070,7 @@ export declare type McpStdioServerConfig = {
|
|
|
1070
1070
|
args?: string[];
|
|
1071
1071
|
env?: Record<string, string>;
|
|
1072
1072
|
/**
|
|
1073
|
-
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even
|
|
1073
|
+
* When true, all tools from this server are always included in the prompt and never deferred behind tool search. Equivalent to setting defer_loading: false on the API. Default: tools are deferred when tool search is enabled. As a side effect this also blocks startup until the server is connected (capped at the standard 5s connect timeout) even though MCP startup is otherwise non-blocking by default, since the tools must be present when the turn-1 prompt is built.
|
|
1074
1074
|
*/
|
|
1075
1075
|
alwaysLoad?: boolean;
|
|
1076
1076
|
};
|
|
@@ -1226,6 +1226,32 @@ export declare type Options = {
|
|
|
1226
1226
|
* otherwise be allowed.
|
|
1227
1227
|
*/
|
|
1228
1228
|
disallowedTools?: string[];
|
|
1229
|
+
/**
|
|
1230
|
+
* Map of tool-name aliases applied before name resolution. When the
|
|
1231
|
+
* model emits a `tool_use` whose name is a key in this map, the tool
|
|
1232
|
+
* execution path resolves the mapped name instead.
|
|
1233
|
+
*
|
|
1234
|
+
* This lets SDK consumers redirect built-in tool names to their own
|
|
1235
|
+
* tools. For example, a host that runs Bash inside a remote sandbox via
|
|
1236
|
+
* an MCP tool can set `{ Bash: 'mcp__workspace__bash' }` so that if the
|
|
1237
|
+
* model emits `Bash` (e.g. because a skill document instructed it to),
|
|
1238
|
+
* the call is routed to the MCP tool instead of failing as unknown.
|
|
1239
|
+
*
|
|
1240
|
+
* The redirect is single-hop: an alias that points at another aliased
|
|
1241
|
+
* name resolves that target literally rather than following a chain, so
|
|
1242
|
+
* cycles like `{A: 'B', B: 'A'}` cannot loop.
|
|
1243
|
+
*
|
|
1244
|
+
* `toolAliases` is complementary to `disallowedTools`, not a replacement
|
|
1245
|
+
* for it: the alias only affects name-based lookup of model-emitted
|
|
1246
|
+
* `tool_use` blocks, whereas `disallowedTools` also blocks harness-internal
|
|
1247
|
+
* direct calls that hold the tool object without a name lookup.
|
|
1248
|
+
*
|
|
1249
|
+
* @example
|
|
1250
|
+
* ```typescript
|
|
1251
|
+
* toolAliases: { Bash: 'mcp__workspace__bash' }
|
|
1252
|
+
* ```
|
|
1253
|
+
*/
|
|
1254
|
+
toolAliases?: Record<string, string>;
|
|
1229
1255
|
/**
|
|
1230
1256
|
* Specify the base set of available built-in tools.
|
|
1231
1257
|
* - `string[]` - Array of specific tool names (e.g., `['Bash', 'Read', 'Edit']`)
|
|
@@ -2465,6 +2491,15 @@ export declare type SDKAssistantMessage = {
|
|
|
2465
2491
|
error?: SDKAssistantMessageError;
|
|
2466
2492
|
uuid: UUID;
|
|
2467
2493
|
session_id: string;
|
|
2494
|
+
request_id?: string;
|
|
2495
|
+
/**
|
|
2496
|
+
* Subagent type that produced this message.
|
|
2497
|
+
*/
|
|
2498
|
+
subagent_type?: string;
|
|
2499
|
+
/**
|
|
2500
|
+
* Description of the subagent task that produced this message.
|
|
2501
|
+
*/
|
|
2502
|
+
task_description?: string;
|
|
2468
2503
|
};
|
|
2469
2504
|
|
|
2470
2505
|
export declare type SDKAssistantMessageError = 'authentication_failed' | 'oauth_org_not_allowed' | 'billing_error' | 'rate_limit' | 'invalid_request' | 'server_error' | 'unknown' | 'max_output_tokens';
|
|
@@ -2714,6 +2749,10 @@ declare type SDKControlInitializeRequest = {
|
|
|
2714
2749
|
*/
|
|
2715
2750
|
planModeInstructions?: string;
|
|
2716
2751
|
|
|
2752
|
+
/**
|
|
2753
|
+
* Map of tool-name aliases applied before name resolution. When the model emits a tool_use whose name is a key in this map, the tool execution path resolves the mapped name instead. Single-hop (no chains). See Options.toolAliases.
|
|
2754
|
+
*/
|
|
2755
|
+
toolAliases?: Record<string, string>;
|
|
2717
2756
|
/**
|
|
2718
2757
|
* 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.
|
|
2719
2758
|
*/
|
|
@@ -3316,6 +3355,7 @@ export declare type SDKResultSuccess = {
|
|
|
3316
3355
|
subtype: 'success';
|
|
3317
3356
|
duration_ms: number;
|
|
3318
3357
|
duration_api_ms: number;
|
|
3358
|
+
ttft_ms?: number;
|
|
3319
3359
|
is_error: boolean;
|
|
3320
3360
|
api_error_status?: number | null;
|
|
3321
3361
|
num_turns: number;
|
|
@@ -3334,30 +3374,6 @@ export declare type SDKResultSuccess = {
|
|
|
3334
3374
|
session_id: string;
|
|
3335
3375
|
};
|
|
3336
3376
|
|
|
3337
|
-
/**
|
|
3338
|
-
* V2 API - UNSTABLE
|
|
3339
|
-
* Session interface for multi-turn conversations.
|
|
3340
|
-
* Has methods, so not serializable.
|
|
3341
|
-
* @deprecated Use `query()` instead. The V2 session API will be removed in a future release.
|
|
3342
|
-
* @alpha
|
|
3343
|
-
*/
|
|
3344
|
-
export declare interface SDKSession {
|
|
3345
|
-
/**
|
|
3346
|
-
* The session ID. Available after receiving the first message.
|
|
3347
|
-
* For resumed sessions, available immediately.
|
|
3348
|
-
* Throws if accessed before the session is initialized.
|
|
3349
|
-
*/
|
|
3350
|
-
readonly sessionId: string;
|
|
3351
|
-
/** Send a message to the agent */
|
|
3352
|
-
send(message: string | SDKUserMessage): Promise<void>;
|
|
3353
|
-
/** Stream messages from the agent */
|
|
3354
|
-
stream(): AsyncGenerator<SDKMessage, void>;
|
|
3355
|
-
/** Close the session */
|
|
3356
|
-
close(): void;
|
|
3357
|
-
/** Async disposal support (calls close if not already closed) */
|
|
3358
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3361
3377
|
/**
|
|
3362
3378
|
* Session metadata returned by listSessions and getSessionInfo.
|
|
3363
3379
|
*/
|
|
@@ -3404,85 +3420,6 @@ export declare type SDKSessionInfo = {
|
|
|
3404
3420
|
createdAt?: number;
|
|
3405
3421
|
};
|
|
3406
3422
|
|
|
3407
|
-
/**
|
|
3408
|
-
* V2 API - UNSTABLE
|
|
3409
|
-
* Options for creating a session.
|
|
3410
|
-
* @deprecated Use `query()` instead. The V2 session API will be removed in a future release.
|
|
3411
|
-
* @alpha
|
|
3412
|
-
*/
|
|
3413
|
-
export declare type SDKSessionOptions = {
|
|
3414
|
-
/** Model to use */
|
|
3415
|
-
model: string;
|
|
3416
|
-
/** Path to Claude Code executable */
|
|
3417
|
-
pathToClaudeCodeExecutable?: string;
|
|
3418
|
-
/** Executable to use (node, bun) */
|
|
3419
|
-
executable?: 'node' | 'bun';
|
|
3420
|
-
/** Arguments to pass to executable */
|
|
3421
|
-
executableArgs?: string[];
|
|
3422
|
-
/**
|
|
3423
|
-
* Environment variables to pass to the Claude Code process.
|
|
3424
|
-
* Defaults to `process.env`.
|
|
3425
|
-
*
|
|
3426
|
-
* SDK consumers can identify their app/library to include in the User-Agent header by setting:
|
|
3427
|
-
* - `CLAUDE_AGENT_SDK_CLIENT_APP` - Your app/library identifier (e.g., "my-app/1.0.0", "my-library/2.1")
|
|
3428
|
-
*/
|
|
3429
|
-
env?: {
|
|
3430
|
-
[envVar: string]: string | undefined;
|
|
3431
|
-
};
|
|
3432
|
-
/**
|
|
3433
|
-
* Working directory for the Claude Code process. Defaults to the current
|
|
3434
|
-
* process's working directory.
|
|
3435
|
-
*/
|
|
3436
|
-
cwd?: string;
|
|
3437
|
-
/**
|
|
3438
|
-
* Which settings sources to load (CLAUDE.md, `.claude/settings.json`).
|
|
3439
|
-
* Defaults to `[]`: no project/user settings are loaded unless specified.
|
|
3440
|
-
* Note that `query()` has the opposite default and loads all sources when
|
|
3441
|
-
* this is omitted.
|
|
3442
|
-
*/
|
|
3443
|
-
settingSources?: SettingSource[];
|
|
3444
|
-
/**
|
|
3445
|
-
* Must be set to `true` when using `permissionMode: 'bypassPermissions'`.
|
|
3446
|
-
* This is a safety measure to ensure intentional bypassing of permissions.
|
|
3447
|
-
*/
|
|
3448
|
-
allowDangerouslySkipPermissions?: boolean;
|
|
3449
|
-
/**
|
|
3450
|
-
* List of tool names that are auto-allowed without prompting for permission.
|
|
3451
|
-
* These tools will execute automatically without asking the user for approval.
|
|
3452
|
-
*/
|
|
3453
|
-
allowedTools?: string[];
|
|
3454
|
-
/**
|
|
3455
|
-
* List of tool names that are disallowed. These tools will be removed
|
|
3456
|
-
* from the model's context and cannot be used.
|
|
3457
|
-
*/
|
|
3458
|
-
disallowedTools?: string[];
|
|
3459
|
-
/**
|
|
3460
|
-
* Custom permission handler for controlling tool usage. Called before each
|
|
3461
|
-
* tool execution to determine if it should be allowed, denied, or prompt the user.
|
|
3462
|
-
*/
|
|
3463
|
-
canUseTool?: CanUseTool;
|
|
3464
|
-
/**
|
|
3465
|
-
* Hook callbacks for responding to various events during execution.
|
|
3466
|
-
*/
|
|
3467
|
-
hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
3468
|
-
/**
|
|
3469
|
-
* Permission mode for the session.
|
|
3470
|
-
* - `'default'` - Standard permission behavior, prompts for dangerous operations
|
|
3471
|
-
* - `'acceptEdits'` - Auto-accept file edit operations
|
|
3472
|
-
* - `'bypassPermissions'` - Bypass all permission checks (requires `allowDangerouslySkipPermissions`)
|
|
3473
|
-
* - `'plan'` - Planning mode, no execution of tools
|
|
3474
|
-
* - `'dontAsk'` - Don't prompt for permissions, deny if not pre-approved
|
|
3475
|
-
*/
|
|
3476
|
-
permissionMode?: PermissionMode;
|
|
3477
|
-
/**
|
|
3478
|
-
* Custom workflow instructions for plan mode. When `permissionMode` is
|
|
3479
|
-
* `'plan'`, this string replaces the default code-implementation workflow
|
|
3480
|
-
* body in the plan-mode system reminder. The CLI still wraps it with the
|
|
3481
|
-
* read-only enforcement preamble and the ExitPlanMode protocol footer.
|
|
3482
|
-
*/
|
|
3483
|
-
planModeInstructions?: string;
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
3423
|
/**
|
|
3487
3424
|
* Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.
|
|
3488
3425
|
*/
|
|
@@ -3584,6 +3521,10 @@ export declare type SDKTaskProgressMessage = {
|
|
|
3584
3521
|
task_id: string;
|
|
3585
3522
|
tool_use_id?: string;
|
|
3586
3523
|
description: string;
|
|
3524
|
+
/**
|
|
3525
|
+
* Subagent type for Task tool subagents.
|
|
3526
|
+
*/
|
|
3527
|
+
subagent_type?: string;
|
|
3587
3528
|
usage: {
|
|
3588
3529
|
total_tokens: number;
|
|
3589
3530
|
tool_uses: number;
|
|
@@ -3602,6 +3543,10 @@ export declare type SDKTaskStartedMessage = {
|
|
|
3602
3543
|
task_id: string;
|
|
3603
3544
|
tool_use_id?: string;
|
|
3604
3545
|
description: string;
|
|
3546
|
+
/**
|
|
3547
|
+
* Subagent type for Task tool subagents.
|
|
3548
|
+
*/
|
|
3549
|
+
subagent_type?: string;
|
|
3605
3550
|
task_type?: string;
|
|
3606
3551
|
/**
|
|
3607
3552
|
* meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.
|
|
@@ -3673,6 +3618,14 @@ export declare type SDKUserMessage = {
|
|
|
3673
3618
|
timestamp?: string;
|
|
3674
3619
|
uuid?: UUID;
|
|
3675
3620
|
session_id?: string;
|
|
3621
|
+
/**
|
|
3622
|
+
* Subagent type that produced this message.
|
|
3623
|
+
*/
|
|
3624
|
+
subagent_type?: string;
|
|
3625
|
+
/**
|
|
3626
|
+
* Description of the subagent task that produced this message.
|
|
3627
|
+
*/
|
|
3628
|
+
task_description?: string;
|
|
3676
3629
|
};
|
|
3677
3630
|
|
|
3678
3631
|
export declare type SDKUserMessageReplay = {
|
|
@@ -5692,37 +5645,6 @@ export declare interface Transport {
|
|
|
5692
5645
|
[Symbol.dispose]?(): void;
|
|
5693
5646
|
}
|
|
5694
5647
|
|
|
5695
|
-
/**
|
|
5696
|
-
* V2 API - UNSTABLE
|
|
5697
|
-
* Create a persistent session for multi-turn conversations.
|
|
5698
|
-
* @deprecated Use `query()` instead. The V2 session API will be removed in a future release.
|
|
5699
|
-
* @alpha
|
|
5700
|
-
*/
|
|
5701
|
-
export declare function unstable_v2_createSession(_options: SDKSessionOptions): SDKSession;
|
|
5702
|
-
|
|
5703
|
-
/**
|
|
5704
|
-
* V2 API - UNSTABLE
|
|
5705
|
-
* One-shot convenience function for single prompts.
|
|
5706
|
-
* @deprecated Use `query()` instead. The V2 session API will be removed in a future release.
|
|
5707
|
-
* @alpha
|
|
5708
|
-
*
|
|
5709
|
-
* @example
|
|
5710
|
-
* ```typescript
|
|
5711
|
-
* const result = await unstable_v2_prompt("What files are here?", {
|
|
5712
|
-
* model: 'claude-sonnet-4-6'
|
|
5713
|
-
* })
|
|
5714
|
-
* ```
|
|
5715
|
-
*/
|
|
5716
|
-
export declare function unstable_v2_prompt(_message: string, _options: SDKSessionOptions): Promise<SDKResultMessage>;
|
|
5717
|
-
|
|
5718
|
-
/**
|
|
5719
|
-
* V2 API - UNSTABLE
|
|
5720
|
-
* Resume an existing session by ID.
|
|
5721
|
-
* @deprecated Use `query()` instead. The V2 session API will be removed in a future release.
|
|
5722
|
-
* @alpha
|
|
5723
|
-
*/
|
|
5724
|
-
export declare function unstable_v2_resumeSession(_sessionId: string, _options: SDKSessionOptions): SDKSession;
|
|
5725
|
-
|
|
5726
5648
|
export declare type UserPromptExpansionHookInput = BaseHookInput & {
|
|
5727
5649
|
hook_event_name: 'UserPromptExpansion';
|
|
5728
5650
|
expansion_type: 'slash_command' | 'mcp_prompt';
|