@ai-sdk/anthropic 3.0.0-beta.15 → 3.0.0-beta.16

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 ? "3.0.0-beta.15" : "0.0.0-test";
13
+ var VERSION = true ? "3.0.0-beta.16" : "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 = {}) => {
@@ -756,7 +1164,10 @@ async function convertToAnthropicMessagesPrompt({
756
1164
  });
757
1165
  break;
758
1166
  }
759
- const codeExecutionOutput = codeExecution_20250522OutputSchema.parse(output.value);
1167
+ const codeExecutionOutput = await validateTypes2({
1168
+ value: output.value,
1169
+ schema: codeExecution_20250522OutputSchema
1170
+ });
760
1171
  anthropicContent.push({
761
1172
  type: "code_execution_tool_result",
762
1173
  tool_use_id: part.toolCallId,
@@ -779,9 +1190,10 @@ async function convertToAnthropicMessagesPrompt({
779
1190
  });
780
1191
  break;
781
1192
  }
782
- const webFetchOutput = webFetch_20250910OutputSchema.parse(
783
- output.value
784
- );
1193
+ const webFetchOutput = await validateTypes2({
1194
+ value: output.value,
1195
+ schema: webFetch_20250910OutputSchema
1196
+ });
785
1197
  anthropicContent.push({
786
1198
  type: "web_fetch_tool_result",
787
1199
  tool_use_id: part.toolCallId,
@@ -813,9 +1225,10 @@ async function convertToAnthropicMessagesPrompt({
813
1225
  });
814
1226
  break;
815
1227
  }
816
- const webSearchOutput = webSearch_20250305OutputSchema.parse(
817
- output.value
818
- );
1228
+ const webSearchOutput = await validateTypes2({
1229
+ value: output.value,
1230
+ schema: webSearch_20250305OutputSchema
1231
+ });
819
1232
  anthropicContent.push({
820
1233
  type: "web_search_tool_result",
821
1234
  tool_use_id: part.toolCallId,
@@ -922,67 +1335,15 @@ function mapAnthropicStopReason({
922
1335
  }
923
1336
 
924
1337
  // src/anthropic-messages-language-model.ts
925
- var citationSchemas = {
926
- webSearchResult: z7.object({
927
- type: z7.literal("web_search_result_location"),
928
- cited_text: z7.string(),
929
- url: z7.string(),
930
- title: z7.string(),
931
- encrypted_index: z7.string()
932
- }),
933
- pageLocation: z7.object({
934
- type: z7.literal("page_location"),
935
- cited_text: z7.string(),
936
- document_index: z7.number(),
937
- document_title: z7.string().nullable(),
938
- start_page_number: z7.number(),
939
- end_page_number: z7.number()
940
- }),
941
- charLocation: z7.object({
942
- type: z7.literal("char_location"),
943
- cited_text: z7.string(),
944
- document_index: z7.number(),
945
- document_title: z7.string().nullable(),
946
- start_char_index: z7.number(),
947
- end_char_index: z7.number()
948
- })
949
- };
950
- var citationSchema = z7.discriminatedUnion("type", [
951
- citationSchemas.webSearchResult,
952
- citationSchemas.pageLocation,
953
- citationSchemas.charLocation
954
- ]);
955
- var documentCitationSchema = z7.discriminatedUnion("type", [
956
- citationSchemas.pageLocation,
957
- citationSchemas.charLocation
958
- ]);
959
- function processCitation(citation, citationDocuments, generateId3, onSource) {
960
- if (citation.type === "page_location" || citation.type === "char_location") {
961
- const source = createCitationSource(
962
- citation,
963
- citationDocuments,
964
- generateId3
965
- );
966
- if (source) {
967
- onSource(source);
968
- }
969
- }
970
- }
971
1338
  function createCitationSource(citation, citationDocuments, generateId3) {
972
1339
  var _a;
1340
+ if (citation.type !== "page_location" && citation.type !== "char_location") {
1341
+ return;
1342
+ }
973
1343
  const documentInfo = citationDocuments[citation.document_index];
974
1344
  if (!documentInfo) {
975
- return null;
1345
+ return;
976
1346
  }
977
- const providerMetadata = citation.type === "page_location" ? {
978
- citedText: citation.cited_text,
979
- startPageNumber: citation.start_page_number,
980
- endPageNumber: citation.end_page_number
981
- } : {
982
- citedText: citation.cited_text,
983
- startCharIndex: citation.start_char_index,
984
- endCharIndex: citation.end_char_index
985
- };
986
1347
  return {
987
1348
  type: "source",
988
1349
  sourceType: "document",
@@ -991,7 +1352,15 @@ function createCitationSource(citation, citationDocuments, generateId3) {
991
1352
  title: (_a = citation.document_title) != null ? _a : documentInfo.title,
992
1353
  filename: documentInfo.filename,
993
1354
  providerMetadata: {
994
- anthropic: providerMetadata
1355
+ anthropic: citation.type === "page_location" ? {
1356
+ citedText: citation.cited_text,
1357
+ startPageNumber: citation.start_page_number,
1358
+ endPageNumber: citation.end_page_number
1359
+ } : {
1360
+ citedText: citation.cited_text,
1361
+ startCharIndex: citation.start_char_index,
1362
+ endCharIndex: citation.end_char_index
1363
+ }
995
1364
  }
996
1365
  };
997
1366
  }
@@ -1136,7 +1505,7 @@ var AnthropicMessagesLanguageModel = class {
1136
1505
  toolChoice: anthropicToolChoice,
1137
1506
  toolWarnings,
1138
1507
  betas: toolsBetas
1139
- } = prepareTools(
1508
+ } = await prepareTools(
1140
1509
  jsonResponseTool != null ? {
1141
1510
  tools: [jsonResponseTool],
1142
1511
  toolChoice: { type: "tool", toolName: jsonResponseTool.name },
@@ -1226,12 +1595,14 @@ var AnthropicMessagesLanguageModel = class {
1226
1595
  content.push({ type: "text", text: part.text });
1227
1596
  if (part.citations) {
1228
1597
  for (const citation of part.citations) {
1229
- processCitation(
1598
+ const source = createCitationSource(
1230
1599
  citation,
1231
1600
  citationDocuments,
1232
- this.generateId,
1233
- (source) => content.push(source)
1601
+ this.generateId
1234
1602
  );
1603
+ if (source) {
1604
+ content.push(source);
1605
+ }
1235
1606
  }
1236
1607
  }
1237
1608
  }
@@ -1768,12 +2139,14 @@ var AnthropicMessagesLanguageModel = class {
1768
2139
  }
1769
2140
  case "citations_delta": {
1770
2141
  const citation = value.delta.citation;
1771
- processCitation(
2142
+ const source = createCitationSource(
1772
2143
  citation,
1773
2144
  citationDocuments,
1774
- generateId3,
1775
- (source) => controller.enqueue(source)
2145
+ generateId3
1776
2146
  );
2147
+ if (source) {
2148
+ controller.enqueue(source);
2149
+ }
1777
2150
  return;
1778
2151
  }
1779
2152
  default: {
@@ -1844,402 +2217,201 @@ var AnthropicMessagesLanguageModel = class {
1844
2217
  };
1845
2218
  }
1846
2219
  };
1847
- var anthropicMessagesResponseSchema = z7.object({
1848
- type: z7.literal("message"),
1849
- id: z7.string().nullish(),
1850
- model: z7.string().nullish(),
1851
- content: z7.array(
1852
- z7.discriminatedUnion("type", [
1853
- z7.object({
1854
- type: z7.literal("text"),
1855
- text: z7.string(),
1856
- citations: z7.array(citationSchema).optional()
1857
- }),
1858
- z7.object({
1859
- type: z7.literal("thinking"),
1860
- thinking: z7.string(),
1861
- signature: z7.string()
1862
- }),
1863
- z7.object({
1864
- type: z7.literal("redacted_thinking"),
1865
- data: z7.string()
1866
- }),
1867
- z7.object({
1868
- type: z7.literal("tool_use"),
1869
- id: z7.string(),
1870
- name: z7.string(),
1871
- input: z7.unknown()
1872
- }),
1873
- z7.object({
1874
- type: z7.literal("server_tool_use"),
1875
- id: z7.string(),
1876
- name: z7.string(),
1877
- input: z7.record(z7.string(), z7.unknown()).nullish()
1878
- }),
1879
- z7.object({
1880
- type: z7.literal("web_fetch_tool_result"),
1881
- tool_use_id: z7.string(),
1882
- content: z7.union([
1883
- z7.object({
1884
- type: z7.literal("web_fetch_result"),
1885
- url: z7.string(),
1886
- retrieved_at: z7.string(),
1887
- content: z7.object({
1888
- type: z7.literal("document"),
1889
- title: z7.string().nullable(),
1890
- citations: z7.object({ enabled: z7.boolean() }).optional(),
1891
- source: z7.object({
1892
- type: z7.literal("text"),
1893
- media_type: z7.string(),
1894
- data: z7.string()
1895
- })
1896
- })
1897
- }),
1898
- z7.object({
1899
- type: z7.literal("web_fetch_tool_result_error"),
1900
- error_code: z7.string()
1901
- })
1902
- ])
1903
- }),
1904
- z7.object({
1905
- type: z7.literal("web_search_tool_result"),
1906
- tool_use_id: z7.string(),
1907
- content: z7.union([
1908
- z7.array(
1909
- z7.object({
1910
- type: z7.literal("web_search_result"),
1911
- url: z7.string(),
1912
- title: z7.string(),
1913
- encrypted_content: z7.string(),
1914
- page_age: z7.string().nullish()
1915
- })
1916
- ),
1917
- z7.object({
1918
- type: z7.literal("web_search_tool_result_error"),
1919
- error_code: z7.string()
1920
- })
1921
- ])
1922
- }),
1923
- z7.object({
1924
- type: z7.literal("code_execution_tool_result"),
1925
- tool_use_id: z7.string(),
1926
- content: z7.union([
1927
- z7.object({
1928
- type: z7.literal("code_execution_result"),
1929
- stdout: z7.string(),
1930
- stderr: z7.string(),
1931
- return_code: z7.number()
1932
- }),
1933
- z7.object({
1934
- type: z7.literal("code_execution_tool_result_error"),
1935
- error_code: z7.string()
1936
- })
1937
- ])
1938
- })
1939
- ])
1940
- ),
1941
- stop_reason: z7.string().nullish(),
1942
- stop_sequence: z7.string().nullish(),
1943
- usage: z7.looseObject({
1944
- input_tokens: z7.number(),
1945
- output_tokens: z7.number(),
1946
- cache_creation_input_tokens: z7.number().nullish(),
1947
- cache_read_input_tokens: z7.number().nullish()
1948
- })
1949
- });
1950
- var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
1951
- z7.object({
1952
- type: z7.literal("message_start"),
1953
- message: z7.object({
1954
- id: z7.string().nullish(),
1955
- model: z7.string().nullish(),
1956
- usage: z7.looseObject({
1957
- input_tokens: z7.number(),
1958
- cache_creation_input_tokens: z7.number().nullish(),
1959
- cache_read_input_tokens: z7.number().nullish()
1960
- })
1961
- })
1962
- }),
1963
- z7.object({
1964
- type: z7.literal("content_block_start"),
1965
- index: z7.number(),
1966
- content_block: z7.discriminatedUnion("type", [
1967
- z7.object({
1968
- type: z7.literal("text"),
1969
- text: z7.string()
1970
- }),
1971
- z7.object({
1972
- type: z7.literal("thinking"),
1973
- thinking: z7.string()
1974
- }),
1975
- z7.object({
1976
- type: z7.literal("tool_use"),
1977
- id: z7.string(),
1978
- name: z7.string()
1979
- }),
1980
- z7.object({
1981
- type: z7.literal("redacted_thinking"),
1982
- data: z7.string()
1983
- }),
1984
- z7.object({
1985
- type: z7.literal("server_tool_use"),
1986
- id: z7.string(),
1987
- name: z7.string(),
1988
- input: z7.record(z7.string(), z7.unknown()).nullish()
1989
- }),
1990
- z7.object({
1991
- type: z7.literal("web_fetch_tool_result"),
1992
- tool_use_id: z7.string(),
1993
- content: z7.union([
1994
- z7.object({
1995
- type: z7.literal("web_fetch_result"),
1996
- url: z7.string(),
1997
- retrieved_at: z7.string(),
1998
- content: z7.object({
1999
- type: z7.literal("document"),
2000
- title: z7.string().nullable(),
2001
- citations: z7.object({ enabled: z7.boolean() }).optional(),
2002
- source: z7.object({
2003
- type: z7.literal("text"),
2004
- media_type: z7.string(),
2005
- data: z7.string()
2006
- })
2007
- })
2008
- }),
2009
- z7.object({
2010
- type: z7.literal("web_fetch_tool_result_error"),
2011
- error_code: z7.string()
2012
- })
2013
- ])
2014
- }),
2015
- z7.object({
2016
- type: z7.literal("web_search_tool_result"),
2017
- tool_use_id: z7.string(),
2018
- content: z7.union([
2019
- z7.array(
2020
- z7.object({
2021
- type: z7.literal("web_search_result"),
2022
- url: z7.string(),
2023
- title: z7.string(),
2024
- encrypted_content: z7.string(),
2025
- page_age: z7.string().nullish()
2026
- })
2027
- ),
2028
- z7.object({
2029
- type: z7.literal("web_search_tool_result_error"),
2030
- error_code: z7.string()
2031
- })
2032
- ])
2033
- }),
2034
- z7.object({
2035
- type: z7.literal("code_execution_tool_result"),
2036
- tool_use_id: z7.string(),
2037
- content: z7.union([
2038
- z7.object({
2039
- type: z7.literal("code_execution_result"),
2040
- stdout: z7.string(),
2041
- stderr: z7.string(),
2042
- return_code: z7.number()
2043
- }),
2044
- z7.object({
2045
- type: z7.literal("code_execution_tool_result_error"),
2046
- error_code: z7.string()
2047
- })
2048
- ])
2049
- })
2050
- ])
2051
- }),
2052
- z7.object({
2053
- type: z7.literal("content_block_delta"),
2054
- index: z7.number(),
2055
- delta: z7.discriminatedUnion("type", [
2056
- z7.object({
2057
- type: z7.literal("input_json_delta"),
2058
- partial_json: z7.string()
2059
- }),
2060
- z7.object({
2061
- type: z7.literal("text_delta"),
2062
- text: z7.string()
2063
- }),
2064
- z7.object({
2065
- type: z7.literal("thinking_delta"),
2066
- thinking: z7.string()
2067
- }),
2068
- z7.object({
2069
- type: z7.literal("signature_delta"),
2070
- signature: z7.string()
2071
- }),
2072
- z7.object({
2073
- type: z7.literal("citations_delta"),
2074
- citation: citationSchema
2075
- })
2076
- ])
2077
- }),
2078
- z7.object({
2079
- type: z7.literal("content_block_stop"),
2080
- index: z7.number()
2081
- }),
2082
- z7.object({
2083
- type: z7.literal("error"),
2084
- error: z7.object({
2085
- type: z7.string(),
2086
- message: z7.string()
2087
- })
2088
- }),
2089
- z7.object({
2090
- type: z7.literal("message_delta"),
2091
- delta: z7.object({
2092
- stop_reason: z7.string().nullish(),
2093
- stop_sequence: z7.string().nullish()
2094
- }),
2095
- usage: z7.looseObject({
2096
- output_tokens: z7.number(),
2097
- cache_creation_input_tokens: z7.number().nullish()
2098
- })
2099
- }),
2100
- z7.object({
2101
- type: z7.literal("message_stop")
2102
- }),
2103
- z7.object({
2104
- type: z7.literal("ping")
2105
- })
2106
- ]);
2107
- var anthropicReasoningMetadataSchema = z7.object({
2108
- signature: z7.string().optional(),
2109
- redactedData: z7.string().optional()
2110
- });
2111
2220
 
2112
2221
  // src/tool/bash_20241022.ts
2113
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
2114
- import z8 from "zod/v4";
2222
+ import {
2223
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
2224
+ lazySchema as lazySchema7,
2225
+ zodSchema as zodSchema7
2226
+ } from "@ai-sdk/provider-utils";
2227
+ import * as z8 from "zod/v4";
2228
+ var bash_20241022InputSchema = lazySchema7(
2229
+ () => zodSchema7(
2230
+ z8.object({
2231
+ command: z8.string(),
2232
+ restart: z8.boolean().optional()
2233
+ })
2234
+ )
2235
+ );
2115
2236
  var bash_20241022 = createProviderDefinedToolFactory2({
2116
2237
  id: "anthropic.bash_20241022",
2117
2238
  name: "bash",
2118
- inputSchema: z8.object({
2119
- command: z8.string(),
2120
- restart: z8.boolean().optional()
2121
- })
2239
+ inputSchema: bash_20241022InputSchema
2122
2240
  });
2123
2241
 
2124
2242
  // src/tool/bash_20250124.ts
2125
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
2126
- import z9 from "zod/v4";
2243
+ import {
2244
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
2245
+ lazySchema as lazySchema8,
2246
+ zodSchema as zodSchema8
2247
+ } from "@ai-sdk/provider-utils";
2248
+ import * as z9 from "zod/v4";
2249
+ var bash_20250124InputSchema = lazySchema8(
2250
+ () => zodSchema8(
2251
+ z9.object({
2252
+ command: z9.string(),
2253
+ restart: z9.boolean().optional()
2254
+ })
2255
+ )
2256
+ );
2127
2257
  var bash_20250124 = createProviderDefinedToolFactory3({
2128
2258
  id: "anthropic.bash_20250124",
2129
2259
  name: "bash",
2130
- inputSchema: z9.object({
2131
- command: z9.string(),
2132
- restart: z9.boolean().optional()
2133
- })
2260
+ inputSchema: bash_20250124InputSchema
2134
2261
  });
2135
2262
 
2136
2263
  // src/tool/computer_20241022.ts
2137
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory4 } from "@ai-sdk/provider-utils";
2264
+ import {
2265
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
2266
+ lazySchema as lazySchema9,
2267
+ zodSchema as zodSchema9
2268
+ } from "@ai-sdk/provider-utils";
2138
2269
  import * as z10 from "zod/v4";
2270
+ var computer_20241022InputSchema = lazySchema9(
2271
+ () => zodSchema9(
2272
+ z10.object({
2273
+ action: z10.enum([
2274
+ "key",
2275
+ "type",
2276
+ "mouse_move",
2277
+ "left_click",
2278
+ "left_click_drag",
2279
+ "right_click",
2280
+ "middle_click",
2281
+ "double_click",
2282
+ "screenshot",
2283
+ "cursor_position"
2284
+ ]),
2285
+ coordinate: z10.array(z10.number().int()).optional(),
2286
+ text: z10.string().optional()
2287
+ })
2288
+ )
2289
+ );
2139
2290
  var computer_20241022 = createProviderDefinedToolFactory4({
2140
2291
  id: "anthropic.computer_20241022",
2141
2292
  name: "computer",
2142
- inputSchema: z10.object({
2143
- action: z10.enum([
2144
- "key",
2145
- "type",
2146
- "mouse_move",
2147
- "left_click",
2148
- "left_click_drag",
2149
- "right_click",
2150
- "middle_click",
2151
- "double_click",
2152
- "screenshot",
2153
- "cursor_position"
2154
- ]),
2155
- coordinate: z10.array(z10.number().int()).optional(),
2156
- text: z10.string().optional()
2157
- })
2293
+ inputSchema: computer_20241022InputSchema
2158
2294
  });
2159
2295
 
2160
2296
  // src/tool/computer_20250124.ts
2161
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory5 } from "@ai-sdk/provider-utils";
2297
+ import {
2298
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
2299
+ lazySchema as lazySchema10,
2300
+ zodSchema as zodSchema10
2301
+ } from "@ai-sdk/provider-utils";
2162
2302
  import * as z11 from "zod/v4";
2303
+ var computer_20250124InputSchema = lazySchema10(
2304
+ () => zodSchema10(
2305
+ z11.object({
2306
+ action: z11.enum([
2307
+ "key",
2308
+ "hold_key",
2309
+ "type",
2310
+ "cursor_position",
2311
+ "mouse_move",
2312
+ "left_mouse_down",
2313
+ "left_mouse_up",
2314
+ "left_click",
2315
+ "left_click_drag",
2316
+ "right_click",
2317
+ "middle_click",
2318
+ "double_click",
2319
+ "triple_click",
2320
+ "scroll",
2321
+ "wait",
2322
+ "screenshot"
2323
+ ]),
2324
+ coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2325
+ duration: z11.number().optional(),
2326
+ scroll_amount: z11.number().optional(),
2327
+ scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2328
+ start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2329
+ text: z11.string().optional()
2330
+ })
2331
+ )
2332
+ );
2163
2333
  var computer_20250124 = createProviderDefinedToolFactory5({
2164
2334
  id: "anthropic.computer_20250124",
2165
2335
  name: "computer",
2166
- inputSchema: z11.object({
2167
- action: z11.enum([
2168
- "key",
2169
- "hold_key",
2170
- "type",
2171
- "cursor_position",
2172
- "mouse_move",
2173
- "left_mouse_down",
2174
- "left_mouse_up",
2175
- "left_click",
2176
- "left_click_drag",
2177
- "right_click",
2178
- "middle_click",
2179
- "double_click",
2180
- "triple_click",
2181
- "scroll",
2182
- "wait",
2183
- "screenshot"
2184
- ]),
2185
- coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2186
- duration: z11.number().optional(),
2187
- scroll_amount: z11.number().optional(),
2188
- scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2189
- start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2190
- text: z11.string().optional()
2191
- })
2336
+ inputSchema: computer_20250124InputSchema
2192
2337
  });
2193
2338
 
2194
2339
  // src/tool/text-editor_20241022.ts
2195
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
2340
+ import {
2341
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
2342
+ lazySchema as lazySchema11,
2343
+ zodSchema as zodSchema11
2344
+ } from "@ai-sdk/provider-utils";
2196
2345
  import * as z12 from "zod/v4";
2346
+ var textEditor_20241022InputSchema = lazySchema11(
2347
+ () => zodSchema11(
2348
+ z12.object({
2349
+ command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2350
+ path: z12.string(),
2351
+ file_text: z12.string().optional(),
2352
+ insert_line: z12.number().int().optional(),
2353
+ new_str: z12.string().optional(),
2354
+ old_str: z12.string().optional(),
2355
+ view_range: z12.array(z12.number().int()).optional()
2356
+ })
2357
+ )
2358
+ );
2197
2359
  var textEditor_20241022 = createProviderDefinedToolFactory6({
2198
2360
  id: "anthropic.text_editor_20241022",
2199
2361
  name: "str_replace_editor",
2200
- inputSchema: z12.object({
2201
- command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2202
- path: z12.string(),
2203
- file_text: z12.string().optional(),
2204
- insert_line: z12.number().int().optional(),
2205
- new_str: z12.string().optional(),
2206
- old_str: z12.string().optional(),
2207
- view_range: z12.array(z12.number().int()).optional()
2208
- })
2362
+ inputSchema: textEditor_20241022InputSchema
2209
2363
  });
2210
2364
 
2211
2365
  // src/tool/text-editor_20250124.ts
2212
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory7 } from "@ai-sdk/provider-utils";
2366
+ import {
2367
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
2368
+ lazySchema as lazySchema12,
2369
+ zodSchema as zodSchema12
2370
+ } from "@ai-sdk/provider-utils";
2213
2371
  import * as z13 from "zod/v4";
2372
+ var textEditor_20250124InputSchema = lazySchema12(
2373
+ () => zodSchema12(
2374
+ z13.object({
2375
+ command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2376
+ path: z13.string(),
2377
+ file_text: z13.string().optional(),
2378
+ insert_line: z13.number().int().optional(),
2379
+ new_str: z13.string().optional(),
2380
+ old_str: z13.string().optional(),
2381
+ view_range: z13.array(z13.number().int()).optional()
2382
+ })
2383
+ )
2384
+ );
2214
2385
  var textEditor_20250124 = createProviderDefinedToolFactory7({
2215
2386
  id: "anthropic.text_editor_20250124",
2216
2387
  name: "str_replace_editor",
2217
- inputSchema: z13.object({
2218
- command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2219
- path: z13.string(),
2220
- file_text: z13.string().optional(),
2221
- insert_line: z13.number().int().optional(),
2222
- new_str: z13.string().optional(),
2223
- old_str: z13.string().optional(),
2224
- view_range: z13.array(z13.number().int()).optional()
2225
- })
2388
+ inputSchema: textEditor_20250124InputSchema
2226
2389
  });
2227
2390
 
2228
2391
  // src/tool/text-editor_20250429.ts
2229
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory8 } from "@ai-sdk/provider-utils";
2392
+ import {
2393
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
2394
+ lazySchema as lazySchema13,
2395
+ zodSchema as zodSchema13
2396
+ } from "@ai-sdk/provider-utils";
2230
2397
  import * as z14 from "zod/v4";
2398
+ var textEditor_20250429InputSchema = lazySchema13(
2399
+ () => zodSchema13(
2400
+ z14.object({
2401
+ command: z14.enum(["view", "create", "str_replace", "insert"]),
2402
+ path: z14.string(),
2403
+ file_text: z14.string().optional(),
2404
+ insert_line: z14.number().int().optional(),
2405
+ new_str: z14.string().optional(),
2406
+ old_str: z14.string().optional(),
2407
+ view_range: z14.array(z14.number().int()).optional()
2408
+ })
2409
+ )
2410
+ );
2231
2411
  var textEditor_20250429 = createProviderDefinedToolFactory8({
2232
2412
  id: "anthropic.text_editor_20250429",
2233
2413
  name: "str_replace_based_edit_tool",
2234
- inputSchema: z14.object({
2235
- command: z14.enum(["view", "create", "str_replace", "insert"]),
2236
- path: z14.string(),
2237
- file_text: z14.string().optional(),
2238
- insert_line: z14.number().int().optional(),
2239
- new_str: z14.string().optional(),
2240
- old_str: z14.string().optional(),
2241
- view_range: z14.array(z14.number().int()).optional()
2242
- })
2414
+ inputSchema: textEditor_20250429InputSchema
2243
2415
  });
2244
2416
 
2245
2417
  // src/anthropic-tools.ts