@langchain/anthropic 1.2.3 → 1.3.0-dev-1765432861398
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/README.md +620 -3
- package/dist/chat_models.cjs +8 -5
- package/dist/chat_models.cjs.map +1 -1
- package/dist/chat_models.d.cts +13 -16
- package/dist/chat_models.d.cts.map +1 -0
- package/dist/chat_models.d.ts +13 -16
- package/dist/chat_models.d.ts.map +1 -0
- package/dist/chat_models.js +7 -4
- package/dist/chat_models.js.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +2 -1
- package/dist/tools/bash.cjs +95 -0
- package/dist/tools/bash.cjs.map +1 -0
- package/dist/tools/bash.d.cts +99 -0
- package/dist/tools/bash.d.cts.map +1 -0
- package/dist/tools/bash.d.ts +99 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +94 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/codeExecution.cjs +70 -0
- package/dist/tools/codeExecution.cjs.map +1 -0
- package/dist/tools/codeExecution.d.cts +75 -0
- package/dist/tools/codeExecution.d.cts.map +1 -0
- package/dist/tools/codeExecution.d.ts +75 -0
- package/dist/tools/codeExecution.d.ts.map +1 -0
- package/dist/tools/codeExecution.js +69 -0
- package/dist/tools/codeExecution.js.map +1 -0
- package/dist/tools/computer.cjs +161 -0
- package/dist/tools/computer.cjs.map +1 -0
- package/dist/tools/computer.d.cts +289 -0
- package/dist/tools/computer.d.cts.map +1 -0
- package/dist/tools/computer.d.ts +289 -0
- package/dist/tools/computer.d.ts.map +1 -0
- package/dist/tools/computer.js +159 -0
- package/dist/tools/computer.js.map +1 -0
- package/dist/tools/index.cjs +28 -0
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +28 -0
- package/dist/tools/index.d.cts.map +1 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mcpToolset.cjs +111 -0
- package/dist/tools/mcpToolset.cjs.map +1 -0
- package/dist/tools/mcpToolset.d.cts +141 -0
- package/dist/tools/mcpToolset.d.cts.map +1 -0
- package/dist/tools/mcpToolset.d.ts +141 -0
- package/dist/tools/mcpToolset.d.ts.map +1 -0
- package/dist/tools/mcpToolset.js +110 -0
- package/dist/tools/mcpToolset.js.map +1 -0
- package/dist/tools/memory.cjs +56 -0
- package/dist/tools/memory.cjs.map +1 -0
- package/dist/tools/memory.d.cts +92 -0
- package/dist/tools/memory.d.cts.map +1 -0
- package/dist/tools/memory.d.ts +92 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +55 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/textEditor.cjs +79 -0
- package/dist/tools/textEditor.cjs.map +1 -0
- package/dist/tools/textEditor.d.cts +114 -0
- package/dist/tools/textEditor.d.cts.map +1 -0
- package/dist/tools/textEditor.d.ts +114 -0
- package/dist/tools/textEditor.d.ts.map +1 -0
- package/dist/tools/textEditor.js +78 -0
- package/dist/tools/textEditor.js.map +1 -0
- package/dist/tools/toolSearch.cjs +110 -0
- package/dist/tools/toolSearch.cjs.map +1 -0
- package/dist/tools/toolSearch.d.cts +108 -0
- package/dist/tools/toolSearch.d.cts.map +1 -0
- package/dist/tools/toolSearch.d.ts +108 -0
- package/dist/tools/toolSearch.d.ts.map +1 -0
- package/dist/tools/toolSearch.js +108 -0
- package/dist/tools/toolSearch.js.map +1 -0
- package/dist/tools/types.cjs +204 -0
- package/dist/tools/types.cjs.map +1 -0
- package/dist/tools/types.d.cts +366 -0
- package/dist/tools/types.d.cts.map +1 -0
- package/dist/tools/types.d.ts +366 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +199 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/webFetch.cjs +70 -0
- package/dist/tools/webFetch.cjs.map +1 -0
- package/dist/tools/webFetch.d.cts +96 -0
- package/dist/tools/webFetch.d.cts.map +1 -0
- package/dist/tools/webFetch.d.ts +96 -0
- package/dist/tools/webFetch.d.ts.map +1 -0
- package/dist/tools/webFetch.js +69 -0
- package/dist/tools/webFetch.js.map +1 -0
- package/dist/tools/webSearch.cjs +57 -0
- package/dist/tools/webSearch.cjs.map +1 -0
- package/dist/tools/webSearch.d.cts +84 -0
- package/dist/tools/webSearch.d.cts.map +1 -0
- package/dist/tools/webSearch.d.ts +84 -0
- package/dist/tools/webSearch.d.ts.map +1 -0
- package/dist/tools/webSearch.js +56 -0
- package/dist/tools/webSearch.js.map +1 -0
- package/dist/types.d.cts +2 -3
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +2 -3
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/prompts.d.cts.map +1 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/tools.cjs +9 -2
- package/dist/utils/tools.cjs.map +1 -1
- package/dist/utils/tools.js +13 -6
- package/dist/utils/tools.js.map +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const zod_v4 = require_rolldown_runtime.__toESM(require("zod/v4"));
|
|
3
|
+
|
|
4
|
+
//#region src/tools/types.ts
|
|
5
|
+
/**
|
|
6
|
+
* Memory tool command types as defined by Anthropic's memory tool API.
|
|
7
|
+
* @beta
|
|
8
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/memory-tool
|
|
9
|
+
*/
|
|
10
|
+
const Memory20250818ViewCommandSchema = zod_v4.z.object({
|
|
11
|
+
command: zod_v4.z.literal("view"),
|
|
12
|
+
path: zod_v4.z.string()
|
|
13
|
+
});
|
|
14
|
+
const Memory20250818CreateCommandSchema = zod_v4.z.object({
|
|
15
|
+
command: zod_v4.z.literal("create"),
|
|
16
|
+
path: zod_v4.z.string(),
|
|
17
|
+
file_text: zod_v4.z.string()
|
|
18
|
+
});
|
|
19
|
+
const Memory20250818StrReplaceCommandSchema = zod_v4.z.object({
|
|
20
|
+
command: zod_v4.z.literal("str_replace"),
|
|
21
|
+
path: zod_v4.z.string(),
|
|
22
|
+
old_str: zod_v4.z.string(),
|
|
23
|
+
new_str: zod_v4.z.string()
|
|
24
|
+
});
|
|
25
|
+
const Memory20250818InsertCommandSchema = zod_v4.z.object({
|
|
26
|
+
command: zod_v4.z.literal("insert"),
|
|
27
|
+
path: zod_v4.z.string(),
|
|
28
|
+
insert_line: zod_v4.z.number(),
|
|
29
|
+
insert_text: zod_v4.z.string()
|
|
30
|
+
});
|
|
31
|
+
const Memory20250818DeleteCommandSchema = zod_v4.z.object({
|
|
32
|
+
command: zod_v4.z.literal("delete"),
|
|
33
|
+
path: zod_v4.z.string()
|
|
34
|
+
});
|
|
35
|
+
const Memory20250818RenameCommandSchema = zod_v4.z.object({
|
|
36
|
+
command: zod_v4.z.literal("rename"),
|
|
37
|
+
old_path: zod_v4.z.string(),
|
|
38
|
+
new_path: zod_v4.z.string()
|
|
39
|
+
});
|
|
40
|
+
const Memory20250818CommandSchema = zod_v4.z.discriminatedUnion("command", [
|
|
41
|
+
Memory20250818ViewCommandSchema,
|
|
42
|
+
Memory20250818CreateCommandSchema,
|
|
43
|
+
Memory20250818StrReplaceCommandSchema,
|
|
44
|
+
Memory20250818InsertCommandSchema,
|
|
45
|
+
Memory20250818DeleteCommandSchema,
|
|
46
|
+
Memory20250818RenameCommandSchema
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Text editor tool command types for Claude 4.x models.
|
|
50
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool
|
|
51
|
+
*/
|
|
52
|
+
const TextEditor20250728ViewCommandSchema = zod_v4.z.object({
|
|
53
|
+
command: zod_v4.z.literal("view"),
|
|
54
|
+
path: zod_v4.z.string(),
|
|
55
|
+
view_range: zod_v4.z.tuple([zod_v4.z.number(), zod_v4.z.number()]).optional()
|
|
56
|
+
});
|
|
57
|
+
const TextEditor20250728StrReplaceCommandSchema = zod_v4.z.object({
|
|
58
|
+
command: zod_v4.z.literal("str_replace"),
|
|
59
|
+
path: zod_v4.z.string(),
|
|
60
|
+
old_str: zod_v4.z.string(),
|
|
61
|
+
new_str: zod_v4.z.string()
|
|
62
|
+
});
|
|
63
|
+
const TextEditor20250728CreateCommandSchema = zod_v4.z.object({
|
|
64
|
+
command: zod_v4.z.literal("create"),
|
|
65
|
+
path: zod_v4.z.string(),
|
|
66
|
+
file_text: zod_v4.z.string()
|
|
67
|
+
});
|
|
68
|
+
const TextEditor20250728InsertCommandSchema = zod_v4.z.object({
|
|
69
|
+
command: zod_v4.z.literal("insert"),
|
|
70
|
+
path: zod_v4.z.string(),
|
|
71
|
+
insert_line: zod_v4.z.number(),
|
|
72
|
+
new_str: zod_v4.z.string()
|
|
73
|
+
});
|
|
74
|
+
const TextEditor20250728CommandSchema = zod_v4.z.discriminatedUnion("command", [
|
|
75
|
+
TextEditor20250728ViewCommandSchema,
|
|
76
|
+
TextEditor20250728StrReplaceCommandSchema,
|
|
77
|
+
TextEditor20250728CreateCommandSchema,
|
|
78
|
+
TextEditor20250728InsertCommandSchema
|
|
79
|
+
]);
|
|
80
|
+
const coordinateSchema = zod_v4.z.tuple([zod_v4.z.number(), zod_v4.z.number()]);
|
|
81
|
+
const ComputerScreenshotActionSchema = zod_v4.z.object({ action: zod_v4.z.literal("screenshot") });
|
|
82
|
+
const ComputerLeftClickActionSchema = zod_v4.z.object({
|
|
83
|
+
action: zod_v4.z.literal("left_click"),
|
|
84
|
+
coordinate: coordinateSchema
|
|
85
|
+
});
|
|
86
|
+
const ComputerRightClickActionSchema = zod_v4.z.object({
|
|
87
|
+
action: zod_v4.z.literal("right_click"),
|
|
88
|
+
coordinate: coordinateSchema
|
|
89
|
+
});
|
|
90
|
+
const ComputerMiddleClickActionSchema = zod_v4.z.object({
|
|
91
|
+
action: zod_v4.z.literal("middle_click"),
|
|
92
|
+
coordinate: coordinateSchema
|
|
93
|
+
});
|
|
94
|
+
const ComputerDoubleClickActionSchema = zod_v4.z.object({
|
|
95
|
+
action: zod_v4.z.literal("double_click"),
|
|
96
|
+
coordinate: coordinateSchema
|
|
97
|
+
});
|
|
98
|
+
const ComputerTripleClickActionSchema = zod_v4.z.object({
|
|
99
|
+
action: zod_v4.z.literal("triple_click"),
|
|
100
|
+
coordinate: coordinateSchema
|
|
101
|
+
});
|
|
102
|
+
const ComputerLeftClickDragActionSchema = zod_v4.z.object({
|
|
103
|
+
action: zod_v4.z.literal("left_click_drag"),
|
|
104
|
+
start_coordinate: coordinateSchema,
|
|
105
|
+
end_coordinate: coordinateSchema
|
|
106
|
+
});
|
|
107
|
+
const ComputerLeftMouseDownActionSchema = zod_v4.z.object({
|
|
108
|
+
action: zod_v4.z.literal("left_mouse_down"),
|
|
109
|
+
coordinate: coordinateSchema
|
|
110
|
+
});
|
|
111
|
+
const ComputerLeftMouseUpActionSchema = zod_v4.z.object({
|
|
112
|
+
action: zod_v4.z.literal("left_mouse_up"),
|
|
113
|
+
coordinate: coordinateSchema
|
|
114
|
+
});
|
|
115
|
+
const ComputerScrollActionSchema = zod_v4.z.object({
|
|
116
|
+
action: zod_v4.z.literal("scroll"),
|
|
117
|
+
coordinate: coordinateSchema,
|
|
118
|
+
scroll_direction: zod_v4.z.enum([
|
|
119
|
+
"up",
|
|
120
|
+
"down",
|
|
121
|
+
"left",
|
|
122
|
+
"right"
|
|
123
|
+
]),
|
|
124
|
+
scroll_amount: zod_v4.z.number()
|
|
125
|
+
});
|
|
126
|
+
const ComputerTypeActionSchema = zod_v4.z.object({
|
|
127
|
+
action: zod_v4.z.literal("type"),
|
|
128
|
+
text: zod_v4.z.string()
|
|
129
|
+
});
|
|
130
|
+
const ComputerKeyActionSchema = zod_v4.z.object({
|
|
131
|
+
action: zod_v4.z.literal("key"),
|
|
132
|
+
key: zod_v4.z.string()
|
|
133
|
+
});
|
|
134
|
+
const ComputerMouseMoveActionSchema = zod_v4.z.object({
|
|
135
|
+
action: zod_v4.z.literal("mouse_move"),
|
|
136
|
+
coordinate: coordinateSchema
|
|
137
|
+
});
|
|
138
|
+
const ComputerHoldKeyActionSchema = zod_v4.z.object({
|
|
139
|
+
action: zod_v4.z.literal("hold_key"),
|
|
140
|
+
key: zod_v4.z.string()
|
|
141
|
+
});
|
|
142
|
+
const ComputerWaitActionSchema = zod_v4.z.object({
|
|
143
|
+
action: zod_v4.z.literal("wait"),
|
|
144
|
+
duration: zod_v4.z.number().optional()
|
|
145
|
+
});
|
|
146
|
+
const ComputerZoomActionSchema = zod_v4.z.object({
|
|
147
|
+
action: zod_v4.z.literal("zoom"),
|
|
148
|
+
region: zod_v4.z.tuple([
|
|
149
|
+
zod_v4.z.number(),
|
|
150
|
+
zod_v4.z.number(),
|
|
151
|
+
zod_v4.z.number(),
|
|
152
|
+
zod_v4.z.number()
|
|
153
|
+
])
|
|
154
|
+
});
|
|
155
|
+
const Computer20250124ActionSchema = zod_v4.z.discriminatedUnion("action", [
|
|
156
|
+
ComputerScreenshotActionSchema,
|
|
157
|
+
ComputerLeftClickActionSchema,
|
|
158
|
+
ComputerRightClickActionSchema,
|
|
159
|
+
ComputerMiddleClickActionSchema,
|
|
160
|
+
ComputerDoubleClickActionSchema,
|
|
161
|
+
ComputerTripleClickActionSchema,
|
|
162
|
+
ComputerLeftClickDragActionSchema,
|
|
163
|
+
ComputerLeftMouseDownActionSchema,
|
|
164
|
+
ComputerLeftMouseUpActionSchema,
|
|
165
|
+
ComputerScrollActionSchema,
|
|
166
|
+
ComputerTypeActionSchema,
|
|
167
|
+
ComputerKeyActionSchema,
|
|
168
|
+
ComputerMouseMoveActionSchema,
|
|
169
|
+
ComputerHoldKeyActionSchema,
|
|
170
|
+
ComputerWaitActionSchema
|
|
171
|
+
]);
|
|
172
|
+
const Computer20251124ActionSchema = zod_v4.z.discriminatedUnion("action", [
|
|
173
|
+
ComputerScreenshotActionSchema,
|
|
174
|
+
ComputerLeftClickActionSchema,
|
|
175
|
+
ComputerRightClickActionSchema,
|
|
176
|
+
ComputerMiddleClickActionSchema,
|
|
177
|
+
ComputerDoubleClickActionSchema,
|
|
178
|
+
ComputerTripleClickActionSchema,
|
|
179
|
+
ComputerLeftClickDragActionSchema,
|
|
180
|
+
ComputerLeftMouseDownActionSchema,
|
|
181
|
+
ComputerLeftMouseUpActionSchema,
|
|
182
|
+
ComputerScrollActionSchema,
|
|
183
|
+
ComputerTypeActionSchema,
|
|
184
|
+
ComputerKeyActionSchema,
|
|
185
|
+
ComputerMouseMoveActionSchema,
|
|
186
|
+
ComputerHoldKeyActionSchema,
|
|
187
|
+
ComputerWaitActionSchema,
|
|
188
|
+
ComputerZoomActionSchema
|
|
189
|
+
]);
|
|
190
|
+
/**
|
|
191
|
+
* Bash tool command types for Claude 4 models and Claude 3.7.
|
|
192
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/bash-tool
|
|
193
|
+
*/
|
|
194
|
+
const Bash20250124ExecuteCommandSchema = zod_v4.z.object({ command: zod_v4.z.string().describe("The bash command to run") });
|
|
195
|
+
const Bash20250124RestartCommandSchema = zod_v4.z.object({ restart: zod_v4.z.literal(true).describe("Set to true to restart the bash session") });
|
|
196
|
+
const Bash20250124CommandSchema = zod_v4.z.union([Bash20250124ExecuteCommandSchema, Bash20250124RestartCommandSchema]);
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
exports.Bash20250124CommandSchema = Bash20250124CommandSchema;
|
|
200
|
+
exports.Computer20250124ActionSchema = Computer20250124ActionSchema;
|
|
201
|
+
exports.Computer20251124ActionSchema = Computer20251124ActionSchema;
|
|
202
|
+
exports.Memory20250818CommandSchema = Memory20250818CommandSchema;
|
|
203
|
+
exports.TextEditor20250728CommandSchema = TextEditor20250728CommandSchema;
|
|
204
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","names":["z"],"sources":["../../src/tools/types.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { z } from \"zod/v4\";\n\n/**\n * Memory tool command types as defined by Anthropic's memory tool API.\n * @beta\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/memory-tool\n */\n\n// Zod schemas for memory commands\nexport const Memory20250818ViewCommandSchema = z.object({\n command: z.literal(\"view\"),\n path: z.string(),\n});\n\nexport const Memory20250818CreateCommandSchema = z.object({\n command: z.literal(\"create\"),\n path: z.string(),\n file_text: z.string(),\n});\n\nexport const Memory20250818StrReplaceCommandSchema = z.object({\n command: z.literal(\"str_replace\"),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n});\n\nexport const Memory20250818InsertCommandSchema = z.object({\n command: z.literal(\"insert\"),\n path: z.string(),\n insert_line: z.number(),\n insert_text: z.string(),\n});\n\nexport const Memory20250818DeleteCommandSchema = z.object({\n command: z.literal(\"delete\"),\n path: z.string(),\n});\n\nexport const Memory20250818RenameCommandSchema = z.object({\n command: z.literal(\"rename\"),\n old_path: z.string(),\n new_path: z.string(),\n});\n\n// Discriminated union schema for all memory commands\nexport const Memory20250818CommandSchema = z.discriminatedUnion(\"command\", [\n Memory20250818ViewCommandSchema,\n Memory20250818CreateCommandSchema,\n Memory20250818StrReplaceCommandSchema,\n Memory20250818InsertCommandSchema,\n Memory20250818DeleteCommandSchema,\n Memory20250818RenameCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type Memory20250818ViewCommand = z.infer<\n typeof Memory20250818ViewCommandSchema\n>;\nexport type Memory20250818CreateCommand = z.infer<\n typeof Memory20250818CreateCommandSchema\n>;\nexport type Memory20250818StrReplaceCommand = z.infer<\n typeof Memory20250818StrReplaceCommandSchema\n>;\nexport type Memory20250818InsertCommand = z.infer<\n typeof Memory20250818InsertCommandSchema\n>;\nexport type Memory20250818DeleteCommand = z.infer<\n typeof Memory20250818DeleteCommandSchema\n>;\nexport type Memory20250818RenameCommand = z.infer<\n typeof Memory20250818RenameCommandSchema\n>;\n\nexport type Memory20250818Command = z.infer<typeof Memory20250818CommandSchema>;\n\n/**\n * Options for creating a memory tool.\n */\nexport interface MemoryTool20250818Options {\n /**\n * Optional execute function that handles memory command execution.\n * In LangChain, this is typically handled separately when processing tool calls,\n * but this option is provided for compatibility with the AI SDK pattern.\n * Note: This option is currently unused but reserved for future use.\n */\n execute: (action: Memory20250818Command) => Promise<string> | string;\n}\n\n/**\n * Memory tool type definition.\n */\nexport type MemoryTool20250818 = Anthropic.Beta.BetaMemoryTool20250818;\n\n/**\n * Text editor tool command types for Claude 4.x models.\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool\n */\n\n// Zod schemas for text editor commands\nexport const TextEditor20250728ViewCommandSchema = z.object({\n command: z.literal(\"view\"),\n path: z.string(),\n view_range: z.tuple([z.number(), z.number()]).optional(),\n});\n\nexport const TextEditor20250728StrReplaceCommandSchema = z.object({\n command: z.literal(\"str_replace\"),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n});\n\nexport const TextEditor20250728CreateCommandSchema = z.object({\n command: z.literal(\"create\"),\n path: z.string(),\n file_text: z.string(),\n});\n\nexport const TextEditor20250728InsertCommandSchema = z.object({\n command: z.literal(\"insert\"),\n path: z.string(),\n insert_line: z.number(),\n new_str: z.string(),\n});\n\n// Discriminated union schema for all text editor commands\nexport const TextEditor20250728CommandSchema = z.discriminatedUnion(\"command\", [\n TextEditor20250728ViewCommandSchema,\n TextEditor20250728StrReplaceCommandSchema,\n TextEditor20250728CreateCommandSchema,\n TextEditor20250728InsertCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type TextEditor20250728ViewCommand = z.infer<\n typeof TextEditor20250728ViewCommandSchema\n>;\nexport type TextEditor20250728StrReplaceCommand = z.infer<\n typeof TextEditor20250728StrReplaceCommandSchema\n>;\nexport type TextEditor20250728CreateCommand = z.infer<\n typeof TextEditor20250728CreateCommandSchema\n>;\nexport type TextEditor20250728InsertCommand = z.infer<\n typeof TextEditor20250728InsertCommandSchema\n>;\nexport type TextEditor20250728Command = z.infer<\n typeof TextEditor20250728CommandSchema\n>;\n\n/**\n * Computer use tool action types for Claude Opus 4.5.\n * Includes zoom action which is not available in earlier versions.\n * @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool\n */\nexport type Computer20251124Action =\n | Computer20250124Action\n | ComputerZoomAction;\n\n/**\n * Computer use tool action types for Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n * @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool\n */\nexport type Computer20250124Action =\n | ComputerScreenshotAction\n | ComputerLeftClickAction\n | ComputerRightClickAction\n | ComputerMiddleClickAction\n | ComputerDoubleClickAction\n | ComputerTripleClickAction\n | ComputerLeftClickDragAction\n | ComputerLeftMouseDownAction\n | ComputerLeftMouseUpAction\n | ComputerScrollAction\n | ComputerTypeAction\n | ComputerKeyAction\n | ComputerMouseMoveAction\n | ComputerHoldKeyAction\n | ComputerWaitAction;\n\n// Zod schemas for computer actions\nconst coordinateSchema = z.tuple([z.number(), z.number()]);\n\nexport const ComputerScreenshotActionSchema = z.object({\n action: z.literal(\"screenshot\"),\n});\n\nexport const ComputerLeftClickActionSchema = z.object({\n action: z.literal(\"left_click\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerRightClickActionSchema = z.object({\n action: z.literal(\"right_click\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerMiddleClickActionSchema = z.object({\n action: z.literal(\"middle_click\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerDoubleClickActionSchema = z.object({\n action: z.literal(\"double_click\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerTripleClickActionSchema = z.object({\n action: z.literal(\"triple_click\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftClickDragActionSchema = z.object({\n action: z.literal(\"left_click_drag\"),\n start_coordinate: coordinateSchema,\n end_coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftMouseDownActionSchema = z.object({\n action: z.literal(\"left_mouse_down\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftMouseUpActionSchema = z.object({\n action: z.literal(\"left_mouse_up\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerScrollActionSchema = z.object({\n action: z.literal(\"scroll\"),\n coordinate: coordinateSchema,\n scroll_direction: z.enum([\"up\", \"down\", \"left\", \"right\"]),\n scroll_amount: z.number(),\n});\n\nexport const ComputerTypeActionSchema = z.object({\n action: z.literal(\"type\"),\n text: z.string(),\n});\n\nexport const ComputerKeyActionSchema = z.object({\n action: z.literal(\"key\"),\n key: z.string(),\n});\n\nexport const ComputerMouseMoveActionSchema = z.object({\n action: z.literal(\"mouse_move\"),\n coordinate: coordinateSchema,\n});\n\nexport const ComputerHoldKeyActionSchema = z.object({\n action: z.literal(\"hold_key\"),\n key: z.string(),\n});\n\nexport const ComputerWaitActionSchema = z.object({\n action: z.literal(\"wait\"),\n duration: z.number().optional(),\n});\n\nexport const ComputerZoomActionSchema = z.object({\n action: z.literal(\"zoom\"),\n region: z.tuple([z.number(), z.number(), z.number(), z.number()]),\n});\n\n// Discriminated union schemas\nexport const Computer20250124ActionSchema = z.discriminatedUnion(\"action\", [\n ComputerScreenshotActionSchema,\n ComputerLeftClickActionSchema,\n ComputerRightClickActionSchema,\n ComputerMiddleClickActionSchema,\n ComputerDoubleClickActionSchema,\n ComputerTripleClickActionSchema,\n ComputerLeftClickDragActionSchema,\n ComputerLeftMouseDownActionSchema,\n ComputerLeftMouseUpActionSchema,\n ComputerScrollActionSchema,\n ComputerTypeActionSchema,\n ComputerKeyActionSchema,\n ComputerMouseMoveActionSchema,\n ComputerHoldKeyActionSchema,\n ComputerWaitActionSchema,\n]);\n\nexport const Computer20251124ActionSchema = z.discriminatedUnion(\"action\", [\n ComputerScreenshotActionSchema,\n ComputerLeftClickActionSchema,\n ComputerRightClickActionSchema,\n ComputerMiddleClickActionSchema,\n ComputerDoubleClickActionSchema,\n ComputerTripleClickActionSchema,\n ComputerLeftClickDragActionSchema,\n ComputerLeftMouseDownActionSchema,\n ComputerLeftMouseUpActionSchema,\n ComputerScrollActionSchema,\n ComputerTypeActionSchema,\n ComputerKeyActionSchema,\n ComputerMouseMoveActionSchema,\n ComputerHoldKeyActionSchema,\n ComputerWaitActionSchema,\n ComputerZoomActionSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type ComputerScreenshotAction = z.infer<\n typeof ComputerScreenshotActionSchema\n>;\n\nexport type ComputerLeftClickAction = z.infer<\n typeof ComputerLeftClickActionSchema\n>;\n\nexport type ComputerRightClickAction = z.infer<\n typeof ComputerRightClickActionSchema\n>;\n\nexport type ComputerMiddleClickAction = z.infer<\n typeof ComputerMiddleClickActionSchema\n>;\n\nexport type ComputerDoubleClickAction = z.infer<\n typeof ComputerDoubleClickActionSchema\n>;\n\nexport type ComputerTripleClickAction = z.infer<\n typeof ComputerTripleClickActionSchema\n>;\n\nexport type ComputerLeftClickDragAction = z.infer<\n typeof ComputerLeftClickDragActionSchema\n>;\n\nexport type ComputerLeftMouseDownAction = z.infer<\n typeof ComputerLeftMouseDownActionSchema\n>;\n\nexport type ComputerLeftMouseUpAction = z.infer<\n typeof ComputerLeftMouseUpActionSchema\n>;\n\nexport type ComputerScrollAction = z.infer<typeof ComputerScrollActionSchema>;\n\nexport type ComputerTypeAction = z.infer<typeof ComputerTypeActionSchema>;\n\nexport type ComputerKeyAction = z.infer<typeof ComputerKeyActionSchema>;\n\nexport type ComputerMouseMoveAction = z.infer<\n typeof ComputerMouseMoveActionSchema\n>;\n\nexport type ComputerHoldKeyAction = z.infer<typeof ComputerHoldKeyActionSchema>;\n\nexport type ComputerWaitAction = z.infer<typeof ComputerWaitActionSchema>;\n\nexport type ComputerZoomAction = z.infer<typeof ComputerZoomActionSchema>;\n\n/**\n * Bash tool command types for Claude 4 models and Claude 3.7.\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/bash-tool\n */\n\n// Zod schemas for bash commands\nexport const Bash20250124ExecuteCommandSchema = z.object({\n command: z.string().describe(\"The bash command to run\"),\n});\n\nexport const Bash20250124RestartCommandSchema = z.object({\n restart: z.literal(true).describe(\"Set to true to restart the bash session\"),\n});\n\n// Union schema for all bash commands\nexport const Bash20250124CommandSchema = z.union([\n Bash20250124ExecuteCommandSchema,\n Bash20250124RestartCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type Bash20250124ExecuteCommand = z.infer<\n typeof Bash20250124ExecuteCommandSchema\n>;\nexport type Bash20250124RestartCommand = z.infer<\n typeof Bash20250124RestartCommandSchema\n>;\nexport type Bash20250124Command = z.infer<typeof Bash20250124CommandSchema>;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
|
|
4
|
+
//#region src/tools/types.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Memory tool command types as defined by Anthropic's memory tool API.
|
|
8
|
+
* @beta
|
|
9
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/memory-tool
|
|
10
|
+
*/
|
|
11
|
+
declare const Memory20250818ViewCommandSchema: z.ZodObject<{
|
|
12
|
+
command: z.ZodLiteral<"view">;
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const Memory20250818CreateCommandSchema: z.ZodObject<{
|
|
16
|
+
command: z.ZodLiteral<"create">;
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
file_text: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
declare const Memory20250818StrReplaceCommandSchema: z.ZodObject<{
|
|
21
|
+
command: z.ZodLiteral<"str_replace">;
|
|
22
|
+
path: z.ZodString;
|
|
23
|
+
old_str: z.ZodString;
|
|
24
|
+
new_str: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
declare const Memory20250818InsertCommandSchema: z.ZodObject<{
|
|
27
|
+
command: z.ZodLiteral<"insert">;
|
|
28
|
+
path: z.ZodString;
|
|
29
|
+
insert_line: z.ZodNumber;
|
|
30
|
+
insert_text: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const Memory20250818DeleteCommandSchema: z.ZodObject<{
|
|
33
|
+
command: z.ZodLiteral<"delete">;
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
declare const Memory20250818RenameCommandSchema: z.ZodObject<{
|
|
37
|
+
command: z.ZodLiteral<"rename">;
|
|
38
|
+
old_path: z.ZodString;
|
|
39
|
+
new_path: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
declare const Memory20250818CommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
|
+
command: z.ZodLiteral<"view">;
|
|
43
|
+
path: z.ZodString;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
command: z.ZodLiteral<"create">;
|
|
46
|
+
path: z.ZodString;
|
|
47
|
+
file_text: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
command: z.ZodLiteral<"str_replace">;
|
|
50
|
+
path: z.ZodString;
|
|
51
|
+
old_str: z.ZodString;
|
|
52
|
+
new_str: z.ZodString;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
command: z.ZodLiteral<"insert">;
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
insert_line: z.ZodNumber;
|
|
57
|
+
insert_text: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
command: z.ZodLiteral<"delete">;
|
|
60
|
+
path: z.ZodString;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
command: z.ZodLiteral<"rename">;
|
|
63
|
+
old_path: z.ZodString;
|
|
64
|
+
new_path: z.ZodString;
|
|
65
|
+
}, z.core.$strip>], "command">;
|
|
66
|
+
type Memory20250818ViewCommand = z.infer<typeof Memory20250818ViewCommandSchema>;
|
|
67
|
+
type Memory20250818CreateCommand = z.infer<typeof Memory20250818CreateCommandSchema>;
|
|
68
|
+
type Memory20250818StrReplaceCommand = z.infer<typeof Memory20250818StrReplaceCommandSchema>;
|
|
69
|
+
type Memory20250818InsertCommand = z.infer<typeof Memory20250818InsertCommandSchema>;
|
|
70
|
+
type Memory20250818DeleteCommand = z.infer<typeof Memory20250818DeleteCommandSchema>;
|
|
71
|
+
type Memory20250818RenameCommand = z.infer<typeof Memory20250818RenameCommandSchema>;
|
|
72
|
+
type Memory20250818Command = z.infer<typeof Memory20250818CommandSchema>;
|
|
73
|
+
/**
|
|
74
|
+
* Options for creating a memory tool.
|
|
75
|
+
*/
|
|
76
|
+
interface MemoryTool20250818Options {
|
|
77
|
+
/**
|
|
78
|
+
* Optional execute function that handles memory command execution.
|
|
79
|
+
* In LangChain, this is typically handled separately when processing tool calls,
|
|
80
|
+
* but this option is provided for compatibility with the AI SDK pattern.
|
|
81
|
+
* Note: This option is currently unused but reserved for future use.
|
|
82
|
+
*/
|
|
83
|
+
execute: (action: Memory20250818Command) => Promise<string> | string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Memory tool type definition.
|
|
87
|
+
*/
|
|
88
|
+
type MemoryTool20250818 = Anthropic.Beta.BetaMemoryTool20250818;
|
|
89
|
+
/**
|
|
90
|
+
* Text editor tool command types for Claude 4.x models.
|
|
91
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool
|
|
92
|
+
*/
|
|
93
|
+
declare const TextEditor20250728ViewCommandSchema: z.ZodObject<{
|
|
94
|
+
command: z.ZodLiteral<"view">;
|
|
95
|
+
path: z.ZodString;
|
|
96
|
+
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
declare const TextEditor20250728StrReplaceCommandSchema: z.ZodObject<{
|
|
99
|
+
command: z.ZodLiteral<"str_replace">;
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
old_str: z.ZodString;
|
|
102
|
+
new_str: z.ZodString;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
declare const TextEditor20250728CreateCommandSchema: z.ZodObject<{
|
|
105
|
+
command: z.ZodLiteral<"create">;
|
|
106
|
+
path: z.ZodString;
|
|
107
|
+
file_text: z.ZodString;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
declare const TextEditor20250728InsertCommandSchema: z.ZodObject<{
|
|
110
|
+
command: z.ZodLiteral<"insert">;
|
|
111
|
+
path: z.ZodString;
|
|
112
|
+
insert_line: z.ZodNumber;
|
|
113
|
+
new_str: z.ZodString;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
declare const TextEditor20250728CommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
116
|
+
command: z.ZodLiteral<"view">;
|
|
117
|
+
path: z.ZodString;
|
|
118
|
+
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
command: z.ZodLiteral<"str_replace">;
|
|
121
|
+
path: z.ZodString;
|
|
122
|
+
old_str: z.ZodString;
|
|
123
|
+
new_str: z.ZodString;
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
+
command: z.ZodLiteral<"create">;
|
|
126
|
+
path: z.ZodString;
|
|
127
|
+
file_text: z.ZodString;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
command: z.ZodLiteral<"insert">;
|
|
130
|
+
path: z.ZodString;
|
|
131
|
+
insert_line: z.ZodNumber;
|
|
132
|
+
new_str: z.ZodString;
|
|
133
|
+
}, z.core.$strip>], "command">;
|
|
134
|
+
type TextEditor20250728ViewCommand = z.infer<typeof TextEditor20250728ViewCommandSchema>;
|
|
135
|
+
type TextEditor20250728StrReplaceCommand = z.infer<typeof TextEditor20250728StrReplaceCommandSchema>;
|
|
136
|
+
type TextEditor20250728CreateCommand = z.infer<typeof TextEditor20250728CreateCommandSchema>;
|
|
137
|
+
type TextEditor20250728InsertCommand = z.infer<typeof TextEditor20250728InsertCommandSchema>;
|
|
138
|
+
type TextEditor20250728Command = z.infer<typeof TextEditor20250728CommandSchema>;
|
|
139
|
+
/**
|
|
140
|
+
* Computer use tool action types for Claude Opus 4.5.
|
|
141
|
+
* Includes zoom action which is not available in earlier versions.
|
|
142
|
+
* @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool
|
|
143
|
+
*/
|
|
144
|
+
type Computer20251124Action = Computer20250124Action | ComputerZoomAction;
|
|
145
|
+
/**
|
|
146
|
+
* Computer use tool action types for Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.
|
|
147
|
+
* @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool
|
|
148
|
+
*/
|
|
149
|
+
type Computer20250124Action = ComputerScreenshotAction | ComputerLeftClickAction | ComputerRightClickAction | ComputerMiddleClickAction | ComputerDoubleClickAction | ComputerTripleClickAction | ComputerLeftClickDragAction | ComputerLeftMouseDownAction | ComputerLeftMouseUpAction | ComputerScrollAction | ComputerTypeAction | ComputerKeyAction | ComputerMouseMoveAction | ComputerHoldKeyAction | ComputerWaitAction;
|
|
150
|
+
declare const ComputerScreenshotActionSchema: z.ZodObject<{
|
|
151
|
+
action: z.ZodLiteral<"screenshot">;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
declare const ComputerLeftClickActionSchema: z.ZodObject<{
|
|
154
|
+
action: z.ZodLiteral<"left_click">;
|
|
155
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
declare const ComputerRightClickActionSchema: z.ZodObject<{
|
|
158
|
+
action: z.ZodLiteral<"right_click">;
|
|
159
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
declare const ComputerMiddleClickActionSchema: z.ZodObject<{
|
|
162
|
+
action: z.ZodLiteral<"middle_click">;
|
|
163
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
declare const ComputerDoubleClickActionSchema: z.ZodObject<{
|
|
166
|
+
action: z.ZodLiteral<"double_click">;
|
|
167
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
declare const ComputerTripleClickActionSchema: z.ZodObject<{
|
|
170
|
+
action: z.ZodLiteral<"triple_click">;
|
|
171
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
declare const ComputerLeftClickDragActionSchema: z.ZodObject<{
|
|
174
|
+
action: z.ZodLiteral<"left_click_drag">;
|
|
175
|
+
start_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
176
|
+
end_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
declare const ComputerLeftMouseDownActionSchema: z.ZodObject<{
|
|
179
|
+
action: z.ZodLiteral<"left_mouse_down">;
|
|
180
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
declare const ComputerLeftMouseUpActionSchema: z.ZodObject<{
|
|
183
|
+
action: z.ZodLiteral<"left_mouse_up">;
|
|
184
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
declare const ComputerScrollActionSchema: z.ZodObject<{
|
|
187
|
+
action: z.ZodLiteral<"scroll">;
|
|
188
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
189
|
+
scroll_direction: z.ZodEnum<{
|
|
190
|
+
down: "down";
|
|
191
|
+
left: "left";
|
|
192
|
+
right: "right";
|
|
193
|
+
up: "up";
|
|
194
|
+
}>;
|
|
195
|
+
scroll_amount: z.ZodNumber;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
declare const ComputerTypeActionSchema: z.ZodObject<{
|
|
198
|
+
action: z.ZodLiteral<"type">;
|
|
199
|
+
text: z.ZodString;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
declare const ComputerKeyActionSchema: z.ZodObject<{
|
|
202
|
+
action: z.ZodLiteral<"key">;
|
|
203
|
+
key: z.ZodString;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
declare const ComputerMouseMoveActionSchema: z.ZodObject<{
|
|
206
|
+
action: z.ZodLiteral<"mouse_move">;
|
|
207
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
declare const ComputerHoldKeyActionSchema: z.ZodObject<{
|
|
210
|
+
action: z.ZodLiteral<"hold_key">;
|
|
211
|
+
key: z.ZodString;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
declare const ComputerWaitActionSchema: z.ZodObject<{
|
|
214
|
+
action: z.ZodLiteral<"wait">;
|
|
215
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
declare const ComputerZoomActionSchema: z.ZodObject<{
|
|
218
|
+
action: z.ZodLiteral<"zoom">;
|
|
219
|
+
region: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
declare const Computer20250124ActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
222
|
+
action: z.ZodLiteral<"screenshot">;
|
|
223
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
224
|
+
action: z.ZodLiteral<"left_click">;
|
|
225
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
226
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
227
|
+
action: z.ZodLiteral<"right_click">;
|
|
228
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
action: z.ZodLiteral<"middle_click">;
|
|
231
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
action: z.ZodLiteral<"double_click">;
|
|
234
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
action: z.ZodLiteral<"triple_click">;
|
|
237
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
action: z.ZodLiteral<"left_click_drag">;
|
|
240
|
+
start_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
241
|
+
end_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
243
|
+
action: z.ZodLiteral<"left_mouse_down">;
|
|
244
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
action: z.ZodLiteral<"left_mouse_up">;
|
|
247
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
248
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
249
|
+
action: z.ZodLiteral<"scroll">;
|
|
250
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
251
|
+
scroll_direction: z.ZodEnum<{
|
|
252
|
+
down: "down";
|
|
253
|
+
left: "left";
|
|
254
|
+
right: "right";
|
|
255
|
+
up: "up";
|
|
256
|
+
}>;
|
|
257
|
+
scroll_amount: z.ZodNumber;
|
|
258
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
259
|
+
action: z.ZodLiteral<"type">;
|
|
260
|
+
text: z.ZodString;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
action: z.ZodLiteral<"key">;
|
|
263
|
+
key: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
action: z.ZodLiteral<"mouse_move">;
|
|
266
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
267
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
268
|
+
action: z.ZodLiteral<"hold_key">;
|
|
269
|
+
key: z.ZodString;
|
|
270
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
271
|
+
action: z.ZodLiteral<"wait">;
|
|
272
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
}, z.core.$strip>], "action">;
|
|
274
|
+
declare const Computer20251124ActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
275
|
+
action: z.ZodLiteral<"screenshot">;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
action: z.ZodLiteral<"left_click">;
|
|
278
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
|
+
action: z.ZodLiteral<"right_click">;
|
|
281
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
|
+
action: z.ZodLiteral<"middle_click">;
|
|
284
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
285
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
286
|
+
action: z.ZodLiteral<"double_click">;
|
|
287
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
action: z.ZodLiteral<"triple_click">;
|
|
290
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
291
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
292
|
+
action: z.ZodLiteral<"left_click_drag">;
|
|
293
|
+
start_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
294
|
+
end_coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
295
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
+
action: z.ZodLiteral<"left_mouse_down">;
|
|
297
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
299
|
+
action: z.ZodLiteral<"left_mouse_up">;
|
|
300
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
301
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
302
|
+
action: z.ZodLiteral<"scroll">;
|
|
303
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
304
|
+
scroll_direction: z.ZodEnum<{
|
|
305
|
+
down: "down";
|
|
306
|
+
left: "left";
|
|
307
|
+
right: "right";
|
|
308
|
+
up: "up";
|
|
309
|
+
}>;
|
|
310
|
+
scroll_amount: z.ZodNumber;
|
|
311
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
312
|
+
action: z.ZodLiteral<"type">;
|
|
313
|
+
text: z.ZodString;
|
|
314
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
315
|
+
action: z.ZodLiteral<"key">;
|
|
316
|
+
key: z.ZodString;
|
|
317
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
318
|
+
action: z.ZodLiteral<"mouse_move">;
|
|
319
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
action: z.ZodLiteral<"hold_key">;
|
|
322
|
+
key: z.ZodString;
|
|
323
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
324
|
+
action: z.ZodLiteral<"wait">;
|
|
325
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
327
|
+
action: z.ZodLiteral<"zoom">;
|
|
328
|
+
region: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
329
|
+
}, z.core.$strip>], "action">;
|
|
330
|
+
type ComputerScreenshotAction = z.infer<typeof ComputerScreenshotActionSchema>;
|
|
331
|
+
type ComputerLeftClickAction = z.infer<typeof ComputerLeftClickActionSchema>;
|
|
332
|
+
type ComputerRightClickAction = z.infer<typeof ComputerRightClickActionSchema>;
|
|
333
|
+
type ComputerMiddleClickAction = z.infer<typeof ComputerMiddleClickActionSchema>;
|
|
334
|
+
type ComputerDoubleClickAction = z.infer<typeof ComputerDoubleClickActionSchema>;
|
|
335
|
+
type ComputerTripleClickAction = z.infer<typeof ComputerTripleClickActionSchema>;
|
|
336
|
+
type ComputerLeftClickDragAction = z.infer<typeof ComputerLeftClickDragActionSchema>;
|
|
337
|
+
type ComputerLeftMouseDownAction = z.infer<typeof ComputerLeftMouseDownActionSchema>;
|
|
338
|
+
type ComputerLeftMouseUpAction = z.infer<typeof ComputerLeftMouseUpActionSchema>;
|
|
339
|
+
type ComputerScrollAction = z.infer<typeof ComputerScrollActionSchema>;
|
|
340
|
+
type ComputerTypeAction = z.infer<typeof ComputerTypeActionSchema>;
|
|
341
|
+
type ComputerKeyAction = z.infer<typeof ComputerKeyActionSchema>;
|
|
342
|
+
type ComputerMouseMoveAction = z.infer<typeof ComputerMouseMoveActionSchema>;
|
|
343
|
+
type ComputerHoldKeyAction = z.infer<typeof ComputerHoldKeyActionSchema>;
|
|
344
|
+
type ComputerWaitAction = z.infer<typeof ComputerWaitActionSchema>;
|
|
345
|
+
type ComputerZoomAction = z.infer<typeof ComputerZoomActionSchema>;
|
|
346
|
+
/**
|
|
347
|
+
* Bash tool command types for Claude 4 models and Claude 3.7.
|
|
348
|
+
* @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/bash-tool
|
|
349
|
+
*/
|
|
350
|
+
declare const Bash20250124ExecuteCommandSchema: z.ZodObject<{
|
|
351
|
+
command: z.ZodString;
|
|
352
|
+
}, z.core.$strip>;
|
|
353
|
+
declare const Bash20250124RestartCommandSchema: z.ZodObject<{
|
|
354
|
+
restart: z.ZodLiteral<true>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
declare const Bash20250124CommandSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
357
|
+
command: z.ZodString;
|
|
358
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
359
|
+
restart: z.ZodLiteral<true>;
|
|
360
|
+
}, z.core.$strip>]>;
|
|
361
|
+
type Bash20250124ExecuteCommand = z.infer<typeof Bash20250124ExecuteCommandSchema>;
|
|
362
|
+
type Bash20250124RestartCommand = z.infer<typeof Bash20250124RestartCommandSchema>;
|
|
363
|
+
type Bash20250124Command = z.infer<typeof Bash20250124CommandSchema>;
|
|
364
|
+
//#endregion
|
|
365
|
+
export { Bash20250124Command, Bash20250124CommandSchema, Bash20250124ExecuteCommand, Bash20250124ExecuteCommandSchema, Bash20250124RestartCommand, Bash20250124RestartCommandSchema, Computer20250124Action, Computer20250124ActionSchema, Computer20251124Action, Computer20251124ActionSchema, ComputerDoubleClickAction, ComputerDoubleClickActionSchema, ComputerHoldKeyAction, ComputerHoldKeyActionSchema, ComputerKeyAction, ComputerKeyActionSchema, ComputerLeftClickAction, ComputerLeftClickActionSchema, ComputerLeftClickDragAction, ComputerLeftClickDragActionSchema, ComputerLeftMouseDownAction, ComputerLeftMouseDownActionSchema, ComputerLeftMouseUpAction, ComputerLeftMouseUpActionSchema, ComputerMiddleClickAction, ComputerMiddleClickActionSchema, ComputerMouseMoveAction, ComputerMouseMoveActionSchema, ComputerRightClickAction, ComputerRightClickActionSchema, ComputerScreenshotAction, ComputerScreenshotActionSchema, ComputerScrollAction, ComputerScrollActionSchema, ComputerTripleClickAction, ComputerTripleClickActionSchema, ComputerTypeAction, ComputerTypeActionSchema, ComputerWaitAction, ComputerWaitActionSchema, ComputerZoomAction, ComputerZoomActionSchema, Memory20250818Command, Memory20250818CommandSchema, Memory20250818CreateCommand, Memory20250818CreateCommandSchema, Memory20250818DeleteCommand, Memory20250818DeleteCommandSchema, Memory20250818InsertCommand, Memory20250818InsertCommandSchema, Memory20250818RenameCommand, Memory20250818RenameCommandSchema, Memory20250818StrReplaceCommand, Memory20250818StrReplaceCommandSchema, Memory20250818ViewCommand, Memory20250818ViewCommandSchema, MemoryTool20250818, MemoryTool20250818Options, TextEditor20250728Command, TextEditor20250728CommandSchema, TextEditor20250728CreateCommand, TextEditor20250728CreateCommandSchema, TextEditor20250728InsertCommand, TextEditor20250728InsertCommandSchema, TextEditor20250728StrReplaceCommand, TextEditor20250728StrReplaceCommandSchema, TextEditor20250728ViewCommand, TextEditor20250728ViewCommandSchema };
|
|
366
|
+
//# sourceMappingURL=types.d.cts.map
|