@effect/ai-anthropic 0.22.0 → 4.0.0-beta.0
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/dist/AnthropicClient.d.ts +196 -0
- package/dist/AnthropicClient.d.ts.map +1 -0
- package/dist/AnthropicClient.js +142 -0
- package/dist/AnthropicClient.js.map +1 -0
- package/dist/{dts/AnthropicConfig.d.ts → AnthropicConfig.d.ts} +9 -9
- package/dist/AnthropicConfig.d.ts.map +1 -0
- package/dist/{esm/AnthropicConfig.js → AnthropicConfig.js} +8 -5
- package/dist/AnthropicConfig.js.map +1 -0
- package/dist/AnthropicError.d.ts +102 -0
- package/dist/AnthropicError.d.ts.map +1 -0
- package/dist/AnthropicError.js +10 -0
- package/dist/AnthropicError.js.map +1 -0
- package/dist/AnthropicLanguageModel.d.ts +522 -0
- package/dist/AnthropicLanguageModel.d.ts.map +1 -0
- package/dist/AnthropicLanguageModel.js +2107 -0
- package/dist/AnthropicLanguageModel.js.map +1 -0
- package/dist/AnthropicTelemetry.d.ts +101 -0
- package/dist/AnthropicTelemetry.d.ts.map +1 -0
- package/dist/AnthropicTelemetry.js +35 -0
- package/dist/AnthropicTelemetry.js.map +1 -0
- package/dist/AnthropicTool.d.ts +2153 -0
- package/dist/AnthropicTool.d.ts.map +1 -0
- package/dist/AnthropicTool.js +1168 -0
- package/dist/AnthropicTool.js.map +1 -0
- package/dist/Generated.d.ts +25233 -0
- package/dist/Generated.d.ts.map +1 -0
- package/dist/Generated.js +7649 -0
- package/dist/Generated.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +344 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/{dts/internal → internal}/utilities.d.ts.map +1 -1
- package/dist/internal/utilities.js.map +1 -0
- package/package.json +45 -81
- package/src/AnthropicClient.ts +327 -683
- package/src/AnthropicConfig.ts +20 -34
- package/src/AnthropicError.ts +111 -0
- package/src/AnthropicLanguageModel.ts +2039 -993
- package/src/AnthropicTelemetry.ts +138 -0
- package/src/AnthropicTool.ts +1500 -475
- package/src/Generated.ts +9798 -6359
- package/src/index.ts +38 -6
- package/src/internal/errors.ts +368 -0
- package/src/internal/utilities.ts +1 -1
- package/AnthropicClient/package.json +0 -6
- package/AnthropicConfig/package.json +0 -6
- package/AnthropicLanguageModel/package.json +0 -6
- package/AnthropicTokenizer/package.json +0 -6
- package/AnthropicTool/package.json +0 -6
- package/Generated/package.json +0 -6
- package/README.md +0 -5
- package/dist/cjs/AnthropicClient.js +0 -344
- package/dist/cjs/AnthropicClient.js.map +0 -1
- package/dist/cjs/AnthropicConfig.js +0 -30
- package/dist/cjs/AnthropicConfig.js.map +0 -1
- package/dist/cjs/AnthropicLanguageModel.js +0 -1322
- package/dist/cjs/AnthropicLanguageModel.js.map +0 -1
- package/dist/cjs/AnthropicTokenizer.js +0 -52
- package/dist/cjs/AnthropicTokenizer.js.map +0 -1
- package/dist/cjs/AnthropicTool.js +0 -461
- package/dist/cjs/AnthropicTool.js.map +0 -1
- package/dist/cjs/Generated.js +0 -6578
- package/dist/cjs/Generated.js.map +0 -1
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/internal/utilities.js +0 -29
- package/dist/cjs/internal/utilities.js.map +0 -1
- package/dist/dts/AnthropicClient.d.ts +0 -730
- package/dist/dts/AnthropicClient.d.ts.map +0 -1
- package/dist/dts/AnthropicConfig.d.ts.map +0 -1
- package/dist/dts/AnthropicLanguageModel.d.ts +0 -304
- package/dist/dts/AnthropicLanguageModel.d.ts.map +0 -1
- package/dist/dts/AnthropicTokenizer.d.ts +0 -13
- package/dist/dts/AnthropicTokenizer.d.ts.map +0 -1
- package/dist/dts/AnthropicTool.d.ts +0 -548
- package/dist/dts/AnthropicTool.d.ts.map +0 -1
- package/dist/dts/Generated.d.ts +0 -12504
- package/dist/dts/Generated.d.ts.map +0 -1
- package/dist/dts/index.d.ts +0 -25
- package/dist/dts/index.d.ts.map +0 -1
- package/dist/esm/AnthropicClient.js +0 -317
- package/dist/esm/AnthropicClient.js.map +0 -1
- package/dist/esm/AnthropicConfig.js.map +0 -1
- package/dist/esm/AnthropicLanguageModel.js +0 -1309
- package/dist/esm/AnthropicLanguageModel.js.map +0 -1
- package/dist/esm/AnthropicTokenizer.js +0 -44
- package/dist/esm/AnthropicTokenizer.js.map +0 -1
- package/dist/esm/AnthropicTool.js +0 -452
- package/dist/esm/AnthropicTool.js.map +0 -1
- package/dist/esm/Generated.js +0 -6247
- package/dist/esm/Generated.js.map +0 -1
- package/dist/esm/index.js +0 -25
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/internal/utilities.js.map +0 -1
- package/dist/esm/package.json +0 -4
- package/index/package.json +0 -6
- package/src/AnthropicTokenizer.ts +0 -59
- /package/dist/{dts/internal → internal}/utilities.d.ts +0 -0
- /package/dist/{esm/internal → internal}/utilities.js +0 -0
|
@@ -0,0 +1,1168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic provider-defined tools for use with the LanguageModel.
|
|
3
|
+
*
|
|
4
|
+
* Provides tools that are natively supported by Anthropic's API, including
|
|
5
|
+
* Bash, Code Execution, Computer Use, Memory, and Text Editor functionality.
|
|
6
|
+
*
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Tool from "effect/unstable/ai/Tool";
|
|
11
|
+
import * as Generated from "./Generated.js";
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Bash
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Anthropic Bash tool (2024-10-22 version).
|
|
17
|
+
*
|
|
18
|
+
* Allows the model to execute bash commands in a sandboxed environment.
|
|
19
|
+
* Requires the "computer-use-2024-10-22" beta header.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
* @category Bash
|
|
23
|
+
*/
|
|
24
|
+
export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
25
|
+
id: "anthropic.bash_20241022",
|
|
26
|
+
customName: "AnthropicBash",
|
|
27
|
+
providerName: "bash",
|
|
28
|
+
requiresHandler: true,
|
|
29
|
+
success: Schema.String,
|
|
30
|
+
parameters: /*#__PURE__*/Schema.Struct({
|
|
31
|
+
command: Schema.String,
|
|
32
|
+
restart: /*#__PURE__*/Schema.optional(Schema.Boolean)
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Anthropic Bash tool (2025-01-24 version).
|
|
37
|
+
*
|
|
38
|
+
* Allows the model to execute bash commands in a sandboxed environment.
|
|
39
|
+
* Requires the "computer-use-2025-01-24" beta header.
|
|
40
|
+
*
|
|
41
|
+
* @since 1.0.0
|
|
42
|
+
* @category Bash
|
|
43
|
+
*/
|
|
44
|
+
export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
45
|
+
id: "anthropic.bash_20250124",
|
|
46
|
+
customName: "AnthropicBash",
|
|
47
|
+
providerName: "bash",
|
|
48
|
+
requiresHandler: true,
|
|
49
|
+
success: Schema.String,
|
|
50
|
+
parameters: /*#__PURE__*/Schema.Struct({
|
|
51
|
+
command: Schema.String,
|
|
52
|
+
restart: /*#__PURE__*/Schema.optional(Schema.Boolean)
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// Code Execution
|
|
57
|
+
// =============================================================================
|
|
58
|
+
// -----------------------------------------------------------------------------
|
|
59
|
+
// Code Execution 20250522 Parameters
|
|
60
|
+
// -----------------------------------------------------------------------------
|
|
61
|
+
/**
|
|
62
|
+
* Programmatic tool call execution parameter.
|
|
63
|
+
*
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
* @category Code Execution
|
|
66
|
+
*/
|
|
67
|
+
export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
|
|
68
|
+
type: /*#__PURE__*/Schema.Literal("programmatic-tool-call"),
|
|
69
|
+
/**
|
|
70
|
+
* The code to execute.
|
|
71
|
+
*/
|
|
72
|
+
code: Schema.String
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* Bash code execution parameter.
|
|
76
|
+
*
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
* @category Code Execution
|
|
79
|
+
*/
|
|
80
|
+
export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
|
|
81
|
+
type: /*#__PURE__*/Schema.Literal("bash_code_execution"),
|
|
82
|
+
/**
|
|
83
|
+
* The bash command to execute.
|
|
84
|
+
*/
|
|
85
|
+
command: Schema.String
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Text editor view command for code execution.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
* @category Code Execution
|
|
92
|
+
*/
|
|
93
|
+
export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
|
|
94
|
+
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
95
|
+
command: /*#__PURE__*/Schema.Literal("view"),
|
|
96
|
+
/**
|
|
97
|
+
* Path to the file to view.
|
|
98
|
+
*/
|
|
99
|
+
path: Schema.String
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Text editor create command for code execution.
|
|
103
|
+
*
|
|
104
|
+
* @since 1.0.0
|
|
105
|
+
* @category Code Execution
|
|
106
|
+
*/
|
|
107
|
+
export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
|
|
108
|
+
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
109
|
+
command: /*#__PURE__*/Schema.Literal("create"),
|
|
110
|
+
/**
|
|
111
|
+
* Path where the file should be created.
|
|
112
|
+
*/
|
|
113
|
+
path: Schema.String,
|
|
114
|
+
/**
|
|
115
|
+
* The content to write to the new file.
|
|
116
|
+
*/
|
|
117
|
+
file_text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String))
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Text editor str_replace command for code execution.
|
|
121
|
+
*
|
|
122
|
+
* @since 1.0.0
|
|
123
|
+
* @category Code Execution
|
|
124
|
+
*/
|
|
125
|
+
export const CodeExecutionTextEditorStrReplace = /*#__PURE__*/Schema.Struct({
|
|
126
|
+
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
127
|
+
command: /*#__PURE__*/Schema.Literal("str_replace"),
|
|
128
|
+
/**
|
|
129
|
+
* Path to the file to modify.
|
|
130
|
+
*/
|
|
131
|
+
path: Schema.String,
|
|
132
|
+
/**
|
|
133
|
+
* The text to replace.
|
|
134
|
+
*/
|
|
135
|
+
old_str: Schema.String,
|
|
136
|
+
/**
|
|
137
|
+
* The replacement text.
|
|
138
|
+
*/
|
|
139
|
+
new_str: Schema.String
|
|
140
|
+
});
|
|
141
|
+
const CodeExecution_20250522_Parameters = /*#__PURE__*/Schema.Union([CodeExecutionProgrammaticToolCall, CodeExecutionBashCommand, CodeExecutionTextEditorView, CodeExecutionTextEditorCreate, CodeExecutionTextEditorStrReplace]);
|
|
142
|
+
// -----------------------------------------------------------------------------
|
|
143
|
+
// Code Execution 20250825 Parameters
|
|
144
|
+
// -----------------------------------------------------------------------------
|
|
145
|
+
/**
|
|
146
|
+
* Simple code execution parameter.
|
|
147
|
+
*
|
|
148
|
+
* @since 1.0.0
|
|
149
|
+
* @category Code Execution
|
|
150
|
+
*/
|
|
151
|
+
export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
152
|
+
/**
|
|
153
|
+
* The code to execute.
|
|
154
|
+
*/
|
|
155
|
+
code: Schema.String
|
|
156
|
+
});
|
|
157
|
+
// -----------------------------------------------------------------------------
|
|
158
|
+
// Code Execution Tool Definitions
|
|
159
|
+
// -----------------------------------------------------------------------------
|
|
160
|
+
/**
|
|
161
|
+
* Anthropic Code Execution tool (2025-05-22 version).
|
|
162
|
+
*
|
|
163
|
+
* Allows the model to execute code in a sandboxed environment with support
|
|
164
|
+
* for multiple execution types including programmatic tool calls, bash
|
|
165
|
+
* execution, and text editor operations.
|
|
166
|
+
*
|
|
167
|
+
* @since 1.0.0
|
|
168
|
+
* @category Code Execution
|
|
169
|
+
*/
|
|
170
|
+
export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
|
|
171
|
+
id: "anthropic.code_execution_20250522",
|
|
172
|
+
customName: "AnthropicCodeExecution",
|
|
173
|
+
providerName: "code_execution",
|
|
174
|
+
parameters: CodeExecution_20250522_Parameters,
|
|
175
|
+
success: Generated.BetaResponseCodeExecutionResultBlock,
|
|
176
|
+
failure: Generated.BetaResponseCodeExecutionToolResultError
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* Anthropic Code Execution tool (2025-08-25 version).
|
|
180
|
+
*
|
|
181
|
+
* Allows the model to execute code in a sandboxed environment.
|
|
182
|
+
*
|
|
183
|
+
* @since 1.0.0
|
|
184
|
+
* @category Code Execution
|
|
185
|
+
*/
|
|
186
|
+
export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
|
|
187
|
+
id: "anthropic.code_execution_20250825",
|
|
188
|
+
customName: "AnthropicCodeExecution",
|
|
189
|
+
providerName: "code_execution",
|
|
190
|
+
parameters: CodeExecution_20250825_Parameters,
|
|
191
|
+
success: /*#__PURE__*/Schema.Union([Generated.BetaResponseCodeExecutionResultBlock, Generated.BetaResponseBashCodeExecutionResultBlock, Generated.BetaResponseTextEditorCodeExecutionViewResultBlock, Generated.BetaResponseTextEditorCodeExecutionCreateResultBlock, Generated.BetaResponseTextEditorCodeExecutionStrReplaceResultBlock]),
|
|
192
|
+
failure: /*#__PURE__*/Schema.Union([Generated.BetaResponseCodeExecutionToolResultError, Generated.BetaResponseBashCodeExecutionToolResultError, Generated.BetaResponseTextEditorCodeExecutionToolResultError])
|
|
193
|
+
});
|
|
194
|
+
// =============================================================================
|
|
195
|
+
// Computer Use
|
|
196
|
+
// =============================================================================
|
|
197
|
+
// -----------------------------------------------------------------------------
|
|
198
|
+
// Common Types
|
|
199
|
+
// -----------------------------------------------------------------------------
|
|
200
|
+
/**
|
|
201
|
+
* An `[x, y]` pixel position.
|
|
202
|
+
*
|
|
203
|
+
* @since 1.0.0
|
|
204
|
+
* @category Computer Use
|
|
205
|
+
*/
|
|
206
|
+
export const Coordinate = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
207
|
+
/**
|
|
208
|
+
* A `[x1, y1, x2, y2]` position defining top-left and bottom-right corners.
|
|
209
|
+
*
|
|
210
|
+
* @since 1.0.0
|
|
211
|
+
* @category Computer Use
|
|
212
|
+
*/
|
|
213
|
+
export const Region = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number]);
|
|
214
|
+
/**
|
|
215
|
+
* The direction of the scroll for scroll actions.
|
|
216
|
+
*
|
|
217
|
+
* @since 1.0.0
|
|
218
|
+
* @category Computer Use
|
|
219
|
+
*/
|
|
220
|
+
export const ScrollDirection = /*#__PURE__*/Schema.Literals(["up", "down", "left", "right"]);
|
|
221
|
+
/**
|
|
222
|
+
* Modifier keys that can be held during click/scroll actions.
|
|
223
|
+
*
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
* @category Computer Use
|
|
226
|
+
*/
|
|
227
|
+
export const ModifierKey = /*#__PURE__*/Schema.Literals(["alt", "ctrl", "meta", "shift"]);
|
|
228
|
+
// -----------------------------------------------------------------------------
|
|
229
|
+
// ComputerUse_20241022_Args
|
|
230
|
+
// -----------------------------------------------------------------------------
|
|
231
|
+
const ComputerUse_20241022_Args = /*#__PURE__*/Schema.Struct({
|
|
232
|
+
/**
|
|
233
|
+
* The width of the display being controlled by the model in pixels.
|
|
234
|
+
*/
|
|
235
|
+
displayWidthPx: Schema.Number,
|
|
236
|
+
/**
|
|
237
|
+
* The height of the display being controlled by the model in pixels.
|
|
238
|
+
*/
|
|
239
|
+
displayHeightPx: Schema.Number,
|
|
240
|
+
/**
|
|
241
|
+
* The display number to control (only relevant for X11 environments). If
|
|
242
|
+
* specified, the tool will be provided a display number in the tool
|
|
243
|
+
* definition.
|
|
244
|
+
*/
|
|
245
|
+
displayNumber: /*#__PURE__*/Schema.optional(Schema.Number)
|
|
246
|
+
});
|
|
247
|
+
const ComputerUse_20251124_Args = /*#__PURE__*/Schema.Struct({
|
|
248
|
+
...ComputerUse_20241022_Args.fields,
|
|
249
|
+
enableZoom: /*#__PURE__*/Schema.optional(Schema.Boolean)
|
|
250
|
+
});
|
|
251
|
+
// -----------------------------------------------------------------------------
|
|
252
|
+
// Computer Use 20241022 Actions
|
|
253
|
+
// -----------------------------------------------------------------------------
|
|
254
|
+
/**
|
|
255
|
+
* Press a key or key combination (e.g. `"Return"`, `"ctrl+c"`, `"ctrl+s"`).
|
|
256
|
+
*
|
|
257
|
+
* @since 1.0.0
|
|
258
|
+
* @category Computer Use
|
|
259
|
+
*/
|
|
260
|
+
export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
|
|
261
|
+
action: /*#__PURE__*/Schema.Literal("key"),
|
|
262
|
+
/**
|
|
263
|
+
* The key to press.
|
|
264
|
+
*/
|
|
265
|
+
text: Schema.String
|
|
266
|
+
});
|
|
267
|
+
/**
|
|
268
|
+
* Perform a left click at the current mouse position or the specified coordinates.
|
|
269
|
+
*
|
|
270
|
+
* @since 1.0.0
|
|
271
|
+
* @category Computer Use
|
|
272
|
+
*/
|
|
273
|
+
export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
|
|
274
|
+
action: /*#__PURE__*/Schema.Literal("left_click"),
|
|
275
|
+
/**
|
|
276
|
+
* The `[x, y]` coordinate on the screen to left click (defaults to the current
|
|
277
|
+
* mouse position if omitted).
|
|
278
|
+
*/
|
|
279
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* Move the mouse cursor to the specified coordinates.
|
|
283
|
+
*
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
* @category Computer Use
|
|
286
|
+
*/
|
|
287
|
+
export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
|
|
288
|
+
action: /*#__PURE__*/Schema.Literal("mouse_move"),
|
|
289
|
+
/**
|
|
290
|
+
* The `[x, y]` coordinate on the screen to move to.
|
|
291
|
+
*/
|
|
292
|
+
coordinate: Coordinate
|
|
293
|
+
});
|
|
294
|
+
/**
|
|
295
|
+
* Capture the current display.
|
|
296
|
+
*
|
|
297
|
+
* @since 1.0.0
|
|
298
|
+
* @category Computer Use
|
|
299
|
+
*/
|
|
300
|
+
export const ComputerUseScreenshotAction = /*#__PURE__*/Schema.Struct({
|
|
301
|
+
action: /*#__PURE__*/Schema.Literal("screenshot")
|
|
302
|
+
});
|
|
303
|
+
/**
|
|
304
|
+
* Type a text string.
|
|
305
|
+
*
|
|
306
|
+
* @since 1.0.0
|
|
307
|
+
* @category Computer Use
|
|
308
|
+
*/
|
|
309
|
+
export const TypeAction = /*#__PURE__*/Schema.Struct({
|
|
310
|
+
action: /*#__PURE__*/Schema.Literal("type"),
|
|
311
|
+
/**
|
|
312
|
+
* The text to type.
|
|
313
|
+
*/
|
|
314
|
+
text: Schema.String
|
|
315
|
+
});
|
|
316
|
+
const ComputerUse_20241022_Actions = /*#__PURE__*/Schema.Union([ComputerUseKeyAction, ComputerUseLeftClickAction, ComputerUseMouseMoveAction, ComputerUseScreenshotAction, TypeAction]);
|
|
317
|
+
// -----------------------------------------------------------------------------
|
|
318
|
+
// Computer Use 20250124 Actions
|
|
319
|
+
// -----------------------------------------------------------------------------
|
|
320
|
+
/**
|
|
321
|
+
* Perform a double click.
|
|
322
|
+
*
|
|
323
|
+
* @since 1.0.0
|
|
324
|
+
* @category Computer Use
|
|
325
|
+
*/
|
|
326
|
+
export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
327
|
+
action: /*#__PURE__*/Schema.Literal("double_click"),
|
|
328
|
+
/**
|
|
329
|
+
* The coordinate to double click (defaults to the current mouse position if
|
|
330
|
+
* omitted).
|
|
331
|
+
*/
|
|
332
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
333
|
+
});
|
|
334
|
+
/**
|
|
335
|
+
* Holds a key while performing other actions.
|
|
336
|
+
*
|
|
337
|
+
* @since 1.0.0
|
|
338
|
+
* @category Computer Use
|
|
339
|
+
*/
|
|
340
|
+
export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
|
|
341
|
+
action: /*#__PURE__*/Schema.Literal("hold_key"),
|
|
342
|
+
/**
|
|
343
|
+
* The key to hold (e.g. `"shift"`, `"ctrl"`).
|
|
344
|
+
*/
|
|
345
|
+
text: Schema.String,
|
|
346
|
+
/**
|
|
347
|
+
* The number of seconds to hold the key.
|
|
348
|
+
*/
|
|
349
|
+
duration: Schema.Number
|
|
350
|
+
});
|
|
351
|
+
/**
|
|
352
|
+
* Click and drag from start coordinate to end coordinate.
|
|
353
|
+
*
|
|
354
|
+
* @since 1.0.0
|
|
355
|
+
* @category Computer Use
|
|
356
|
+
*/
|
|
357
|
+
export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
358
|
+
action: /*#__PURE__*/Schema.Literal("left_click_drag"),
|
|
359
|
+
/**
|
|
360
|
+
* The `[x, y]` coordinate to start dragging from.
|
|
361
|
+
*/
|
|
362
|
+
start_coordinate: Coordinate,
|
|
363
|
+
/**
|
|
364
|
+
* The `[x, y]` coordinate to drag to.
|
|
365
|
+
*/
|
|
366
|
+
coordinate: Coordinate
|
|
367
|
+
});
|
|
368
|
+
/**
|
|
369
|
+
* Press the left mouse button down (without releasing).
|
|
370
|
+
*
|
|
371
|
+
* Used for fine-grained click control.
|
|
372
|
+
*
|
|
373
|
+
* @since 1.0.0
|
|
374
|
+
* @category Computer Use
|
|
375
|
+
*/
|
|
376
|
+
export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
377
|
+
action: /*#__PURE__*/Schema.Literal("left_mouse_down"),
|
|
378
|
+
/**
|
|
379
|
+
* The coordinate at which the left mouse button should be held down (defaults
|
|
380
|
+
* to the current mouse position if omitted).
|
|
381
|
+
*/
|
|
382
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
383
|
+
});
|
|
384
|
+
/**
|
|
385
|
+
* Release the left mouse button.
|
|
386
|
+
*
|
|
387
|
+
* Used for fine-grained click control.
|
|
388
|
+
*
|
|
389
|
+
* @since 1.0.0
|
|
390
|
+
* @category Computer Use
|
|
391
|
+
*/
|
|
392
|
+
export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
393
|
+
action: /*#__PURE__*/Schema.Literal("left_mouse_up"),
|
|
394
|
+
/**
|
|
395
|
+
* The coordinate at which the left mouse button should be released (defaults
|
|
396
|
+
* to the current mouse position if omitted).
|
|
397
|
+
*/
|
|
398
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
399
|
+
});
|
|
400
|
+
/**
|
|
401
|
+
* Perform a middle click.
|
|
402
|
+
*
|
|
403
|
+
* @since 1.0.0
|
|
404
|
+
* @category Computer Use
|
|
405
|
+
*/
|
|
406
|
+
export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
407
|
+
action: /*#__PURE__*/Schema.Literal("middle_click"),
|
|
408
|
+
/**
|
|
409
|
+
* The coordinate to middle click (defaults to the current mouse position if
|
|
410
|
+
* omitted).
|
|
411
|
+
*/
|
|
412
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
413
|
+
});
|
|
414
|
+
/**
|
|
415
|
+
* Perform a right click.
|
|
416
|
+
*
|
|
417
|
+
* @since 1.0.0
|
|
418
|
+
* @category Computer Use
|
|
419
|
+
*/
|
|
420
|
+
export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
421
|
+
action: /*#__PURE__*/Schema.Literal("right_click"),
|
|
422
|
+
/**
|
|
423
|
+
* The coordinate to right click (defaults to the current mouse position if
|
|
424
|
+
* omitted).
|
|
425
|
+
*/
|
|
426
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
427
|
+
});
|
|
428
|
+
/**
|
|
429
|
+
* Scroll a given amount in a specified direction.
|
|
430
|
+
*
|
|
431
|
+
* @since 1.0.0
|
|
432
|
+
* @category Computer Use
|
|
433
|
+
*/
|
|
434
|
+
export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
435
|
+
action: /*#__PURE__*/Schema.Literal("scroll"),
|
|
436
|
+
/**
|
|
437
|
+
* The coordinate to start scrolling from (defaults to the current mouse
|
|
438
|
+
* position if omitted).
|
|
439
|
+
*/
|
|
440
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate),
|
|
441
|
+
/**
|
|
442
|
+
* The direction to scroll.
|
|
443
|
+
*/
|
|
444
|
+
scroll_direction: ScrollDirection,
|
|
445
|
+
/**
|
|
446
|
+
* The amount to scroll (in pixels or scroll units).
|
|
447
|
+
*/
|
|
448
|
+
scroll_amount: Schema.Number
|
|
449
|
+
});
|
|
450
|
+
/**
|
|
451
|
+
* Perform a triple click.
|
|
452
|
+
*
|
|
453
|
+
* @since 1.0.0
|
|
454
|
+
* @category Computer Use
|
|
455
|
+
*/
|
|
456
|
+
export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
457
|
+
action: /*#__PURE__*/Schema.Literal("triple_click"),
|
|
458
|
+
/**
|
|
459
|
+
* The coordinate to triple click (defaults to the current mouse position if
|
|
460
|
+
* omitted).
|
|
461
|
+
*/
|
|
462
|
+
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
463
|
+
});
|
|
464
|
+
/**
|
|
465
|
+
* Pause between performing actions.
|
|
466
|
+
*
|
|
467
|
+
* @since 1.0.0
|
|
468
|
+
* @category Computer Use
|
|
469
|
+
*/
|
|
470
|
+
export const ComputerUseWaitAction = /*#__PURE__*/Schema.Struct({
|
|
471
|
+
action: /*#__PURE__*/Schema.Literal("wait"),
|
|
472
|
+
/**
|
|
473
|
+
* The number of seconds to wait.
|
|
474
|
+
*/
|
|
475
|
+
duration: Schema.Number
|
|
476
|
+
});
|
|
477
|
+
const ComputerUse_20250124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_20241022_Actions.members, ComputerUseDoubleClickAction, ComputerUseHoldKeyAction, ComputerUseLeftClickDragAction, ComputerUseLeftMouseDownAction, ComputerUseLeftMouseUpAction, ComputerUseMiddleClickAction, ComputerUseRightClickAction, ComputerUseScrollAction, ComputerUseTripleClickAction, ComputerUseWaitAction]);
|
|
478
|
+
// -----------------------------------------------------------------------------
|
|
479
|
+
// Computer Use 20251124 Actions
|
|
480
|
+
// -----------------------------------------------------------------------------
|
|
481
|
+
/**
|
|
482
|
+
* Zoom into a specific region of the screen at full resolution.
|
|
483
|
+
*
|
|
484
|
+
* Requires `enableZoom: true` in the tool definition.
|
|
485
|
+
*
|
|
486
|
+
* @since 1.0.0
|
|
487
|
+
* @category Computer Use
|
|
488
|
+
*/
|
|
489
|
+
export const ComputerUseZoomAction = /*#__PURE__*/Schema.Struct({
|
|
490
|
+
action: /*#__PURE__*/Schema.Literal("zoom"),
|
|
491
|
+
/**
|
|
492
|
+
* Region to zoom into, defined as `[x1, y1, x2, y2]` coordinates where
|
|
493
|
+
* `(x1, y1)` is the top-left corner and `(x2, y2)` is the bottom-right corner.
|
|
494
|
+
*/
|
|
495
|
+
region: Region
|
|
496
|
+
});
|
|
497
|
+
const ComputerUse_20251124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_20250124_Actions.members, ComputerUseZoomAction]);
|
|
498
|
+
// -----------------------------------------------------------------------------
|
|
499
|
+
// Computer Use Tool Definitions
|
|
500
|
+
// -----------------------------------------------------------------------------
|
|
501
|
+
/**
|
|
502
|
+
* Computer use tool for Claude 3.5 Sonnet v2 (deprecated).
|
|
503
|
+
*
|
|
504
|
+
* Requires the "computer-use-2024-10-22" beta header.
|
|
505
|
+
*
|
|
506
|
+
* Basic actions only: screenshot, left_click, type, key, mouse_move.
|
|
507
|
+
*
|
|
508
|
+
* @since 1.0.0
|
|
509
|
+
* @category Computer Use
|
|
510
|
+
*/
|
|
511
|
+
export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
512
|
+
id: "anthropic.computer_use_20241022",
|
|
513
|
+
customName: "AnthropicComputerUse",
|
|
514
|
+
providerName: "computer_use",
|
|
515
|
+
requiresHandler: true,
|
|
516
|
+
args: ComputerUse_20241022_Args,
|
|
517
|
+
parameters: ComputerUse_20241022_Actions,
|
|
518
|
+
success: Schema.String
|
|
519
|
+
});
|
|
520
|
+
/**
|
|
521
|
+
* Computer use tool for Claude 4 models and Claude Sonnet 3.7.
|
|
522
|
+
*
|
|
523
|
+
* Requires the "computer-use-2025-01-24" beta header.
|
|
524
|
+
*
|
|
525
|
+
* Includes basic actions plus enhanced actions: scroll, left_click_drag,
|
|
526
|
+
* right_click, middle_click, double_click, triple_click, left_mouse_down,
|
|
527
|
+
* left_mouse_up, hold_key, wait.
|
|
528
|
+
*
|
|
529
|
+
* @since 1.0.0
|
|
530
|
+
* @category Computer Use
|
|
531
|
+
*/
|
|
532
|
+
export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
533
|
+
id: "anthropic.computer_20250124",
|
|
534
|
+
customName: "AnthropicComputerUse",
|
|
535
|
+
providerName: "computer",
|
|
536
|
+
requiresHandler: true,
|
|
537
|
+
args: ComputerUse_20241022_Args,
|
|
538
|
+
parameters: ComputerUse_20250124_Actions,
|
|
539
|
+
success: Schema.String
|
|
540
|
+
});
|
|
541
|
+
/**
|
|
542
|
+
* Computer use tool for Claude Opus 4.5 only.
|
|
543
|
+
*
|
|
544
|
+
* Requires the "computer-use-2025-11-24" beta header.
|
|
545
|
+
*
|
|
546
|
+
* Includes all actions from computer_20250124 plus the zoom action for
|
|
547
|
+
* detailed screen region inspection. Requires `enableZoom: true` in args.
|
|
548
|
+
*
|
|
549
|
+
* @since 1.0.0
|
|
550
|
+
* @category Computer Use
|
|
551
|
+
*/
|
|
552
|
+
export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
553
|
+
id: "anthropic.computer_20251124",
|
|
554
|
+
customName: "AnthropicComputerUse",
|
|
555
|
+
providerName: "computer",
|
|
556
|
+
requiresHandler: true,
|
|
557
|
+
args: ComputerUse_20251124_Args,
|
|
558
|
+
parameters: ComputerUse_20251124_Actions,
|
|
559
|
+
success: Schema.String
|
|
560
|
+
});
|
|
561
|
+
// =============================================================================
|
|
562
|
+
// Memory
|
|
563
|
+
// =============================================================================
|
|
564
|
+
// -----------------------------------------------------------------------------
|
|
565
|
+
// Common Types
|
|
566
|
+
// -----------------------------------------------------------------------------
|
|
567
|
+
/**
|
|
568
|
+
* A `[start, end]` line range for viewing file contents.
|
|
569
|
+
*
|
|
570
|
+
* Lines are 1-indexed. Use -1 for end to read to end of file.
|
|
571
|
+
*
|
|
572
|
+
* @example [1, 50] // View lines 1-50
|
|
573
|
+
* @example [100, -1] // View from line 100 to end of file
|
|
574
|
+
*
|
|
575
|
+
* @since 1.0.0
|
|
576
|
+
* @category Memory
|
|
577
|
+
*/
|
|
578
|
+
export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
579
|
+
// -----------------------------------------------------------------------------
|
|
580
|
+
// Memory 20250818 Commands
|
|
581
|
+
// -----------------------------------------------------------------------------
|
|
582
|
+
/**
|
|
583
|
+
* Creates a new file.
|
|
584
|
+
*
|
|
585
|
+
* @since 1.0.0
|
|
586
|
+
* @category Memory
|
|
587
|
+
*/
|
|
588
|
+
export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
589
|
+
command: /*#__PURE__*/Schema.Literal("create"),
|
|
590
|
+
/**
|
|
591
|
+
* The path to the file that should be created.
|
|
592
|
+
*/
|
|
593
|
+
path: Schema.String
|
|
594
|
+
});
|
|
595
|
+
/**
|
|
596
|
+
* Delete a file or directory.
|
|
597
|
+
*
|
|
598
|
+
* @since 1.0.0
|
|
599
|
+
* @category Memory
|
|
600
|
+
*/
|
|
601
|
+
export const MemoryDeleteCommand = /*#__PURE__*/Schema.Struct({
|
|
602
|
+
command: /*#__PURE__*/Schema.Literal("delete"),
|
|
603
|
+
/**
|
|
604
|
+
* The path to the file to delete.
|
|
605
|
+
*/
|
|
606
|
+
path: Schema.String
|
|
607
|
+
});
|
|
608
|
+
/**
|
|
609
|
+
* Insert text at a specific line.
|
|
610
|
+
*
|
|
611
|
+
* @since 1.0.0
|
|
612
|
+
* @category Memory
|
|
613
|
+
*/
|
|
614
|
+
export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
615
|
+
command: /*#__PURE__*/Schema.Literal("insert"),
|
|
616
|
+
/**
|
|
617
|
+
* The path to the file to insert text into.
|
|
618
|
+
*/
|
|
619
|
+
path: Schema.String,
|
|
620
|
+
/**
|
|
621
|
+
* The line at which the text should be inserted.
|
|
622
|
+
*/
|
|
623
|
+
insert_line: Schema.Number,
|
|
624
|
+
/**
|
|
625
|
+
* The text to insert.
|
|
626
|
+
*/
|
|
627
|
+
insert_text: Schema.String
|
|
628
|
+
});
|
|
629
|
+
/**
|
|
630
|
+
* Rename or move a file or directory.
|
|
631
|
+
*
|
|
632
|
+
* @since 1.0.0
|
|
633
|
+
* @category Memory
|
|
634
|
+
*/
|
|
635
|
+
export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
636
|
+
command: /*#__PURE__*/Schema.Literal("rename"),
|
|
637
|
+
/**
|
|
638
|
+
* The old path to the file or directory.
|
|
639
|
+
*/
|
|
640
|
+
old_path: Schema.String,
|
|
641
|
+
/**
|
|
642
|
+
* The new path to the file or directory.
|
|
643
|
+
*/
|
|
644
|
+
new_path: Schema.String
|
|
645
|
+
});
|
|
646
|
+
/**
|
|
647
|
+
* Replace text in a file.
|
|
648
|
+
*
|
|
649
|
+
* @since 1.0.0
|
|
650
|
+
* @category Memory
|
|
651
|
+
*/
|
|
652
|
+
export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
653
|
+
command: /*#__PURE__*/Schema.Literal("str_replace"),
|
|
654
|
+
/**
|
|
655
|
+
* The path to the file in which the replacement should occur.
|
|
656
|
+
*/
|
|
657
|
+
path: Schema.String,
|
|
658
|
+
/**
|
|
659
|
+
* The text to replace.
|
|
660
|
+
*/
|
|
661
|
+
old_str: Schema.String,
|
|
662
|
+
/**
|
|
663
|
+
* The replacement text.
|
|
664
|
+
*/
|
|
665
|
+
new_str: Schema.String
|
|
666
|
+
});
|
|
667
|
+
/**
|
|
668
|
+
* Shows directory contents or file contents with optional line ranges.
|
|
669
|
+
*
|
|
670
|
+
* @since 1.0.0
|
|
671
|
+
* @category Memory
|
|
672
|
+
*/
|
|
673
|
+
export const MemoryViewCommand = /*#__PURE__*/Schema.Struct({
|
|
674
|
+
command: /*#__PURE__*/Schema.Literal("view"),
|
|
675
|
+
/**
|
|
676
|
+
* The path to the file to view.
|
|
677
|
+
*/
|
|
678
|
+
path: Schema.String,
|
|
679
|
+
/**
|
|
680
|
+
* The specific lines to view.
|
|
681
|
+
*/
|
|
682
|
+
view_range: /*#__PURE__*/Schema.optional(ViewRange)
|
|
683
|
+
});
|
|
684
|
+
const Memory_20250818_Commands = /*#__PURE__*/Schema.Union([MemoryCreateCommand, MemoryDeleteCommand, MemoryInsertCommand, MemoryRenameCommand, MemoryStrReplaceCommand, MemoryViewCommand]);
|
|
685
|
+
// -----------------------------------------------------------------------------
|
|
686
|
+
// Memory Tool Definitions
|
|
687
|
+
// -----------------------------------------------------------------------------
|
|
688
|
+
/**
|
|
689
|
+
* Memory tool for persistent file operations across conversations.
|
|
690
|
+
*
|
|
691
|
+
* Provides commands for creating, viewing, editing, renaming, and deleting
|
|
692
|
+
* files within the model's memory space.
|
|
693
|
+
*
|
|
694
|
+
* @since 1.0.0
|
|
695
|
+
* @category Memory
|
|
696
|
+
*/
|
|
697
|
+
export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
698
|
+
id: "anthropic.memory_20250818",
|
|
699
|
+
customName: "AnthropicMemory",
|
|
700
|
+
providerName: "memory",
|
|
701
|
+
parameters: Memory_20250818_Commands,
|
|
702
|
+
success: Schema.String
|
|
703
|
+
});
|
|
704
|
+
// =============================================================================
|
|
705
|
+
// Text Editor
|
|
706
|
+
// =============================================================================
|
|
707
|
+
// -----------------------------------------------------------------------------
|
|
708
|
+
// Text Editor Commands
|
|
709
|
+
// -----------------------------------------------------------------------------
|
|
710
|
+
/**
|
|
711
|
+
* View the contents of a file or list directory contents.
|
|
712
|
+
*
|
|
713
|
+
* When used on a file: Returns the file contents, optionally limited to a line range.
|
|
714
|
+
* When used on a directory: Lists all files and subdirectories.
|
|
715
|
+
*
|
|
716
|
+
* @since 1.0.0
|
|
717
|
+
* @category Text Editor
|
|
718
|
+
*/
|
|
719
|
+
export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
720
|
+
command: /*#__PURE__*/Schema.Literal("view"),
|
|
721
|
+
/**
|
|
722
|
+
* Absolute or relative path to the file or directory to view.
|
|
723
|
+
*/
|
|
724
|
+
path: Schema.String,
|
|
725
|
+
/**
|
|
726
|
+
* Optional line range to view (only applies to files, not directories).
|
|
727
|
+
* Lines are 1-indexed. Use -1 for end to read to end of file.
|
|
728
|
+
*/
|
|
729
|
+
view_range: /*#__PURE__*/Schema.optional(ViewRange)
|
|
730
|
+
});
|
|
731
|
+
/**
|
|
732
|
+
* Create a new file with specified content.
|
|
733
|
+
*
|
|
734
|
+
* Will fail if the file already exists. Parent directories must exist.
|
|
735
|
+
*
|
|
736
|
+
* @since 1.0.0
|
|
737
|
+
* @category Text Editor
|
|
738
|
+
*/
|
|
739
|
+
export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
740
|
+
command: /*#__PURE__*/Schema.Literal("create"),
|
|
741
|
+
/**
|
|
742
|
+
* Path where the file should be created.
|
|
743
|
+
*/
|
|
744
|
+
path: Schema.String,
|
|
745
|
+
/**
|
|
746
|
+
* The content to write to the new file.
|
|
747
|
+
*/
|
|
748
|
+
file_text: Schema.String
|
|
749
|
+
});
|
|
750
|
+
/**
|
|
751
|
+
* Replace a specific string in a file with a new string.
|
|
752
|
+
*
|
|
753
|
+
* The `old_str` must match exactly (including whitespace and indentation)
|
|
754
|
+
* and must be unique in the file.
|
|
755
|
+
*
|
|
756
|
+
* @since 1.0.0
|
|
757
|
+
* @category Text Editor
|
|
758
|
+
*/
|
|
759
|
+
export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
760
|
+
command: /*#__PURE__*/Schema.Literal("str_replace"),
|
|
761
|
+
/**
|
|
762
|
+
* Path to the file to modify.
|
|
763
|
+
*/
|
|
764
|
+
path: Schema.String,
|
|
765
|
+
/**
|
|
766
|
+
* The exact string to find and replace (must be unique in the file).
|
|
767
|
+
*/
|
|
768
|
+
old_str: Schema.String,
|
|
769
|
+
/**
|
|
770
|
+
* The string to replace old_str with (can be empty to delete).
|
|
771
|
+
*/
|
|
772
|
+
new_str: Schema.String
|
|
773
|
+
});
|
|
774
|
+
/**
|
|
775
|
+
* Insert text at a specific line number in a file.
|
|
776
|
+
*
|
|
777
|
+
* Inserts the new text AFTER the specified line number.
|
|
778
|
+
*
|
|
779
|
+
* @since 1.0.0
|
|
780
|
+
* @category Text Editor
|
|
781
|
+
*/
|
|
782
|
+
export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
783
|
+
command: /*#__PURE__*/Schema.Literal("insert"),
|
|
784
|
+
/**
|
|
785
|
+
* Path to the file to modify.
|
|
786
|
+
*/
|
|
787
|
+
path: Schema.String,
|
|
788
|
+
/**
|
|
789
|
+
* The line number after which to insert (0 = beginning, 1-indexed).
|
|
790
|
+
*/
|
|
791
|
+
insert_line: Schema.Number,
|
|
792
|
+
/**
|
|
793
|
+
* The text to insert.
|
|
794
|
+
*/
|
|
795
|
+
new_str: Schema.String
|
|
796
|
+
});
|
|
797
|
+
/**
|
|
798
|
+
* Undo the last edit made to a file.
|
|
799
|
+
*
|
|
800
|
+
* Reverts the most recent str_replace, insert, or create operation on the file.
|
|
801
|
+
*
|
|
802
|
+
* NOTE: This command is available in text_editor_20241022 and text_editor_20250124,
|
|
803
|
+
* but NOT in text_editor_20250728 (Claude 4 models).
|
|
804
|
+
*
|
|
805
|
+
* @since 1.0.0
|
|
806
|
+
* @category Text Editor
|
|
807
|
+
*/
|
|
808
|
+
export const TextEditorUndoEditCommand = /*#__PURE__*/Schema.Struct({
|
|
809
|
+
command: /*#__PURE__*/Schema.Literal("undo_edit"),
|
|
810
|
+
/**
|
|
811
|
+
* Path to the file to undo the last edit on.
|
|
812
|
+
*/
|
|
813
|
+
path: Schema.String
|
|
814
|
+
});
|
|
815
|
+
const TextEditor_StrReplaceEditor_Commands = /*#__PURE__*/Schema.Union([TextEditorViewCommand, TextEditorCreateCommand, TextEditorStrReplaceCommand, TextEditorInsertCommand, TextEditorUndoEditCommand]);
|
|
816
|
+
const TextEditor_StrReplaceBasedEdit_Commands = /*#__PURE__*/Schema.Union([TextEditorViewCommand, TextEditorCreateCommand, TextEditorStrReplaceCommand, TextEditorInsertCommand]);
|
|
817
|
+
// -----------------------------------------------------------------------------
|
|
818
|
+
// Text Editor Args
|
|
819
|
+
// -----------------------------------------------------------------------------
|
|
820
|
+
const TextEditor_StrReplaceBasedEdit_Args = /*#__PURE__*/Schema.Struct({
|
|
821
|
+
/**
|
|
822
|
+
* Maximum number of characters to return when viewing large files.
|
|
823
|
+
* When a file exceeds this limit, it will be truncated.
|
|
824
|
+
*/
|
|
825
|
+
max_characters: /*#__PURE__*/Schema.optional(Schema.Number)
|
|
826
|
+
});
|
|
827
|
+
// -----------------------------------------------------------------------------
|
|
828
|
+
// Text Editor Tool Definitions
|
|
829
|
+
// -----------------------------------------------------------------------------
|
|
830
|
+
/**
|
|
831
|
+
* Text editor tool for Claude 3.5 Sonnet (deprecated).
|
|
832
|
+
*
|
|
833
|
+
* Requires the "computer-use-2024-10-22" beta header.
|
|
834
|
+
*
|
|
835
|
+
* @since 1.0.0
|
|
836
|
+
* @category Text Editor
|
|
837
|
+
*/
|
|
838
|
+
export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
839
|
+
id: "anthropic.text_editor_20241022",
|
|
840
|
+
customName: "AnthropicTextEditor",
|
|
841
|
+
providerName: "str_replace_editor",
|
|
842
|
+
requiresHandler: true,
|
|
843
|
+
parameters: TextEditor_StrReplaceEditor_Commands,
|
|
844
|
+
success: Schema.String
|
|
845
|
+
});
|
|
846
|
+
/**
|
|
847
|
+
* Text editor tool for Claude Sonnet 3.7 (deprecated model).
|
|
848
|
+
*
|
|
849
|
+
* @since 1.0.0
|
|
850
|
+
* @category Text Editor
|
|
851
|
+
*/
|
|
852
|
+
export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
853
|
+
id: "anthropic.text_editor_20250124",
|
|
854
|
+
customName: "AnthropicTextEditor",
|
|
855
|
+
providerName: "str_replace_editor",
|
|
856
|
+
requiresHandler: true,
|
|
857
|
+
parameters: TextEditor_StrReplaceEditor_Commands,
|
|
858
|
+
success: Schema.String
|
|
859
|
+
});
|
|
860
|
+
/**
|
|
861
|
+
* Text editor tool for Claude 4 models.
|
|
862
|
+
*
|
|
863
|
+
* NOTE: This version does NOT support the `undo_edit` command.
|
|
864
|
+
*
|
|
865
|
+
* @since 1.0.0
|
|
866
|
+
* @category Text Editor
|
|
867
|
+
*/
|
|
868
|
+
export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
869
|
+
id: "anthropic.text_editor_20250429",
|
|
870
|
+
customName: "AnthropicTextEditor",
|
|
871
|
+
providerName: "str_replace_based_edit_tool",
|
|
872
|
+
requiresHandler: true,
|
|
873
|
+
args: TextEditor_StrReplaceBasedEdit_Args,
|
|
874
|
+
parameters: TextEditor_StrReplaceBasedEdit_Commands,
|
|
875
|
+
success: Schema.String
|
|
876
|
+
});
|
|
877
|
+
/**
|
|
878
|
+
* Text editor tool for Claude 4 models.
|
|
879
|
+
*
|
|
880
|
+
* NOTE: This version does NOT support the `undo_edit` command.
|
|
881
|
+
*
|
|
882
|
+
* @since 1.0.0
|
|
883
|
+
* @category Text Editor
|
|
884
|
+
*/
|
|
885
|
+
export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
886
|
+
id: "anthropic.text_editor_20250728",
|
|
887
|
+
customName: "AnthropicTextEditor",
|
|
888
|
+
providerName: "str_replace_based_edit_tool",
|
|
889
|
+
requiresHandler: true,
|
|
890
|
+
args: TextEditor_StrReplaceBasedEdit_Args,
|
|
891
|
+
parameters: TextEditor_StrReplaceBasedEdit_Commands,
|
|
892
|
+
success: Schema.String
|
|
893
|
+
});
|
|
894
|
+
// =============================================================================
|
|
895
|
+
// Web Search
|
|
896
|
+
// =============================================================================
|
|
897
|
+
// -----------------------------------------------------------------------------
|
|
898
|
+
// Web Search Types
|
|
899
|
+
// -----------------------------------------------------------------------------
|
|
900
|
+
/**
|
|
901
|
+
* User location for localizing search results.
|
|
902
|
+
*
|
|
903
|
+
* Providing location helps return more relevant results for location-dependent
|
|
904
|
+
* queries like weather, local businesses, events, etc.
|
|
905
|
+
*
|
|
906
|
+
* @since 1.0.0
|
|
907
|
+
* @category Web Search
|
|
908
|
+
*/
|
|
909
|
+
export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
|
|
910
|
+
/**
|
|
911
|
+
* Location type - currently only "approximate" is supported.
|
|
912
|
+
*/
|
|
913
|
+
type: /*#__PURE__*/Schema.Literal("approximate"),
|
|
914
|
+
/**
|
|
915
|
+
* City name.
|
|
916
|
+
*/
|
|
917
|
+
city: /*#__PURE__*/Schema.optional(Schema.String),
|
|
918
|
+
/**
|
|
919
|
+
* Region/state/province name.
|
|
920
|
+
*/
|
|
921
|
+
region: /*#__PURE__*/Schema.optional(Schema.String),
|
|
922
|
+
/**
|
|
923
|
+
* ISO 3166-1 alpha-2 country code.
|
|
924
|
+
*/
|
|
925
|
+
country: /*#__PURE__*/Schema.optional(Schema.String),
|
|
926
|
+
/**
|
|
927
|
+
* IANA timezone identifier.
|
|
928
|
+
*/
|
|
929
|
+
timezone: /*#__PURE__*/Schema.optional(Schema.String)
|
|
930
|
+
});
|
|
931
|
+
// -----------------------------------------------------------------------------
|
|
932
|
+
// Web Search Args
|
|
933
|
+
// -----------------------------------------------------------------------------
|
|
934
|
+
/**
|
|
935
|
+
* Configuration arguments for the web search tool.
|
|
936
|
+
*
|
|
937
|
+
* @since 1.0.0
|
|
938
|
+
* @category Web Search
|
|
939
|
+
*/
|
|
940
|
+
export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
|
|
941
|
+
/**
|
|
942
|
+
* Maximum number of searches allowed per API request.
|
|
943
|
+
*/
|
|
944
|
+
maxUses: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
945
|
+
/**
|
|
946
|
+
* Restrict search results to only these domains.
|
|
947
|
+
*
|
|
948
|
+
* Cannot be used together with `blockedDomains`.
|
|
949
|
+
*/
|
|
950
|
+
allowedDomains: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),
|
|
951
|
+
/**
|
|
952
|
+
* Exclude results from these domains.
|
|
953
|
+
*
|
|
954
|
+
* Cannot be used together with `allowedDomains`.
|
|
955
|
+
*/
|
|
956
|
+
blockedDomains: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),
|
|
957
|
+
/**
|
|
958
|
+
* User location for localizing search results.
|
|
959
|
+
*/
|
|
960
|
+
userLocation: /*#__PURE__*/Schema.optional(WebSearchUserLocation)
|
|
961
|
+
});
|
|
962
|
+
// -----------------------------------------------------------------------------
|
|
963
|
+
// Web Search Parameters
|
|
964
|
+
// -----------------------------------------------------------------------------
|
|
965
|
+
/**
|
|
966
|
+
* Input parameters for a web search.
|
|
967
|
+
*
|
|
968
|
+
* @since 1.0.0
|
|
969
|
+
* @category Web Search
|
|
970
|
+
*/
|
|
971
|
+
export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
972
|
+
/**
|
|
973
|
+
* The search query generated by Claude.
|
|
974
|
+
*/
|
|
975
|
+
query: Schema.String
|
|
976
|
+
});
|
|
977
|
+
// -----------------------------------------------------------------------------
|
|
978
|
+
// Web Search Tool Definitions
|
|
979
|
+
// -----------------------------------------------------------------------------
|
|
980
|
+
/**
|
|
981
|
+
* Web search tool for Claude models.
|
|
982
|
+
*
|
|
983
|
+
* Enables Claude to search the web for real-time information. This is a
|
|
984
|
+
* server-side tool executed by Anthropic's infrastructure.
|
|
985
|
+
*
|
|
986
|
+
* Generally available (no beta header required).
|
|
987
|
+
*
|
|
988
|
+
* @since 1.0.0
|
|
989
|
+
* @category Web Search
|
|
990
|
+
*/
|
|
991
|
+
export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
|
|
992
|
+
id: "anthropic.web_search_20250305",
|
|
993
|
+
customName: "AnthropicWebSearch",
|
|
994
|
+
providerName: "web_search",
|
|
995
|
+
args: WebSearch_20250305_Args,
|
|
996
|
+
parameters: WebSearchParameters,
|
|
997
|
+
success: /*#__PURE__*/Schema.Array(Generated.BetaResponseWebSearchResultBlock),
|
|
998
|
+
failure: Generated.BetaResponseWebSearchToolResultError
|
|
999
|
+
});
|
|
1000
|
+
// =============================================================================
|
|
1001
|
+
// Web Fetch
|
|
1002
|
+
// =============================================================================
|
|
1003
|
+
// -----------------------------------------------------------------------------
|
|
1004
|
+
// Web Fetch Types
|
|
1005
|
+
// -----------------------------------------------------------------------------
|
|
1006
|
+
/**
|
|
1007
|
+
* Citation configuration for web fetch.
|
|
1008
|
+
*
|
|
1009
|
+
* @since 1.0.0
|
|
1010
|
+
* @category Web Fetch
|
|
1011
|
+
*/
|
|
1012
|
+
export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
|
|
1013
|
+
/**
|
|
1014
|
+
* Enable citations for fetched content.
|
|
1015
|
+
*/
|
|
1016
|
+
enabled: Schema.Boolean
|
|
1017
|
+
});
|
|
1018
|
+
// -----------------------------------------------------------------------------
|
|
1019
|
+
// Web Fetch Args
|
|
1020
|
+
// -----------------------------------------------------------------------------
|
|
1021
|
+
/**
|
|
1022
|
+
* Configuration arguments for the web fetch tool.
|
|
1023
|
+
*
|
|
1024
|
+
* @since 1.0.0
|
|
1025
|
+
* @category Web Fetch
|
|
1026
|
+
*/
|
|
1027
|
+
export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
|
|
1028
|
+
/**
|
|
1029
|
+
* Maximum number of fetches allowed per API request.
|
|
1030
|
+
*/
|
|
1031
|
+
maxUses: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
1032
|
+
/**
|
|
1033
|
+
* Restrict fetches to only these domains.
|
|
1034
|
+
*
|
|
1035
|
+
* Cannot be used together with `blockedDomains`.
|
|
1036
|
+
*/
|
|
1037
|
+
allowedDomains: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),
|
|
1038
|
+
/**
|
|
1039
|
+
* Exclude fetches from these domains.
|
|
1040
|
+
*
|
|
1041
|
+
* Cannot be used together with `allowedDomains`.
|
|
1042
|
+
*/
|
|
1043
|
+
blockedDomains: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),
|
|
1044
|
+
/**
|
|
1045
|
+
* Enable citations for fetched content.
|
|
1046
|
+
*/
|
|
1047
|
+
citations: /*#__PURE__*/Schema.optional(WebFetchCitationsConfig),
|
|
1048
|
+
/**
|
|
1049
|
+
* Maximum content length in tokens.
|
|
1050
|
+
*/
|
|
1051
|
+
maxContentTokens: /*#__PURE__*/Schema.optional(Schema.Number)
|
|
1052
|
+
});
|
|
1053
|
+
// -----------------------------------------------------------------------------
|
|
1054
|
+
// Web Fetch Parameters
|
|
1055
|
+
// -----------------------------------------------------------------------------
|
|
1056
|
+
/**
|
|
1057
|
+
* Input parameters for a web fetch.
|
|
1058
|
+
*
|
|
1059
|
+
* @since 1.0.0
|
|
1060
|
+
* @category Web Fetch
|
|
1061
|
+
*/
|
|
1062
|
+
export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
|
|
1063
|
+
/**
|
|
1064
|
+
* URL to fetch. Must be a URL provided by the user or from prior search/fetch
|
|
1065
|
+
* results. Maximum URL length: 250 characters.
|
|
1066
|
+
*/
|
|
1067
|
+
url: Schema.String
|
|
1068
|
+
});
|
|
1069
|
+
// -----------------------------------------------------------------------------
|
|
1070
|
+
// Web Fetch Tool Definitions
|
|
1071
|
+
// -----------------------------------------------------------------------------
|
|
1072
|
+
/**
|
|
1073
|
+
* Web fetch tool for Claude models.
|
|
1074
|
+
*
|
|
1075
|
+
* Allows Claude to retrieve full content from web pages and PDF documents.
|
|
1076
|
+
* This is a server-side tool executed by Anthropic's infrastructure.
|
|
1077
|
+
*
|
|
1078
|
+
* Requires the "web-fetch-2025-09-10" beta header.
|
|
1079
|
+
*
|
|
1080
|
+
* @since 1.0.0
|
|
1081
|
+
* @category Web Fetch
|
|
1082
|
+
*/
|
|
1083
|
+
export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
|
|
1084
|
+
id: "anthropic.web_fetch_20250910",
|
|
1085
|
+
customName: "AnthropicWebFetch",
|
|
1086
|
+
providerName: "web_fetch",
|
|
1087
|
+
args: WebFetch_20250910_Args,
|
|
1088
|
+
parameters: WebFetchParameters,
|
|
1089
|
+
success: Generated.BetaResponseWebFetchResultBlock,
|
|
1090
|
+
failure: Generated.BetaResponseWebFetchToolResultError
|
|
1091
|
+
});
|
|
1092
|
+
// =============================================================================
|
|
1093
|
+
// Tool Search
|
|
1094
|
+
// =============================================================================
|
|
1095
|
+
// -----------------------------------------------------------------------------
|
|
1096
|
+
// Tool Search Parameters
|
|
1097
|
+
// -----------------------------------------------------------------------------
|
|
1098
|
+
/**
|
|
1099
|
+
* Input parameters for regex-based tool search.
|
|
1100
|
+
*
|
|
1101
|
+
* Claude constructs regex patterns using Python's `re.search()` syntax.
|
|
1102
|
+
* Maximum query length: 200 characters.
|
|
1103
|
+
*
|
|
1104
|
+
* @since 1.0.0
|
|
1105
|
+
* @category Tool Search
|
|
1106
|
+
*/
|
|
1107
|
+
export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
1108
|
+
/**
|
|
1109
|
+
* Python regex pattern to search for tools.
|
|
1110
|
+
*/
|
|
1111
|
+
query: Schema.String
|
|
1112
|
+
});
|
|
1113
|
+
/**
|
|
1114
|
+
* Input parameters for BM25/natural language tool search.
|
|
1115
|
+
*
|
|
1116
|
+
* @since 1.0.0
|
|
1117
|
+
* @category Tool Search
|
|
1118
|
+
*/
|
|
1119
|
+
export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
1120
|
+
/**
|
|
1121
|
+
* Natural language query to search for tools.
|
|
1122
|
+
*/
|
|
1123
|
+
query: Schema.String
|
|
1124
|
+
});
|
|
1125
|
+
// -----------------------------------------------------------------------------
|
|
1126
|
+
// Tool Search Tool Definitions
|
|
1127
|
+
// -----------------------------------------------------------------------------
|
|
1128
|
+
/**
|
|
1129
|
+
* Regex-based tool search for Claude models.
|
|
1130
|
+
*
|
|
1131
|
+
* Claude constructs regex patterns using Python's `re.search()` syntax to
|
|
1132
|
+
* find tools. The regex is matched against tool names, descriptions,
|
|
1133
|
+
* argument names, and argument descriptions.
|
|
1134
|
+
*
|
|
1135
|
+
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1136
|
+
*
|
|
1137
|
+
* @since 1.0.0
|
|
1138
|
+
* @category Tool Search
|
|
1139
|
+
*/
|
|
1140
|
+
export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
1141
|
+
id: "anthropic.tool_search_tool_regex_20251119",
|
|
1142
|
+
customName: "AnthropicToolSearchRegex",
|
|
1143
|
+
providerName: "tool_search_tool_regex",
|
|
1144
|
+
parameters: ToolSearchRegexParameters,
|
|
1145
|
+
success: /*#__PURE__*/Schema.Array(Generated.BetaRequestToolReferenceBlock),
|
|
1146
|
+
failure: Generated.BetaResponseToolSearchToolResultError
|
|
1147
|
+
});
|
|
1148
|
+
/**
|
|
1149
|
+
* BM25/natural language tool search for Claude models.
|
|
1150
|
+
*
|
|
1151
|
+
* Claude uses natural language queries to search for tools using the
|
|
1152
|
+
* BM25 algorithm. The search is performed against tool names, descriptions,
|
|
1153
|
+
* argument names, and argument descriptions.
|
|
1154
|
+
*
|
|
1155
|
+
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1156
|
+
*
|
|
1157
|
+
* @since 1.0.0
|
|
1158
|
+
* @category Tool Search
|
|
1159
|
+
*/
|
|
1160
|
+
export const ToolSearchBM25_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
1161
|
+
id: "anthropic.tool_search_tool_bm25_20251119",
|
|
1162
|
+
customName: "AnthropicToolSearchBM25",
|
|
1163
|
+
providerName: "tool_search_tool_bm25",
|
|
1164
|
+
parameters: ToolSearchBM25Parameters,
|
|
1165
|
+
success: /*#__PURE__*/Schema.Array(Generated.BetaRequestToolReferenceBlock),
|
|
1166
|
+
failure: Generated.BetaResponseToolSearchToolResultError
|
|
1167
|
+
});
|
|
1168
|
+
//# sourceMappingURL=AnthropicTool.js.map
|