@effect/ai-anthropic 4.0.0-beta.7 → 4.0.0-beta.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/AnthropicClient.d.ts +89 -66
  2. package/dist/AnthropicClient.d.ts.map +1 -1
  3. package/dist/AnthropicClient.js +75 -17
  4. package/dist/AnthropicClient.js.map +1 -1
  5. package/dist/AnthropicConfig.d.ts +68 -10
  6. package/dist/AnthropicConfig.d.ts.map +1 -1
  7. package/dist/AnthropicConfig.js +43 -7
  8. package/dist/AnthropicConfig.js.map +1 -1
  9. package/dist/AnthropicError.d.ts +136 -37
  10. package/dist/AnthropicError.d.ts.map +1 -1
  11. package/dist/AnthropicError.js +1 -1
  12. package/dist/AnthropicLanguageModel.d.ts +384 -71
  13. package/dist/AnthropicLanguageModel.d.ts.map +1 -1
  14. package/dist/AnthropicLanguageModel.js +102 -16
  15. package/dist/AnthropicLanguageModel.js.map +1 -1
  16. package/dist/AnthropicTelemetry.d.ts +42 -15
  17. package/dist/AnthropicTelemetry.d.ts.map +1 -1
  18. package/dist/AnthropicTelemetry.js +44 -8
  19. package/dist/AnthropicTelemetry.js.map +1 -1
  20. package/dist/AnthropicTool.d.ts +1116 -183
  21. package/dist/AnthropicTool.d.ts.map +1 -1
  22. package/dist/AnthropicTool.js +818 -129
  23. package/dist/AnthropicTool.js.map +1 -1
  24. package/dist/Generated.d.ts +11661 -5260
  25. package/dist/Generated.d.ts.map +1 -1
  26. package/dist/Generated.js +2318 -915
  27. package/dist/Generated.js.map +1 -1
  28. package/dist/index.d.ts +8 -29
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +8 -29
  31. package/dist/index.js.map +1 -1
  32. package/dist/internal/errors.js +7 -7
  33. package/dist/internal/errors.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/AnthropicClient.ts +119 -70
  36. package/src/AnthropicConfig.ts +69 -11
  37. package/src/AnthropicError.ts +138 -37
  38. package/src/AnthropicLanguageModel.ts +405 -38
  39. package/src/AnthropicTelemetry.ts +76 -20
  40. package/src/AnthropicTool.ts +1109 -176
  41. package/src/Generated.ts +3751 -1815
  42. package/src/index.ts +8 -29
  43. package/src/internal/errors.ts +9 -7
@@ -1,10 +1,60 @@
1
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
2
+ * The `AnthropicTool` module defines Anthropic provider tools that can be
3
+ * attached to Anthropic-backed Effect AI language model requests. These are
4
+ * provider-defined tools: Anthropic owns the tool names, argument formats,
5
+ * beta headers, and in some cases the execution environment.
6
+ *
7
+ * **Mental model**
8
+ *
9
+ * - Exports such as {@link Bash_20250124}, {@link CodeExecution_20250825},
10
+ * {@link ComputerUse_20250124}, and {@link WebSearch_20250305} create
11
+ * versioned provider-defined tool values understood by the Anthropic
12
+ * language model integration
13
+ * - Tool-specific `Schema` exports describe the arguments Claude may provide
14
+ * when invoking that provider tool
15
+ * - Some tools run on Anthropic infrastructure, such as
16
+ * {@link WebSearch_20250305}, {@link WebFetch_20250910}, and
17
+ * {@link CodeExecution_20250825}; handler-backed tools such as Bash,
18
+ * Computer Use, and Text Editor variants require application-side execution
19
+ * - Selecting a versioned tool lets the Anthropic model layer add the beta
20
+ * header required by that exact Anthropic API version
21
+ *
22
+ * **Common tasks**
23
+ *
24
+ * - Enable terminal-style actions with {@link Bash_20250124}
25
+ * - Enable sandboxed code execution with {@link CodeExecution_20250825}
26
+ * - Enable desktop automation payloads with {@link ComputerUse_20250124}
27
+ * - Enable persistent memory file operations with {@link Memory_20250818}
28
+ * - Enable text-editor commands with {@link TextEditor_20250728}
29
+ * - Enable hosted web capabilities with {@link WebSearch_20250305} or
30
+ * {@link WebFetch_20250910}
31
+ * - Restrict tool discovery with {@link ToolSearchRegex_20251119} or
32
+ * {@link ToolSearchBM25_20251119}
33
+ *
34
+ * **Quickstart**
35
+ *
36
+ * **Example** (Creating hosted Anthropic tools)
37
+ *
38
+ * ```ts
39
+ * import { AnthropicTool } from "@effect/ai-anthropic"
40
+ *
41
+ * const tools = [
42
+ * AnthropicTool.WebSearch_20250305({ maxUses: 3 }),
43
+ * AnthropicTool.WebFetch_20250910({
44
+ * citations: { enabled: true }
45
+ * })
46
+ * ]
47
+ * ```
48
+ *
49
+ * **Gotchas**
50
+ *
51
+ * - The suffix date is part of the Anthropic tool contract; choose the version
52
+ * that matches the model and beta behavior you intend to use
53
+ * - Handler-backed tools expose schemas for Claude's requested actions, but
54
+ * your runtime is responsible for performing those actions and returning
55
+ * results
56
+ *
57
+ * @since 4.0.0
8
58
  */
9
59
  import * as Schema from "effect/Schema";
10
60
  import * as Tool from "effect/unstable/ai/Tool";
@@ -15,11 +65,20 @@ import * as Generated from "./Generated.js";
15
65
  /**
16
66
  * Anthropic Bash tool (2024-10-22 version).
17
67
  *
68
+ * **When to use**
69
+ *
70
+ * Use when you need the model to execute bash commands and require the 2024-10-22
71
+ * version of the Anthropic computer-use beta.
72
+ *
73
+ * **Details**
74
+ *
18
75
  * Allows the model to execute bash commands in a sandboxed environment.
19
76
  * Requires the "computer-use-2024-10-22" beta header.
20
77
  *
21
- * @since 1.0.0
78
+ * @see {@link Bash_20250124} for the newer 2025-01-24 version of the bash tool
79
+ *
22
80
  * @category Bash
81
+ * @since 4.0.0
23
82
  */
24
83
  export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
25
84
  id: "anthropic.bash_20241022",
@@ -35,11 +94,20 @@ export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
35
94
  /**
36
95
  * Anthropic Bash tool (2025-01-24 version).
37
96
  *
97
+ * **When to use**
98
+ *
99
+ * Use when you need the model to execute bash commands and require the 2025-01-24
100
+ * version of the Anthropic computer-use beta.
101
+ *
102
+ * **Details**
103
+ *
38
104
  * Allows the model to execute bash commands in a sandboxed environment.
39
105
  * Requires the "computer-use-2025-01-24" beta header.
40
106
  *
41
- * @since 1.0.0
107
+ * @see {@link Bash_20241022} for the older 2024-10-22 version of the bash tool
108
+ *
42
109
  * @category Bash
110
+ * @since 4.0.0
43
111
  */
44
112
  export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
45
113
  id: "anthropic.bash_20250124",
@@ -59,10 +127,17 @@ export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
59
127
  // Code Execution 20250522 Parameters
60
128
  // -----------------------------------------------------------------------------
