@anthropic-ai/claude-agent-sdk 0.2.9 → 0.2.10
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/cli.js +1417 -1486
- package/package.json +2 -2
- package/sdk-tools.d.ts +12 -0
- package/sdk.d.ts +37 -5
- package/sdk.mjs +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropic-ai/claude-agent-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"main": "sdk.mjs",
|
|
5
5
|
"types": "sdk.d.ts",
|
|
6
6
|
"engines": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@img/sharp-linuxmusl-x64": "^0.33.5",
|
|
38
38
|
"@img/sharp-win32-x64": "^0.33.5"
|
|
39
39
|
},
|
|
40
|
-
"claudeCodeVersion": "2.1.
|
|
40
|
+
"claudeCodeVersion": "2.1.10"
|
|
41
41
|
}
|
package/sdk-tools.d.ts
CHANGED
|
@@ -126,6 +126,18 @@ export interface ExitPlanModeInput {
|
|
|
126
126
|
*/
|
|
127
127
|
prompt: string;
|
|
128
128
|
}[];
|
|
129
|
+
/**
|
|
130
|
+
* Whether to push the plan to a remote Claude.ai session
|
|
131
|
+
*/
|
|
132
|
+
pushToRemote?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* The remote session ID if pushed to remote
|
|
135
|
+
*/
|
|
136
|
+
remoteSessionId?: string;
|
|
137
|
+
/**
|
|
138
|
+
* The remote session URL if pushed to remote
|
|
139
|
+
*/
|
|
140
|
+
remoteSessionUrl?: string;
|
|
129
141
|
[k: string]: unknown;
|
|
130
142
|
}
|
|
131
143
|
export interface FileEditInput {
|
package/sdk.d.ts
CHANGED
|
@@ -55,6 +55,14 @@ export declare type AgentDefinition = {
|
|
|
55
55
|
* Experimental: Critical reminder added to system prompt
|
|
56
56
|
*/
|
|
57
57
|
criticalSystemReminder_EXPERIMENTAL?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Array of skill names to preload into the agent context
|
|
60
|
+
*/
|
|
61
|
+
skills?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Maximum number of agentic turns (API round-trips) before stopping
|
|
64
|
+
*/
|
|
65
|
+
maxTurns?: number;
|
|
58
66
|
};
|
|
59
67
|
|
|
60
68
|
export declare type AgentMcpServerSpec = string | Record<string, McpServerConfigForProcessTransport>;
|
|
@@ -192,6 +200,7 @@ declare namespace coreTypes {
|
|
|
192
200
|
SDKStatusMessage,
|
|
193
201
|
SDKStatus,
|
|
194
202
|
SDKSystemMessage,
|
|
203
|
+
SDKTaskNotificationMessage,
|
|
195
204
|
SDKToolProgressMessage,
|
|
196
205
|
SDKUserMessageReplay,
|
|
197
206
|
SDKUserMessage,
|
|
@@ -201,6 +210,8 @@ declare namespace coreTypes {
|
|
|
201
210
|
SessionStartHookInput,
|
|
202
211
|
SessionStartHookSpecificOutput,
|
|
203
212
|
SettingSource,
|
|
213
|
+
SetupHookInput,
|
|
214
|
+
SetupHookSpecificOutput,
|
|
204
215
|
SlashCommand,
|
|
205
216
|
StopHookInput,
|
|
206
217
|
SubagentStartHookInput,
|
|
@@ -230,7 +241,7 @@ export declare const EXIT_REASONS: readonly ["clear", "logout", "prompt_input_ex
|
|
|
230
241
|
|
|
231
242
|
export declare type ExitReason = 'clear' | 'logout' | 'prompt_input_exit' | 'other' | 'bypass_permissions_disabled';
|
|
232
243
|
|
|
233
|
-
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStart", "SubagentStop", "PreCompact", "PermissionRequest"];
|
|
244
|
+
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStart", "SubagentStop", "PreCompact", "PermissionRequest", "Setup"];
|
|
234
245
|
|
|
235
246
|
/**
|
|
236
247
|
* Hook callback function for responding to events during execution.
|
|
@@ -249,9 +260,9 @@ export declare interface HookCallbackMatcher {
|
|
|
249
260
|
timeout?: number;
|
|
250
261
|
}
|
|
251
262
|
|
|
252
|
-
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'Notification' | 'UserPromptSubmit' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PermissionRequest';
|
|
263
|
+
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'Notification' | 'UserPromptSubmit' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PermissionRequest' | 'Setup';
|
|
253
264
|
|
|
254
|
-
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | NotificationHookInput | UserPromptSubmitHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PermissionRequestHookInput;
|
|
265
|
+
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | NotificationHookInput | UserPromptSubmitHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PermissionRequestHookInput | SetupHookInput;
|
|
255
266
|
|
|
256
267
|
export declare type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
|
|
257
268
|
|
|
@@ -1196,7 +1207,7 @@ export declare type SdkMcpToolDefinition<Schema extends AnyZodRawShape = AnyZodR
|
|
|
1196
1207
|
handler: (args: InferShape<Schema>, extra: unknown) => Promise<CallToolResult>;
|
|
1197
1208
|
};
|
|
1198
1209
|
|
|
1199
|
-
export declare type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKHookResponseMessage | SDKToolProgressMessage | SDKAuthStatusMessage;
|
|
1210
|
+
export declare type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKHookResponseMessage | SDKToolProgressMessage | SDKAuthStatusMessage | SDKTaskNotificationMessage;
|
|
1200
1211
|
|
|
1201
1212
|
export declare type SDKPartialAssistantMessage = {
|
|
1202
1213
|
type: 'stream_event';
|
|
@@ -1373,6 +1384,17 @@ export declare type SDKSystemMessage = {
|
|
|
1373
1384
|
session_id: string;
|
|
1374
1385
|
};
|
|
1375
1386
|
|
|
1387
|
+
export declare type SDKTaskNotificationMessage = {
|
|
1388
|
+
type: 'system';
|
|
1389
|
+
subtype: 'task_notification';
|
|
1390
|
+
task_id: string;
|
|
1391
|
+
status: 'completed' | 'failed' | 'stopped';
|
|
1392
|
+
output_file: string;
|
|
1393
|
+
summary: string;
|
|
1394
|
+
uuid: UUID;
|
|
1395
|
+
session_id: string;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1376
1398
|
export declare type SDKToolProgressMessage = {
|
|
1377
1399
|
type: 'tool_progress';
|
|
1378
1400
|
tool_use_id: string;
|
|
@@ -1426,6 +1448,16 @@ export declare type SessionStartHookSpecificOutput = {
|
|
|
1426
1448
|
*/
|
|
1427
1449
|
export declare type SettingSource = 'user' | 'project' | 'local';
|
|
1428
1450
|
|
|
1451
|
+
export declare type SetupHookInput = BaseHookInput & {
|
|
1452
|
+
hook_event_name: 'Setup';
|
|
1453
|
+
trigger: 'init' | 'maintenance';
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
export declare type SetupHookSpecificOutput = {
|
|
1457
|
+
hookEventName: 'Setup';
|
|
1458
|
+
additionalContext?: string;
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1429
1461
|
/**
|
|
1430
1462
|
* Information about an available skill (invoked via /command syntax).
|
|
1431
1463
|
*/
|
|
@@ -1537,7 +1569,7 @@ export declare type SyncHookJSONOutput = {
|
|
|
1537
1569
|
decision?: 'approve' | 'block';
|
|
1538
1570
|
systemMessage?: string;
|
|
1539
1571
|
reason?: string;
|
|
1540
|
-
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | SessionStartHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PermissionRequestHookSpecificOutput;
|
|
1572
|
+
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PermissionRequestHookSpecificOutput;
|
|
1541
1573
|
};
|
|
1542
1574
|
|
|
1543
1575
|
export declare function tool<Schema extends AnyZodRawShape>(_name: string, _description: string, _inputSchema: Schema, _handler: (args: InferShape<Schema>, extra: unknown) => Promise<CallToolResult>): SdkMcpToolDefinition<Schema>;
|
package/sdk.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
|
|
3
3
|
|
|
4
|
-
// Version: 0.2.
|
|
4
|
+
// Version: 0.2.10
|
|
5
5
|
|
|
6
6
|
// Want to see the unminified source? We're hiring!
|
|
7
7
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -7499,7 +7499,8 @@ var HOOK_EVENTS = [
|
|
|
7499
7499
|
"SubagentStart",
|
|
7500
7500
|
"SubagentStop",
|
|
7501
7501
|
"PreCompact",
|
|
7502
|
-
"PermissionRequest"
|
|
7502
|
+
"PermissionRequest",
|
|
7503
|
+
"Setup"
|
|
7503
7504
|
];
|
|
7504
7505
|
var EXIT_REASONS = [
|
|
7505
7506
|
"clear",
|
|
@@ -21324,7 +21325,7 @@ function query({
|
|
|
21324
21325
|
const dirname2 = join5(filename, "..");
|
|
21325
21326
|
pathToClaudeCodeExecutable = join5(dirname2, "cli.js");
|
|
21326
21327
|
}
|
|
21327
|
-
process.env.CLAUDE_AGENT_SDK_VERSION = "0.2.
|
|
21328
|
+
process.env.CLAUDE_AGENT_SDK_VERSION = "0.2.10";
|
|
21328
21329
|
const {
|
|
21329
21330
|
abortController = createAbortController(),
|
|
21330
21331
|
additionalDirectories = [],
|