@anthropic-ai/claude-code 1.0.92 → 1.0.94
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 +882 -881
- package/package.json +1 -1
- package/sdk.d.ts +65 -1
- package/sdk.mjs +13838 -647
- package/vendor/claude-code.vsix +0 -0
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -1,5 +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';
|
|
4
|
+
import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { type z, type ZodRawShape, type ZodObject } from 'zod';
|
|
3
6
|
export type NonNullableUsage = {
|
|
4
7
|
[K in keyof Usage]: NonNullable<Usage[K]>;
|
|
5
8
|
};
|
|
@@ -21,16 +24,60 @@ export type McpHttpServerConfig = {
|
|
|
21
24
|
url: string;
|
|
22
25
|
headers?: Record<string, string>;
|
|
23
26
|
};
|
|
24
|
-
export type
|
|
27
|
+
export type McpSdkServerConfig = {
|
|
28
|
+
type: 'sdk';
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
export type McpSdkServerConfigWithInstance = McpSdkServerConfig & {
|
|
32
|
+
instance: McpServer;
|
|
33
|
+
};
|
|
34
|
+
export type McpServerConfig = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfigWithInstance;
|
|
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
|
+
};
|
|
25
66
|
export type PermissionResult = {
|
|
26
67
|
behavior: 'allow';
|
|
27
68
|
updatedInput: Record<string, unknown>;
|
|
69
|
+
updatedPermissions?: PermissionUpdate[];
|
|
28
70
|
} | {
|
|
29
71
|
behavior: 'deny';
|
|
30
72
|
message: string;
|
|
31
73
|
};
|
|
74
|
+
export type PermissionRuleValue = {
|
|
75
|
+
toolName: string;
|
|
76
|
+
ruleContent?: string;
|
|
77
|
+
};
|
|
32
78
|
export type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
|
|
33
79
|
signal: AbortSignal;
|
|
80
|
+
suggestions?: PermissionUpdate[];
|
|
34
81
|
}) => Promise<PermissionResult>;
|
|
35
82
|
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStop", "PreCompact"];
|
|
36
83
|
export type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
@@ -235,6 +282,23 @@ export declare function query({ prompt, options, }: {
|
|
|
235
282
|
prompt: string | AsyncIterable<SDKUserMessage>;
|
|
236
283
|
options?: Options;
|
|
237
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;
|
|
238
302
|
export declare class AbortError extends Error {
|
|
239
303
|
}
|
|
240
304
|
export {};
|