61
129
  /**
62
- * Programmatic tool call execution parameter.
130
+ * Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
131
+ *
132
+ * **When to use**
133
+ *
134
+ * Use when constructing or validating a programmatic tool call for the Anthropic
135
+ * Code Execution tool.
136
+ *
137
+ * @see {@link CodeExecution_20250522} for the parent tool definition
63
138
  *
64
- * @since 1.0.0
65
139
  * @category Code Execution
140
+ * @since 4.0.0
66
141
  */
67
142
  export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
68
143
  type: /*#__PURE__*/Schema.Literal("programmatic-tool-call"),
@@ -72,10 +147,22 @@ export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
72
147
  code: Schema.String
73
148
  });
74
149
  /**
75
- * Bash code execution parameter.
150
+ * Schema for the `bash_code_execution` input variant of Anthropic Code Execution.
151
+ *
152
+ * **When to use**
153
+ *
154
+ * Use when validating or constructing a bash command request for
155
+ * `CodeExecution_20250522`.
156
+ *
157
+ * **Details**
158
+ *
159
+ * The schema requires `type` to be `"bash_code_execution"` and `command` to
160
+ * contain the bash command sent to Anthropic.
161
+ *
162
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this input variant
76
163
  *
77
- * @since 1.0.0
78
164
  * @category Code Execution
165
+ * @since 4.0.0
79
166
  */
80
167
  export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
81
168
  type: /*#__PURE__*/Schema.Literal("bash_code_execution"),
@@ -85,10 +172,23 @@ export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
85
172
  command: Schema.String
86
173
  });
87
174
  /**
88
- * Text editor view command for code execution.
175
+ * Schema for a code execution text editor request that views a file by path.
176
+ *
177
+ * **When to use**
178
+ *
179
+ * Use to validate or construct the `view` command for Anthropic code execution
180
+ * text editor tool calls.
181
+ *
182
+ * **Details**
183
+ *
184
+ * The encoded payload uses `type: "text_editor_code_execution"`,
185
+ * `command: "view"`, and a `path` string.
186
+ *
187
+ * @see {@link CodeExecutionTextEditorCreate} for the command that creates a file
188
+ * @see {@link CodeExecutionTextEditorStrReplace} for the command that replaces text in a file
89
189
  *
90
- * @since 1.0.0
91
190
  * @category Code Execution
191
+ * @since 4.0.0
92
192
  */
93
193
  export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
94
194
  type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
@@ -99,10 +199,25 @@ export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
99
199
  path: Schema.String
100
200
  });
101
201
  /**
102
- * Text editor create command for code execution.
202
+ * Schema for a text editor code execution request that creates a file at a path.
203
+ *
204
+ * **When to use**
205
+ *
206
+ * Use when validating or constructing an Anthropic `text_editor_code_execution`
207
+ * tool call that should create a file.
208
+ *
209
+ * **Details**
210
+ *
211
+ * The request is discriminated by `type: "text_editor_code_execution"` and
212
+ * `command: "create"`. It requires `path` and accepts optional `file_text`; the
213
+ * schema allows `file_text` to be omitted, `null`, or a string.
214
+ *
215
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this request
216
+ * @see {@link CodeExecutionTextEditorView} for the matching view request
217
+ * @see {@link CodeExecutionTextEditorStrReplace} for the matching replace request
103
218
  *
104
- * @since 1.0.0
105
219
  * @category Code Execution
220
+ * @since 4.0.0
106
221
  */
107
222
  export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
108
223
  type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
@@ -117,10 +232,23 @@ export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
117
232
  file_text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String))
118
233
  });
119
234
  /**
120
- * Text editor str_replace command for code execution.
235
+ * Schema for a code execution text editor request that replaces one exact string in a file.
236
+ *
237
+ * **When to use**
238
+ *
239
+ * Use when validating or constructing the `str_replace` text editor operation
240
+ * for the 2025-05-22 Anthropic code execution tool.
241
+ *
242
+ * **Gotchas**
243
+ *
244
+ * The `old_str` must match the file contents exactly, including whitespace and
245
+ * indentation, and must identify a single occurrence.
246
+ *
247
+ * @see {@link CodeExecutionTextEditorView} for reading file contents before choosing the replacement text
248
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
121
249
  *
122
- * @since 1.0.0
123
250
  * @category Code Execution
251
+ * @since 4.0.0
124
252
  */
