@anthropic-ai/claude-agent-sdk 0.2.12 → 0.2.15

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.
Files changed (5) hide show
  1. package/cli.js +1976 -2022
  2. package/package.json +2 -2
  3. package/sdk-tools.d.ts +4 -0
  4. package/sdk.d.ts +43 -3
  5. package/sdk.mjs +45 -21480
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-agent-sdk",
3
- "version": "0.2.12",
3
+ "version": "0.2.15",
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.12"
40
+ "claudeCodeVersion": "2.1.15"
41
41
  }
package/sdk-tools.d.ts CHANGED
@@ -138,6 +138,10 @@ export interface ExitPlanModeInput {
138
138
  * The remote session URL if pushed to remote
139
139
  */
140
140
  remoteSessionUrl?: string;
141
+ /**
142
+ * The remote session title if pushed to remote
143
+ */
144
+ remoteSessionTitle?: string;
141
145
  [k: string]: unknown;
142
146
  }
143
147
  export interface FileEditInput {
package/sdk.d.ts CHANGED
@@ -168,6 +168,7 @@ declare namespace coreTypes {
168
168
  ModelInfo,
169
169
  ModelUsage,
170
170
  NotificationHookInput,
171
+ NotificationHookSpecificOutput,
171
172
  OutputFormat,
172
173
  OutputFormatType,
173
174
  PermissionBehavior,
@@ -191,6 +192,7 @@ declare namespace coreTypes {
191
192
  SDKAuthStatusMessage,
192
193
  SDKCompactBoundaryMessage,
193
194
  SDKHookResponseMessage,
195
+ SDKHookStartedMessage,
194
196
  SDKMessage,
195
197
  SDKPartialAssistantMessage,
196
198
  SDKPermissionDenial,
@@ -399,6 +401,11 @@ export declare type NotificationHookInput = BaseHookInput & {
399
401
  notification_type: string;
400
402
  };
401
403
 
404
+ export declare type NotificationHookSpecificOutput = {
405
+ hookEventName: 'Notification';
406
+ additionalContext?: string;
407
+ };
408
+
402
409
  /**
403
410
  * Options for the query function.
404
411
  * Contains callbacks and other non-serializable fields.
@@ -982,6 +989,15 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
982
989
  * @param stream - Async iterable of user messages to send
983
990
  */
984
991
  streamInput(stream: AsyncIterable<SDKUserMessage>): Promise<void>;
992
+ /**
993
+ * Close the query and terminate the underlying process.
994
+ * This forcefully ends the query, cleaning up all resources including
995
+ * pending requests, MCP transports, and the CLI subprocess.
996
+ *
997
+ * Use this when you need to abort a query that is still running.
998
+ * After calling close(), no further messages will be received.
999
+ */
1000
+ close(): void;
985
1001
  }
986
1002
 
987
1003
  export declare function query(_params: {
@@ -1103,6 +1119,11 @@ declare type SDKControlMcpMessageRequest = {
1103
1119
  message: JSONRPCMessage;
1104
1120
  };
1105
1121
 
1122
+ declare type SDKControlMcpReconnectRequest = {
1123
+ subtype: 'mcp_reconnect';
1124
+ serverName: string;
1125
+ };
1126
+
1106
1127
  declare type SDKControlMcpSetServersRequest = {
1107
1128
  subtype: 'mcp_set_servers';
1108
1129
  servers: Record<string, coreTypes.McpServerConfigForProcessTransport>;
@@ -1112,6 +1133,12 @@ declare type SDKControlMcpStatusRequest = {
1112
1133
  subtype: 'mcp_status';
1113
1134
  };
1114
1135
 
1136
+ declare type SDKControlMcpToggleRequest = {
1137
+ subtype: 'mcp_toggle';
1138
+ serverName: string;
1139
+ enabled: boolean;
1140
+ };
1141
+
1115
1142
  declare type SDKControlPermissionRequest = {
1116
1143
  subtype: 'can_use_tool';
1117
1144
  tool_name: string;
@@ -1129,7 +1156,7 @@ declare type SDKControlRequest = {
1129
1156
  request: SDKControlRequestInner;
1130
1157
  };
1131
1158
 
1132
- declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlMcpSetServersRequest;
1159
+ declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlMcpSetServersRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest;
1133
1160
 
1134
1161
  declare type SDKControlResponse = {
1135
1162
  type: 'control_response';
@@ -1179,11 +1206,24 @@ declare type SDKHookCallbackRequest = {
1179
1206
  export declare type SDKHookResponseMessage = {
1180
1207
  type: 'system';
1181
1208
  subtype: 'hook_response';
1209
+ hook_id: string;
1182
1210
  hook_name: string;
1183
1211
  hook_event: string;
1212
+ output: string;
1184
1213
  stdout: string;
1185
1214
  stderr: string;
1186
1215
  exit_code?: number;
1216
+ outcome: 'success' | 'error' | 'cancelled';
1217
+ uuid: UUID;
1218
+ session_id: string;
1219
+ };
1220
+
1221
+ export declare type SDKHookStartedMessage = {
1222
+ type: 'system';
1223
+ subtype: 'hook_started';
1224
+ hook_id: string;
1225
+ hook_name: string;
1226
+ hook_event: string;
1187
1227
  uuid: UUID;
1188
1228
  session_id: string;
1189
1229
  };
@@ -1207,7 +1247,7 @@ export declare type SdkMcpToolDefinition<Schema extends AnyZodRawShape = AnyZodR
1207
1247
  handler: (args: InferShape<Schema>, extra: unknown) => Promise<CallToolResult>;
1208
1248
  };
1209
1249
 
1210
- export declare type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKHookResponseMessage | SDKToolProgressMessage | SDKAuthStatusMessage | SDKTaskNotificationMessage;
1250
+ export declare type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKHookStartedMessage | SDKHookResponseMessage | SDKToolProgressMessage | SDKAuthStatusMessage | SDKTaskNotificationMessage;
1211
1251
 
1212
1252
  export declare type SDKPartialAssistantMessage = {
1213
1253
  type: 'stream_event';
@@ -1569,7 +1609,7 @@ export declare type SyncHookJSONOutput = {
1569
1609
  decision?: 'approve' | 'block';
1570
1610
  systemMessage?: string;
1571
1611
  reason?: string;
1572
- hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PermissionRequestHookSpecificOutput;
1612
+ hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput;
1573
1613
  };
1574
1614
 
1575
1615
  export declare function tool<Schema extends AnyZodRawShape>(_name: string, _description: string, _inputSchema: Schema, _handler: (args: InferShape<Schema>, extra: unknown) => Promise<CallToolResult>): SdkMcpToolDefinition<Schema>;