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