125
253
  export const CodeExecutionTextEditorStrReplace = /*#__PURE__*/Schema.Struct({
126
254
  type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
@@ -143,10 +271,17 @@ const CodeExecution_20250522_Parameters = /*#__PURE__*/Schema.Union([CodeExecuti
143
271
  // Code Execution 20250825 Parameters
144
272
  // -----------------------------------------------------------------------------
145
273
  /**
146
- * Simple code execution parameter.
274
+ * Schema for the 2025-08-25 code execution tool input, containing the code to execute.
275
+ *
276
+ * **When to use**
277
+ *
278
+ * Use when validating or constructing the input payload for the 2025-08-25
279
+ * Anthropic code execution tool.
280
+ *
281
+ * @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this schema
147
282
  *
148
- * @since 1.0.0
149
283
  * @category Code Execution
284
+ * @since 4.0.0
150
285
  */
151
286
  export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
152
287
  /**
@@ -160,12 +295,21 @@ export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
160
295
  /**
161
296
  * Anthropic Code Execution tool (2025-05-22 version).
162
297
  *
298
+ * **When to use**
299
+ *
300
+ * Use when you need the model to execute code in a sandboxed environment and
301
+ * require the 2025-05-22 version of the Anthropic code-execution beta.
302
+ *
303
+ * **Details**
304
+ *
163
305
  * Allows the model to execute code in a sandboxed environment with support
164
306
  * for multiple execution types including programmatic tool calls, bash
165
307
  * execution, and text editor operations.
166
308
  *
167
- * @since 1.0.0
309
+ * @see {@link CodeExecutionProgrammaticToolCall} for the programmatic tool call schema
310
+ *
168
311
  * @category Code Execution
312
+ * @since 4.0.0
169
313
  */
170
314
  export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
171
315
  id: "anthropic.code_execution_20250522",
@@ -178,10 +322,21 @@ export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
178
322
  /**
179
323
  * Anthropic Code Execution tool (2025-08-25 version).
180
324
  *
181
- * Allows the model to execute code in a sandboxed environment.
325
+ * **When to use**
326
+ *
327
+ * Use when you need the model to execute code in a sandboxed environment and
328
+ * require the 2025-08-25 version of the Anthropic code-execution beta.
329
+ *
330
+ * **Details**
331
+ *
332
+ * Requires the `code-execution-2025-08-25` beta header and uses
333
+ * `CodeExecution_20250825_Parameters` as its input schema.
334
+ *
335
+ * @see {@link CodeExecution_20250522} for the older 2025-05-22 code execution tool
336
+ * @see {@link CodeExecution_20250825_Parameters} for the input schema consumed by this tool
182
337
  *
183
- * @since 1.0.0
184
338
  * @category Code Execution
339
+ * @since 4.0.0
185
340
  */
186
341
  export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
187
342
  id: "anthropic.code_execution_20250825",
@@ -198,31 +353,55 @@ export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
198
353
  // Common Types
199
354
  // -----------------------------------------------------------------------------
200
355
  /**
201
- * An `[x, y]` pixel position.
356
+ * Schema for an `[x, y]` screen coordinate in pixels.
357
+ *
358
+ * **Details**
359
+ *
360
+ * This is a two-number tuple used by computer-use actions that accept screen
361
+ * positions.
362
+ *
363
+ * **Gotchas**
364
+ *
365
+ * This schema validates tuple shape only and does not check display bounds.
202
366
  *
203
- * @since 1.0.0
204
367
  * @category Computer Use
368
+ * @since 4.0.0
205
369
  */
206
370
  export const Coordinate = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
207
371
  /**
208
- * A `[x1, y1, x2, y2]` position defining top-left and bottom-right corners.
372
+ * Schema for an `[x1, y1, x2, y2]` screen region in pixels.
373
+ *
374
+ * **Details**
375
+ *
376
+ * The tuple represents top-left and bottom-right corners.
377
+ *
378
+ * **Gotchas**
379
+ *
380
+ * This schema validates four numbers only and does not check coordinate ordering
381
+ * or display bounds.
209
382
  *
210
- * @since 1.0.0
211
383
  * @category Computer Use
384
+ * @since 4.0.0
212
385
  */
213
386
  export const Region = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number]);
214
387
  /**
215
- * The direction of the scroll for scroll actions.
388
+ * Scroll direction literal: `"up"`, `"down"`, `"left"`, or `"right"`.
389
+ *
390
+ * @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
216
391
  *
217
- * @since 1.0.0
218
392
  * @category Computer Use
393
+ * @since 4.0.0
219
394
  */
220
395
  export const ScrollDirection = /*#__PURE__*/Schema.Literals(["up", "down", "left", "right"]);
221
396
  /**
222
- * Modifier keys that can be held during click/scroll actions.
397
+ * Modifier key literal.
398
+ *
399
+ * **Details**
400
+ *
401
+ * Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
223
402
  *
224
- * @since 1.0.0
225
403
  * @category Computer Use
404
+ * @since 4.0.0
226
405
  */
227
406
  export const ModifierKey = /*#__PURE__*/Schema.Literals(["alt", "ctrl", "meta", "shift"]);
228
407
  // -----------------------------------------------------------------------------
@@ -252,10 +431,19 @@ const ComputerUse_20251124_Args = /*#__PURE__*/Schema.Struct({
252
431
  // Computer Use 20241022 Actions
253
432
  // -----------------------------------------------------------------------------
254
433
  /**
255
- * Press a key or key combination (e.g. `"Return"`, `"ctrl+c"`, `"ctrl+s"`).
434
+ * Schema for a computer-use action that presses a key or key combination, such
435
+ * as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
436
+ *
437
+ * **When to use**
438
+ *
439
+ * Use when validating or constructing a computer-use action for keyboard
440
+ * shortcuts or non-text key presses.
441
+ *
442
+ * @see {@link TypeAction} for entering ordinary text strings
443
+ * @see {@link ComputerUseHoldKeyAction} for holding a key for a duration
256
444
  *
257
- * @since 1.0.0
258
445
  * @category Computer Use
446
+ * @since 4.0.0
259
447
  */
260
448
  export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
261
449
  action: /*#__PURE__*/Schema.Literal("key"),
@@ -265,10 +453,30 @@ export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
265
453
  text: Schema.String
266
454
  });
267
455
  /**
268
- * Perform a left click at the current mouse position or the specified coordinates.
456
+ * Schema for a computer-use action that performs a left click.
457
+ *
458
+ * **When to use**
459
+ *
460
+ * Use to validate or construct an Anthropic computer-use payload for clicking
461
+ * once at the current mouse position or at a specific screen coordinate.
462
+ *
463
+ * **Details**
464
+ *
465
+ * The encoded payload uses `action: "left_click"`. The optional `coordinate`
466
+ * field supplies the `[x, y]` pixel position; when omitted, the action uses the
467
+ * current mouse position.
468
+ *
469
+ * **Gotchas**
470
+ *
471
+ * The coordinate schema only checks that the value is a two-number tuple. It
472
+ * does not validate that the point falls within the configured display
473
+ * dimensions.
474
+ *
475
+ * @see {@link ComputerUseDoubleClickAction} for performing a double click
476
+ * @see {@link ComputerUseMouseMoveAction} for moving the mouse without clicking
269
477
  *
270
- * @since 1.0.0
271
478
  * @category Computer Use
479
+ * @since 4.0.0
272
480
  */
273
481
  export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
274
482
  action: /*#__PURE__*/Schema.Literal("left_click"),
@@ -279,10 +487,27 @@ export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
279
487
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
280
488
  });
281
489
  /**
282
- * Move the mouse cursor to the specified coordinates.
490
+ * Schema for a computer-use action that moves the mouse cursor to a required
491
+ * `[x, y]` screen coordinate.
492
+ *
493
+ * **When to use**
494
+ *
495
+ * Use to validate or construct a mouse movement action for an Anthropic
496
+ * computer-use tool call.
497
+ *
498
+ * **Details**
499
+ *
500
+ * The encoded payload has action `"mouse_move"` and a required `coordinate`
501
+ * field containing the target `[x, y]` pixel position.
502
+ *
503
+ * **Gotchas**
504
+ *
505
+ * The coordinate schema only checks that the value is a two-number tuple. It
506
+ * does not validate that the point falls within the configured display
507
+ * dimensions.
283
508
  *
284
- * @since 1.0.0
285
509
  * @category Computer Use
510
+ * @since 4.0.0
286
511
  */
287
512
  export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
288
513
  action: /*#__PURE__*/Schema.Literal("mouse_move"),
@@ -292,19 +517,43 @@ export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
292
517
  coordinate: Coordinate
293
518
  });
294
519
  /**
295
- * Capture the current display.
520
+ * Schema for a computer-use action that requests a screenshot of the current display.
521
+ *
522
+ * **When to use**
523
+ *
524
+ * Use to validate or construct a computer-use tool action that asks the handler
525
+ * to capture the full current display.
526
+ *
527
+ * **Details**
528
+ *
529
+ * The payload contains only `action: "screenshot"` and does not include
530
+ * coordinates or other options.
531
+ *
532
+ * @see {@link ComputerUseZoomAction} for requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
296
533
  *
297
- * @since 1.0.0
298
534
  * @category Computer Use
535
+ * @since 4.0.0
299
536
  */
300
537
  export const ComputerUseScreenshotAction = /*#__PURE__*/Schema.Struct({
301
538
  action: /*#__PURE__*/Schema.Literal("screenshot")
302
539
  });
303
540
  /**
304
- * Type a text string.
541
+ * Schema for a computer-use action that enters text.
542
+ *
543
+ * **When to use**
544
+ *
545
+ * Use to validate or construct a computer-use action for entering ordinary text
546
+ * strings.
547
+ *
548
+ * **Details**
549
+ *
550
+ * The payload uses `action: "type"` and a `text` string containing the text to
551
+ * enter.
552
+ *
553
+ * @see {@link ComputerUseKeyAction} for key presses and keyboard shortcuts
305
554
  *
306
- * @since 1.0.0
307
555
  * @category Computer Use
556
+ * @since 4.0.0
308
557
  */
