@anthropic-ai/claude-agent-sdk 0.1.69 → 0.1.71
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 +1746 -1441
- package/entrypoints/agentSdkTypes.d.ts +31 -5
- package/entrypoints/sdkControlTypes.d.ts +11 -2
- package/package.json +2 -2
- package/sdk.mjs +23657 -12163
|
@@ -306,9 +306,10 @@ export type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
|
|
|
306
306
|
* - `'acceptEdits'` - Auto-accept file edit operations
|
|
307
307
|
* - `'bypassPermissions'` - Bypass all permission checks (requires `allowDangerouslySkipPermissions`)
|
|
308
308
|
* - `'plan'` - Planning mode, no actual tool execution
|
|
309
|
+
* - `'delegate'` - Delegate mode, restricts team leader to only Teammate and Task tools
|
|
309
310
|
* - `'dontAsk'` - Don't prompt for permissions, deny if not pre-approved
|
|
310
311
|
*/
|
|
311
|
-
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk';
|
|
312
|
+
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'delegate' | 'dontAsk';
|
|
312
313
|
/**
|
|
313
314
|
* Information about an available slash command.
|
|
314
315
|
*/
|
|
@@ -353,6 +354,17 @@ export type McpServerStatus = {
|
|
|
353
354
|
version: string;
|
|
354
355
|
};
|
|
355
356
|
};
|
|
357
|
+
/**
|
|
358
|
+
* Result of a setMcpServers operation.
|
|
359
|
+
*/
|
|
360
|
+
export type McpSetServersResult = {
|
|
361
|
+
/** Names of servers that were added */
|
|
362
|
+
added: string[];
|
|
363
|
+
/** Names of servers that were removed */
|
|
364
|
+
removed: string[];
|
|
365
|
+
/** Map of server names to error messages for servers that failed to connect */
|
|
366
|
+
errors: Record<string, string>;
|
|
367
|
+
};
|
|
356
368
|
type SDKUserMessageContent = {
|
|
357
369
|
type: 'user';
|
|
358
370
|
message: APIUserMessage;
|
|
@@ -579,6 +591,18 @@ export interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
579
591
|
* @param userMessageId - UUID of the user message to rewind to
|
|
580
592
|
*/
|
|
581
593
|
rewindFiles(userMessageId: string): Promise<void>;
|
|
594
|
+
/**
|
|
595
|
+
* Dynamically set the MCP servers for this session.
|
|
596
|
+
* This replaces the current set of dynamically-added MCP servers with the provided set.
|
|
597
|
+
* Servers that are removed will be disconnected, and new servers will be connected.
|
|
598
|
+
*
|
|
599
|
+
* Note: This only affects servers added dynamically via this method or the SDK.
|
|
600
|
+
* Servers configured via settings files are not affected.
|
|
601
|
+
*
|
|
602
|
+
* @param servers - Record of server name to configuration. Pass an empty object to remove all dynamic servers.
|
|
603
|
+
* @returns Information about which servers were added, removed, and any connection errors
|
|
604
|
+
*/
|
|
605
|
+
setMcpServers(servers: Record<string, McpServerConfigForProcessTransport>): Promise<McpSetServersResult>;
|
|
582
606
|
/**
|
|
583
607
|
* Stream input messages to the query.
|
|
584
608
|
* Used internally for multi-turn conversations.
|
|
@@ -710,8 +734,9 @@ export type Options = {
|
|
|
710
734
|
*/
|
|
711
735
|
agents?: Record<string, AgentDefinition>;
|
|
712
736
|
/**
|
|
713
|
-
* List of tool names that are allowed
|
|
714
|
-
* will
|
|
737
|
+
* List of tool names that are auto-allowed without prompting for permission.
|
|
738
|
+
* These tools will execute automatically without asking the user for approval.
|
|
739
|
+
* To restrict which tools are available, use the `tools` option instead.
|
|
715
740
|
*/
|
|
716
741
|
allowedTools?: string[];
|
|
717
742
|
/**
|
|
@@ -729,8 +754,9 @@ export type Options = {
|
|
|
729
754
|
*/
|
|
730
755
|
cwd?: string;
|
|
731
756
|
/**
|
|
732
|
-
* List of tool names that are disallowed. These tools will
|
|
733
|
-
* even if they would
|
|
757
|
+
* List of tool names that are disallowed. These tools will be removed
|
|
758
|
+
* from the model's context and cannot be used, even if they would
|
|
759
|
+
* otherwise be allowed.
|
|
734
760
|
*/
|
|
735
761
|
disallowedTools?: string[];
|
|
736
762
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccountInfo, type PermissionMode, type SDKMessage, type SDKUserMessage, type HookInput, type HookEvent, type PermissionUpdate, type ModelInfo, type SlashCommand, type AgentDefinition } from './agentSdkTypes.js';
|
|
1
|
+
import { type AccountInfo, type PermissionMode, type SDKMessage, type SDKUserMessage, type HookInput, type HookEvent, type PermissionUpdate, type ModelInfo, type SlashCommand, type AgentDefinition, type McpServerConfigForProcessTransport } from './agentSdkTypes.js';
|
|
2
2
|
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
export type SDKControlInitializeRequest = {
|
|
4
4
|
subtype: 'initialize';
|
|
@@ -65,10 +65,19 @@ export type SDKControlMcpMessageRequest = {
|
|
|
65
65
|
server_name: string;
|
|
66
66
|
message: JSONRPCMessage;
|
|
67
67
|
};
|
|
68
|
+
export type SDKControlMcpSetServersRequest = {
|
|
69
|
+
subtype: 'mcp_set_servers';
|
|
70
|
+
servers: Record<string, McpServerConfigForProcessTransport>;
|
|
71
|
+
};
|
|
72
|
+
export type SDKControlMcpSetServersResponse = {
|
|
73
|
+
added: string[];
|
|
74
|
+
removed: string[];
|
|
75
|
+
errors: Record<string, string>;
|
|
76
|
+
};
|
|
68
77
|
export type SDKControlRequest = {
|
|
69
78
|
type: 'control_request';
|
|
70
79
|
request_id: string;
|
|
71
|
-
request: SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest;
|
|
80
|
+
request: SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlMcpSetServersRequest;
|
|
72
81
|
};
|
|
73
82
|
export type SDKControlResponse = {
|
|
74
83
|
type: 'control_response';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropic-ai/claude-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"main": "sdk.mjs",
|
|
5
5
|
"types": "sdk.d.ts",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"zod": "^3.24.1"
|
|
28
|
+
"zod": "^3.24.1 || ^4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
31
|
"@img/sharp-darwin-arm64": "^0.33.5",
|