@ai-sdk/anthropic 2.0.24 → 2.0.25

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.
@@ -11,66 +11,403 @@ import {
11
11
  postJsonToApi,
12
12
  resolve
13
13
  } from "@ai-sdk/provider-utils";
14
- import * as z7 from "zod/v4";
15
14
 
16
15
  // src/anthropic-error.ts
17
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
16
+ import {
17
+ createJsonErrorResponseHandler,
18
+ lazySchema,
19
+ zodSchema
20
+ } from "@ai-sdk/provider-utils";
18
21
  import * as z from "zod/v4";
19
- var anthropicErrorDataSchema = z.object({
20
- type: z.literal("error"),
21
- error: z.object({
22
- type: z.string(),
23
- message: z.string()
24
- })
25
- });
22
+ var anthropicErrorDataSchema = lazySchema(
23
+ () => zodSchema(
24
+ z.object({
25
+ type: z.literal("error"),
26
+ error: z.object({
27
+ type: z.string(),
28
+ message: z.string()
29
+ })
30
+ })
31
+ )
32
+ );
26
33
  var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
27
34
  errorSchema: anthropicErrorDataSchema,
28
35
  errorToMessage: (data) => data.error.message
29
36
  });
30
37
 
31
- // src/anthropic-messages-options.ts
38
+ // src/anthropic-messages-api.ts
39
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
32
40
  import * as z2 from "zod/v4";