309
558
  export const TypeAction = /*#__PURE__*/Schema.Struct({
310
559
  action: /*#__PURE__*/Schema.Literal("type"),
@@ -318,10 +567,29 @@ const ComputerUse_20241022_Actions = /*#__PURE__*/Schema.Union([ComputerUseKeyAc
318
567
  // Computer Use 20250124 Actions
319
568
  // -----------------------------------------------------------------------------
320
569
  /**
321
- * Perform a double click.
570
+ * Schema for a computer-use action that performs a double click.
571
+ *
572
+ * **When to use**
573
+ *
574
+ * Use to validate or construct an Anthropic computer-use payload for double
575
+ * clicking at the current mouse position or at a specific screen coordinate.
576
+ *
577
+ * **Details**
578
+ *
579
+ * The encoded payload uses `action: "double_click"`. The optional
580
+ * `coordinate` field supplies the `[x, y]` pixel position; when omitted, the
581
+ * action uses the current mouse position.
582
+ *
583
+ * **Gotchas**
584
+ *
585
+ * The coordinate schema only checks that the value is a two-number tuple. It
586
+ * does not validate that the point falls within the configured display
587
+ * dimensions.
588
+ *
589
+ * @see {@link ComputerUseLeftClickAction} for performing a single left click
322
590
  *
323
- * @since 1.0.0
324
591
  * @category Computer Use
592
+ * @since 4.0.0
325
593
  */
326
594
  export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
327
595
  action: /*#__PURE__*/Schema.Literal("double_click"),
@@ -332,10 +600,29 @@ export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
332
600
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
333
601
  });
334
602
  /**
335
- * Holds a key while performing other actions.
603
+ * Hold a key for a specified duration during computer-use execution.
604
+ *
605
+ * **When to use**
606
+ *
607
+ * Use to keep a keyboard key depressed for a fixed number of seconds in a
608
+ * computer-use action sequence.
609
+ *
610
+ * **Details**
611
+ *
612
+ * The schema describes objects with `action: "hold_key"`, a `text` field
613
+ * containing the key to hold, and a `duration` field containing the number of
614
+ * seconds to hold it.
615
+ *
616
+ * **Gotchas**
617
+ *
618
+ * The schema only checks that `duration` is a number; it does not require a
619
+ * positive value.
620
+ *
621
+ * @see {@link ComputerUseKeyAction} for pressing a key or key combination without holding it
622
+ * @see {@link ComputerUseWaitAction} for pausing between actions without holding a key
336
623
  *
337
- * @since 1.0.0
338
624
  * @category Computer Use
625
+ * @since 4.0.0
339
626
  */
340
627
  export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
341
628
  action: /*#__PURE__*/Schema.Literal("hold_key"),
@@ -349,10 +636,29 @@ export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
349
636
  duration: Schema.Number
350
637
  });
351
638
  /**
352
- * Click and drag from start coordinate to end coordinate.
639
+ * Schema for a computer-use action that drags with the left mouse button.
640
+ *
641
+ * **When to use**
642
+ *
643
+ * Use to validate or construct an Anthropic computer-use payload for dragging
644
+ * from one screen coordinate to another in a single action.
645
+ *
646
+ * **Details**
647
+ *
648
+ * The encoded payload uses `action: "left_click_drag"` and requires both
649
+ * `start_coordinate` and `coordinate` as `[x, y]` pixel positions.
650
+ *
651
+ * **Gotchas**
652
+ *
653
+ * The coordinate schema only checks that each value is a two-number tuple. It
654
+ * does not validate that either point falls within the configured display
655
+ * dimensions.
656
+ *
657
+ * @see {@link ComputerUseLeftMouseDownAction} for starting a manual drag sequence
658
+ * @see {@link ComputerUseLeftMouseUpAction} for ending a manual drag sequence
353
659
  *
354
- * @since 1.0.0
355
660
  * @category Computer Use
661
+ * @since 4.0.0
356
662
  */
357
663
  export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
358
664
  action: /*#__PURE__*/Schema.Literal("left_click_drag"),
@@ -368,10 +674,12 @@ export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
368
674
  /**
369
675
  * Press the left mouse button down (without releasing).
370
676
  *
371
- * Used for fine-grained click control.
677
+ * **When to use**
678
+ *
679
+ * Use when you use this for fine-grained click control.
372
680
  *
373
- * @since 1.0.0
374
681
  * @category Computer Use
682
+ * @since 4.0.0
375
683
  */
376
684
  export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
377
685
  action: /*#__PURE__*/Schema.Literal("left_mouse_down"),
@@ -384,10 +692,12 @@ export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
384
692
  /**
385
693
  * Release the left mouse button.
386
694
  *
387
- * Used for fine-grained click control.
695
+ * **When to use**
696
+ *
697
+ * Use when you use this for fine-grained click control.
388
698
  *
389
- * @since 1.0.0
390
699
  * @category Computer Use
700
+ * @since 4.0.0
391
701
  */
392
702
  export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
393
703
  action: /*#__PURE__*/Schema.Literal("left_mouse_up"),
@@ -398,10 +708,29 @@ export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
398
708
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
399
709
  });
400
710
  /**
401
- * Perform a middle click.
711
+ * Schema for a computer-use action that performs a middle click.
712
+ *
713
+ * **When to use**
714
+ *
715
+ * Use to validate or construct a middle-button click action for Anthropic
716
+ * computer use, optionally targeting a specific screen coordinate.
717
+ *
718
+ * **Details**
719
+ *
720
+ * The payload must use `action: "middle_click"`. When `coordinate` is omitted,
721
+ * the click occurs at the current mouse position.
722
+ *
723
+ * **Gotchas**
724
+ *
725
+ * This action is available in the 2025-01-24 computer-use action set and later;
726
+ * it is not part of `ComputerUse_20241022`.
727
+ *
728
+ * @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
729
+ * @see {@link ComputerUseLeftClickAction} for primary-button clicks
730
+ * @see {@link ComputerUseRightClickAction} for secondary-button clicks
402
731
  *
403
- * @since 1.0.0
404
732
  * @category Computer Use
733
+ * @since 4.0.0
405
734
  */
406
735
  export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
407
736
  action: /*#__PURE__*/Schema.Literal("middle_click"),
@@ -412,10 +741,25 @@ export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
412
741
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
413
742
  });
414
743
  /**
415
- * Perform a right click.
744
+ * Schema for a computer-use action that performs a right click, optionally at a
745
+ * specific screen coordinate.
746
+ *
747
+ * **When to use**
748
+ *
749
+ * Use to validate or construct the `right_click` action for an Anthropic
750
+ * computer-use tool call.
751
+ *
752
+ * **Details**
753
+ *
754
+ * The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
755
+ * When omitted, the right click is performed at the current mouse position.
756
+ *
757
+ * @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
758
+ * @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
759
+ * @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
416
760
  *
417
- * @since 1.0.0
418
761
  * @category Computer Use
762
+ * @since 4.0.0
419
763
  */
420
764
  export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
421
765
  action: /*#__PURE__*/Schema.Literal("right_click"),
@@ -426,10 +770,27 @@ export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
426
770
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
427
771
  });
428
772
  /**
429
- * Scroll a given amount in a specified direction.
773
+ * Schema for a computer-use scroll action.
774
+ *
775
+ * **When to use**
776
+ *
777
+ * Use when validating or constructing Anthropic computer-use scroll payloads.
778
+ *
779
+ * **Details**
780
+ *
781
+ * The encoded payload uses `action: "scroll"`, an optional `coordinate`,
782
+ * `scroll_direction`, and `scroll_amount`.
783
+ *
784
+ * **Gotchas**
785
+ *
786
+ * `coordinate` only checks a two-number tuple, and `scroll_amount` is only
787
+ * `Schema.Number`.
788
+ *
789
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
790
+ * @see {@link ScrollDirection} for the accepted direction literals
430
791
  *
431
- * @since 1.0.0
432
792
  * @category Computer Use
793
+ * @since 4.0.0
433
794
  */
434
795
  export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
435
796
  action: /*#__PURE__*/Schema.Literal("scroll"),
@@ -448,10 +809,29 @@ export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
448
809
  scroll_amount: Schema.Number
449
810
  });
