@anthropic-ai/claude-code 1.0.93 → 1.0.95

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "main": "sdk.mjs",
5
5
  "types": "sdk.d.ts",
6
6
  "bin": {
package/sdk.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { Message as APIAssistantMessage, MessageParam as APIUserMessage, Usage } from '@anthropic-ai/sdk/resources';
2
2
  import type { UUID } from 'crypto';
3
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
4
  import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { type z, type ZodRawShape, type ZodObject } from 'zod';
4
6
  export type NonNullableUsage = {
5
7
  [K in keyof Usage]: NonNullable<Usage[K]>;
6
8
  };
@@ -31,15 +33,51 @@ export type McpSdkServerConfigWithInstance = McpSdkServerConfig & {
31
33
  };
32
34
  export type McpServerConfig = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfigWithInstance;
33
35
  export type McpServerConfigForProcessTransport = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfig;
36
+ type PermissionUpdateDestination = 'userSettings' | 'projectSettings' | 'localSettings' | 'session';
37
+ export type PermissionBehavior = 'allow' | 'deny' | 'ask';
38
+ export type PermissionUpdate = {
39
+ type: 'addRules';
40
+ rules: PermissionRuleValue[];
41
+ behavior: PermissionBehavior;
42
+ destination: PermissionUpdateDestination;
43
+ } | {
44
+ type: 'replaceRules';
45
+ rules: PermissionRuleValue[];
46
+ behavior: PermissionBehavior;
47
+ destination: PermissionUpdateDestination;
48
+ } | {
49
+ type: 'removeRules';
50
+ rules: PermissionRuleValue[];
51
+ behavior: PermissionBehavior;
52
+ destination: PermissionUpdateDestination;
53
+ } | {
54
+ type: 'setMode';
55
+ mode: PermissionMode;
56
+ destination: PermissionUpdateDestination;
57
+ } | {
58
+ type: 'addDirectories';
59
+ directories: string[];
60
+ destination: PermissionUpdateDestination;
61
+ } | {
62
+ type: 'removeDirectories';
63
+ directories: string[];
64
+ destination: PermissionUpdateDestination;
65
+ };
34
66
  export type PermissionResult = {
35
67
  behavior: 'allow';
36
68
  updatedInput: Record<string, unknown>;
69
+ updatedPermissions?: PermissionUpdate[];
37
70
  } | {
38
71
  behavior: 'deny';
39
72
  message: string;
40
73
  };
74
+ export type PermissionRuleValue = {
75
+ toolName: string;
76
+ ruleContent?: string;
77
+ };
41
78
  export type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
42
79
  signal: AbortSignal;
80
+ suggestions?: PermissionUpdate[];
43
81
  }) => Promise<PermissionResult>;
44
82
  export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStop", "PreCompact"];
45
83
  export type HookEvent = (typeof HOOK_EVENTS)[number];
@@ -244,6 +282,23 @@ export declare function query({ prompt, options, }: {
244
282
  prompt: string | AsyncIterable<SDKUserMessage>;
245
283
  options?: Options;
246
284
  }): Query;
285
+ type SdkMcpToolDefinition<Schema extends ZodRawShape = ZodRawShape> = {
286
+ name: string;
287
+ description: string;
288
+ inputSchema: Schema;
289
+ handler: (args: z.infer<ZodObject<Schema>>, extra: unknown) => Promise<CallToolResult>;
290
+ };
291
+ export declare function tool<Schema extends ZodRawShape>(name: string, description: string, inputSchema: Schema, handler: (args: z.infer<ZodObject<Schema>>, extra: unknown) => Promise<CallToolResult>): SdkMcpToolDefinition<Schema>;
292
+ type CreateSdkMcpServerOptions = {
293
+ name: string;
294
+ version?: string;
295
+ tools?: Array<SdkMcpToolDefinition<any>>;
296
+ };
297
+ /**
298
+ * Creates an MCP server instance that can be used with the SDK transport.
299
+ * This allows SDK users to define custom tools that run in the same process.
300
+ */
301
+ export declare function createSdkMcpServer(options: CreateSdkMcpServerOptions): McpSdkServerConfigWithInstance;
247
302
  export declare class AbortError extends Error {
248
303
  }
249
304
  export {};
package/sdk.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
4
4
 
5
- // Version: 1.0.93
5
+ // Version: 1.0.95
6
6
 
7
7
  // Want to see the unminified source? We're hiring!
8
8
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
@@ -6902,7 +6902,8 @@ class Query {
6902
6902
  throw new Error("canUseTool callback is not provided.");
6903
6903
  }
6904
6904
  return this.canUseTool(request.request.tool_name, request.request.input, {
6905
- signal
6905
+ signal,
6906
+ suggestions: request.request.permission_suggestions
6906
6907
  });
6907
6908
  } else if (request.request.subtype === "hook_callback") {
6908
6909
  const result = await this.handleHookCallbacks(request.request.callback_id, request.request.input, request.request.tool_use_id, signal);
Binary file