33
- var anthropicFilePartProviderOptions = z2.object({
41
+ var anthropicMessagesResponseSchema = lazySchema2(
42
+ () => zodSchema2(
43
+ z2.object({
44
+ type: z2.literal("message"),
45
+ id: z2.string().nullish(),
46
+ model: z2.string().nullish(),
47
+ content: z2.array(
48
+ z2.discriminatedUnion("type", [
49
+ z2.object({
50
+ type: z2.literal("text"),
51
+ text: z2.string(),
52
+ citations: z2.array(
53
+ z2.discriminatedUnion("type", [
54
+ z2.object({
55
+ type: z2.literal("web_search_result_location"),
56
+ cited_text: z2.string(),
57
+ url: z2.string(),
58
+ title: z2.string(),
59
+ encrypted_index: z2.string()
60
+ }),
61
+ z2.object({
62
+ type: z2.literal("page_location"),
63
+ cited_text: z2.string(),
64
+ document_index: z2.number(),
65
+ document_title: z2.string().nullable(),
66
+ start_page_number: z2.number(),
67
+ end_page_number: z2.number()
68
+ }),
69
+ z2.object({
70
+ type: z2.literal("char_location"),
71
+ cited_text: z2.string(),
72
+ document_index: z2.number(),
73
+ document_title: z2.string().nullable(),
74
+ start_char_index: z2.number(),
75
+ end_char_index: z2.number()
76
+ })
77
+ ])
78
+ ).optional()
79
+ }),
80
+ z2.object({
81
+ type: z2.literal("thinking"),
82
+ thinking: z2.string(),
83
+ signature: z2.string()
84
+ }),
85
+ z2.object({
86
+ type: z2.literal("redacted_thinking"),
87
+ data: z2.string()
88
+ }),
89
+ z2.object({
90
+ type: z2.literal("tool_use"),
91
+ id: z2.string(),
92
+ name: z2.string(),
93
+ input: z2.unknown()
94
+ }),
95
+ z2.object({
96
+ type: z2.literal("server_tool_use"),
97
+ id: z2.string(),
98
+ name: z2.string(),
99
+ input: z2.record(z2.string(), z2.unknown()).nullish()
100
+ }),
101
+ z2.object({
102
+ type: z2.literal("web_fetch_tool_result"),
103
+ tool_use_id: z2.string(),
104
+ content: z2.union([
105
+ z2.object({
106
+ type: z2.literal("web_fetch_result"),
107
+ url: z2.string(),
108
+ retrieved_at: z2.string(),
109
+ content: z2.object({
110
+ type: z2.literal("document"),
111
+ title: z2.string().nullable(),
112
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
113
+ source: z2.object({
114
+ type: z2.literal("text"),
115
+ media_type: z2.string(),
116
+ data: z2.string()
117
+ })
118
+ })
119
+ }),
120
+ z2.object({
121
+ type: z2.literal("web_fetch_tool_result_error"),
122
+ error_code: z2.string()
123
+ })
124
+ ])
125
+ }),
126
+ z2.object({
127
+ type: z2.literal("web_search_tool_result"),
128
+ tool_use_id: z2.string(),
129
+ content: z2.union([
130
+ z2.array(
131
+ z2.object({
132
+ type: z2.literal("web_search_result"),
133
+ url: z2.string(),
134
+ title: z2.string(),
135
+ encrypted_content: z2.string(),
136
+ page_age: z2.string().nullish()
137
+ })
138
+ ),
139
+ z2.object({
140
+ type: z2.literal("web_search_tool_result_error"),
141
+ error_code: z2.string()
142
+ })
143
+ ])
144
+ }),
145
+ z2.object({
146
+ type: z2.literal("code_execution_tool_result"),
147
+ tool_use_id: z2.string(),
148
+ content: z2.union([
149
+ z2.object({
150
+ type: z2.literal("code_execution_result"),
151
+ stdout: z2.string(),
152
+ stderr: z2.string(),
153
+ return_code: z2.number()
154
+ }),
155
+ z2.object({
156
+ type: z2.literal("code_execution_tool_result_error"),
157
+ error_code: z2.string()
158
+ })
159
+ ])
160
+ })
161
+ ])
162
+ ),
163
+ stop_reason: z2.string().nullish(),
164
+ stop_sequence: z2.string().nullish(),
165
+ usage: z2.looseObject({
166
+ input_tokens: z2.number(),
167
+ output_tokens: z2.number(),
168
+ cache_creation_input_tokens: z2.number().nullish(),
169
+ cache_read_input_tokens: z2.number().nullish()
170
+ })
171
+ })
172
+ )
173
+ );
174
+ var anthropicMessagesChunkSchema = lazySchema2(
175
+ () => zodSchema2(
176
+ z2.discriminatedUnion("type", [
177
+ z2.object({
178
+ type: z2.literal("message_start"),
179
+ message: z2.object({
180
+ id: z2.string().nullish(),
181
+ model: z2.string().nullish(),
182
+ usage: z2.looseObject({
183
+ input_tokens: z2.number(),
184
+ cache_creation_input_tokens: z2.number().nullish(),
185
+ cache_read_input_tokens: z2.number().nullish()
186
+ })
187
+ })
188
+ }),
189
+ z2.object({
190
+ type: z2.literal("content_block_start"),
191
+ index: z2.number(),
192
+ content_block: z2.discriminatedUnion("type", [
193
+ z2.object({
194
+ type: z2.literal("text"),
195
+ text: z2.string()
196
+ }),
197
+ z2.object({
198
+ type: z2.literal("thinking"),
199
+ thinking: z2.string()
200
+ }),
201
+ z2.object({
202
+ type: z2.literal("tool_use"),
203
+ id: z2.string(),
204
+ name: z2.string()
205
+ }),
206
+ z2.object({
207
+ type: z2.literal("redacted_thinking"),
208
+ data: z2.string()
209
+ }),
210
+ z2.object({
211
+ type: z2.literal("server_tool_use"),
212
+ id: z2.string(),
213
+ name: z2.string(),
214
+ input: z2.record(z2.string(), z2.unknown()).nullish()
215
+ }),
216
+ z2.object({
217
+ type: z2.literal("web_fetch_tool_result"),
218
+ tool_use_id: z2.string(),
219
+ content: z2.union([
220
+ z2.object({
221
+ type: z2.literal("web_fetch_result"),
222
+ url: z2.string(),
223
+ retrieved_at: z2.string(),
224
+ content: z2.object({
225
+ type: z2.literal("document"),
226
+ title: z2.string().nullable(),
227
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
228
+ source: z2.object({
229
+ type: z2.literal("text"),
230
+ media_type: z2.string(),
231
+ data: z2.string()
232
+ })
233
+ })
234
+ }),
235
+ z2.object({
236
+ type: z2.literal("web_fetch_tool_result_error"),
237
+ error_code: z2.string()
238
+ })
239
+ ])
240
+ }),
241
+ z2.object({
242
+ type: z2.literal("web_search_tool_result"),
243
+ tool_use_id: z2.string(),
244
+ content: z2.union([
245
+ z2.array(
246
+ z2.object({
247
+ type: z2.literal("web_search_result"),
248
+ url: z2.string(),
249
+ title: z2.string(),
250
+ encrypted_content: z2.string(),
251
+ page_age: z2.string().nullish()
252
+ })
253
+ ),
254
+ z2.object({
255
+ type: z2.literal("web_search_tool_result_error"),
256
+ error_code: z2.string()
257
+ })
258
+ ])
259
+ }),
260
+ z2.object({
261
+ type: z2.literal("code_execution_tool_result"),
262
+ tool_use_id: z2.string(),
263
+ content: z2.union([
264
+ z2.object({
265
+ type: z2.literal("code_execution_result"),
266
+ stdout: z2.string(),
267
+ stderr: z2.string(),
268
+ return_code: z2.number()
269
+ }),
270
+ z2.object({
271
+ type: z2.literal("code_execution_tool_result_error"),
272
+ error_code: z2.string()
273
+ })
274
+ ])
275
+ })
276
+ ])
277
+ }),
278
+ z2.object({
279
+ type: z2.literal("content_block_delta"),
280
+ index: z2.number(),
281
+ delta: z2.discriminatedUnion("type", [
282
+ z2.object({
283
+ type: z2.literal("input_json_delta"),
284
+ partial_json: z2.string()
285
+ }),
286
+ z2.object({
287
+ type: z2.literal("text_delta"),
288
+ text: z2.string()
289
+ }),
290
+ z2.object({
291
+ type: z2.literal("thinking_delta"),
292
+ thinking: z2.string()
293
+ }),
294
+ z2.object({
295
+ type: z2.literal("signature_delta"),
296
+ signature: z2.string()
297
+ }),
298
+ z2.object({
299
+ type: z2.literal("citations_delta"),
300
+ citation: z2.discriminatedUnion("type", [
301
+ z2.object({
302
+ type: z2.literal("web_search_result_location"),
303
+ cited_text: z2.string(),
304
+ url: z2.string(),
305
+ title: z2.string(),
306
+ encrypted_index: z2.string()
307
+ }),
308
+ z2.object({
309
+ type: z2.literal("page_location"),
310
+ cited_text: z2.string(),
311
+ document_index: z2.number(),
312
+ document_title: z2.string().nullable(),
313
+ start_page_number: z2.number(),
314
+ end_page_number: z2.number()
315
+ }),
316
+ z2.object({
317
+ type: z2.literal("char_location"),
318
+ cited_text: z2.string(),
319
+ document_index: z2.number(),
320
+ document_title: z2.string().nullable(),
321
+ start_char_index: z2.number(),
322
+ end_char_index: z2.number()
323
+ })
324
+ ])
325
+ })
326
+ ])
327
+ }),
328
+ z2.object({
329
+ type: z2.literal("content_block_stop"),
330
+ index: z2.number()
331
+ }),
332
+ z2.object({
333
+ type: z2.literal("error"),
334
+ error: z2.object({
335
+ type: z2.string(),
336
+ message: z2.string()
337
+ })
338
+ }),
339
+ z2.object({
340
+ type: z2.literal("message_delta"),
341
+ delta: z2.object({
342
+ stop_reason: z2.string().nullish(),
343
+ stop_sequence: z2.string().nullish()
344
+ }),
345
+ usage: z2.looseObject({
346
+ output_tokens: z2.number(),
347
+ cache_creation_input_tokens: z2.number().nullish()
348
+ })
349
+ }),
350
+ z2.object({
351
+ type: z2.literal("message_stop")
352
+ }),
353
+ z2.object({
354
+ type: z2.literal("ping")
355
+ })
356
+ ])
357
+ )
358
+ );
359
+ var anthropicReasoningMetadataSchema = lazySchema2(
360
+ () => zodSchema2(
361
+ z2.object({
362
+ signature: z2.string().optional(),
363
+ redactedData: z2.string().optional()
364
+ })
365
+ )
366
+ );
367
+
368
+ // src/anthropic-messages-options.ts
369
+ import * as z3 from "zod/v4";
370
+ var anthropicFilePartProviderOptions = z3.object({
34
371
  /**
35
372
  * Citation configuration for this document.
36
373
  * When enabled, this document will generate citations in the response.
37
374
  */
38
- citations: z2.object({
375
+ citations: z3.object({
39
376
  /**
40
377
  * Enable citations for this document
41
378
  */
42
- enabled: z2.boolean()
379
+ enabled: z3.boolean()
43
380
  }).optional(),
44
381
  /**
45
382
  * Custom title for the document.
46
383
  * If not provided, the filename will be used.
47
384
  */
48
- title: z2.string().optional(),
385
+ title: z3.string().optional(),
49
386
  /**
50
387
  * Context about the document that will be passed to the model
51
388
  * but not used towards cited content.
52
389
  * Useful for storing document metadata as text or stringified JSON.
53
390
  */
54
- context: z2.string().optional()
391
+ context: z3.string().optional()
55
392
  });
56
- var anthropicProviderOptions = z2.object({
57
- sendReasoning: z2.boolean().optional(),
58
- thinking: z2.object({
59
- type: z2.union([z2.literal("enabled"), z2.literal("disabled")]),
60
- budgetTokens: z2.number().optional()
393
+ var anthropicProviderOptions = z3.object({
394
+ sendReasoning: z3.boolean().optional(),
395
+ thinking: z3.object({
396
+ type: z3.union([z3.literal("enabled"), z3.literal("disabled")]),
397
+ budgetTokens: z3.number().optional()
61
398
  }).optional(),
62
399
  /**
63
400
  * Whether to disable parallel function calling during tool use. Default is false.
64
401
  * When set to true, Claude will use at most one tool per response.
65
402
  */
66
- disableParallelToolUse: z2.boolean().optional(),
403
+ disableParallelToolUse: z3.boolean().optional(),
67
404
  /**
68
405
  * Cache control settings for this message.
69
406
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
70
407
  */
71
- cacheControl: z2.object({
72
- type: z2.literal("ephemeral"),
73
- ttl: z2.union([z2.literal("5m"), z2.literal("1h")]).optional()
408
+ cacheControl: z3.object({
409
+ type: z3.literal("ephemeral"),
410
+ ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
74
411
  }).optional()
75
412
  });
76
413
 
@@ -89,57 +426,84 @@ function getCacheControl(providerMetadata) {
89
426
 
90
427
  // src/tool/text-editor_20250728.ts
91
428
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
92
- import * as z3 from "zod/v4";
93
- var textEditor_20250728ArgsSchema = z3.object({
94
- maxCharacters: z3.number().optional()
95
- });
429
+ import * as z4 from "zod/v4";
430
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
431
+ var textEditor_20250728ArgsSchema = lazySchema3(
432
+ () => zodSchema3(
433
+ z4.object({
434
+ maxCharacters: z4.number().optional()
435
+ })
436
+ )
437
+ );
438
+ var textEditor_20250728InputSchema = lazySchema3(
439
+ () => zodSchema3(
440
+ z4.object({
441
+ command: z4.enum(["view", "create", "str_replace", "insert"]),
442
+ path: z4.string(),
443
+ file_text: z4.string().optional(),
444
+ insert_line: z4.number().int().optional(),
445
+ new_str: z4.string().optional(),
446
+ old_str: z4.string().optional(),
447
+ view_range: z4.array(z4.number().int()).optional()
448
+ })
449
+ )
450
+ );
96
451
  var factory = createProviderDefinedToolFactory({
97
452
  id: "anthropic.text_editor_20250728",
98
453
  name: "str_replace_based_edit_tool",
99
- inputSchema: z3.object({
100
- command: z3.enum(["view", "create", "str_replace", "insert"]),
101
- path: z3.string(),
102
- file_text: z3.string().optional(),
103
- insert_line: z3.number().int().optional(),
104
- new_str: z3.string().optional(),
105
- old_str: z3.string().optional(),
106
- view_range: z3.array(z3.number().int()).optional()
107
- })
454
+ inputSchema: textEditor_20250728InputSchema
108
455
  });
109
456
  var textEditor_20250728 = (args = {}) => {
110
457
  return factory(args);
111
458
  };
112
459
 
113
460
  // src/tool/web-search_20250305.ts
114
- import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
115
- import * as z4 from "zod/v4";
116
- var webSearch_20250305ArgsSchema = z4.object({
117
- maxUses: z4.number().optional(),
118
- allowedDomains: z4.array(z4.string()).optional(),
119
- blockedDomains: z4.array(z4.string()).optional(),
120
- userLocation: z4.object({
121
- type: z4.literal("approximate"),
122
- city: z4.string().optional(),
123
- region: z4.string().optional(),
124
- country: z4.string().optional(),
125
- timezone: z4.string().optional()
126
- }).optional()
127
- });
128
- var webSearch_20250305OutputSchema = z4.array(
129
- z4.object({
130
- url: z4.string(),
131
- title: z4.string(),
132
- pageAge: z4.string().nullable(),
133
- encryptedContent: z4.string(),
134
- type: z4.literal("web_search_result")
135
- })
461
+ import {
462
+ createProviderDefinedToolFactoryWithOutputSchema,
463
+ lazySchema as lazySchema4,
464
+ zodSchema as zodSchema4
465
+ } from "@ai-sdk/provider-utils";
466
+ import * as z5 from "zod/v4";
467
+ var webSearch_20250305ArgsSchema = lazySchema4(
468
+ () => zodSchema4(
469
+ z5.object({
470
+ maxUses: z5.number().optional(),
471
+ allowedDomains: z5.array(z5.string()).optional(),
472
+ blockedDomains: z5.array(z5.string()).optional(),
473
+ userLocation: z5.object({
474
+ type: z5.literal("approximate"),
475
+ city: z5.string().optional(),
476
+ region: z5.string().optional(),
477
+ country: z5.string().optional(),
478
+ timezone: z5.string().optional()
479
+ }).optional()
480
+ })
481
+ )
482
+ );
483
+ var webSearch_20250305OutputSchema = lazySchema4(
484
+ () => zodSchema4(
485
+ z5.array(
486
+ z5.object({
487
+ url: z5.string(),
488
+ title: z5.string(),
489
+ pageAge: z5.string().nullable(),
490
+ encryptedContent: z5.string(),
491
+ type: z5.literal("web_search_result")
492
+ })
493
+ )
494
+ )
495
+ );
496
+ var webSearch_20250305InputSchema = lazySchema4(
497
+ () => zodSchema4(
498
+ z5.object({
499
+ query: z5.string()
500
+ })
501
+ )
136
502
  );
137
503
  var factory2 = createProviderDefinedToolFactoryWithOutputSchema({
138
504
  id: "anthropic.web_search_20250305",
139
505
  name: "web_search",
140
- inputSchema: z4.object({
141
- query: z4.string()
142
- }),
506
+ inputSchema: webSearch_20250305InputSchema,
143
507
  outputSchema: webSearch_20250305OutputSchema
144
508
  });
145
509
  var webSearch_20250305 = (args = {}) => {
@@ -147,43 +511,60 @@ var webSearch_20250305 = (args = {}) => {
147
511
  };
148
512
 
149
513
  // src/tool/web-fetch-20250910.ts
150
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
151
- import * as z5 from "zod/v4";
152
- var webFetch_20250910ArgsSchema = z5.object({
153
- maxUses: z5.number().optional(),
154
- allowedDomains: z5.array(z5.string()).optional(),
155
- blockedDomains: z5.array(z5.string()).optional(),
156
- citations: z5.object({ enabled: z5.boolean() }).optional(),
157
- maxContentTokens: z5.number().optional()
158
- });
159
- var webFetch_20250910OutputSchema = z5.object({
160
- type: z5.literal("web_fetch_result"),
161
- url: z5.string(),
162
- content: z5.object({
163
- type: z5.literal("document"),
164
- title: z5.string(),
165
- citations: z5.object({ enabled: z5.boolean() }).optional(),
166
- source: z5.union([
167
- z5.object({
168
- type: z5.literal("base64"),
169
- mediaType: z5.literal("application/pdf"),
170
- data: z5.string()
514
+ import {
515
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
516
+ lazySchema as lazySchema5,
517
+ zodSchema as zodSchema5
518
+ } from "@ai-sdk/provider-utils";
519
+ import * as z6 from "zod/v4";
520
+ var webFetch_20250910ArgsSchema = lazySchema5(
521
+ () => zodSchema5(
522
+ z6.object({
523
+ maxUses: z6.number().optional(),
524
+ allowedDomains: z6.array(z6.string()).optional(),
525
+ blockedDomains: z6.array(z6.string()).optional(),
526
+ citations: z6.object({ enabled: z6.boolean() }).optional(),
527
+ maxContentTokens: z6.number().optional()
528
+ })
529
+ )
530
+ );
531
+ var webFetch_20250910OutputSchema = lazySchema5(
532
+ () => zodSchema5(
533
+ z6.object({
534
+ type: z6.literal("web_fetch_result"),
535
+ url: z6.string(),
536
+ content: z6.object({
537
+ type: z6.literal("document"),
538
+ title: z6.string(),
539
+ citations: z6.object({ enabled: z6.boolean() }).optional(),
540
+ source: z6.union([
541
+ z6.object({
542
+ type: z6.literal("base64"),
543
+ mediaType: z6.literal("application/pdf"),
544
+ data: z6.string()
545
+ }),
546
+ z6.object({
547
+ type: z6.literal("text"),
548
+ mediaType: z6.literal("text/plain"),
549
+ data: z6.string()
550
+ })
551
+ ])
171
552
  }),
172
- z5.object({
173
- type: z5.literal("text"),
174
- mediaType: z5.literal("text/plain"),
175
- data: z5.string()
176
- })
177
- ])
178
- }),
179
- retrievedAt: z5.string().nullable()
180
- });
553
+ retrievedAt: z6.string().nullable()
554
+ })
555
+ )
556
+ );
557
+ var webFetch_20250910InputSchema = lazySchema5(
558
+ () => zodSchema5(
559
+ z6.object({
560
+ url: z6.string()
561
+ })
562
+ )
563
+ );
181
564
  var factory3 = createProviderDefinedToolFactoryWithOutputSchema2({
182
565
  id: "anthropic.web_fetch_20250910",
183
566
  name: "web_fetch",
184
- inputSchema: z5.object({
185
- url: z5.string()
186
- }),
567
+ inputSchema: webFetch_20250910InputSchema,
187
568
  outputSchema: webFetch_20250910OutputSchema
188
569
  });
189
570
  var webFetch_20250910 = (args = {}) => {
@@ -191,7 +572,8 @@ var webFetch_20250910 = (args = {}) => {
191
572
  };
192
573
 
193
574
  // src/anthropic-prepare-tools.ts
194
- function prepareTools({
575
+ import { validateTypes } from "@ai-sdk/provider-utils";
576
+ async function prepareTools({
195
577
  tools,
196
578
  toolChoice,
197
579
  disableParallelToolUse
@@ -272,7 +654,10 @@ function prepareTools({
272
654
  break;
273
655
  }
274
656
  case "anthropic.text_editor_20250728": {
275
- const args = textEditor_20250728ArgsSchema.parse(tool.args);
657
+ const args = await validateTypes({
658
+ value: tool.args,
659
+ schema: textEditor_20250728ArgsSchema
660
+ });
276
661
  anthropicTools2.push({
277
662
  name: "str_replace_based_edit_tool",
278
663
  type: "text_editor_20250728",
@@ -298,7 +683,10 @@ function prepareTools({
298
683
  }
299
684
  case "anthropic.web_fetch_20250910": {
300
685
  betas.add("web-fetch-2025-09-10");
301
- const args = webFetch_20250910ArgsSchema.parse(tool.args);
686
+ const args = await validateTypes({
687
+ value: tool.args,
688
+ schema: webFetch_20250910ArgsSchema
689
+ });
302
690
  anthropicTools2.push({
303
691
  type: "web_fetch_20250910",
304
692
  name: "web_fetch",
@@ -311,7 +699,10 @@ function prepareTools({
311
699
  break;
312
700
  }
313
701
  case "anthropic.web_search_20250305": {
314
- const args = webSearch_20250305ArgsSchema.parse(tool.args);
702
+ const args = await validateTypes({
703
+ value: tool.args,
704
+ schema: webSearch_20250305ArgsSchema
705
+ });
315
706
  anthropicTools2.push({
316
707
  type: "web_search_20250305",
317
708
  name: "web_search",
@@ -391,23 +782,40 @@ function prepareTools({
391
782
  import {
392
783
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
393
784
  } from "@ai-sdk/provider";
394
- import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
785
+ import {
786
+ convertToBase64,
787
+ parseProviderOptions,
788
+ validateTypes as validateTypes2
789
+ } from "@ai-sdk/provider-utils";
395
790
 
396
791
  // src/tool/code-execution_20250522.ts
397
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
398
- import * as z6 from "zod/v4";
399
- var codeExecution_20250522OutputSchema = z6.object({
400
- type: z6.literal("code_execution_result"),
401
- stdout: z6.string(),
402
- stderr: z6.string(),
403
- return_code: z6.number()
404
- });
792
+ import {
793
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
794
+ lazySchema as lazySchema6,
795
+ zodSchema as zodSchema6
796
+ } from "@ai-sdk/provider-utils";
797
+ import * as z7 from "zod/v4";
798
+ var codeExecution_20250522OutputSchema = lazySchema6(
799
+ () => zodSchema6(
800
+ z7.object({
801
+ type: z7.literal("code_execution_result"),
802
+ stdout: z7.string(),
803
+ stderr: z7.string(),
804
+ return_code: z7.number()
805
+ })
806
+ )
807
+ );
808
+ var codeExecution_20250522InputSchema = lazySchema6(
809
+ () => zodSchema6(
810
+ z7.object({
811
+ code: z7.string()
812
+ })
813
+ )
814
+ );
405
815
  var factory4 = createProviderDefinedToolFactoryWithOutputSchema3({
406
816
  id: "anthropic.code_execution_20250522",
407
817
  name: "code_execution",
408
- inputSchema: z6.object({
409
- code: z6.string()
410
- }),
818
+ inputSchema: codeExecution_20250522InputSchema,
411
819
  outputSchema: codeExecution_20250522OutputSchema
412
820
  });
413
821
  var codeExecution_20250522 = (args = {}) => {
@@ -739,7 +1147,10 @@ async function convertToAnthropicMessagesPrompt({
739
1147
  });
740
1148
  break;
741
1149
  }
742
- const codeExecutionOutput = codeExecution_20250522OutputSchema.parse(output.value);
1150
+ const codeExecutionOutput = await validateTypes2({
1151
+ value: output.value,
1152
+ schema: codeExecution_20250522OutputSchema
1153
+ });
743
1154
  anthropicContent.push({
744
1155
  type: "code_execution_tool_result",
745
1156
  tool_use_id: part.toolCallId,
@@ -762,9 +1173,10 @@ async function convertToAnthropicMessagesPrompt({
762
1173
  });
763
1174
  break;
764
1175
  }
765
- const webFetchOutput = webFetch_20250910OutputSchema.parse(
766
- output.value
767
- );
1176
+ const webFetchOutput = await validateTypes2({
1177
+ value: output.value,
1178
+ schema: webFetch_20250910OutputSchema
1179
+ });
768
1180
  anthropicContent.push({
769
1181
  type: "web_fetch_tool_result",
770
1182
  tool_use_id: part.toolCallId,
@@ -796,9 +1208,10 @@ async function convertToAnthropicMessagesPrompt({
796
1208
  });
797
1209
  break;
798
1210
  }
799
- const webSearchOutput = webSearch_20250305OutputSchema.parse(
800
- output.value
801
- );
1211
+ const webSearchOutput = await validateTypes2({
1212
+ value: output.value,
1213
+ schema: webSearch_20250305OutputSchema
1214
+ });
802
1215
  anthropicContent.push({
803
1216
  type: "web_search_tool_result",
804
1217
  tool_use_id: part.toolCallId,
@@ -905,67 +1318,15 @@ function mapAnthropicStopReason({
905
1318
  }
906
1319
 
907
1320
  // src/anthropic-messages-language-model.ts
908
- var citationSchemas = {
909
- webSearchResult: z7.object({
910
- type: z7.literal("web_search_result_location"),
911
- cited_text: z7.string(),
912
- url: z7.string(),
913
- title: z7.string(),
914
- encrypted_index: z7.string()
915
- }),
916
- pageLocation: z7.object({
917
- type: z7.literal("page_location"),
918
- cited_text: z7.string(),
919
- document_index: z7.number(),
920
- document_title: z7.string().nullable(),
921
- start_page_number: z7.number(),
922
- end_page_number: z7.number()
923
- }),
924
- charLocation: z7.object({
925
- type: z7.literal("char_location"),
926
- cited_text: z7.string(),
927
- document_index: z7.number(),
928
- document_title: z7.string().nullable(),
929
- start_char_index: z7.number(),
930
- end_char_index: z7.number()
931
- })
932
- };
933
- var citationSchema = z7.discriminatedUnion("type", [
934
- citationSchemas.webSearchResult,
935
- citationSchemas.pageLocation,
936
- citationSchemas.charLocation
937
- ]);
938
- var documentCitationSchema = z7.discriminatedUnion("type", [
939
- citationSchemas.pageLocation,
940
- citationSchemas.charLocation
941
- ]);
942
- function processCitation(citation, citationDocuments, generateId2, onSource) {
943
- if (citation.type === "page_location" || citation.type === "char_location") {
944
- const source = createCitationSource(
945
- citation,
946
- citationDocuments,
947
- generateId2
948
- );
949
- if (source) {
950
- onSource(source);
951
- }
952
- }
953
- }
954
1321
  function createCitationSource(citation, citationDocuments, generateId2) {
955
1322
  var _a;
1323
+ if (citation.type !== "page_location" && citation.type !== "char_location") {
1324
+ return;
1325
+ }
956
1326
  const documentInfo = citationDocuments[citation.document_index];
957
1327
  if (!documentInfo) {
958
- return null;
1328
+ return;
959
1329
  }
960
- const providerMetadata = citation.type === "page_location" ? {
961
- citedText: citation.cited_text,
962
- startPageNumber: citation.start_page_number,
963
- endPageNumber: citation.end_page_number
964
- } : {
965
- citedText: citation.cited_text,
966
- startCharIndex: citation.start_char_index,
967
- endCharIndex: citation.end_char_index
968
- };
969
1330
  return {
970
1331
  type: "source",
971
1332
  sourceType: "document",
@@ -974,7 +1335,15 @@ function createCitationSource(citation, citationDocuments, generateId2) {
974
1335
  title: (_a = citation.document_title) != null ? _a : documentInfo.title,
975
1336
  filename: documentInfo.filename,
976
1337
  providerMetadata: {
977
- anthropic: providerMetadata
1338
+ anthropic: citation.type === "page_location" ? {
1339
+ citedText: citation.cited_text,
1340
+ startPageNumber: citation.start_page_number,
1341
+ endPageNumber: citation.end_page_number
1342
+ } : {
1343
+ citedText: citation.cited_text,
1344
+ startCharIndex: citation.start_char_index,
1345
+ endCharIndex: citation.end_char_index
1346
+ }
978
1347
  }
979
1348
  };
980
1349
  }
@@ -1119,7 +1488,7 @@ var AnthropicMessagesLanguageModel = class {
1119
1488
  toolChoice: anthropicToolChoice,
1120
1489
  toolWarnings,
1121
1490
  betas: toolsBetas
1122
- } = prepareTools(
1491
+ } = await prepareTools(
1123
1492
  jsonResponseTool != null ? {
1124
1493
  tools: [jsonResponseTool],
1125
1494
  toolChoice: { type: "tool", toolName: jsonResponseTool.name },
@@ -1209,12 +1578,14 @@ var AnthropicMessagesLanguageModel = class {
1209
1578
  content.push({ type: "text", text: part.text });
1210
1579
  if (part.citations) {
1211
1580
  for (const citation of part.citations) {
1212
- processCitation(
1581
+ const source = createCitationSource(
1213
1582
  citation,
1214
1583
  citationDocuments,
1215
- this.generateId,
1216
- (source) => content.push(source)
1584
+ this.generateId
1217
1585
  );
1586
+ if (source) {
1587
+ content.push(source);
1588
+ }
1218
1589
  }
1219
1590
  }
1220
1591
  }
@@ -1751,12 +2122,14 @@ var AnthropicMessagesLanguageModel = class {
1751
2122
  }
1752
2123
  case "citations_delta": {
1753
2124
  const citation = value.delta.citation;
1754
- processCitation(
2125
+ const source = createCitationSource(
1755
2126
  citation,
1756
2127
  citationDocuments,
1757
- generateId2,
1758
- (source) => controller.enqueue(source)
2128
+ generateId2
1759
2129
  );
2130
+ if (source) {
2131
+ controller.enqueue(source);
2132
+ }
1760
2133
  return;
1761
2134
  }
1762
2135
  default: {
@@ -1827,402 +2200,201 @@ var AnthropicMessagesLanguageModel = class {
1827
2200
  };
1828
2201
  }
1829
2202
  };
1830
- var anthropicMessagesResponseSchema = z7.object({
1831
- type: z7.literal("message"),
1832
- id: z7.string().nullish(),
1833
- model: z7.string().nullish(),
1834
- content: z7.array(
1835
- z7.discriminatedUnion("type", [
1836
- z7.object({
1837
- type: z7.literal("text"),
1838
- text: z7.string(),
1839
- citations: z7.array(citationSchema).optional()
1840
- }),
1841
- z7.object({
1842
- type: z7.literal("thinking"),
1843
- thinking: z7.string(),
1844
- signature: z7.string()
1845
- }),
1846
- z7.object({
1847
- type: z7.literal("redacted_thinking"),
1848
- data: z7.string()
1849
- }),
1850
- z7.object({
1851
- type: z7.literal("tool_use"),
1852
- id: z7.string(),
1853
- name: z7.string(),
1854
- input: z7.unknown()
1855
- }),
1856
- z7.object({
1857
- type: z7.literal("server_tool_use"),
1858
- id: z7.string(),
1859
- name: z7.string(),
1860
- input: z7.record(z7.string(), z7.unknown()).nullish()
1861
- }),
1862
- z7.object({
1863
- type: z7.literal("web_fetch_tool_result"),
1864
- tool_use_id: z7.string(),
1865
- content: z7.union([
1866
- z7.object({
1867
- type: z7.literal("web_fetch_result"),
1868
- url: z7.string(),
1869
- retrieved_at: z7.string(),
1870
- content: z7.object({
1871
- type: z7.literal("document"),
1872
- title: z7.string().nullable(),
1873
- citations: z7.object({ enabled: z7.boolean() }).optional(),
1874
- source: z7.object({
1875
- type: z7.literal("text"),
1876
- media_type: z7.string(),
1877
- data: z7.string()
1878
- })
1879
- })
1880
- }),
1881
- z7.object({
1882
- type: z7.literal("web_fetch_tool_result_error"),
1883
- error_code: z7.string()
1884
- })
1885
- ])
1886
- }),
1887
- z7.object({
1888
- type: z7.literal("web_search_tool_result"),
1889
- tool_use_id: z7.string(),
1890
- content: z7.union([
1891
- z7.array(
1892
- z7.object({
1893
- type: z7.literal("web_search_result"),
1894
- url: z7.string(),
1895
- title: z7.string(),
1896
- encrypted_content: z7.string(),
1897
- page_age: z7.string().nullish()
1898
- })
1899
- ),
1900
- z7.object({
1901
- type: z7.literal("web_search_tool_result_error"),
1902
- error_code: z7.string()
1903
- })
1904
- ])
1905
- }),
1906
- z7.object({
1907
- type: z7.literal("code_execution_tool_result"),
1908
- tool_use_id: z7.string(),
1909
- content: z7.union([
1910
- z7.object({
1911
- type: z7.literal("code_execution_result"),
1912
- stdout: z7.string(),
1913
- stderr: z7.string(),
1914
- return_code: z7.number()
1915
- }),
1916
- z7.object({
1917
- type: z7.literal("code_execution_tool_result_error"),
1918
- error_code: z7.string()
1919
- })
1920
- ])
1921
- })
1922
- ])
1923
- ),
1924
- stop_reason: z7.string().nullish(),
1925
- stop_sequence: z7.string().nullish(),
1926
- usage: z7.looseObject({
1927
- input_tokens: z7.number(),
1928
- output_tokens: z7.number(),
1929
- cache_creation_input_tokens: z7.number().nullish(),
1930
- cache_read_input_tokens: z7.number().nullish()
1931
- })
1932
- });
1933
- var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
1934
- z7.object({
1935
- type: z7.literal("message_start"),
1936
- message: z7.object({
1937
- id: z7.string().nullish(),
1938
- model: z7.string().nullish(),
1939
- usage: z7.looseObject({
1940
- input_tokens: z7.number(),
1941
- cache_creation_input_tokens: z7.number().nullish(),
1942
- cache_read_input_tokens: z7.number().nullish()
1943
- })
1944
- })
1945
- }),
1946
- z7.object({
1947
- type: z7.literal("content_block_start"),
1948
- index: z7.number(),
1949
- content_block: z7.discriminatedUnion("type", [
1950
- z7.object({
1951
- type: z7.literal("text"),
1952
- text: z7.string()
1953
- }),
1954
- z7.object({
1955
- type: z7.literal("thinking"),
1956
- thinking: z7.string()
1957
- }),
1958
- z7.object({
1959
- type: z7.literal("tool_use"),
1960
- id: z7.string(),
1961
- name: z7.string()
1962
- }),
1963
- z7.object({
1964
- type: z7.literal("redacted_thinking"),
1965
- data: z7.string()
1966
- }),
1967
- z7.object({
1968
- type: z7.literal("server_tool_use"),
1969
- id: z7.string(),
1970
- name: z7.string(),
1971
- input: z7.record(z7.string(), z7.unknown()).nullish()
1972
- }),
1973
- z7.object({
1974
- type: z7.literal("web_fetch_tool_result"),
1975
- tool_use_id: z7.string(),
1976
- content: z7.union([
1977
- z7.object({
1978
- type: z7.literal("web_fetch_result"),
1979
- url: z7.string(),
1980
- retrieved_at: z7.string(),
1981
- content: z7.object({
1982
- type: z7.literal("document"),
1983
- title: z7.string().nullable(),
1984
- citations: z7.object({ enabled: z7.boolean() }).optional(),
1985
- source: z7.object({
1986
- type: z7.literal("text"),
1987
- media_type: z7.string(),
1988
- data: z7.string()
1989
- })
1990
- })
1991
- }),
1992
- z7.object({
1993
- type: z7.literal("web_fetch_tool_result_error"),
1994
- error_code: z7.string()
1995
- })
1996
- ])
1997
- }),
1998
- z7.object({
1999
- type: z7.literal("web_search_tool_result"),
2000
- tool_use_id: z7.string(),
2001
- content: z7.union([
2002
- z7.array(
2003
- z7.object({
2004
- type: z7.literal("web_search_result"),
2005
- url: z7.string(),
2006
- title: z7.string(),
2007
- encrypted_content: z7.string(),
2008
- page_age: z7.string().nullish()
2009
- })
2010
- ),
2011
- z7.object({
2012
- type: z7.literal("web_search_tool_result_error"),
2013
- error_code: z7.string()
2014
- })
2015
- ])
2016
- }),
2017
- z7.object({
2018
- type: z7.literal("code_execution_tool_result"),
2019
- tool_use_id: z7.string(),
2020
- content: z7.union([
2021
- z7.object({
2022
- type: z7.literal("code_execution_result"),
2023
- stdout: z7.string(),
2024
- stderr: z7.string(),
2025
- return_code: z7.number()
2026
- }),
2027
- z7.object({
2028
- type: z7.literal("code_execution_tool_result_error"),
2029
- error_code: z7.string()
2030
- })
2031
- ])
2032
- })
2033
- ])
2034
- }),
2035
- z7.object({
2036
- type: z7.literal("content_block_delta"),
2037
- index: z7.number(),
2038
- delta: z7.discriminatedUnion("type", [
2039
- z7.object({
2040
- type: z7.literal("input_json_delta"),
2041
- partial_json: z7.string()
2042
- }),
2043
- z7.object({
2044
- type: z7.literal("text_delta"),
2045
- text: z7.string()
2046
- }),
2047
- z7.object({
2048
- type: z7.literal("thinking_delta"),
2049
- thinking: z7.string()
2050
- }),
2051
- z7.object({
2052
- type: z7.literal("signature_delta"),
2053
- signature: z7.string()
2054
- }),
2055
- z7.object({
2056
- type: z7.literal("citations_delta"),
2057
- citation: citationSchema
2058
- })
2059
- ])
2060
- }),
2061
- z7.object({
2062
- type: z7.literal("content_block_stop"),
2063
- index: z7.number()
2064
- }),
2065
- z7.object({
2066
- type: z7.literal("error"),
2067
- error: z7.object({
2068
- type: z7.string(),
2069
- message: z7.string()
2070
- })
2071
- }),
2072
- z7.object({
2073
- type: z7.literal("message_delta"),
2074
- delta: z7.object({
2075
- stop_reason: z7.string().nullish(),
2076
- stop_sequence: z7.string().nullish()
2077
- }),
2078
- usage: z7.looseObject({
2079
- output_tokens: z7.number(),
2080
- cache_creation_input_tokens: z7.number().nullish()
2081
- })
2082
- }),
2083
- z7.object({
2084
- type: z7.literal("message_stop")
2085
- }),
2086
- z7.object({
2087
- type: z7.literal("ping")
2088
- })
2089
- ]);
2090
- var anthropicReasoningMetadataSchema = z7.object({
2091
- signature: z7.string().optional(),
2092
- redactedData: z7.string().optional()
2093
- });
2094
2203
 
2095
2204
  // src/tool/bash_20241022.ts
2096
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
2097
- import z8 from "zod/v4";
2205
+ import {
2206
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
2207
+ lazySchema as lazySchema7,
2208
+ zodSchema as zodSchema7
2209
+ } from "@ai-sdk/provider-utils";
2210
+ import * as z8 from "zod/v4";
2211
+ var bash_20241022InputSchema = lazySchema7(
2212
+ () => zodSchema7(
2213
+ z8.object({
2214
+ command: z8.string(),
2215
+ restart: z8.boolean().optional()
2216
+ })
2217
+ )
2218
+ );
2098
2219
  var bash_20241022 = createProviderDefinedToolFactory2({
2099
2220
  id: "anthropic.bash_20241022",
2100
2221
  name: "bash",
2101
- inputSchema: z8.object({
2102
- command: z8.string(),
2103
- restart: z8.boolean().optional()
2104
- })
2222
+ inputSchema: bash_20241022InputSchema
2105
2223
  });
2106
2224
 
2107
2225
  // src/tool/bash_20250124.ts
2108
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
2109
- import z9 from "zod/v4";
2226
+ import {
2227
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
2228
+ lazySchema as lazySchema8,
2229
+ zodSchema as zodSchema8
2230
+ } from "@ai-sdk/provider-utils";
2231
+ import * as z9 from "zod/v4";
2232
+ var bash_20250124InputSchema = lazySchema8(
2233
+ () => zodSchema8(
2234
+ z9.object({
2235
+ command: z9.string(),
2236
+ restart: z9.boolean().optional()
2237
+ })
2238
+ )
2239
+ );
2110
2240
  var bash_20250124 = createProviderDefinedToolFactory3({
2111
2241
  id: "anthropic.bash_20250124",
2112
2242
  name: "bash",
2113
- inputSchema: z9.object({
2114
- command: z9.string(),
2115
- restart: z9.boolean().optional()
2116
- })
2243
+ inputSchema: bash_20250124InputSchema
2117
2244
  });
2118
2245
 
2119
2246
  // src/tool/computer_20241022.ts
2120
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory4 } from "@ai-sdk/provider-utils";
2247
+ import {
2248
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
2249
+ lazySchema as lazySchema9,
2250
+ zodSchema as zodSchema9
2251
+ } from "@ai-sdk/provider-utils";
2121
2252
  import * as z10 from "zod/v4";
2253
+ var computer_20241022InputSchema = lazySchema9(
2254
+ () => zodSchema9(
2255
+ z10.object({
2256
+ action: z10.enum([
2257
+ "key",
2258
+ "type",
2259
+ "mouse_move",
2260
+ "left_click",
2261
+ "left_click_drag",
2262
+ "right_click",
2263
+ "middle_click",
2264
+ "double_click",
2265
+ "screenshot",
2266
+ "cursor_position"
2267
+ ]),
2268
+ coordinate: z10.array(z10.number().int()).optional(),
2269
+ text: z10.string().optional()
2270
+ })
2271
+ )
2272
+ );
2122
2273
  var computer_20241022 = createProviderDefinedToolFactory4({
2123
2274
  id: "anthropic.computer_20241022",
2124
2275
  name: "computer",
2125
- inputSchema: z10.object({
2126
- action: z10.enum([
2127
- "key",
2128
- "type",
2129
- "mouse_move",
2130
- "left_click",
2131
- "left_click_drag",
2132
- "right_click",
2133
- "middle_click",
2134
- "double_click",
2135
- "screenshot",
2136
- "cursor_position"
2137
- ]),
2138
- coordinate: z10.array(z10.number().int()).optional(),
2139
- text: z10.string().optional()
2140
- })
2276
+ inputSchema: computer_20241022InputSchema
2141
2277
  });
2142
2278
 
2143
2279
  // src/tool/computer_20250124.ts
2144
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory5 } from "@ai-sdk/provider-utils";
2280
+ import {
2281
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
2282
+ lazySchema as lazySchema10,
2283
+ zodSchema as zodSchema10
2284
+ } from "@ai-sdk/provider-utils";
2145
2285
  import * as z11 from "zod/v4";
2286
+ var computer_20250124InputSchema = lazySchema10(
2287
+ () => zodSchema10(
2288
+ z11.object({
2289
+ action: z11.enum([
2290
+ "key",
2291
+ "hold_key",
2292
+ "type",
2293
+ "cursor_position",
2294
+ "mouse_move",
2295
+ "left_mouse_down",
2296
+ "left_mouse_up",
2297
+ "left_click",
2298
+ "left_click_drag",
2299
+ "right_click",
2300
+ "middle_click",
2301
+ "double_click",
2302
+ "triple_click",
2303
+ "scroll",
2304
+ "wait",
2305
+ "screenshot"
2306
+ ]),
2307
+ coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2308
+ duration: z11.number().optional(),
2309
+ scroll_amount: z11.number().optional(),
2310
+ scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2311
+ start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2312
+ text: z11.string().optional()
2313
+ })
2314
+ )
2315
+ );
2146
2316
  var computer_20250124 = createProviderDefinedToolFactory5({
2147
2317
  id: "anthropic.computer_20250124",
2148
2318
  name: "computer",
2149
- inputSchema: z11.object({
2150
- action: z11.enum([
2151
- "key",
2152
- "hold_key",
2153
- "type",
2154
- "cursor_position",
2155
- "mouse_move",
2156
- "left_mouse_down",
2157
- "left_mouse_up",
2158
- "left_click",
2159
- "left_click_drag",
2160
- "right_click",
2161
- "middle_click",
2162
- "double_click",
2163
- "triple_click",
2164
- "scroll",
2165
- "wait",
2166
- "screenshot"
2167
- ]),
2168
- coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2169
- duration: z11.number().optional(),
2170
- scroll_amount: z11.number().optional(),
2171
- scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2172
- start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2173
- text: z11.string().optional()
2174
- })
2319
+ inputSchema: computer_20250124InputSchema
2175
2320
  });
2176
2321
 
2177
2322
  // src/tool/text-editor_20241022.ts
2178
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
2323
+ import {
2324
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
2325
+ lazySchema as lazySchema11,
2326
+ zodSchema as zodSchema11
2327
+ } from "@ai-sdk/provider-utils";
2179
2328
  import * as z12 from "zod/v4";
2329
+ var textEditor_20241022InputSchema = lazySchema11(
2330
+ () => zodSchema11(
2331
+ z12.object({
2332
+ command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2333
+ path: z12.string(),
2334
+ file_text: z12.string().optional(),
2335
+ insert_line: z12.number().int().optional(),
2336
+ new_str: z12.string().optional(),
2337
+ old_str: z12.string().optional(),
2338
+ view_range: z12.array(z12.number().int()).optional()
2339
+ })
2340
+ )
2341
+ );
2180
2342
  var textEditor_20241022 = createProviderDefinedToolFactory6({
2181
2343
  id: "anthropic.text_editor_20241022",
2182
2344
  name: "str_replace_editor",
2183
- inputSchema: z12.object({
2184
- command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2185
- path: z12.string(),
2186
- file_text: z12.string().optional(),
2187
- insert_line: z12.number().int().optional(),
2188
- new_str: z12.string().optional(),
2189
- old_str: z12.string().optional(),
2190
- view_range: z12.array(z12.number().int()).optional()
2191
- })
2345
+ inputSchema: textEditor_20241022InputSchema
2192
2346
  });
2193
2347
 
2194
2348
  // src/tool/text-editor_20250124.ts
2195
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory7 } from "@ai-sdk/provider-utils";
2349
+ import {
2350
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
2351
+ lazySchema as lazySchema12,
2352
+ zodSchema as zodSchema12
2353
+ } from "@ai-sdk/provider-utils";
2196
2354
  import * as z13 from "zod/v4";
2355
+ var textEditor_20250124InputSchema = lazySchema12(
2356
+ () => zodSchema12(
2357
+ z13.object({
2358
+ command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2359
+ path: z13.string(),
2360
+ file_text: z13.string().optional(),
2361
+ insert_line: z13.number().int().optional(),
2362
+ new_str: z13.string().optional(),
2363
+ old_str: z13.string().optional(),
2364
+ view_range: z13.array(z13.number().int()).optional()
2365
+ })
2366
+ )
2367
+ );
2197
2368
  var textEditor_20250124 = createProviderDefinedToolFactory7({
2198
2369
  id: "anthropic.text_editor_20250124",
2199
2370
  name: "str_replace_editor",
2200
- inputSchema: z13.object({
2201
- command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2202
- path: z13.string(),
2203
- file_text: z13.string().optional(),
2204
- insert_line: z13.number().int().optional(),
2205
- new_str: z13.string().optional(),
2206
- old_str: z13.string().optional(),
2207
- view_range: z13.array(z13.number().int()).optional()
2208
- })
2371
+ inputSchema: textEditor_20250124InputSchema
2209
2372
  });
2210
2373
 
2211
2374
  // src/tool/text-editor_20250429.ts
2212
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory8 } from "@ai-sdk/provider-utils";
2375
+ import {
2376
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
2377
+ lazySchema as lazySchema13,
2378
+ zodSchema as zodSchema13
2379
+ } from "@ai-sdk/provider-utils";
2213
2380
  import * as z14 from "zod/v4";
2381
+ var textEditor_20250429InputSchema = lazySchema13(
2382
+ () => zodSchema13(
2383
+ z14.object({
2384
+ command: z14.enum(["view", "create", "str_replace", "insert"]),
2385
+ path: z14.string(),
2386
+ file_text: z14.string().optional(),
2387
+ insert_line: z14.number().int().optional(),
2388
+ new_str: z14.string().optional(),
2389
+ old_str: z14.string().optional(),
2390
+ view_range: z14.array(z14.number().int()).optional()
2391
+ })
2392
+ )
2393
+ );
2214
2394
  var textEditor_20250429 = createProviderDefinedToolFactory8({
2215
2395
  id: "anthropic.text_editor_20250429",
2216
2396
  name: "str_replace_based_edit_tool",
2217
- inputSchema: z14.object({
2218
- command: z14.enum(["view", "create", "str_replace", "insert"]),
2219
- path: z14.string(),
2220
- file_text: z14.string().optional(),
2221
- insert_line: z14.number().int().optional(),
2222
- new_str: z14.string().optional(),
2223
- old_str: z14.string().optional(),
2224
- view_range: z14.array(z14.number().int()).optional()
2225
- })
2397
+ inputSchema: textEditor_20250429InputSchema
2226
2398
  });
2227
2399
 
2228
2400
  // src/anthropic-tools.ts