450
811
  /**
451
- * Perform a triple click.
812
+ * Schema for a computer-use triple-click action.
813
+ *
814
+ * **When to use**
815
+ *
816
+ * Use when validating or constructing Anthropic computer-use triple-click
817
+ * payloads at the current pointer position or an optional coordinate.
818
+ *
819
+ * **Details**
820
+ *
821
+ * The encoded payload uses `action: "triple_click"` and an optional
822
+ * `coordinate`.
823
+ *
824
+ * **Gotchas**
825
+ *
826
+ * `coordinate` only validates as a two-number tuple and does not check display
827
+ * bounds.
828
+ *
829
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
830
+ * @see {@link ComputerUseDoubleClickAction} for the two-click variant
831
+ * @see {@link ComputerUseLeftClickAction} for a single left click
452
832
  *
453
- * @since 1.0.0
454
833
  * @category Computer Use
834
+ * @since 4.0.0
455
835
  */
456
836
  export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
457
837
  action: /*#__PURE__*/Schema.Literal("triple_click"),
@@ -462,10 +842,28 @@ export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
462
842
  coordinate: /*#__PURE__*/Schema.optional(Coordinate)
463
843
  });
464
844
  /**
465
- * Pause between performing actions.
845
+ * Schema for a computer-use wait action.
846
+ *
847
+ * **When to use**
848
+ *
849
+ * Use when validating or constructing Anthropic computer-use payloads that pause
850
+ * between actions.
851
+ *
852
+ * **Details**
853
+ *
854
+ * The encoded payload uses `action: "wait"` and a required `duration` in
855
+ * seconds.
856
+ *
857
+ * **Gotchas**
858
+ *
859
+ * `duration` is only `Schema.Number`; it is not constrained to positive or
860
+ * finite values.
861
+ *
862
+ * @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
863
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
466
864
  *
467
- * @since 1.0.0
468
865
  * @category Computer Use
866
+ * @since 4.0.0
469
867
  */
470
868
  export const ComputerUseWaitAction = /*#__PURE__*/Schema.Struct({
471
869
  action: /*#__PURE__*/Schema.Literal("wait"),
@@ -481,10 +879,20 @@ const ComputerUse_20250124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
481
879
  /**
482
880
  * Zoom into a specific region of the screen at full resolution.
483
881
  *
484
- * Requires `enableZoom: true` in the tool definition.
882
+ * **Details**
883
+ *
884
+ * The encoded payload uses `action: "zoom"` and a `region` tuple.
885
+ *
886
+ * **Gotchas**
887
+ *
888
+ * Requires `enableZoom: true` in the tool definition. `region` is only a
889
+ * four-number tuple and does not validate corner ordering or display bounds.
890
+ *
891
+ * @see {@link ComputerUse_20251124} for the tool version that accepts this action
892
+ * @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
485
893
  *
486
- * @since 1.0.0
487
894
  * @category Computer Use
895
+ * @since 4.0.0
488
896
  */
489
897
  export const ComputerUseZoomAction = /*#__PURE__*/Schema.Struct({
490
898
  action: /*#__PURE__*/Schema.Literal("zoom"),
@@ -501,12 +909,13 @@ const ComputerUse_20251124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
501
909
  /**
502
910
  * Computer use tool for Claude 3.5 Sonnet v2 (deprecated).
503
911
  *
504
- * Requires the "computer-use-2024-10-22" beta header.
912
+ * **Details**
505
913
  *
914
+ * Requires the "computer-use-2024-10-22" beta header.
506
915
  * Basic actions only: screenshot, left_click, type, key, mouse_move.
507
916
  *
508
- * @since 1.0.0
509
917
  * @category Computer Use
918
+ * @since 4.0.0
510
919
  */
511
920
  export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
512
921
  id: "anthropic.computer_use_20241022",
@@ -520,14 +929,23 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
520
929
  /**
521
930
  * Computer use tool for Claude 4 models and Claude Sonnet 3.7.
522
931
  *
523
- * Requires the "computer-use-2025-01-24" beta header.
932
+ * **When to use**
933
+ *
934
+ * Use when configuring Anthropic computer use for Claude 4 models or Claude
935
+ * Sonnet 3.7 with the 2025-01-24 action set.
524
936
  *
937
+ * **Details**
938
+ *
939
+ * Requires the "computer-use-2025-01-24" beta header.
525
940
  * Includes basic actions plus enhanced actions: scroll, left_click_drag,
526
941
  * right_click, middle_click, double_click, triple_click, left_mouse_down,
527
942
  * left_mouse_up, hold_key, wait.
528
943
  *
529
- * @since 1.0.0
944
+ * @see {@link ComputerUse_20241022} for the older basic action set
945
+ * @see {@link ComputerUse_20251124} for the newer zoom-capable version
946
+ *
530
947
  * @category Computer Use
948
+ * @since 4.0.0
531
949
  */
532
950
  export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
533
951
  id: "anthropic.computer_20250124",
@@ -541,13 +959,26 @@ export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
541
959
  /**
542
960
  * Computer use tool for Claude Opus 4.5 only.
543
961
  *
544
- * Requires the "computer-use-2025-11-24" beta header.
962
+ * **When to use**
963
+ *
964
+ * Use when configuring Anthropic computer use for Claude Opus 4.5 with the
965
+ * 2025-11-24 action set and zoom-capable screen inspection.
966
+ *
967
+ * **Details**
545
968
  *
969
+ * Requires the "computer-use-2025-11-24" beta header.
546
970
  * Includes all actions from computer_20250124 plus the zoom action for
547
- * detailed screen region inspection. Requires `enableZoom: true` in args.
971
+ * detailed screen region inspection.
972
+ *
973
+ * **Gotchas**
974
+ *
975
+ * Zoom actions require `enableZoom: true` in args.
976
+ *
977
+ * @see {@link ComputerUse_20250124} for the previous action set without zoom
978
+ * @see {@link ComputerUseZoomAction} for the zoom action payload
548
979
  *
549
- * @since 1.0.0
550
980
  * @category Computer Use
981
+ * @since 4.0.0
551
982
  */
552
983
  export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
553
984
  id: "anthropic.computer_20251124",
@@ -567,23 +998,36 @@ export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
567
998
  /**
568
999
  * A `[start, end]` line range for viewing file contents.
569
1000
  *
570
- * Lines are 1-indexed. Use -1 for end to read to end of file.
1001
+ * **When to use**
1002
+ *
1003
+ * Use when constructing or validating `view_range` for memory or text editor
1004
+ * view commands.
571
1005
  *
572
- * @example [1, 50] // View lines 1-50
573
- * @example [100, -1] // View from line 100 to end of file
1006
+ * **Details**
1007
+ *
1008
+ * Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
1009
+ * example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
1010
+ * the end of the file.
1011
+ *
1012
+ * @see {@link MemoryViewCommand} for memory view payloads that use this range
1013
+ * @see {@link TextEditorViewCommand} for text editor view payloads that use this range
574
1014
  *
575
- * @since 1.0.0
576
1015
  * @category Memory
1016
+ * @since 4.0.0
577
1017
  */
578
1018
  export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
579
1019
  // -----------------------------------------------------------------------------
580
1020
  // Memory 20250818 Commands
581
1021
  // -----------------------------------------------------------------------------
582
1022
  /**
583
- * Creates a new file.
1023
+ * Schema for the memory tool command that creates a new file at a path.
1024
+ *
1025
+ * **Details**
1026
+ *
1027
+ * The payload contains `command: "create"` and a `path` string.
584
1028
  *
585
- * @since 1.0.0
586
1029
  * @category Memory
1030
+ * @since 4.0.0
587
1031
  */
588
1032
  export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
589
1033
  command: /*#__PURE__*/Schema.Literal("create"),
@@ -593,23 +1037,35 @@ export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
593
1037
  path: Schema.String
594
1038
  });
595
1039
  /**
596
- * Delete a file or directory.
1040
+ * Schema for a memory command that deletes a file or directory.
597
1041
  *
598
- * @since 1.0.0
599
1042
  * @category Memory
1043
+ * @since 4.0.0
600
1044
  */
601
1045
  export const MemoryDeleteCommand = /*#__PURE__*/Schema.Struct({
602
1046
  command: /*#__PURE__*/Schema.Literal("delete"),
603
1047
  /**
604
- * The path to the file to delete.
1048
+ * The path to the file or directory to delete.
605
1049
  */
606
1050
  path: Schema.String
607
1051
  });
608
1052
  /**
609
- * Insert text at a specific line.
1053
+ * Schema for the memory `insert` command.
1054
+ *
1055
+ * **When to use**
1056
+ *
1057
+ * Use when validating or constructing `insert` payloads for `Memory_20250818`.
1058
+ *
1059
+ * **Details**
1060
+ *
1061
+ * The payload is discriminated by `command: "insert"` and requires `path`,
1062
+ * `insert_line`, and `insert_text`.
1063
+ *
1064
+ * @see {@link Memory_20250818} for the provider-defined tool that consumes this command
1065
+ * @see {@link MemoryStrReplaceCommand} for replacing existing text instead
610
1066
  *
611
- * @since 1.0.0
612
1067
  * @category Memory
1068
+ * @since 4.0.0
613
1069
  */
614
1070
  export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
615
1071
  command: /*#__PURE__*/Schema.Literal("insert"),
@@ -627,10 +1083,15 @@ export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
627
1083
  insert_text: Schema.String
628
1084
  });
629
1085
  /**
630
- * Rename or move a file or directory.
1086
+ * Schema for the memory command that renames or moves a file or directory.
1087
+ *
1088
+ * **Details**
1089
+ *
1090
+ * The payload uses `command: "rename"` and requires `old_path` as the current
1091
+ * path plus `new_path` as the new destination path.
631
1092
  *
632
- * @since 1.0.0
633
1093
  * @category Memory
1094
+ * @since 4.0.0
634
1095
  */
635
1096
  export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
636
1097
  command: /*#__PURE__*/Schema.Literal("rename"),
@@ -644,10 +1105,22 @@ export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
644
1105
  new_path: Schema.String
645
1106
  });
646
1107
  /**
647
- * Replace text in a file.
1108
+ * Schema for the memory `str_replace` command.
1109
+ *
1110
+ * **When to use**
1111
+ *
1112
+ * Use when validating or constructing `str_replace` payloads for
1113
+ * `Memory_20250818`.
1114
+ *
1115
+ * **Details**
1116
+ *
1117
+ * The payload is discriminated by `command: "str_replace"` and requires `path`,
1118
+ * `old_str`, and `new_str`.
1119
+ *
1120
+ * @see {@link Memory_20250818} for the provider-defined tool that consumes this command
648
1121
  *
649
- * @since 1.0.0
650
1122
  * @category Memory
1123
+ * @since 4.0.0
651
1124
  */
652
1125
  export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
653
1126
  command: /*#__PURE__*/Schema.Literal("str_replace"),
@@ -667,13 +1140,18 @@ export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
667
1140
  /**
668
1141
  * Shows directory contents or file contents with optional line ranges.
669
1142
  *
670
- * @since 1.0.0
1143
+ * **Details**
1144
+ *
1145
+ * When used on a file, returns file contents optionally limited by `view_range`.
1146
+ * When used on a directory, lists contents.
1147
+ *
671
1148
  * @category Memory
1149
+ * @since 4.0.0
672
1150
  */
673
1151
  export const MemoryViewCommand = /*#__PURE__*/Schema.Struct({
674
1152
  command: /*#__PURE__*/Schema.Literal("view"),
675
1153
  /**
676
- * The path to the file to view.
1154
+ * The path to the file or directory to view.
677
1155
  */
678
1156
  path: Schema.String,
679
1157
  /**
@@ -688,11 +1166,13 @@ const Memory_20250818_Commands = /*#__PURE__*/Schema.Union([MemoryCreateCommand,
688
1166
  /**
689
1167
  * Memory tool for persistent file operations across conversations.
690
1168
  *
1169
+ * **Details**
1170
+ *
691
1171
  * Provides commands for creating, viewing, editing, renaming, and deleting
692
1172
  * files within the model's memory space.
693
1173
  *
694
- * @since 1.0.0
695
1174
  * @category Memory
1175
+ * @since 4.0.0
696
1176
  */
697
1177
  export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
698
1178
  id: "anthropic.memory_20250818",
@@ -710,11 +1190,22 @@ export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
710
1190
  /**
711
1191
  * View the contents of a file or list directory contents.
712
1192
  *
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.
1193
+ * **When to use**
1194
+ *
1195
+ * Use when validating or constructing the standalone Anthropic Text Editor
1196
+ * `view` command.
1197
+ *
1198
+ * **Details**
1199
+ *
1200
+ * When used on a file, returns the file contents, optionally limited to a line
1201
+ * range. When used on a directory, lists all files and subdirectories.
1202
+ * `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
1203
+ * the end of the file.
1204
+ *
1205
+ * @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
715
1206
  *
716
- * @since 1.0.0
717
1207
  * @category Text Editor
1208
+ * @since 4.0.0
718
1209
  */
719
1210
  export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
720
1211
  command: /*#__PURE__*/Schema.Literal("view"),
@@ -731,10 +1222,22 @@ export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
731
1222
  /**
732
1223
  * Create a new file with specified content.
733
1224
  *
734
- * Will fail if the file already exists. Parent directories must exist.
1225
+ * **When to use**
1226
+ *
1227
+ * Use when validating or constructing an Anthropic text editor `create`
1228
+ * command.
1229
+ *
1230
+ * **Details**
1231
+ *
1232
+ * The payload is discriminated by `command: "create"` and requires both `path`
1233
+ * and `file_text`.
1234
+ *
1235
+ * **Gotchas**
1236
+ *
1237
+ * Fails if the file already exists. Parent directories must exist.
735
1238
  *
736
- * @since 1.0.0
737
1239
  * @category Text Editor
1240
+ * @since 4.0.0
738
1241
  */
739
1242
  export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
740
1243
  command: /*#__PURE__*/Schema.Literal("create"),
@@ -750,11 +1253,26 @@ export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
750
1253
  /**
751
1254
  * Replace a specific string in a file with a new string.
752
1255
  *
1256
+ * **When to use**
1257
+ *
1258
+ * Use when validating or constructing standalone Anthropic text editor
1259
+ * `str_replace` commands.
1260
+ *
1261
+ * **Details**
1262
+ *
1263
+ * The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
1264
+ * `new_str` may be empty to delete text.
1265
+ *
1266
+ * **Gotchas**
1267
+ *
753
1268
  * The `old_str` must match exactly (including whitespace and indentation)
754
1269
  * and must be unique in the file.
755
1270
  *
756
- * @since 1.0.0
1271
+ * @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
1272
+ * @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
1273
+ *
757
1274
  * @category Text Editor
1275
+ * @since 4.0.0
758
1276
  */
759
1277
  export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
760
1278
  command: /*#__PURE__*/Schema.Literal("str_replace"),
@@ -774,10 +1292,13 @@ export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
774
1292
  /**
775
1293
  * Insert text at a specific line number in a file.
776
1294
  *
777
- * Inserts the new text AFTER the specified line number.
1295
+ * **Details**
1296
+ *
1297
+ * Inserts the new text after the specified line number. Use `0` to insert at
1298
+ * the beginning of the file; other values are 1-indexed.
778
1299
  *
779
- * @since 1.0.0
780
1300
  * @category Text Editor
1301
+ * @since 4.0.0
781
1302
  */
782
1303
  export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
783
1304
  command: /*#__PURE__*/Schema.Literal("insert"),
@@ -797,13 +1318,19 @@ export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
797
1318
  /**
798
1319
  * Undo the last edit made to a file.
799
1320
  *
800
- * Reverts the most recent str_replace, insert, or create operation on the file.
1321
+ * **Details**
1322
+ *
1323
+ * Reverts the most recent `str_replace`, `insert`, or `create` operation on the
1324
+ * file.
1325
+ *
1326
+ * **Gotchas**
801
1327
  *
802
- * NOTE: This command is available in text_editor_20241022 and text_editor_20250124,
803
- * but NOT in text_editor_20250728 (Claude 4 models).
1328
+ * This command is available in `text_editor_20241022` and
1329
+ * `text_editor_20250124`, but not in `text_editor_20250429` or
1330
+ * `text_editor_20250728`.
804
1331
  *
805
- * @since 1.0.0
806
1332
  * @category Text Editor
1333
+ * @since 4.0.0
807
1334
  */
808
1335
  export const TextEditorUndoEditCommand = /*#__PURE__*/Schema.Struct({
809
1336
  command: /*#__PURE__*/Schema.Literal("undo_edit"),
@@ -830,10 +1357,21 @@ const TextEditor_StrReplaceBasedEdit_Args = /*#__PURE__*/Schema.Struct({
830
1357
  /**
831
1358
  * Text editor tool for Claude 3.5 Sonnet (deprecated).
832
1359
  *
833
- * Requires the "computer-use-2024-10-22" beta header.
1360
+ * **When to use**
1361
+ *
1362
+ * Use when configuring the 2024-10-22 `str_replace_editor` compatibility path
1363
+ * for Claude 3.5 Sonnet.
1364
+ *
1365
+ * **Details**
1366
+ *
1367
+ * Requires the "computer-use-2024-10-22" beta header and supports `view`,
1368
+ * `create`, `str_replace`, `insert`, and `undo_edit` commands.
1369
+ *
1370
+ * @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
1371
+ * @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
834
1372
  *
835
- * @since 1.0.0
836
1373
  * @category Text Editor
1374
+ * @since 4.0.0
837
1375
  */
838
1376
  export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
839
1377
  id: "anthropic.text_editor_20241022",
@@ -846,8 +1384,21 @@ export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
846
1384
  /**
847
1385
  * Text editor tool for Claude Sonnet 3.7 (deprecated model).
848
1386
  *
849
- * @since 1.0.0
1387
+ * **When to use**
1388
+ *
1389
+ * Use when configuring the 2025-01-24 Claude Sonnet 3.7 text editor tool using
1390
+ * `str_replace_editor`.
1391
+ *
1392
+ * **Details**
1393
+ *
1394
+ * Requires the "computer-use-2025-01-24" beta header, requires a handler, and
1395
+ * supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
1396
+ *
1397
+ * @see {@link TextEditor_20241022} for the older `str_replace_editor` version
1398
+ * @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
1399
+ *
850
1400
  * @category Text Editor
1401
+ * @since 4.0.0
851
1402
  */
852
1403
  export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
853
1404
  id: "anthropic.text_editor_20250124",
@@ -858,12 +1409,26 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
858
1409
  success: Schema.String
859
1410
  });
860
1411
  /**
861
- * Text editor tool for Claude 4 models.
1412
+ * Text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
1413
+ *
1414
+ * **When to use**
1415
+ *
1416
+ * Use when configuring the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
1417
+ * version.
1418
+ *
1419
+ * **Details**
1420
+ *
1421
+ * Requires the "computer-use-2025-01-24" beta header.
1422
+ *
1423
+ * **Gotchas**
862
1424
  *
863
- * NOTE: This version does NOT support the `undo_edit` command.
1425
+ * This version does not support the `undo_edit` command.
1426
+ *
1427
+ * @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
1428
+ * @see {@link TextEditor_20250728} for the later Claude 4 text editor version
864
1429
  *
865
- * @since 1.0.0
866
1430
  * @category Text Editor
1431
+ * @since 4.0.0
867
1432
  */
868
1433
  export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
869
1434
  id: "anthropic.text_editor_20250429",
@@ -877,10 +1442,17 @@ export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
877
1442
  /**
878
1443
  * Text editor tool for Claude 4 models.
879
1444
  *
880
- * NOTE: This version does NOT support the `undo_edit` command.
1445
+ * **Details**
1446
+ *
1447
+ * Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
1448
+ * file-view output for this version.
1449
+ *
1450
+ * **Gotchas**
1451
+ *
1452
+ * This version does not support the `undo_edit` command.
881
1453
  *
882
- * @since 1.0.0
883
1454
  * @category Text Editor
1455
+ * @since 4.0.0
884
1456
  */
885
1457
  export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
886
1458
  id: "anthropic.text_editor_20250728",
@@ -900,11 +1472,21 @@ export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
900
1472
  /**
901
1473
  * User location for localizing search results.
902
1474
  *
903
- * Providing location helps return more relevant results for location-dependent
904
- * queries like weather, local businesses, events, etc.
1475
+ * **When to use**
1476
+ *
1477
+ * Use when providing location helps return more relevant results for
1478
+ * location-dependent queries like weather, local businesses, or events.
1479
+ *
1480
+ * **Details**
1481
+ *
1482
+ * The schema uses `type: "approximate"` plus optional `city`, `region`,
1483
+ * `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
1484
+ * `timezone` is an IANA time zone identifier.
1485
+ *
1486
+ * @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
905
1487
  *
906
- * @since 1.0.0
907
1488
  * @category Web Search
1489
+ * @since 4.0.0
908
1490
  */
909
1491
  export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
910
1492
  /**
@@ -934,8 +1516,25 @@ export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
934
1516
  /**
935
1517
  * Configuration arguments for the web search tool.
936
1518
  *
937
- * @since 1.0.0
1519
+ * **When to use**
1520
+ *
1521
+ * Use when configuring `WebSearch_20250305` with search limits, domain filters,
1522
+ * or user location.
1523
+ *
1524
+ * **Details**
1525
+ *
1526
+ * The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
1527
+ * `userLocation`.
1528
+ *
1529
+ * **Gotchas**
1530
+ *
1531
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
1532
+ *
1533
+ * @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
1534
+ * @see {@link WebSearchUserLocation} for localizing search results
1535
+ *
938
1536
  * @category Web Search
1537
+ * @since 4.0.0
939
1538
  */
940
1539
  export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
941
1540
  /**
@@ -963,10 +1562,17 @@ export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
963
1562
  // Web Search Parameters
964
1563
  // -----------------------------------------------------------------------------
965
1564
  /**
966
- * Input parameters for a web search.
1565
+ * Schema for Claude-supplied web search tool parameters.
1566
+ *
1567
+ * **Details**
1568
+ *
1569
+ * The payload contains the generated `query` string and is consumed by
1570
+ * `WebSearch_20250305`.
1571
+ *
1572
+ * @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
967
1573
  *
968
- * @since 1.0.0
969
1574
  * @category Web Search
1575
+ * @since 4.0.0
970
1576
  */
971
1577
  export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
972
1578
  /**
@@ -980,13 +1586,20 @@ export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
980
1586
  /**
981
1587
  * Web search tool for Claude models.
982
1588
  *
1589
+ * **When to use**
1590
+ *
1591
+ * Use when Claude should search the web for real-time information.
1592
+ *
1593
+ * **Details**
1594
+ *
983
1595
  * Enables Claude to search the web for real-time information. This is a
984
1596
  * server-side tool executed by Anthropic's infrastructure.
985
- *
986
1597
  * Generally available (no beta header required).
987
1598
  *
988
- * @since 1.0.0
1599
+ * @see {@link WebFetch_20250910} for retrieving known URLs after discovery
1600
+ *
989
1601
  * @category Web Search
1602
+ * @since 4.0.0
990
1603
  */
991
1604
  export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
992
1605
  id: "anthropic.web_search_20250305",
@@ -1006,8 +1619,19 @@ export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
1006
1619
  /**
1007
1620
  * Citation configuration for web fetch.
1008
1621
  *
1009
- * @since 1.0.0
1622
+ * **When to use**
1623
+ *
1624
+ * Use when configuring whether web fetch results should include citations.
1625
+ *
1626
+ * **Details**
1627
+ *
1628
+ * The payload contains the `enabled` flag. `citations` is optional on
1629
+ * `WebFetch_20250910_Args`, and citations are disabled by default.
1630
+ *
1631
+ * @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
1632
+ *
1010
1633
  * @category Web Fetch
1634
+ * @since 4.0.0
1011
1635
  */
1012
1636
  export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
1013
1637
  /**
@@ -1021,8 +1645,27 @@ export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
1021
1645
  /**
1022
1646
  * Configuration arguments for the web fetch tool.
1023
1647
  *
1024
- * @since 1.0.0
1648
+ * **When to use**
1649
+ *
1650
+ * Use when configuring `WebFetch_20250910` with usage limits, domain filters,
1651
+ * citations, or content token limits.
1652
+ *
1653
+ * **Details**
1654
+ *
1655
+ * The payload can set `maxUses`, domain filters, `citations`, and
1656
+ * `maxContentTokens`, which map to Anthropic web fetch request fields.
1657
+ *
1658
+ * **Gotchas**
1659
+ *
1660
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
1661
+ * `maxContentTokens` is approximate and does not apply to binary content such
1662
+ * as PDFs.
1663
+ *
1664
+ * @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
1665
+ * @see {@link WebFetchCitationsConfig} for configuring citations
1666
+ *
1025
1667
  * @category Web Fetch
1668
+ * @since 4.0.0
1026
1669
  */
1027
1670
  export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
1028
1671
  /**
@@ -1054,10 +1697,26 @@ export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
1054
1697
  // Web Fetch Parameters
1055
1698
  // -----------------------------------------------------------------------------
1056
1699
  /**
1057
- * Input parameters for a web fetch.
1700
+ * Schema for Claude-supplied web fetch parameters.
1701
+ *
1702
+ * **When to use**
1703
+ *
1704
+ * Use when validating or constructing the `url` payload consumed by
1705
+ * `WebFetch_20250910`.
1706
+ *
1707
+ * **Details**
1708
+ *
1709
+ * The payload contains the single `url` parameter for Anthropic web fetch.
1710
+ *
1711
+ * **Gotchas**
1712
+ *
1713
+ * The URL must be user-provided or from prior search/fetch results. Maximum URL
1714
+ * length is 250 characters.
1715
+ *
1716
+ * @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
1058
1717
  *
1059
- * @since 1.0.0
1060
1718
  * @category Web Fetch
1719
+ * @since 4.0.0
1061
1720
  */
1062
1721
  export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
1063
1722
  /**
@@ -1072,13 +1731,20 @@ export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
1072
1731
  /**
1073
1732
  * Web fetch tool for Claude models.
1074
1733
  *
1734
+ * **When to use**
1735
+ *
1736
+ * Use when Claude should retrieve the content of a specific web page or PDF.
1737
+ *
1738
+ * **Details**
1739
+ *
1075
1740
  * Allows Claude to retrieve full content from web pages and PDF documents.
1076
- * This is a server-side tool executed by Anthropic's infrastructure.
1741
+ * This is a server-side tool executed by Anthropic's infrastructure. Selecting
1742
+ * this tool adds the "web-fetch-2025-09-10" beta header.
1077
1743
  *
1078
- * Requires the "web-fetch-2025-09-10" beta header.
1744
+ * @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
1079
1745
  *
1080
- * @since 1.0.0
1081
1746
  * @category Web Fetch
1747
+ * @since 4.0.0
1082
1748
  */
1083
1749
  export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
1084
1750
  id: "anthropic.web_fetch_20250910",
@@ -1098,11 +1764,13 @@ export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
1098
1764
  /**
1099
1765
  * Input parameters for regex-based tool search.
1100
1766
  *
1767
+ * **Details**
1768
+ *
1101
1769
  * Claude constructs regex patterns using Python's `re.search()` syntax.
1102
1770
  * Maximum query length: 200 characters.
1103
1771
  *
1104
- * @since 1.0.0
1105
1772
  * @category Tool Search
1773
+ * @since 4.0.0
1106
1774
  */
1107
1775
  export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
1108
1776
  /**
@@ -1113,8 +1781,20 @@ export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
1113
1781
  /**
1114
1782
  * Input parameters for BM25/natural language tool search.
1115
1783
  *
1116
- * @since 1.0.0
1784
+ * **When to use**
1785
+ *
1786
+ * Use when validating or constructing the natural-language query payload for
1787
+ * `ToolSearchBM25_20251119`.
1788
+ *
1789
+ * **Details**
1790
+ *
1791
+ * The payload contains Claude's natural-language `query`. BM25 searches tool
1792
+ * names, descriptions, argument names, and argument descriptions.
1793
+ *
1794
+ * @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
1795
+ *
1117
1796
  * @category Tool Search
1797
+ * @since 4.0.0
1118
1798
  */
1119
1799
  export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
1120
1800
  /**
@@ -1128,14 +1808,15 @@ export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
1128
1808
  /**
1129
1809
  * Regex-based tool search for Claude models.
1130
1810
  *
1811
+ * **Details**
1812
+ *
1131
1813
  * Claude constructs regex patterns using Python's `re.search()` syntax to
1132
1814
  * find tools. The regex is matched against tool names, descriptions,
1133
1815
  * argument names, and argument descriptions.
1134
- *
1135
1816
  * Requires the "advanced-tool-use-2025-11-20" beta header.
1136
1817
  *
1137
- * @since 1.0.0
1138
1818
  * @category Tool Search
1819
+ * @since 4.0.0
1139
1820
  */
1140
1821
  export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
1141
1822
  id: "anthropic.tool_search_tool_regex_20251119",
@@ -1148,14 +1829,22 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
1148
1829
  /**
1149
1830
  * BM25/natural language tool search for Claude models.
1150
1831
  *
1832
+ * **When to use**
1833
+ *
1834
+ * Use when you want Claude to find relevant tools from a natural-language query
1835
+ * instead of a regex pattern.
1836
+ *
1837
+ * **Details**
1838
+ *
1151
1839
  * Claude uses natural language queries to search for tools using the
1152
1840
  * BM25 algorithm. The search is performed against tool names, descriptions,
1153
1841
  * argument names, and argument descriptions.
1154
- *
1155
1842
  * Requires the "advanced-tool-use-2025-11-20" beta header.
1156
1843
  *
1157
- * @since 1.0.0
1844
+ * @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
1845
+ *
1158
1846
  * @category Tool Search
1847
+ * @since 4.0.0
1159
1848
  */
1160
1849
  export const ToolSearchBM25_20251119 = /*#__PURE__*/Tool.providerDefined({
1161
1850
  id: "anthropic.tool_search_tool_bm25_20251119",