@ai-sdk/anthropic 4.0.0-beta.2 → 4.0.0-beta.21

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
@@ -11,23 +11,17 @@ import {
11
11
  withUserAgentSuffix
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
- // src/version.ts
15
- var VERSION = true ? "4.0.0-beta.2" : "0.0.0-test";
16
-
17
- // src/anthropic-messages-language-model.ts
18
- import {
19
- APICallError
20
- } from "@ai-sdk/provider";
14
+ // src/anthropic-files.ts
21
15
  import {
22
16
  combineHeaders,
23
- createEventSourceResponseHandler,
17
+ convertBase64ToUint8Array,
24
18
  createJsonResponseHandler,
25
- createToolNameMapping,
26
- generateId,
27
- parseProviderOptions as parseProviderOptions2,
28
- postJsonToApi,
29
- resolve
19
+ lazySchema as lazySchema2,
20
+ parseProviderOptions,
21
+ postFormDataToApi,
22
+ zodSchema as zodSchema2
30
23
  } from "@ai-sdk/provider-utils";
24
+ import { z as z2 } from "zod/v4";
31
25
 
32
26
  // src/anthropic-error.ts
33
27
  import {
@@ -52,319 +46,411 @@ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
52
46
  errorToMessage: (data) => data.error.message
53
47
  });
54
48
 
55
- // src/anthropic-messages-api.ts
56
- import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
57
- import { z as z2 } from "zod/v4";
58
- var anthropicMessagesResponseSchema = lazySchema2(
49
+ // src/anthropic-files.ts
50
+ var anthropicUploadFileProviderOptions = z2.object({});
51
+ var anthropicUploadFileResponseSchema = lazySchema2(
59
52
  () => zodSchema2(
60
53
  z2.object({
61
- type: z2.literal("message"),
62
- id: z2.string().nullish(),
63
- model: z2.string().nullish(),
64
- content: z2.array(
65
- z2.discriminatedUnion("type", [
66
- z2.object({
67
- type: z2.literal("text"),
68
- text: z2.string(),
69
- citations: z2.array(
70
- z2.discriminatedUnion("type", [
71
- z2.object({
72
- type: z2.literal("web_search_result_location"),
73
- cited_text: z2.string(),
74
- url: z2.string(),
75
- title: z2.string(),
76
- encrypted_index: z2.string()
54
+ id: z2.string(),
55
+ type: z2.literal("file"),
56
+ filename: z2.string(),
57
+ mime_type: z2.string(),
58
+ size_bytes: z2.number(),
59
+ created_at: z2.string(),
60
+ downloadable: z2.boolean().nullish()
61
+ })
62
+ )
63
+ );
64
+ var AnthropicFiles = class {
65
+ constructor(config) {
66
+ this.config = config;
67
+ this.specificationVersion = "v4";
68
+ }
69
+ get provider() {
70
+ return this.config.provider;
71
+ }
72
+ async uploadFile({
73
+ data,
74
+ mediaType,
75
+ filename,
76
+ providerOptions
77
+ }) {
78
+ var _a, _b;
79
+ const anthropicOptions = await parseProviderOptions({
80
+ provider: "anthropic",
81
+ providerOptions,
82
+ schema: zodSchema2(anthropicUploadFileProviderOptions)
83
+ });
84
+ const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
85
+ const blob = new Blob([fileBytes], { type: mediaType });
86
+ const formData = new FormData();
87
+ if (filename != null) {
88
+ formData.append("file", blob, filename);
89
+ } else {
90
+ formData.append("file", blob);
91
+ }
92
+ const { value: response } = await postFormDataToApi({
93
+ url: `${this.config.baseURL}/files`,
94
+ headers: combineHeaders(this.config.headers(), {
95
+ "anthropic-beta": "files-api-2025-04-14"
96
+ }),
97
+ formData,
98
+ failedResponseHandler: anthropicFailedResponseHandler,
99
+ successfulResponseHandler: createJsonResponseHandler(
100
+ anthropicUploadFileResponseSchema
101
+ ),
102
+ fetch: this.config.fetch
103
+ });
104
+ return {
105
+ warnings: [],
106
+ providerReference: { anthropic: response.id },
107
+ mediaType: (_a = response.mime_type) != null ? _a : mediaType,
108
+ filename: (_b = response.filename) != null ? _b : filename,
109
+ providerMetadata: {
110
+ anthropic: {
111
+ filename: response.filename,
112
+ mimeType: response.mime_type,
113
+ sizeBytes: response.size_bytes,
114
+ createdAt: response.created_at,
115
+ ...response.downloadable != null ? { downloadable: response.downloadable } : {}
116
+ }
117
+ }
118
+ };
119
+ }
120
+ };
121
+
122
+ // src/anthropic-messages-language-model.ts
123
+ import {
124
+ APICallError
125
+ } from "@ai-sdk/provider";
126
+ import {
127
+ combineHeaders as combineHeaders2,
128
+ createEventSourceResponseHandler,
129
+ createJsonResponseHandler as createJsonResponseHandler2,
130
+ createToolNameMapping,
131
+ generateId,
132
+ isCustomReasoning,
133
+ mapReasoningToProviderBudget,
134
+ mapReasoningToProviderEffort,
135
+ parseProviderOptions as parseProviderOptions3,
136
+ postJsonToApi,
137
+ resolve,
138
+ resolveProviderReference as resolveProviderReference2
139
+ } from "@ai-sdk/provider-utils";
140
+
141
+ // src/anthropic-messages-api.ts
142
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
143
+ import { z as z3 } from "zod/v4";
144
+ var anthropicMessagesResponseSchema = lazySchema3(
145
+ () => zodSchema3(
146
+ z3.object({
147
+ type: z3.literal("message"),
148
+ id: z3.string().nullish(),
149
+ model: z3.string().nullish(),
150
+ content: z3.array(
151
+ z3.discriminatedUnion("type", [
152
+ z3.object({
153
+ type: z3.literal("text"),
154
+ text: z3.string(),
155
+ citations: z3.array(
156
+ z3.discriminatedUnion("type", [
157
+ z3.object({
158
+ type: z3.literal("web_search_result_location"),
159
+ cited_text: z3.string(),
160
+ url: z3.string(),
161
+ title: z3.string(),
162
+ encrypted_index: z3.string()
77
163
  }),
78
- z2.object({
79
- type: z2.literal("page_location"),
80
- cited_text: z2.string(),
81
- document_index: z2.number(),
82
- document_title: z2.string().nullable(),
83
- start_page_number: z2.number(),
84
- end_page_number: z2.number()
164
+ z3.object({
165
+ type: z3.literal("page_location"),
166
+ cited_text: z3.string(),
167
+ document_index: z3.number(),
168
+ document_title: z3.string().nullable(),
169
+ start_page_number: z3.number(),
170
+ end_page_number: z3.number()
85
171
  }),
86
- z2.object({
87
- type: z2.literal("char_location"),
88
- cited_text: z2.string(),
89
- document_index: z2.number(),
90
- document_title: z2.string().nullable(),
91
- start_char_index: z2.number(),
92
- end_char_index: z2.number()
172
+ z3.object({
173
+ type: z3.literal("char_location"),
174
+ cited_text: z3.string(),
175
+ document_index: z3.number(),
176
+ document_title: z3.string().nullable(),
177
+ start_char_index: z3.number(),
178
+ end_char_index: z3.number()
93
179
  })
94
180
  ])
95
181
  ).optional()
96
182
  }),
97
- z2.object({
98
- type: z2.literal("thinking"),
99
- thinking: z2.string(),
100
- signature: z2.string()
183
+ z3.object({
184
+ type: z3.literal("thinking"),
185
+ thinking: z3.string(),
186
+ signature: z3.string()
101
187
  }),
102
- z2.object({
103
- type: z2.literal("redacted_thinking"),
104
- data: z2.string()
188
+ z3.object({
189
+ type: z3.literal("redacted_thinking"),
190
+ data: z3.string()
105
191
  }),
106
- z2.object({
107
- type: z2.literal("compaction"),
108
- content: z2.string()
192
+ z3.object({
193
+ type: z3.literal("compaction"),
194
+ content: z3.string()
109
195
  }),
110
- z2.object({
111
- type: z2.literal("tool_use"),
112
- id: z2.string(),
113
- name: z2.string(),
114
- input: z2.unknown(),
196
+ z3.object({
197
+ type: z3.literal("tool_use"),
198
+ id: z3.string(),
199
+ name: z3.string(),
200
+ input: z3.unknown(),
115
201
  // Programmatic tool calling: caller info when triggered from code execution
116
- caller: z2.union([
117
- z2.object({
118
- type: z2.literal("code_execution_20250825"),
119
- tool_id: z2.string()
202
+ caller: z3.union([
203
+ z3.object({
204
+ type: z3.literal("code_execution_20250825"),
205
+ tool_id: z3.string()
120
206
  }),
121
- z2.object({
122
- type: z2.literal("code_execution_20260120"),
123
- tool_id: z2.string()
207
+ z3.object({
208
+ type: z3.literal("code_execution_20260120"),
209
+ tool_id: z3.string()
124
210
  }),
125
- z2.object({
126
- type: z2.literal("direct")
211
+ z3.object({
212
+ type: z3.literal("direct")
127
213
  })
128
214
  ]).optional()
129
215
  }),
130
- z2.object({
131
- type: z2.literal("server_tool_use"),
132
- id: z2.string(),
133
- name: z2.string(),
134
- input: z2.record(z2.string(), z2.unknown()).nullish(),
135
- caller: z2.union([
136
- z2.object({
137
- type: z2.literal("code_execution_20260120"),
138
- tool_id: z2.string()
216
+ z3.object({
217
+ type: z3.literal("server_tool_use"),
218
+ id: z3.string(),
219
+ name: z3.string(),
220
+ input: z3.record(z3.string(), z3.unknown()).nullish(),
221
+ caller: z3.union([
222
+ z3.object({
223
+ type: z3.literal("code_execution_20260120"),
224
+ tool_id: z3.string()
139
225
  }),
140
- z2.object({
141
- type: z2.literal("direct")
226
+ z3.object({
227
+ type: z3.literal("direct")
142
228
  })
143
229
  ]).optional()
144
230
  }),
145
- z2.object({
146
- type: z2.literal("mcp_tool_use"),
147
- id: z2.string(),
148
- name: z2.string(),
149
- input: z2.unknown(),
150
- server_name: z2.string()
231
+ z3.object({
232
+ type: z3.literal("mcp_tool_use"),
233
+ id: z3.string(),
234
+ name: z3.string(),
235
+ input: z3.unknown(),
236
+ server_name: z3.string()
151
237
  }),
152
- z2.object({
153
- type: z2.literal("mcp_tool_result"),
154
- tool_use_id: z2.string(),
155
- is_error: z2.boolean(),
156
- content: z2.array(
157
- z2.union([
158
- z2.string(),
159
- z2.object({ type: z2.literal("text"), text: z2.string() })
238
+ z3.object({
239
+ type: z3.literal("mcp_tool_result"),
240
+ tool_use_id: z3.string(),
241
+ is_error: z3.boolean(),
242
+ content: z3.array(
243
+ z3.union([
244
+ z3.string(),
245
+ z3.object({ type: z3.literal("text"), text: z3.string() })
160
246
  ])
161
247
  )
162
248
  }),
163
- z2.object({
164
- type: z2.literal("web_fetch_tool_result"),
165
- tool_use_id: z2.string(),
166
- content: z2.union([
167
- z2.object({
168
- type: z2.literal("web_fetch_result"),
169
- url: z2.string(),
170
- retrieved_at: z2.string(),
171
- content: z2.object({
172
- type: z2.literal("document"),
173
- title: z2.string().nullable(),
174
- citations: z2.object({ enabled: z2.boolean() }).optional(),
175
- source: z2.union([
176
- z2.object({
177
- type: z2.literal("base64"),
178
- media_type: z2.literal("application/pdf"),
179
- data: z2.string()
249
+ z3.object({
250
+ type: z3.literal("web_fetch_tool_result"),
251
+ tool_use_id: z3.string(),
252
+ content: z3.union([
253
+ z3.object({
254
+ type: z3.literal("web_fetch_result"),
255
+ url: z3.string(),
256
+ retrieved_at: z3.string(),
257
+ content: z3.object({
258
+ type: z3.literal("document"),
259
+ title: z3.string().nullable(),
260
+ citations: z3.object({ enabled: z3.boolean() }).optional(),
261
+ source: z3.union([
262
+ z3.object({
263
+ type: z3.literal("base64"),
264
+ media_type: z3.literal("application/pdf"),
265
+ data: z3.string()
180
266
  }),
181
- z2.object({
182
- type: z2.literal("text"),
183
- media_type: z2.literal("text/plain"),
184
- data: z2.string()
267
+ z3.object({
268
+ type: z3.literal("text"),
269
+ media_type: z3.literal("text/plain"),
270
+ data: z3.string()
185
271
  })
186
272
  ])
187
273
  })
188
274
  }),
189
- z2.object({
190
- type: z2.literal("web_fetch_tool_result_error"),
191
- error_code: z2.string()
275
+ z3.object({
276
+ type: z3.literal("web_fetch_tool_result_error"),
277
+ error_code: z3.string()
192
278
  })
193
279
  ])
194
280
  }),
195
- z2.object({
196
- type: z2.literal("web_search_tool_result"),
197
- tool_use_id: z2.string(),
198
- content: z2.union([
199
- z2.array(
200
- z2.object({
201
- type: z2.literal("web_search_result"),
202
- url: z2.string(),
203
- title: z2.string(),
204
- encrypted_content: z2.string(),
205
- page_age: z2.string().nullish()
281
+ z3.object({
282
+ type: z3.literal("web_search_tool_result"),
283
+ tool_use_id: z3.string(),
284
+ content: z3.union([
285
+ z3.array(
286
+ z3.object({
287
+ type: z3.literal("web_search_result"),
288
+ url: z3.string(),
289
+ title: z3.string(),
290
+ encrypted_content: z3.string(),
291
+ page_age: z3.string().nullish()
206
292
  })
207
293
  ),
208
- z2.object({
209
- type: z2.literal("web_search_tool_result_error"),
210
- error_code: z2.string()
294
+ z3.object({
295
+ type: z3.literal("web_search_tool_result_error"),
296
+ error_code: z3.string()
211
297
  })
212
298
  ])
213
299
  }),
214
300
  // code execution results for code_execution_20250522 tool:
215
- z2.object({
216
- type: z2.literal("code_execution_tool_result"),
217
- tool_use_id: z2.string(),
218
- content: z2.union([
219
- z2.object({
220
- type: z2.literal("code_execution_result"),
221
- stdout: z2.string(),
222
- stderr: z2.string(),
223
- return_code: z2.number(),
224
- content: z2.array(
225
- z2.object({
226
- type: z2.literal("code_execution_output"),
227
- file_id: z2.string()
301
+ z3.object({
302
+ type: z3.literal("code_execution_tool_result"),
303
+ tool_use_id: z3.string(),
304
+ content: z3.union([
305
+ z3.object({
306
+ type: z3.literal("code_execution_result"),
307
+ stdout: z3.string(),
308
+ stderr: z3.string(),
309
+ return_code: z3.number(),
310
+ content: z3.array(
311
+ z3.object({
312
+ type: z3.literal("code_execution_output"),
313
+ file_id: z3.string()
228
314
  })
229
315
  ).optional().default([])
230
316
  }),
231
- z2.object({
232
- type: z2.literal("encrypted_code_execution_result"),
233
- encrypted_stdout: z2.string(),
234
- stderr: z2.string(),
235
- return_code: z2.number(),
236
- content: z2.array(
237
- z2.object({
238
- type: z2.literal("code_execution_output"),
239
- file_id: z2.string()
317
+ z3.object({
318
+ type: z3.literal("encrypted_code_execution_result"),
319
+ encrypted_stdout: z3.string(),
320
+ stderr: z3.string(),
321
+ return_code: z3.number(),
322
+ content: z3.array(
323
+ z3.object({
324
+ type: z3.literal("code_execution_output"),
325
+ file_id: z3.string()
240
326
  })
241
327
  ).optional().default([])
242
328
  }),
243
- z2.object({
244
- type: z2.literal("code_execution_tool_result_error"),
245
- error_code: z2.string()
329
+ z3.object({
330
+ type: z3.literal("code_execution_tool_result_error"),
331
+ error_code: z3.string()
246
332
  })
247
333
  ])
248
334
  }),
249
335
  // bash code execution results for code_execution_20250825 tool:
250
- z2.object({
251
- type: z2.literal("bash_code_execution_tool_result"),
252
- tool_use_id: z2.string(),
253
- content: z2.discriminatedUnion("type", [
254
- z2.object({
255
- type: z2.literal("bash_code_execution_result"),
256
- content: z2.array(
257
- z2.object({
258
- type: z2.literal("bash_code_execution_output"),
259
- file_id: z2.string()
336
+ z3.object({
337
+ type: z3.literal("bash_code_execution_tool_result"),
338
+ tool_use_id: z3.string(),
339
+ content: z3.discriminatedUnion("type", [
340
+ z3.object({
341
+ type: z3.literal("bash_code_execution_result"),
342
+ content: z3.array(
343
+ z3.object({
344
+ type: z3.literal("bash_code_execution_output"),
345
+ file_id: z3.string()
260
346
  })
261
347
  ),
262
- stdout: z2.string(),
263
- stderr: z2.string(),
264
- return_code: z2.number()
348
+ stdout: z3.string(),
349
+ stderr: z3.string(),
350
+ return_code: z3.number()
265
351
  }),
266
- z2.object({
267
- type: z2.literal("bash_code_execution_tool_result_error"),
268
- error_code: z2.string()
352
+ z3.object({
353
+ type: z3.literal("bash_code_execution_tool_result_error"),
354
+ error_code: z3.string()
269
355
  })
270
356
  ])
271
357
  }),
272
358
  // text editor code execution results for code_execution_20250825 tool:
273
- z2.object({
274
- type: z2.literal("text_editor_code_execution_tool_result"),
275
- tool_use_id: z2.string(),
276
- content: z2.discriminatedUnion("type", [
277
- z2.object({
278
- type: z2.literal("text_editor_code_execution_tool_result_error"),
279
- error_code: z2.string()
359
+ z3.object({
360
+ type: z3.literal("text_editor_code_execution_tool_result"),
361
+ tool_use_id: z3.string(),
362
+ content: z3.discriminatedUnion("type", [
363
+ z3.object({
364
+ type: z3.literal("text_editor_code_execution_tool_result_error"),
365
+ error_code: z3.string()
280
366
  }),
281
- z2.object({
282
- type: z2.literal("text_editor_code_execution_view_result"),
283
- content: z2.string(),
284
- file_type: z2.string(),
285
- num_lines: z2.number().nullable(),
286
- start_line: z2.number().nullable(),
287
- total_lines: z2.number().nullable()
367
+ z3.object({
368
+ type: z3.literal("text_editor_code_execution_view_result"),
369
+ content: z3.string(),
370
+ file_type: z3.string(),
371
+ num_lines: z3.number().nullable(),
372
+ start_line: z3.number().nullable(),
373
+ total_lines: z3.number().nullable()
288
374
  }),
289
- z2.object({
290
- type: z2.literal("text_editor_code_execution_create_result"),
291
- is_file_update: z2.boolean()
375
+ z3.object({
376
+ type: z3.literal("text_editor_code_execution_create_result"),
377
+ is_file_update: z3.boolean()
292
378
  }),
293
- z2.object({
294
- type: z2.literal(
379
+ z3.object({
380
+ type: z3.literal(
295
381
  "text_editor_code_execution_str_replace_result"
296
382
  ),
297
- lines: z2.array(z2.string()).nullable(),
298
- new_lines: z2.number().nullable(),
299
- new_start: z2.number().nullable(),
300
- old_lines: z2.number().nullable(),
301
- old_start: z2.number().nullable()
383
+ lines: z3.array(z3.string()).nullable(),
384
+ new_lines: z3.number().nullable(),
385
+ new_start: z3.number().nullable(),
386
+ old_lines: z3.number().nullable(),
387
+ old_start: z3.number().nullable()
302
388
  })
303
389
  ])
304
390
  }),
305
391
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
306
- z2.object({
307
- type: z2.literal("tool_search_tool_result"),
308
- tool_use_id: z2.string(),
309
- content: z2.union([
310
- z2.object({
311
- type: z2.literal("tool_search_tool_search_result"),
312
- tool_references: z2.array(
313
- z2.object({
314
- type: z2.literal("tool_reference"),
315
- tool_name: z2.string()
392
+ z3.object({
393
+ type: z3.literal("tool_search_tool_result"),
394
+ tool_use_id: z3.string(),
395
+ content: z3.union([
396
+ z3.object({
397
+ type: z3.literal("tool_search_tool_search_result"),
398
+ tool_references: z3.array(
399
+ z3.object({
400
+ type: z3.literal("tool_reference"),
401
+ tool_name: z3.string()
316
402
  })
317
403
  )
318
404
  }),
319
- z2.object({
320
- type: z2.literal("tool_search_tool_result_error"),
321
- error_code: z2.string()
405
+ z3.object({
406
+ type: z3.literal("tool_search_tool_result_error"),
407
+ error_code: z3.string()
322
408
  })
323
409
  ])
324
410
  })
325
411
  ])
326
412
  ),
327
- stop_reason: z2.string().nullish(),
328
- stop_sequence: z2.string().nullish(),
329
- usage: z2.looseObject({
330
- input_tokens: z2.number(),
331
- output_tokens: z2.number(),
332
- cache_creation_input_tokens: z2.number().nullish(),
333
- cache_read_input_tokens: z2.number().nullish(),
334
- iterations: z2.array(
335
- z2.object({
336
- type: z2.union([z2.literal("compaction"), z2.literal("message")]),
337
- input_tokens: z2.number(),
338
- output_tokens: z2.number()
413
+ stop_reason: z3.string().nullish(),
414
+ stop_sequence: z3.string().nullish(),
415
+ usage: z3.looseObject({
416
+ input_tokens: z3.number(),
417
+ output_tokens: z3.number(),
418
+ cache_creation_input_tokens: z3.number().nullish(),
419
+ cache_read_input_tokens: z3.number().nullish(),
420
+ iterations: z3.array(
421
+ z3.object({
422
+ type: z3.union([z3.literal("compaction"), z3.literal("message")]),
423
+ input_tokens: z3.number(),
424
+ output_tokens: z3.number()
339
425
  })
340
426
  ).nullish()
341
427
  }),
342
- container: z2.object({
343
- expires_at: z2.string(),
344
- id: z2.string(),
345
- skills: z2.array(
346
- z2.object({
347
- type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
348
- skill_id: z2.string(),
349
- version: z2.string()
428
+ container: z3.object({
429
+ expires_at: z3.string(),
430
+ id: z3.string(),
431
+ skills: z3.array(
432
+ z3.object({
433
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
434
+ skill_id: z3.string(),
435
+ version: z3.string()
350
436
  })
351
437
  ).nullish()
352
438
  }).nullish(),
353
- context_management: z2.object({
354
- applied_edits: z2.array(
355
- z2.union([
356
- z2.object({
357
- type: z2.literal("clear_tool_uses_20250919"),
358
- cleared_tool_uses: z2.number(),
359
- cleared_input_tokens: z2.number()
439
+ context_management: z3.object({
440
+ applied_edits: z3.array(
441
+ z3.union([
442
+ z3.object({
443
+ type: z3.literal("clear_tool_uses_20250919"),
444
+ cleared_tool_uses: z3.number(),
445
+ cleared_input_tokens: z3.number()
360
446
  }),
361
- z2.object({
362
- type: z2.literal("clear_thinking_20251015"),
363
- cleared_thinking_turns: z2.number(),
364
- cleared_input_tokens: z2.number()
447
+ z3.object({
448
+ type: z3.literal("clear_thinking_20251015"),
449
+ cleared_thinking_turns: z3.number(),
450
+ cleared_input_tokens: z3.number()
365
451
  }),
366
- z2.object({
367
- type: z2.literal("compact_20260112")
452
+ z3.object({
453
+ type: z3.literal("compact_20260112")
368
454
  })
369
455
  ])
370
456
  )
@@ -372,457 +458,457 @@ var anthropicMessagesResponseSchema = lazySchema2(
372
458
  })
373
459
  )
374
460
  );
375
- var anthropicMessagesChunkSchema = lazySchema2(
376
- () => zodSchema2(
377
- z2.discriminatedUnion("type", [
378
- z2.object({
379
- type: z2.literal("message_start"),
380
- message: z2.object({
381
- id: z2.string().nullish(),
382
- model: z2.string().nullish(),
383
- role: z2.string().nullish(),
384
- usage: z2.looseObject({
385
- input_tokens: z2.number(),
386
- cache_creation_input_tokens: z2.number().nullish(),
387
- cache_read_input_tokens: z2.number().nullish()
461
+ var anthropicMessagesChunkSchema = lazySchema3(
462
+ () => zodSchema3(
463
+ z3.discriminatedUnion("type", [
464
+ z3.object({
465
+ type: z3.literal("message_start"),
466
+ message: z3.object({
467
+ id: z3.string().nullish(),
468
+ model: z3.string().nullish(),
469
+ role: z3.string().nullish(),
470
+ usage: z3.looseObject({
471
+ input_tokens: z3.number(),
472
+ cache_creation_input_tokens: z3.number().nullish(),
473
+ cache_read_input_tokens: z3.number().nullish()
388
474
  }),
389
475
  // Programmatic tool calling: content may be pre-populated for deferred tool calls
390
- content: z2.array(
391
- z2.discriminatedUnion("type", [
392
- z2.object({
393
- type: z2.literal("tool_use"),
394
- id: z2.string(),
395
- name: z2.string(),
396
- input: z2.unknown(),
397
- caller: z2.union([
398
- z2.object({
399
- type: z2.literal("code_execution_20250825"),
400
- tool_id: z2.string()
476
+ content: z3.array(
477
+ z3.discriminatedUnion("type", [
478
+ z3.object({
479
+ type: z3.literal("tool_use"),
480
+ id: z3.string(),
481
+ name: z3.string(),
482
+ input: z3.unknown(),
483
+ caller: z3.union([
484
+ z3.object({
485
+ type: z3.literal("code_execution_20250825"),
486
+ tool_id: z3.string()
401
487
  }),
402
- z2.object({
403
- type: z2.literal("code_execution_20260120"),
404
- tool_id: z2.string()
488
+ z3.object({
489
+ type: z3.literal("code_execution_20260120"),
490
+ tool_id: z3.string()
405
491
  }),
406
- z2.object({
407
- type: z2.literal("direct")
492
+ z3.object({
493
+ type: z3.literal("direct")
408
494
  })
409
495
  ]).optional()
410
496
  })
411
497
  ])
412
498
  ).nullish(),
413
- stop_reason: z2.string().nullish(),
414
- container: z2.object({
415
- expires_at: z2.string(),
416
- id: z2.string()
499
+ stop_reason: z3.string().nullish(),
500
+ container: z3.object({
501
+ expires_at: z3.string(),
502
+ id: z3.string()
417
503
  }).nullish()
418
504
  })
419
505
  }),
420
- z2.object({
421
- type: z2.literal("content_block_start"),
422
- index: z2.number(),
423
- content_block: z2.discriminatedUnion("type", [
424
- z2.object({
425
- type: z2.literal("text"),
426
- text: z2.string()
506
+ z3.object({
507
+ type: z3.literal("content_block_start"),
508
+ index: z3.number(),
509
+ content_block: z3.discriminatedUnion("type", [
510
+ z3.object({
511
+ type: z3.literal("text"),
512
+ text: z3.string()
427
513
  }),
428
- z2.object({
429
- type: z2.literal("thinking"),
430
- thinking: z2.string()
514
+ z3.object({
515
+ type: z3.literal("thinking"),
516
+ thinking: z3.string()
431
517
  }),
432
- z2.object({
433
- type: z2.literal("tool_use"),
434
- id: z2.string(),
435
- name: z2.string(),
518
+ z3.object({
519
+ type: z3.literal("tool_use"),
520
+ id: z3.string(),
521
+ name: z3.string(),
436
522
  // Programmatic tool calling: input may be present directly for deferred tool calls
437
- input: z2.record(z2.string(), z2.unknown()).optional(),
523
+ input: z3.record(z3.string(), z3.unknown()).optional(),
438
524
  // Programmatic tool calling: caller info when triggered from code execution
439
- caller: z2.union([
440
- z2.object({
441
- type: z2.literal("code_execution_20250825"),
442
- tool_id: z2.string()
525
+ caller: z3.union([
526
+ z3.object({
527
+ type: z3.literal("code_execution_20250825"),
528
+ tool_id: z3.string()
443
529
  }),
444
- z2.object({
445
- type: z2.literal("code_execution_20260120"),
446
- tool_id: z2.string()
530
+ z3.object({
531
+ type: z3.literal("code_execution_20260120"),
532
+ tool_id: z3.string()
447
533
  }),
448
- z2.object({
449
- type: z2.literal("direct")
534
+ z3.object({
535
+ type: z3.literal("direct")
450
536
  })
451
537
  ]).optional()
452
538
  }),
453
- z2.object({
454
- type: z2.literal("redacted_thinking"),
455
- data: z2.string()
539
+ z3.object({
540
+ type: z3.literal("redacted_thinking"),
541
+ data: z3.string()
456
542
  }),
457
- z2.object({
458
- type: z2.literal("compaction"),
459
- content: z2.string().nullish()
543
+ z3.object({
544
+ type: z3.literal("compaction"),
545
+ content: z3.string().nullish()
460
546
  }),
461
- z2.object({
462
- type: z2.literal("server_tool_use"),
463
- id: z2.string(),
464
- name: z2.string(),
465
- input: z2.record(z2.string(), z2.unknown()).nullish(),
466
- caller: z2.union([
467
- z2.object({
468
- type: z2.literal("code_execution_20260120"),
469
- tool_id: z2.string()
547
+ z3.object({
548
+ type: z3.literal("server_tool_use"),
549
+ id: z3.string(),
550
+ name: z3.string(),
551
+ input: z3.record(z3.string(), z3.unknown()).nullish(),
552
+ caller: z3.union([
553
+ z3.object({
554
+ type: z3.literal("code_execution_20260120"),
555
+ tool_id: z3.string()
470
556
  }),
471
- z2.object({
472
- type: z2.literal("direct")
557
+ z3.object({
558
+ type: z3.literal("direct")
473
559
  })
474
560
  ]).optional()
475
561
  }),
476
- z2.object({
477
- type: z2.literal("mcp_tool_use"),
478
- id: z2.string(),
479
- name: z2.string(),
480
- input: z2.unknown(),
481
- server_name: z2.string()
562
+ z3.object({
563
+ type: z3.literal("mcp_tool_use"),
564
+ id: z3.string(),
565
+ name: z3.string(),
566
+ input: z3.unknown(),
567
+ server_name: z3.string()
482
568
  }),
483
- z2.object({
484
- type: z2.literal("mcp_tool_result"),
485
- tool_use_id: z2.string(),
486
- is_error: z2.boolean(),
487
- content: z2.array(
488
- z2.union([
489
- z2.string(),
490
- z2.object({ type: z2.literal("text"), text: z2.string() })
569
+ z3.object({
570
+ type: z3.literal("mcp_tool_result"),
571
+ tool_use_id: z3.string(),
572
+ is_error: z3.boolean(),
573
+ content: z3.array(
574
+ z3.union([
575
+ z3.string(),
576
+ z3.object({ type: z3.literal("text"), text: z3.string() })
491
577
  ])
492
578
  )
493
579
  }),
494
- z2.object({
495
- type: z2.literal("web_fetch_tool_result"),
496
- tool_use_id: z2.string(),
497
- content: z2.union([
498
- z2.object({
499
- type: z2.literal("web_fetch_result"),
500
- url: z2.string(),
501
- retrieved_at: z2.string(),
502
- content: z2.object({
503
- type: z2.literal("document"),
504
- title: z2.string().nullable(),
505
- citations: z2.object({ enabled: z2.boolean() }).optional(),
506
- source: z2.union([
507
- z2.object({
508
- type: z2.literal("base64"),
509
- media_type: z2.literal("application/pdf"),
510
- data: z2.string()
580
+ z3.object({
581
+ type: z3.literal("web_fetch_tool_result"),
582
+ tool_use_id: z3.string(),
583
+ content: z3.union([
584
+ z3.object({
585
+ type: z3.literal("web_fetch_result"),
586
+ url: z3.string(),
587
+ retrieved_at: z3.string(),
588
+ content: z3.object({
589
+ type: z3.literal("document"),
590
+ title: z3.string().nullable(),
591
+ citations: z3.object({ enabled: z3.boolean() }).optional(),
592
+ source: z3.union([
593
+ z3.object({
594
+ type: z3.literal("base64"),
595
+ media_type: z3.literal("application/pdf"),
596
+ data: z3.string()
511
597
  }),
512
- z2.object({
513
- type: z2.literal("text"),
514
- media_type: z2.literal("text/plain"),
515
- data: z2.string()
598
+ z3.object({
599
+ type: z3.literal("text"),
600
+ media_type: z3.literal("text/plain"),
601
+ data: z3.string()
516
602
  })
517
603
  ])
518
604
  })
519
605
  }),
520
- z2.object({
521
- type: z2.literal("web_fetch_tool_result_error"),
522
- error_code: z2.string()
606
+ z3.object({
607
+ type: z3.literal("web_fetch_tool_result_error"),
608
+ error_code: z3.string()
523
609
  })
524
610
  ])
525
611
  }),
526
- z2.object({
527
- type: z2.literal("web_search_tool_result"),
528
- tool_use_id: z2.string(),
529
- content: z2.union([
530
- z2.array(
531
- z2.object({
532
- type: z2.literal("web_search_result"),
533
- url: z2.string(),
534
- title: z2.string(),
535
- encrypted_content: z2.string(),
536
- page_age: z2.string().nullish()
612
+ z3.object({
613
+ type: z3.literal("web_search_tool_result"),
614
+ tool_use_id: z3.string(),
615
+ content: z3.union([
616
+ z3.array(
617
+ z3.object({
618
+ type: z3.literal("web_search_result"),
619
+ url: z3.string(),
620
+ title: z3.string(),
621
+ encrypted_content: z3.string(),
622
+ page_age: z3.string().nullish()
537
623
  })
538
624
  ),
539
- z2.object({
540
- type: z2.literal("web_search_tool_result_error"),
541
- error_code: z2.string()
625
+ z3.object({
626
+ type: z3.literal("web_search_tool_result_error"),
627
+ error_code: z3.string()
542
628
  })
543
629
  ])
544
630
  }),
545
631
  // code execution results for code_execution_20250522 tool:
546
- z2.object({
547
- type: z2.literal("code_execution_tool_result"),
548
- tool_use_id: z2.string(),
549
- content: z2.union([
550
- z2.object({
551
- type: z2.literal("code_execution_result"),
552
- stdout: z2.string(),
553
- stderr: z2.string(),
554
- return_code: z2.number(),
555
- content: z2.array(
556
- z2.object({
557
- type: z2.literal("code_execution_output"),
558
- file_id: z2.string()
632
+ z3.object({
633
+ type: z3.literal("code_execution_tool_result"),
634
+ tool_use_id: z3.string(),
635
+ content: z3.union([
636
+ z3.object({
637
+ type: z3.literal("code_execution_result"),
638
+ stdout: z3.string(),
639
+ stderr: z3.string(),
640
+ return_code: z3.number(),
641
+ content: z3.array(
642
+ z3.object({
643
+ type: z3.literal("code_execution_output"),
644
+ file_id: z3.string()
559
645
  })
560
646
  ).optional().default([])
561
647
  }),
562
- z2.object({
563
- type: z2.literal("encrypted_code_execution_result"),
564
- encrypted_stdout: z2.string(),
565
- stderr: z2.string(),
566
- return_code: z2.number(),
567
- content: z2.array(
568
- z2.object({
569
- type: z2.literal("code_execution_output"),
570
- file_id: z2.string()
648
+ z3.object({
649
+ type: z3.literal("encrypted_code_execution_result"),
650
+ encrypted_stdout: z3.string(),
651
+ stderr: z3.string(),
652
+ return_code: z3.number(),
653
+ content: z3.array(
654
+ z3.object({
655
+ type: z3.literal("code_execution_output"),
656
+ file_id: z3.string()
571
657
  })
572
658
  ).optional().default([])
573
659
  }),
574
- z2.object({
575
- type: z2.literal("code_execution_tool_result_error"),
576
- error_code: z2.string()
660
+ z3.object({
661
+ type: z3.literal("code_execution_tool_result_error"),
662
+ error_code: z3.string()
577
663
  })
578
664
  ])
579
665
  }),
580
666
  // bash code execution results for code_execution_20250825 tool:
581
- z2.object({
582
- type: z2.literal("bash_code_execution_tool_result"),
583
- tool_use_id: z2.string(),
584
- content: z2.discriminatedUnion("type", [
585
- z2.object({
586
- type: z2.literal("bash_code_execution_result"),
587
- content: z2.array(
588
- z2.object({
589
- type: z2.literal("bash_code_execution_output"),
590
- file_id: z2.string()
667
+ z3.object({
668
+ type: z3.literal("bash_code_execution_tool_result"),
669
+ tool_use_id: z3.string(),
670
+ content: z3.discriminatedUnion("type", [
671
+ z3.object({
672
+ type: z3.literal("bash_code_execution_result"),
673
+ content: z3.array(
674
+ z3.object({
675
+ type: z3.literal("bash_code_execution_output"),
676
+ file_id: z3.string()
591
677
  })
592
678
  ),
593
- stdout: z2.string(),
594
- stderr: z2.string(),
595
- return_code: z2.number()
679
+ stdout: z3.string(),
680
+ stderr: z3.string(),
681
+ return_code: z3.number()
596
682
  }),
597
- z2.object({
598
- type: z2.literal("bash_code_execution_tool_result_error"),
599
- error_code: z2.string()
683
+ z3.object({
684
+ type: z3.literal("bash_code_execution_tool_result_error"),
685
+ error_code: z3.string()
600
686
  })
601
687
  ])
602
688
  }),
603
689
  // text editor code execution results for code_execution_20250825 tool:
604
- z2.object({
605
- type: z2.literal("text_editor_code_execution_tool_result"),
606
- tool_use_id: z2.string(),
607
- content: z2.discriminatedUnion("type", [
608
- z2.object({
609
- type: z2.literal("text_editor_code_execution_tool_result_error"),
610
- error_code: z2.string()
690
+ z3.object({
691
+ type: z3.literal("text_editor_code_execution_tool_result"),
692
+ tool_use_id: z3.string(),
693
+ content: z3.discriminatedUnion("type", [
694
+ z3.object({
695
+ type: z3.literal("text_editor_code_execution_tool_result_error"),
696
+ error_code: z3.string()
611
697
  }),
612
- z2.object({
613
- type: z2.literal("text_editor_code_execution_view_result"),
614
- content: z2.string(),
615
- file_type: z2.string(),
616
- num_lines: z2.number().nullable(),
617
- start_line: z2.number().nullable(),
618
- total_lines: z2.number().nullable()
698
+ z3.object({
699
+ type: z3.literal("text_editor_code_execution_view_result"),
700
+ content: z3.string(),
701
+ file_type: z3.string(),
702
+ num_lines: z3.number().nullable(),
703
+ start_line: z3.number().nullable(),
704
+ total_lines: z3.number().nullable()
619
705
  }),
620
- z2.object({
621
- type: z2.literal("text_editor_code_execution_create_result"),
622
- is_file_update: z2.boolean()
706
+ z3.object({
707
+ type: z3.literal("text_editor_code_execution_create_result"),
708
+ is_file_update: z3.boolean()
623
709
  }),
624
- z2.object({
625
- type: z2.literal(
710
+ z3.object({
711
+ type: z3.literal(
626
712
  "text_editor_code_execution_str_replace_result"
627
713
  ),
628
- lines: z2.array(z2.string()).nullable(),
629
- new_lines: z2.number().nullable(),
630
- new_start: z2.number().nullable(),
631
- old_lines: z2.number().nullable(),
632
- old_start: z2.number().nullable()
714
+ lines: z3.array(z3.string()).nullable(),
715
+ new_lines: z3.number().nullable(),
716
+ new_start: z3.number().nullable(),
717
+ old_lines: z3.number().nullable(),
718
+ old_start: z3.number().nullable()
633
719
  })
634
720
  ])
635
721
  }),
636
722
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
637
- z2.object({
638
- type: z2.literal("tool_search_tool_result"),
639
- tool_use_id: z2.string(),
640
- content: z2.union([
641
- z2.object({
642
- type: z2.literal("tool_search_tool_search_result"),
643
- tool_references: z2.array(
644
- z2.object({
645
- type: z2.literal("tool_reference"),
646
- tool_name: z2.string()
723
+ z3.object({
724
+ type: z3.literal("tool_search_tool_result"),
725
+ tool_use_id: z3.string(),
726
+ content: z3.union([
727
+ z3.object({
728
+ type: z3.literal("tool_search_tool_search_result"),
729
+ tool_references: z3.array(
730
+ z3.object({
731
+ type: z3.literal("tool_reference"),
732
+ tool_name: z3.string()
647
733
  })
648
734
  )
649
735
  }),
650
- z2.object({
651
- type: z2.literal("tool_search_tool_result_error"),
652
- error_code: z2.string()
736
+ z3.object({
737
+ type: z3.literal("tool_search_tool_result_error"),
738
+ error_code: z3.string()
653
739
  })
654
740
  ])
655
741
  })
656
742
  ])
657
743
  }),
658
- z2.object({
659
- type: z2.literal("content_block_delta"),
660
- index: z2.number(),
661
- delta: z2.discriminatedUnion("type", [
662
- z2.object({
663
- type: z2.literal("input_json_delta"),
664
- partial_json: z2.string()
744
+ z3.object({
745
+ type: z3.literal("content_block_delta"),
746
+ index: z3.number(),
747
+ delta: z3.discriminatedUnion("type", [
748
+ z3.object({
749
+ type: z3.literal("input_json_delta"),
750
+ partial_json: z3.string()
665
751
  }),
666
- z2.object({
667
- type: z2.literal("text_delta"),
668
- text: z2.string()
752
+ z3.object({
753
+ type: z3.literal("text_delta"),
754
+ text: z3.string()
669
755
  }),
670
- z2.object({
671
- type: z2.literal("thinking_delta"),
672
- thinking: z2.string()
756
+ z3.object({
757
+ type: z3.literal("thinking_delta"),
758
+ thinking: z3.string()
673
759
  }),
674
- z2.object({
675
- type: z2.literal("signature_delta"),
676
- signature: z2.string()
760
+ z3.object({
761
+ type: z3.literal("signature_delta"),
762
+ signature: z3.string()
677
763
  }),
678
- z2.object({
679
- type: z2.literal("compaction_delta"),
680
- content: z2.string().nullish()
764
+ z3.object({
765
+ type: z3.literal("compaction_delta"),
766
+ content: z3.string().nullish()
681
767
  }),
682
- z2.object({
683
- type: z2.literal("citations_delta"),
684
- citation: z2.discriminatedUnion("type", [
685
- z2.object({
686
- type: z2.literal("web_search_result_location"),
687
- cited_text: z2.string(),
688
- url: z2.string(),
689
- title: z2.string(),
690
- encrypted_index: z2.string()
768
+ z3.object({
769
+ type: z3.literal("citations_delta"),
770
+ citation: z3.discriminatedUnion("type", [
771
+ z3.object({
772
+ type: z3.literal("web_search_result_location"),
773
+ cited_text: z3.string(),
774
+ url: z3.string(),
775
+ title: z3.string(),
776
+ encrypted_index: z3.string()
691
777
  }),
692
- z2.object({
693
- type: z2.literal("page_location"),
694
- cited_text: z2.string(),
695
- document_index: z2.number(),
696
- document_title: z2.string().nullable(),
697
- start_page_number: z2.number(),
698
- end_page_number: z2.number()
778
+ z3.object({
779
+ type: z3.literal("page_location"),
780
+ cited_text: z3.string(),
781
+ document_index: z3.number(),
782
+ document_title: z3.string().nullable(),
783
+ start_page_number: z3.number(),
784
+ end_page_number: z3.number()
699
785
  }),
700
- z2.object({
701
- type: z2.literal("char_location"),
702
- cited_text: z2.string(),
703
- document_index: z2.number(),
704
- document_title: z2.string().nullable(),
705
- start_char_index: z2.number(),
706
- end_char_index: z2.number()
786
+ z3.object({
787
+ type: z3.literal("char_location"),
788
+ cited_text: z3.string(),
789
+ document_index: z3.number(),
790
+ document_title: z3.string().nullable(),
791
+ start_char_index: z3.number(),
792
+ end_char_index: z3.number()
707
793
  })
708
794
  ])
709
795
  })
710
796
  ])
711
797
  }),
712
- z2.object({
713
- type: z2.literal("content_block_stop"),
714
- index: z2.number()
798
+ z3.object({
799
+ type: z3.literal("content_block_stop"),
800
+ index: z3.number()
715
801
  }),
716
- z2.object({
717
- type: z2.literal("error"),
718
- error: z2.object({
719
- type: z2.string(),
720
- message: z2.string()
802
+ z3.object({
803
+ type: z3.literal("error"),
804
+ error: z3.object({
805
+ type: z3.string(),
806
+ message: z3.string()
721
807
  })
722
808
  }),
723
- z2.object({
724
- type: z2.literal("message_delta"),
725
- delta: z2.object({
726
- stop_reason: z2.string().nullish(),
727
- stop_sequence: z2.string().nullish(),
728
- container: z2.object({
729
- expires_at: z2.string(),
730
- id: z2.string(),
731
- skills: z2.array(
732
- z2.object({
733
- type: z2.union([
734
- z2.literal("anthropic"),
735
- z2.literal("custom")
809
+ z3.object({
810
+ type: z3.literal("message_delta"),
811
+ delta: z3.object({
812
+ stop_reason: z3.string().nullish(),
813
+ stop_sequence: z3.string().nullish(),
814
+ container: z3.object({
815
+ expires_at: z3.string(),
816
+ id: z3.string(),
817
+ skills: z3.array(
818
+ z3.object({
819
+ type: z3.union([
820
+ z3.literal("anthropic"),
821
+ z3.literal("custom")
736
822
  ]),
737
- skill_id: z2.string(),
738
- version: z2.string()
823
+ skill_id: z3.string(),
824
+ version: z3.string()
739
825
  })
740
826
  ).nullish()
741
827
  }).nullish()
742
828
  }),
743
- usage: z2.looseObject({
744
- input_tokens: z2.number().nullish(),
745
- output_tokens: z2.number(),
746
- cache_creation_input_tokens: z2.number().nullish(),
747
- cache_read_input_tokens: z2.number().nullish(),
748
- iterations: z2.array(
749
- z2.object({
750
- type: z2.union([z2.literal("compaction"), z2.literal("message")]),
751
- input_tokens: z2.number(),
752
- output_tokens: z2.number()
829
+ usage: z3.looseObject({
830
+ input_tokens: z3.number().nullish(),
831
+ output_tokens: z3.number(),
832
+ cache_creation_input_tokens: z3.number().nullish(),
833
+ cache_read_input_tokens: z3.number().nullish(),
834
+ iterations: z3.array(
835
+ z3.object({
836
+ type: z3.union([z3.literal("compaction"), z3.literal("message")]),
837
+ input_tokens: z3.number(),
838
+ output_tokens: z3.number()
753
839
  })
754
840
  ).nullish()
755
841
  }),
756
- context_management: z2.object({
757
- applied_edits: z2.array(
758
- z2.union([
759
- z2.object({
760
- type: z2.literal("clear_tool_uses_20250919"),
761
- cleared_tool_uses: z2.number(),
762
- cleared_input_tokens: z2.number()
842
+ context_management: z3.object({
843
+ applied_edits: z3.array(
844
+ z3.union([
845
+ z3.object({
846
+ type: z3.literal("clear_tool_uses_20250919"),
847
+ cleared_tool_uses: z3.number(),
848
+ cleared_input_tokens: z3.number()
763
849
  }),
764
- z2.object({
765
- type: z2.literal("clear_thinking_20251015"),
766
- cleared_thinking_turns: z2.number(),
767
- cleared_input_tokens: z2.number()
850
+ z3.object({
851
+ type: z3.literal("clear_thinking_20251015"),
852
+ cleared_thinking_turns: z3.number(),
853
+ cleared_input_tokens: z3.number()
768
854
  }),
769
- z2.object({
770
- type: z2.literal("compact_20260112")
855
+ z3.object({
856
+ type: z3.literal("compact_20260112")
771
857
  })
772
858
  ])
773
859
  )
774
860
  }).nullish()
775
861
  }),
776
- z2.object({
777
- type: z2.literal("message_stop")
862
+ z3.object({
863
+ type: z3.literal("message_stop")
778
864
  }),
779
- z2.object({
780
- type: z2.literal("ping")
865
+ z3.object({
866
+ type: z3.literal("ping")
781
867
  })
782
868
  ])
783
869
  )
784
870
  );
785
- var anthropicReasoningMetadataSchema = lazySchema2(
786
- () => zodSchema2(
787
- z2.object({
788
- signature: z2.string().optional(),
789
- redactedData: z2.string().optional()
871
+ var anthropicReasoningMetadataSchema = lazySchema3(
872
+ () => zodSchema3(
873
+ z3.object({
874
+ signature: z3.string().optional(),
875
+ redactedData: z3.string().optional()
790
876
  })
791
877
  )
792
878
  );
793
879
 
794
880
  // src/anthropic-messages-options.ts
795
- import { z as z3 } from "zod/v4";
796
- var anthropicFilePartProviderOptions = z3.object({
881
+ import { z as z4 } from "zod/v4";
882
+ var anthropicFilePartProviderOptions = z4.object({
797
883
  /**
798
884
  * Citation configuration for this document.
799
885
  * When enabled, this document will generate citations in the response.
800
886
  */
801
- citations: z3.object({
887
+ citations: z4.object({
802
888
  /**
803
889
  * Enable citations for this document
804
890
  */
805
- enabled: z3.boolean()
891
+ enabled: z4.boolean()
806
892
  }).optional(),
807
893
  /**
808
894
  * Custom title for the document.
809
895
  * If not provided, the filename will be used.
810
896
  */
811
- title: z3.string().optional(),
897
+ title: z4.string().optional(),
812
898
  /**
813
899
  * Context about the document that will be passed to the model
814
900
  * but not used towards cited content.
815
901
  * Useful for storing document metadata as text or stringified JSON.
816
902
  */
817
- context: z3.string().optional()
903
+ context: z4.string().optional()
818
904
  });
819
- var anthropicLanguageModelOptions = z3.object({
905
+ var anthropicLanguageModelOptions = z4.object({
820
906
  /**
821
907
  * Whether to send reasoning to the model.
822
908
  *
823
909
  * This allows you to deactivate reasoning inputs for models that do not support them.
824
910
  */
825
- sendReasoning: z3.boolean().optional(),
911
+ sendReasoning: z4.boolean().optional(),
826
912
  /**
827
913
  * Determines how structured outputs are generated.
828
914
  *
@@ -830,52 +916,66 @@ var anthropicLanguageModelOptions = z3.object({
830
916
  * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
831
917
  * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
832
918
  */
833
- structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
919
+ structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional(),
834
920
  /**
835
921
  * Configuration for enabling Claude's extended thinking.
836
922
  *
837
923
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
838
924
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
839
925
  */
840
- thinking: z3.discriminatedUnion("type", [
841
- z3.object({
926
+ thinking: z4.discriminatedUnion("type", [
927
+ z4.object({
842
928
  /** for Sonnet 4.6, Opus 4.6, and newer models */
843
- type: z3.literal("adaptive")
929
+ type: z4.literal("adaptive")
844
930
  }),
845
- z3.object({
931
+ z4.object({
846
932
  /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
847
- type: z3.literal("enabled"),
848
- budgetTokens: z3.number().optional()
933
+ type: z4.literal("enabled"),
934
+ budgetTokens: z4.number().optional()
849
935
  }),
850
- z3.object({
851
- type: z3.literal("disabled")
936
+ z4.object({
937
+ type: z4.literal("disabled")
852
938
  })
853
939
  ]).optional(),
854
940
  /**
855
941
  * Whether to disable parallel function calling during tool use. Default is false.
856
942
  * When set to true, Claude will use at most one tool per response.
857
943
  */
858
- disableParallelToolUse: z3.boolean().optional(),
944
+ disableParallelToolUse: z4.boolean().optional(),
859
945
  /**
860
946
  * Cache control settings for this message.
861
947
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
862
948
  */
863
- cacheControl: z3.object({
864
- type: z3.literal("ephemeral"),
865
- ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
949
+ cacheControl: z4.object({
950
+ type: z4.literal("ephemeral"),
951
+ ttl: z4.union([z4.literal("5m"), z4.literal("1h")]).optional()
952
+ }).optional(),
953
+ /**
954
+ * Metadata to include with the request.
955
+ *
956
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
957
+ */
958
+ metadata: z4.object({
959
+ /**
960
+ * An external identifier for the user associated with the request.
961
+ *
962
+ * Should be a UUID, hash value, or other opaque identifier.
963
+ * Must not contain PII (name, email, phone number, etc.).
964
+ */
965
+ userId: z4.string().optional()
866
966
  }).optional(),
867
967
  /**
868
968
  * MCP servers to be utilized in this request.
869
969
  */
870
- mcpServers: z3.array(
871
- z3.object({
872
- type: z3.literal("url"),
873
- name: z3.string(),
874
- url: z3.string(),
875
- authorizationToken: z3.string().nullish(),
876
- toolConfiguration: z3.object({
877
- enabled: z3.boolean().nullish(),
878
- allowedTools: z3.array(z3.string()).nullish()
970
+ mcpServers: z4.array(
971
+ z4.object({
972
+ type: z4.literal("url"),
973
+ name: z4.string(),
974
+ url: z4.string(),
975
+ authorizationToken: z4.string().nullish(),
976
+ toolConfiguration: z4.object({
977
+ enabled: z4.boolean().nullish(),
978
+ allowedTools: z4.array(z4.string()).nullish()
879
979
  }).nullish()
880
980
  })
881
981
  ).optional(),
@@ -884,14 +984,21 @@ var anthropicLanguageModelOptions = z3.object({
884
984
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
885
985
  * Requires code execution tool to be enabled.
886
986
  */
887
- container: z3.object({
888
- id: z3.string().optional(),
889
- skills: z3.array(
890
- z3.object({
891
- type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
892
- skillId: z3.string(),
893
- version: z3.string().optional()
894
- })
987
+ container: z4.object({
988
+ id: z4.string().optional(),
989
+ skills: z4.array(
990
+ z4.discriminatedUnion("type", [
991
+ z4.object({
992
+ type: z4.literal("anthropic"),
993
+ skillId: z4.string(),
994
+ version: z4.string().optional()
995
+ }),
996
+ z4.object({
997
+ type: z4.literal("custom"),
998
+ providerReference: z4.record(z4.string(), z4.string()),
999
+ version: z4.string().optional()
1000
+ })
1001
+ ])
895
1002
  ).optional()
896
1003
  }).optional(),
897
1004
  /**
@@ -902,65 +1009,65 @@ var anthropicLanguageModelOptions = z3.object({
902
1009
  *
903
1010
  * @default true
904
1011
  */
905
- toolStreaming: z3.boolean().optional(),
1012
+ toolStreaming: z4.boolean().optional(),
906
1013
  /**
907
1014
  * @default 'high'
908
1015
  */
909
- effort: z3.enum(["low", "medium", "high", "max"]).optional(),
1016
+ effort: z4.enum(["low", "medium", "high", "max"]).optional(),
910
1017
  /**
911
1018
  * Enable fast mode for faster inference (2.5x faster output token speeds).
912
1019
  * Only supported with claude-opus-4-6.
913
1020
  */
914
- speed: z3.enum(["fast", "standard"]).optional(),
1021
+ speed: z4.enum(["fast", "standard"]).optional(),
915
1022
  /**
916
1023
  * A set of beta features to enable.
917
1024
  * Allow a provider to receive the full `betas` set if it needs it.
918
1025
  */
919
- anthropicBeta: z3.array(z3.string()).optional(),
920
- contextManagement: z3.object({
921
- edits: z3.array(
922
- z3.discriminatedUnion("type", [
923
- z3.object({
924
- type: z3.literal("clear_tool_uses_20250919"),
925
- trigger: z3.discriminatedUnion("type", [
926
- z3.object({
927
- type: z3.literal("input_tokens"),
928
- value: z3.number()
1026
+ anthropicBeta: z4.array(z4.string()).optional(),
1027
+ contextManagement: z4.object({
1028
+ edits: z4.array(
1029
+ z4.discriminatedUnion("type", [
1030
+ z4.object({
1031
+ type: z4.literal("clear_tool_uses_20250919"),
1032
+ trigger: z4.discriminatedUnion("type", [
1033
+ z4.object({
1034
+ type: z4.literal("input_tokens"),
1035
+ value: z4.number()
929
1036
  }),
930
- z3.object({
931
- type: z3.literal("tool_uses"),
932
- value: z3.number()
1037
+ z4.object({
1038
+ type: z4.literal("tool_uses"),
1039
+ value: z4.number()
933
1040
  })
934
1041
  ]).optional(),
935
- keep: z3.object({
936
- type: z3.literal("tool_uses"),
937
- value: z3.number()
1042
+ keep: z4.object({
1043
+ type: z4.literal("tool_uses"),
1044
+ value: z4.number()
938
1045
  }).optional(),
939
- clearAtLeast: z3.object({
940
- type: z3.literal("input_tokens"),
941
- value: z3.number()
1046
+ clearAtLeast: z4.object({
1047
+ type: z4.literal("input_tokens"),
1048
+ value: z4.number()
942
1049
  }).optional(),
943
- clearToolInputs: z3.boolean().optional(),
944
- excludeTools: z3.array(z3.string()).optional()
1050
+ clearToolInputs: z4.boolean().optional(),
1051
+ excludeTools: z4.array(z4.string()).optional()
945
1052
  }),
946
- z3.object({
947
- type: z3.literal("clear_thinking_20251015"),
948
- keep: z3.union([
949
- z3.literal("all"),
950
- z3.object({
951
- type: z3.literal("thinking_turns"),
952
- value: z3.number()
1053
+ z4.object({
1054
+ type: z4.literal("clear_thinking_20251015"),
1055
+ keep: z4.union([
1056
+ z4.literal("all"),
1057
+ z4.object({
1058
+ type: z4.literal("thinking_turns"),
1059
+ value: z4.number()
953
1060
  })
954
1061
  ]).optional()
955
1062
  }),
956
- z3.object({
957
- type: z3.literal("compact_20260112"),
958
- trigger: z3.object({
959
- type: z3.literal("input_tokens"),
960
- value: z3.number()
1063
+ z4.object({
1064
+ type: z4.literal("compact_20260112"),
1065
+ trigger: z4.object({
1066
+ type: z4.literal("input_tokens"),
1067
+ value: z4.number()
961
1068
  }).optional(),
962
- pauseAfterCompaction: z3.boolean().optional(),
963
- instructions: z3.string().optional()
1069
+ pauseAfterCompaction: z4.boolean().optional(),
1070
+ instructions: z4.string().optional()
964
1071
  })
965
1072
  ])
966
1073
  )
@@ -1016,26 +1123,26 @@ var CacheControlValidator = class {
1016
1123
 
1017
1124
  // src/tool/text-editor_20250728.ts
1018
1125
  import { createProviderToolFactory } from "@ai-sdk/provider-utils";
1019
- import { z as z4 } from "zod/v4";
1020
- import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
1021
- var textEditor_20250728ArgsSchema = lazySchema3(
1022
- () => zodSchema3(
1023
- z4.object({
1024
- maxCharacters: z4.number().optional()
1126
+ import { z as z5 } from "zod/v4";
1127
+ import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
1128
+ var textEditor_20250728ArgsSchema = lazySchema4(
1129
+ () => zodSchema4(
1130
+ z5.object({
1131
+ maxCharacters: z5.number().optional()
1025
1132
  })
1026
1133
  )
1027
1134
  );
1028
- var textEditor_20250728InputSchema = lazySchema3(
1029
- () => zodSchema3(
1030
- z4.object({
1031
- command: z4.enum(["view", "create", "str_replace", "insert"]),
1032
- path: z4.string(),
1033
- file_text: z4.string().optional(),
1034
- insert_line: z4.number().int().optional(),
1035
- new_str: z4.string().optional(),
1036
- insert_text: z4.string().optional(),
1037
- old_str: z4.string().optional(),
1038
- view_range: z4.array(z4.number().int()).optional()
1135
+ var textEditor_20250728InputSchema = lazySchema4(
1136
+ () => zodSchema4(
1137
+ z5.object({
1138
+ command: z5.enum(["view", "create", "str_replace", "insert"]),
1139
+ path: z5.string(),
1140
+ file_text: z5.string().optional(),
1141
+ insert_line: z5.number().int().optional(),
1142
+ new_str: z5.string().optional(),
1143
+ insert_text: z5.string().optional(),
1144
+ old_str: z5.string().optional(),
1145
+ view_range: z5.array(z5.number().int()).optional()
1039
1146
  })
1040
1147
  )
1041
1148
  );
@@ -1050,64 +1157,11 @@ var textEditor_20250728 = (args = {}) => {
1050
1157
  // src/tool/web-search_20260209.ts
1051
1158
  import {
1052
1159
  createProviderToolFactoryWithOutputSchema,
1053
- lazySchema as lazySchema4,
1054
- zodSchema as zodSchema4
1055
- } from "@ai-sdk/provider-utils";
1056
- import { z as z5 } from "zod/v4";
1057
- var webSearch_20260209ArgsSchema = lazySchema4(
1058
- () => zodSchema4(
1059
- z5.object({
1060
- maxUses: z5.number().optional(),
1061
- allowedDomains: z5.array(z5.string()).optional(),
1062
- blockedDomains: z5.array(z5.string()).optional(),
1063
- userLocation: z5.object({
1064
- type: z5.literal("approximate"),
1065
- city: z5.string().optional(),
1066
- region: z5.string().optional(),
1067
- country: z5.string().optional(),
1068
- timezone: z5.string().optional()
1069
- }).optional()
1070
- })
1071
- )
1072
- );
1073
- var webSearch_20260209OutputSchema = lazySchema4(
1074
- () => zodSchema4(
1075
- z5.array(
1076
- z5.object({
1077
- url: z5.string(),
1078
- title: z5.string().nullable(),
1079
- pageAge: z5.string().nullable(),
1080
- encryptedContent: z5.string(),
1081
- type: z5.literal("web_search_result")
1082
- })
1083
- )
1084
- )
1085
- );
1086
- var webSearch_20260209InputSchema = lazySchema4(
1087
- () => zodSchema4(
1088
- z5.object({
1089
- query: z5.string()
1090
- })
1091
- )
1092
- );
1093
- var factory2 = createProviderToolFactoryWithOutputSchema({
1094
- id: "anthropic.web_search_20260209",
1095
- inputSchema: webSearch_20260209InputSchema,
1096
- outputSchema: webSearch_20260209OutputSchema,
1097
- supportsDeferredResults: true
1098
- });
1099
- var webSearch_20260209 = (args = {}) => {
1100
- return factory2(args);
1101
- };
1102
-
1103
- // src/tool/web-search_20250305.ts
1104
- import {
1105
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1106
1160
  lazySchema as lazySchema5,
1107
1161
  zodSchema as zodSchema5
1108
1162
  } from "@ai-sdk/provider-utils";
1109
1163
  import { z as z6 } from "zod/v4";
1110
- var webSearch_20250305ArgsSchema = lazySchema5(
1164
+ var webSearch_20260209ArgsSchema = lazySchema5(
1111
1165
  () => zodSchema5(
1112
1166
  z6.object({
1113
1167
  maxUses: z6.number().optional(),
@@ -1123,7 +1177,7 @@ var webSearch_20250305ArgsSchema = lazySchema5(
1123
1177
  })
1124
1178
  )
1125
1179
  );
1126
- var webSearch_20250305OutputSchema = lazySchema5(
1180
+ var webSearch_20260209OutputSchema = lazySchema5(
1127
1181
  () => zodSchema5(
1128
1182
  z6.array(
1129
1183
  z6.object({
@@ -1136,92 +1190,84 @@ var webSearch_20250305OutputSchema = lazySchema5(
1136
1190
  )
1137
1191
  )
1138
1192
  );
1139
- var webSearch_20250305InputSchema = lazySchema5(
1193
+ var webSearch_20260209InputSchema = lazySchema5(
1140
1194
  () => zodSchema5(
1141
1195
  z6.object({
1142
1196
  query: z6.string()
1143
1197
  })
1144
1198
  )
1145
1199
  );
1146
- var factory3 = createProviderToolFactoryWithOutputSchema2({
1147
- id: "anthropic.web_search_20250305",
1148
- inputSchema: webSearch_20250305InputSchema,
1149
- outputSchema: webSearch_20250305OutputSchema,
1200
+ var factory2 = createProviderToolFactoryWithOutputSchema({
1201
+ id: "anthropic.web_search_20260209",
1202
+ inputSchema: webSearch_20260209InputSchema,
1203
+ outputSchema: webSearch_20260209OutputSchema,
1150
1204
  supportsDeferredResults: true
1151
1205
  });
1152
- var webSearch_20250305 = (args = {}) => {
1153
- return factory3(args);
1206
+ var webSearch_20260209 = (args = {}) => {
1207
+ return factory2(args);
1154
1208
  };
1155
1209
 
1156
- // src/tool/web-fetch-20260209.ts
1210
+ // src/tool/web-search_20250305.ts
1157
1211
  import {
1158
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1212
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1159
1213
  lazySchema as lazySchema6,
1160
1214
  zodSchema as zodSchema6
1161
1215
  } from "@ai-sdk/provider-utils";
1162
1216
  import { z as z7 } from "zod/v4";
1163
- var webFetch_20260209ArgsSchema = lazySchema6(
1217
+ var webSearch_20250305ArgsSchema = lazySchema6(
1164
1218
  () => zodSchema6(
1165
1219
  z7.object({
1166
1220
  maxUses: z7.number().optional(),
1167
1221
  allowedDomains: z7.array(z7.string()).optional(),
1168
1222
  blockedDomains: z7.array(z7.string()).optional(),
1169
- citations: z7.object({ enabled: z7.boolean() }).optional(),
1170
- maxContentTokens: z7.number().optional()
1223
+ userLocation: z7.object({
1224
+ type: z7.literal("approximate"),
1225
+ city: z7.string().optional(),
1226
+ region: z7.string().optional(),
1227
+ country: z7.string().optional(),
1228
+ timezone: z7.string().optional()
1229
+ }).optional()
1171
1230
  })
1172
1231
  )
1173
1232
  );
1174
- var webFetch_20260209OutputSchema = lazySchema6(
1233
+ var webSearch_20250305OutputSchema = lazySchema6(
1175
1234
  () => zodSchema6(
1176
- z7.object({
1177
- type: z7.literal("web_fetch_result"),
1178
- url: z7.string(),
1179
- content: z7.object({
1180
- type: z7.literal("document"),
1235
+ z7.array(
1236
+ z7.object({
1237
+ url: z7.string(),
1181
1238
  title: z7.string().nullable(),
1182
- citations: z7.object({ enabled: z7.boolean() }).optional(),
1183
- source: z7.union([
1184
- z7.object({
1185
- type: z7.literal("base64"),
1186
- mediaType: z7.literal("application/pdf"),
1187
- data: z7.string()
1188
- }),
1189
- z7.object({
1190
- type: z7.literal("text"),
1191
- mediaType: z7.literal("text/plain"),
1192
- data: z7.string()
1193
- })
1194
- ])
1195
- }),
1196
- retrievedAt: z7.string().nullable()
1197
- })
1239
+ pageAge: z7.string().nullable(),
1240
+ encryptedContent: z7.string(),
1241
+ type: z7.literal("web_search_result")
1242
+ })
1243
+ )
1198
1244
  )
1199
1245
  );
1200
- var webFetch_20260209InputSchema = lazySchema6(
1246
+ var webSearch_20250305InputSchema = lazySchema6(
1201
1247
  () => zodSchema6(
1202
1248
  z7.object({
1203
- url: z7.string()
1249
+ query: z7.string()
1204
1250
  })
1205
1251
  )
1206
1252
  );
1207
- var factory4 = createProviderToolFactoryWithOutputSchema3({
1208
- id: "anthropic.web_fetch_20260209",
1209
- inputSchema: webFetch_20260209InputSchema,
1210
- outputSchema: webFetch_20260209OutputSchema,
1253
+ var factory3 = createProviderToolFactoryWithOutputSchema2({
1254
+ id: "anthropic.web_search_20250305",
1255
+ inputSchema: webSearch_20250305InputSchema,
1256
+ outputSchema: webSearch_20250305OutputSchema,
1211
1257
  supportsDeferredResults: true
1212
1258
  });
1213
- var webFetch_20260209 = (args = {}) => {
1214
- return factory4(args);
1259
+ var webSearch_20250305 = (args = {}) => {
1260
+ return factory3(args);
1215
1261
  };
1216
1262
 
1217
- // src/tool/web-fetch-20250910.ts
1263
+ // src/tool/web-fetch-20260209.ts
1218
1264
  import {
1219
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1265
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1220
1266
  lazySchema as lazySchema7,
1221
1267
  zodSchema as zodSchema7
1222
1268
  } from "@ai-sdk/provider-utils";
1223
1269
  import { z as z8 } from "zod/v4";
1224
- var webFetch_20250910ArgsSchema = lazySchema7(
1270
+ var webFetch_20260209ArgsSchema = lazySchema7(
1225
1271
  () => zodSchema7(
1226
1272
  z8.object({
1227
1273
  maxUses: z8.number().optional(),
@@ -1232,7 +1278,7 @@ var webFetch_20250910ArgsSchema = lazySchema7(
1232
1278
  })
1233
1279
  )
1234
1280
  );
1235
- var webFetch_20250910OutputSchema = lazySchema7(
1281
+ var webFetch_20260209OutputSchema = lazySchema7(
1236
1282
  () => zodSchema7(
1237
1283
  z8.object({
1238
1284
  type: z8.literal("web_fetch_result"),
@@ -1258,13 +1304,74 @@ var webFetch_20250910OutputSchema = lazySchema7(
1258
1304
  })
1259
1305
  )
1260
1306
  );
1261
- var webFetch_20250910InputSchema = lazySchema7(
1307
+ var webFetch_20260209InputSchema = lazySchema7(
1262
1308
  () => zodSchema7(
1263
1309
  z8.object({
1264
1310
  url: z8.string()
1265
1311
  })
1266
1312
  )
1267
1313
  );
1314
+ var factory4 = createProviderToolFactoryWithOutputSchema3({
1315
+ id: "anthropic.web_fetch_20260209",
1316
+ inputSchema: webFetch_20260209InputSchema,
1317
+ outputSchema: webFetch_20260209OutputSchema,
1318
+ supportsDeferredResults: true
1319
+ });
1320
+ var webFetch_20260209 = (args = {}) => {
1321
+ return factory4(args);
1322
+ };
1323
+
1324
+ // src/tool/web-fetch-20250910.ts
1325
+ import {
1326
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1327
+ lazySchema as lazySchema8,
1328
+ zodSchema as zodSchema8
1329
+ } from "@ai-sdk/provider-utils";
1330
+ import { z as z9 } from "zod/v4";
1331
+ var webFetch_20250910ArgsSchema = lazySchema8(
1332
+ () => zodSchema8(
1333
+ z9.object({
1334
+ maxUses: z9.number().optional(),
1335
+ allowedDomains: z9.array(z9.string()).optional(),
1336
+ blockedDomains: z9.array(z9.string()).optional(),
1337
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1338
+ maxContentTokens: z9.number().optional()
1339
+ })
1340
+ )
1341
+ );
1342
+ var webFetch_20250910OutputSchema = lazySchema8(
1343
+ () => zodSchema8(
1344
+ z9.object({
1345
+ type: z9.literal("web_fetch_result"),
1346
+ url: z9.string(),
1347
+ content: z9.object({
1348
+ type: z9.literal("document"),
1349
+ title: z9.string().nullable(),
1350
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1351
+ source: z9.union([
1352
+ z9.object({
1353
+ type: z9.literal("base64"),
1354
+ mediaType: z9.literal("application/pdf"),
1355
+ data: z9.string()
1356
+ }),
1357
+ z9.object({
1358
+ type: z9.literal("text"),
1359
+ mediaType: z9.literal("text/plain"),
1360
+ data: z9.string()
1361
+ })
1362
+ ])
1363
+ }),
1364
+ retrievedAt: z9.string().nullable()
1365
+ })
1366
+ )
1367
+ );
1368
+ var webFetch_20250910InputSchema = lazySchema8(
1369
+ () => zodSchema8(
1370
+ z9.object({
1371
+ url: z9.string()
1372
+ })
1373
+ )
1374
+ );
1268
1375
  var factory5 = createProviderToolFactoryWithOutputSchema4({
1269
1376
  id: "anthropic.web_fetch_20250910",
1270
1377
  inputSchema: webFetch_20250910InputSchema,
@@ -1282,7 +1389,8 @@ async function prepareTools({
1282
1389
  toolChoice,
1283
1390
  disableParallelToolUse,
1284
1391
  cacheControlValidator,
1285
- supportsStructuredOutput
1392
+ supportsStructuredOutput,
1393
+ supportsStrictTools
1286
1394
  }) {
1287
1395
  var _a;
1288
1396
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1304,13 +1412,20 @@ async function prepareTools({
1304
1412
  const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1305
1413
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1306
1414
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1415
+ if (!supportsStrictTools && tool.strict != null) {
1416
+ toolWarnings.push({
1417
+ type: "unsupported",
1418
+ feature: "strict",
1419
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1420
+ });
1421
+ }
1307
1422
  anthropicTools2.push({
1308
1423
  name: tool.name,
1309
1424
  description: tool.description,
1310
1425
  input_schema: tool.inputSchema,
1311
1426
  cache_control: cacheControl,
1312
1427
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1313
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1428
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1314
1429
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1315
1430
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1316
1431
  ...tool.inputExamples != null ? {
@@ -1526,7 +1641,6 @@ async function prepareTools({
1526
1641
  break;
1527
1642
  }
1528
1643
  case "anthropic.tool_search_regex_20251119": {
1529
- betas.add("advanced-tool-use-2025-11-20");
1530
1644
  anthropicTools2.push({
1531
1645
  type: "tool_search_tool_regex_20251119",
1532
1646
  name: "tool_search_tool_regex"
@@ -1534,7 +1648,6 @@ async function prepareTools({
1534
1648
  break;
1535
1649
  }
1536
1650
  case "anthropic.tool_search_bm25_20251119": {
1537
- betas.add("advanced-tool-use-2025-11-20");
1538
1651
  anthropicTools2.push({
1539
1652
  type: "tool_search_tool_bm25_20251119",
1540
1653
  name: "tool_search_tool_bm25"
@@ -1657,9 +1770,11 @@ import {
1657
1770
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1658
1771
  } from "@ai-sdk/provider";
1659
1772
  import {
1660
- convertBase64ToUint8Array,
1773
+ convertBase64ToUint8Array as convertBase64ToUint8Array2,
1661
1774
  convertToBase64,
1662
- parseProviderOptions,
1775
+ isProviderReference,
1776
+ parseProviderOptions as parseProviderOptions2,
1777
+ resolveProviderReference,
1663
1778
  validateTypes as validateTypes2,
1664
1779
  isNonNullable
1665
1780
  } from "@ai-sdk/provider-utils";
@@ -1667,30 +1782,30 @@ import {
1667
1782
  // src/tool/code-execution_20250522.ts
1668
1783
  import {
1669
1784
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1670
- lazySchema as lazySchema8,
1671
- zodSchema as zodSchema8
1785
+ lazySchema as lazySchema9,
1786
+ zodSchema as zodSchema9
1672
1787
  } from "@ai-sdk/provider-utils";
1673
- import { z as z9 } from "zod/v4";
1674
- var codeExecution_20250522OutputSchema = lazySchema8(
1675
- () => zodSchema8(
1676
- z9.object({
1677
- type: z9.literal("code_execution_result"),
1678
- stdout: z9.string(),
1679
- stderr: z9.string(),
1680
- return_code: z9.number(),
1681
- content: z9.array(
1682
- z9.object({
1683
- type: z9.literal("code_execution_output"),
1684
- file_id: z9.string()
1788
+ import { z as z10 } from "zod/v4";
1789
+ var codeExecution_20250522OutputSchema = lazySchema9(
1790
+ () => zodSchema9(
1791
+ z10.object({
1792
+ type: z10.literal("code_execution_result"),
1793
+ stdout: z10.string(),
1794
+ stderr: z10.string(),
1795
+ return_code: z10.number(),
1796
+ content: z10.array(
1797
+ z10.object({
1798
+ type: z10.literal("code_execution_output"),
1799
+ file_id: z10.string()
1685
1800
  })
1686
1801
  ).optional().default([])
1687
1802
  })
1688
1803
  )
1689
1804
  );
1690
- var codeExecution_20250522InputSchema = lazySchema8(
1691
- () => zodSchema8(
1692
- z9.object({
1693
- code: z9.string()
1805
+ var codeExecution_20250522InputSchema = lazySchema9(
1806
+ () => zodSchema9(
1807
+ z10.object({
1808
+ code: z10.string()
1694
1809
  })
1695
1810
  )
1696
1811
  );
@@ -1706,98 +1821,98 @@ var codeExecution_20250522 = (args = {}) => {
1706
1821
  // src/tool/code-execution_20250825.ts
1707
1822
  import {
1708
1823
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1709
- lazySchema as lazySchema9,
1710
- zodSchema as zodSchema9
1824
+ lazySchema as lazySchema10,
1825
+ zodSchema as zodSchema10
1711
1826
  } from "@ai-sdk/provider-utils";
1712
- import { z as z10 } from "zod/v4";
1713
- var codeExecution_20250825OutputSchema = lazySchema9(
1714
- () => zodSchema9(
1715
- z10.discriminatedUnion("type", [
1716
- z10.object({
1717
- type: z10.literal("code_execution_result"),
1718
- stdout: z10.string(),
1719
- stderr: z10.string(),
1720
- return_code: z10.number(),
1721
- content: z10.array(
1722
- z10.object({
1723
- type: z10.literal("code_execution_output"),
1724
- file_id: z10.string()
1827
+ import { z as z11 } from "zod/v4";
1828
+ var codeExecution_20250825OutputSchema = lazySchema10(
1829
+ () => zodSchema10(
1830
+ z11.discriminatedUnion("type", [
1831
+ z11.object({
1832
+ type: z11.literal("code_execution_result"),
1833
+ stdout: z11.string(),
1834
+ stderr: z11.string(),
1835
+ return_code: z11.number(),
1836
+ content: z11.array(
1837
+ z11.object({
1838
+ type: z11.literal("code_execution_output"),
1839
+ file_id: z11.string()
1725
1840
  })
1726
1841
  ).optional().default([])
1727
1842
  }),
1728
- z10.object({
1729
- type: z10.literal("bash_code_execution_result"),
1730
- content: z10.array(
1731
- z10.object({
1732
- type: z10.literal("bash_code_execution_output"),
1733
- file_id: z10.string()
1843
+ z11.object({
1844
+ type: z11.literal("bash_code_execution_result"),
1845
+ content: z11.array(
1846
+ z11.object({
1847
+ type: z11.literal("bash_code_execution_output"),
1848
+ file_id: z11.string()
1734
1849
  })
1735
1850
  ),
1736
- stdout: z10.string(),
1737
- stderr: z10.string(),
1738
- return_code: z10.number()
1851
+ stdout: z11.string(),
1852
+ stderr: z11.string(),
1853
+ return_code: z11.number()
1739
1854
  }),
1740
- z10.object({
1741
- type: z10.literal("bash_code_execution_tool_result_error"),
1742
- error_code: z10.string()
1855
+ z11.object({
1856
+ type: z11.literal("bash_code_execution_tool_result_error"),
1857
+ error_code: z11.string()
1743
1858
  }),
1744
- z10.object({
1745
- type: z10.literal("text_editor_code_execution_tool_result_error"),
1746
- error_code: z10.string()
1859
+ z11.object({
1860
+ type: z11.literal("text_editor_code_execution_tool_result_error"),
1861
+ error_code: z11.string()
1747
1862
  }),
1748
- z10.object({
1749
- type: z10.literal("text_editor_code_execution_view_result"),
1750
- content: z10.string(),
1751
- file_type: z10.string(),
1752
- num_lines: z10.number().nullable(),
1753
- start_line: z10.number().nullable(),
1754
- total_lines: z10.number().nullable()
1863
+ z11.object({
1864
+ type: z11.literal("text_editor_code_execution_view_result"),
1865
+ content: z11.string(),
1866
+ file_type: z11.string(),
1867
+ num_lines: z11.number().nullable(),
1868
+ start_line: z11.number().nullable(),
1869
+ total_lines: z11.number().nullable()
1755
1870
  }),
1756
- z10.object({
1757
- type: z10.literal("text_editor_code_execution_create_result"),
1758
- is_file_update: z10.boolean()
1871
+ z11.object({
1872
+ type: z11.literal("text_editor_code_execution_create_result"),
1873
+ is_file_update: z11.boolean()
1759
1874
  }),
1760
- z10.object({
1761
- type: z10.literal("text_editor_code_execution_str_replace_result"),
1762
- lines: z10.array(z10.string()).nullable(),
1763
- new_lines: z10.number().nullable(),
1764
- new_start: z10.number().nullable(),
1765
- old_lines: z10.number().nullable(),
1766
- old_start: z10.number().nullable()
1875
+ z11.object({
1876
+ type: z11.literal("text_editor_code_execution_str_replace_result"),
1877
+ lines: z11.array(z11.string()).nullable(),
1878
+ new_lines: z11.number().nullable(),
1879
+ new_start: z11.number().nullable(),
1880
+ old_lines: z11.number().nullable(),
1881
+ old_start: z11.number().nullable()
1767
1882
  })
1768
1883
  ])
1769
1884
  )
1770
1885
  );
1771
- var codeExecution_20250825InputSchema = lazySchema9(
1772
- () => zodSchema9(
1773
- z10.discriminatedUnion("type", [
1886
+ var codeExecution_20250825InputSchema = lazySchema10(
1887
+ () => zodSchema10(
1888
+ z11.discriminatedUnion("type", [
1774
1889
  // Programmatic tool calling format (mapped from { code } by AI SDK)
1775
- z10.object({
1776
- type: z10.literal("programmatic-tool-call"),
1777
- code: z10.string()
1890
+ z11.object({
1891
+ type: z11.literal("programmatic-tool-call"),
1892
+ code: z11.string()
1778
1893
  }),
1779
- z10.object({
1780
- type: z10.literal("bash_code_execution"),
1781
- command: z10.string()
1894
+ z11.object({
1895
+ type: z11.literal("bash_code_execution"),
1896
+ command: z11.string()
1782
1897
  }),
1783
- z10.discriminatedUnion("command", [
1784
- z10.object({
1785
- type: z10.literal("text_editor_code_execution"),
1786
- command: z10.literal("view"),
1787
- path: z10.string()
1898
+ z11.discriminatedUnion("command", [
1899
+ z11.object({
1900
+ type: z11.literal("text_editor_code_execution"),
1901
+ command: z11.literal("view"),
1902
+ path: z11.string()
1788
1903
  }),
1789
- z10.object({
1790
- type: z10.literal("text_editor_code_execution"),
1791
- command: z10.literal("create"),
1792
- path: z10.string(),
1793
- file_text: z10.string().nullish()
1904
+ z11.object({
1905
+ type: z11.literal("text_editor_code_execution"),
1906
+ command: z11.literal("create"),
1907
+ path: z11.string(),
1908
+ file_text: z11.string().nullish()
1794
1909
  }),
1795
- z10.object({
1796
- type: z10.literal("text_editor_code_execution"),
1797
- command: z10.literal("str_replace"),
1798
- path: z10.string(),
1799
- old_str: z10.string(),
1800
- new_str: z10.string()
1910
+ z11.object({
1911
+ type: z11.literal("text_editor_code_execution"),
1912
+ command: z11.literal("str_replace"),
1913
+ path: z11.string(),
1914
+ old_str: z11.string(),
1915
+ new_str: z11.string()
1801
1916
  })
1802
1917
  ])
1803
1918
  ])
@@ -1819,109 +1934,109 @@ var codeExecution_20250825 = (args = {}) => {
1819
1934
  // src/tool/code-execution_20260120.ts
1820
1935
  import {
1821
1936
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
1822
- lazySchema as lazySchema10,
1823
- zodSchema as zodSchema10
1937
+ lazySchema as lazySchema11,
1938
+ zodSchema as zodSchema11
1824
1939
  } from "@ai-sdk/provider-utils";
1825
- import { z as z11 } from "zod/v4";
1826
- var codeExecution_20260120OutputSchema = lazySchema10(
1827
- () => zodSchema10(
1828
- z11.discriminatedUnion("type", [
1829
- z11.object({
1830
- type: z11.literal("code_execution_result"),
1831
- stdout: z11.string(),
1832
- stderr: z11.string(),
1833
- return_code: z11.number(),
1834
- content: z11.array(
1835
- z11.object({
1836
- type: z11.literal("code_execution_output"),
1837
- file_id: z11.string()
1940
+ import { z as z12 } from "zod/v4";
1941
+ var codeExecution_20260120OutputSchema = lazySchema11(
1942
+ () => zodSchema11(
1943
+ z12.discriminatedUnion("type", [
1944
+ z12.object({
1945
+ type: z12.literal("code_execution_result"),
1946
+ stdout: z12.string(),
1947
+ stderr: z12.string(),
1948
+ return_code: z12.number(),
1949
+ content: z12.array(
1950
+ z12.object({
1951
+ type: z12.literal("code_execution_output"),
1952
+ file_id: z12.string()
1838
1953
  })
1839
1954
  ).optional().default([])
1840
1955
  }),
1841
- z11.object({
1842
- type: z11.literal("encrypted_code_execution_result"),
1843
- encrypted_stdout: z11.string(),
1844
- stderr: z11.string(),
1845
- return_code: z11.number(),
1846
- content: z11.array(
1847
- z11.object({
1848
- type: z11.literal("code_execution_output"),
1849
- file_id: z11.string()
1956
+ z12.object({
1957
+ type: z12.literal("encrypted_code_execution_result"),
1958
+ encrypted_stdout: z12.string(),
1959
+ stderr: z12.string(),
1960
+ return_code: z12.number(),
1961
+ content: z12.array(
1962
+ z12.object({
1963
+ type: z12.literal("code_execution_output"),
1964
+ file_id: z12.string()
1850
1965
  })
1851
1966
  ).optional().default([])
1852
1967
  }),
1853
- z11.object({
1854
- type: z11.literal("bash_code_execution_result"),
1855
- content: z11.array(
1856
- z11.object({
1857
- type: z11.literal("bash_code_execution_output"),
1858
- file_id: z11.string()
1968
+ z12.object({
1969
+ type: z12.literal("bash_code_execution_result"),
1970
+ content: z12.array(
1971
+ z12.object({
1972
+ type: z12.literal("bash_code_execution_output"),
1973
+ file_id: z12.string()
1859
1974
  })
1860
1975
  ),
1861
- stdout: z11.string(),
1862
- stderr: z11.string(),
1863
- return_code: z11.number()
1864
- }),
1865
- z11.object({
1866
- type: z11.literal("bash_code_execution_tool_result_error"),
1867
- error_code: z11.string()
1976
+ stdout: z12.string(),
1977
+ stderr: z12.string(),
1978
+ return_code: z12.number()
1868
1979
  }),
1869
- z11.object({
1870
- type: z11.literal("text_editor_code_execution_tool_result_error"),
1871
- error_code: z11.string()
1872
- }),
1873
- z11.object({
1874
- type: z11.literal("text_editor_code_execution_view_result"),
1875
- content: z11.string(),
1876
- file_type: z11.string(),
1877
- num_lines: z11.number().nullable(),
1878
- start_line: z11.number().nullable(),
1879
- total_lines: z11.number().nullable()
1980
+ z12.object({
1981
+ type: z12.literal("bash_code_execution_tool_result_error"),
1982
+ error_code: z12.string()
1880
1983
  }),
1881
- z11.object({
1882
- type: z11.literal("text_editor_code_execution_create_result"),
1883
- is_file_update: z11.boolean()
1984
+ z12.object({
1985
+ type: z12.literal("text_editor_code_execution_tool_result_error"),
1986
+ error_code: z12.string()
1884
1987
  }),
1885
- z11.object({
1886
- type: z11.literal("text_editor_code_execution_str_replace_result"),
1887
- lines: z11.array(z11.string()).nullable(),
1888
- new_lines: z11.number().nullable(),
1889
- new_start: z11.number().nullable(),
1890
- old_lines: z11.number().nullable(),
1891
- old_start: z11.number().nullable()
1988
+ z12.object({
1989
+ type: z12.literal("text_editor_code_execution_view_result"),
1990
+ content: z12.string(),
1991
+ file_type: z12.string(),
1992
+ num_lines: z12.number().nullable(),
1993
+ start_line: z12.number().nullable(),
1994
+ total_lines: z12.number().nullable()
1995
+ }),
1996
+ z12.object({
1997
+ type: z12.literal("text_editor_code_execution_create_result"),
1998
+ is_file_update: z12.boolean()
1999
+ }),
2000
+ z12.object({
2001
+ type: z12.literal("text_editor_code_execution_str_replace_result"),
2002
+ lines: z12.array(z12.string()).nullable(),
2003
+ new_lines: z12.number().nullable(),
2004
+ new_start: z12.number().nullable(),
2005
+ old_lines: z12.number().nullable(),
2006
+ old_start: z12.number().nullable()
1892
2007
  })
1893
2008
  ])
1894
2009
  )
1895
2010
  );
1896
- var codeExecution_20260120InputSchema = lazySchema10(
1897
- () => zodSchema10(
1898
- z11.discriminatedUnion("type", [
1899
- z11.object({
1900
- type: z11.literal("programmatic-tool-call"),
1901
- code: z11.string()
2011
+ var codeExecution_20260120InputSchema = lazySchema11(
2012
+ () => zodSchema11(
2013
+ z12.discriminatedUnion("type", [
2014
+ z12.object({
2015
+ type: z12.literal("programmatic-tool-call"),
2016
+ code: z12.string()
1902
2017
  }),
1903
- z11.object({
1904
- type: z11.literal("bash_code_execution"),
1905
- command: z11.string()
2018
+ z12.object({
2019
+ type: z12.literal("bash_code_execution"),
2020
+ command: z12.string()
1906
2021
  }),
1907
- z11.discriminatedUnion("command", [
1908
- z11.object({
1909
- type: z11.literal("text_editor_code_execution"),
1910
- command: z11.literal("view"),
1911
- path: z11.string()
2022
+ z12.discriminatedUnion("command", [
2023
+ z12.object({
2024
+ type: z12.literal("text_editor_code_execution"),
2025
+ command: z12.literal("view"),
2026
+ path: z12.string()
1912
2027
  }),
1913
- z11.object({
1914
- type: z11.literal("text_editor_code_execution"),
1915
- command: z11.literal("create"),
1916
- path: z11.string(),
1917
- file_text: z11.string().nullish()
2028
+ z12.object({
2029
+ type: z12.literal("text_editor_code_execution"),
2030
+ command: z12.literal("create"),
2031
+ path: z12.string(),
2032
+ file_text: z12.string().nullish()
1918
2033
  }),
1919
- z11.object({
1920
- type: z11.literal("text_editor_code_execution"),
1921
- command: z11.literal("str_replace"),
1922
- path: z11.string(),
1923
- old_str: z11.string(),
1924
- new_str: z11.string()
2034
+ z12.object({
2035
+ type: z12.literal("text_editor_code_execution"),
2036
+ command: z12.literal("str_replace"),
2037
+ path: z12.string(),
2038
+ old_str: z12.string(),
2039
+ new_str: z12.string()
1925
2040
  })
1926
2041
  ])
1927
2042
  ])
@@ -1940,23 +2055,23 @@ var codeExecution_20260120 = (args = {}) => {
1940
2055
  // src/tool/tool-search-regex_20251119.ts
1941
2056
  import {
1942
2057
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
1943
- lazySchema as lazySchema11,
1944
- zodSchema as zodSchema11
2058
+ lazySchema as lazySchema12,
2059
+ zodSchema as zodSchema12
1945
2060
  } from "@ai-sdk/provider-utils";
1946
- import { z as z12 } from "zod/v4";
1947
- var toolSearchRegex_20251119OutputSchema = lazySchema11(
1948
- () => zodSchema11(
1949
- z12.array(
1950
- z12.object({
1951
- type: z12.literal("tool_reference"),
1952
- toolName: z12.string()
2061
+ import { z as z13 } from "zod/v4";
2062
+ var toolSearchRegex_20251119OutputSchema = lazySchema12(
2063
+ () => zodSchema12(
2064
+ z13.array(
2065
+ z13.object({
2066
+ type: z13.literal("tool_reference"),
2067
+ toolName: z13.string()
1953
2068
  })
1954
2069
  )
1955
2070
  )
1956
2071
  );
1957
- var toolSearchRegex_20251119InputSchema = lazySchema11(
1958
- () => zodSchema11(
1959
- z12.object({
2072
+ var toolSearchRegex_20251119InputSchema = lazySchema12(
2073
+ () => zodSchema12(
2074
+ z13.object({
1960
2075
  /**
1961
2076
  * A regex pattern to search for tools.
1962
2077
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1967,11 +2082,11 @@ var toolSearchRegex_20251119InputSchema = lazySchema11(
1967
2082
  * - "database.*query|query.*database" - OR patterns for flexibility
1968
2083
  * - "(?i)slack" - case-insensitive search
1969
2084
  */
1970
- pattern: z12.string(),
2085
+ pattern: z13.string(),
1971
2086
  /**
1972
2087
  * Maximum number of tools to return. Optional.
1973
2088
  */
1974
- limit: z12.number().optional()
2089
+ limit: z13.number().optional()
1975
2090
  })
1976
2091
  )
1977
2092
  );
@@ -1988,7 +2103,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
1988
2103
  // src/convert-to-anthropic-messages-prompt.ts
1989
2104
  function convertToString(data) {
1990
2105
  if (typeof data === "string") {
1991
- return new TextDecoder().decode(convertBase64ToUint8Array(data));
2106
+ return new TextDecoder().decode(convertBase64ToUint8Array2(data));
1992
2107
  }
1993
2108
  if (data instanceof Uint8Array) {
1994
2109
  return new TextDecoder().decode(data);
@@ -2026,7 +2141,7 @@ async function convertToAnthropicMessagesPrompt({
2026
2141
  const messages = [];
2027
2142
  async function shouldEnableCitations(providerMetadata) {
2028
2143
  var _a2, _b2;
2029
- const anthropicOptions = await parseProviderOptions({
2144
+ const anthropicOptions = await parseProviderOptions2({
2030
2145
  provider: "anthropic",
2031
2146
  providerOptions: providerMetadata,
2032
2147
  schema: anthropicFilePartProviderOptions
@@ -2034,7 +2149,7 @@ async function convertToAnthropicMessagesPrompt({
2034
2149
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
2035
2150
  }
2036
2151
  async function getDocumentMetadata(providerMetadata) {
2037
- const anthropicOptions = await parseProviderOptions({
2152
+ const anthropicOptions = await parseProviderOptions2({
2038
2153
  provider: "anthropic",
2039
2154
  providerOptions: providerMetadata,
2040
2155
  schema: anthropicFilePartProviderOptions
@@ -2091,7 +2206,26 @@ async function convertToAnthropicMessagesPrompt({
2091
2206
  break;
2092
2207
  }
2093
2208
  case "file": {
2094
- if (part.mediaType.startsWith("image/")) {
2209
+ if (isProviderReference(part.data)) {
2210
+ const fileId = resolveProviderReference({
2211
+ reference: part.data,
2212
+ provider: "anthropic"
2213
+ });
2214
+ betas.add("files-api-2025-04-14");
2215
+ if (part.mediaType.startsWith("image/")) {
2216
+ anthropicContent.push({
2217
+ type: "image",
2218
+ source: { type: "file", file_id: fileId },
2219
+ cache_control: cacheControl
2220
+ });
2221
+ } else {
2222
+ anthropicContent.push({
2223
+ type: "document",
2224
+ source: { type: "file", file_id: fileId },
2225
+ cache_control: cacheControl
2226
+ });
2227
+ }
2228
+ } else if (part.mediaType.startsWith("image/")) {
2095
2229
  anthropicContent.push({
2096
2230
  type: "image",
2097
2231
  source: isUrlData(part.data) ? {
@@ -2334,7 +2468,7 @@ async function convertToAnthropicMessagesPrompt({
2334
2468
  }
2335
2469
  case "reasoning": {
2336
2470
  if (sendReasoning) {
2337
- const reasoningMetadata = await parseProviderOptions({
2471
+ const reasoningMetadata = await parseProviderOptions2({
2338
2472
  provider: "anthropic",
2339
2473
  providerOptions: part.providerOptions,
2340
2474
  schema: anthropicReasoningMetadataSchema
@@ -2867,7 +3001,7 @@ function createCitationSource(citation, citationDocuments, generateId3) {
2867
3001
  }
2868
3002
  var AnthropicMessagesLanguageModel = class {
2869
3003
  constructor(modelId, config) {
2870
- this.specificationVersion = "v3";
3004
+ this.specificationVersion = "v4";
2871
3005
  var _a;
2872
3006
  this.modelId = modelId;
2873
3007
  this.config = config;
@@ -2906,10 +3040,11 @@ var AnthropicMessagesLanguageModel = class {
2906
3040
  seed,
2907
3041
  tools,
2908
3042
  toolChoice,
3043
+ reasoning,
2909
3044
  providerOptions,
2910
3045
  stream
2911
3046
  }) {
2912
- var _a, _b, _c, _d, _e, _f, _g;
3047
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2913
3048
  const warnings = [];
2914
3049
  if (frequencyPenalty != null) {
2915
3050
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2945,12 +3080,12 @@ var AnthropicMessagesLanguageModel = class {
2945
3080
  }
2946
3081
  }
2947
3082
  const providerOptionsName = this.providerOptionsName;
2948
- const canonicalOptions = await parseProviderOptions2({
3083
+ const canonicalOptions = await parseProviderOptions3({
2949
3084
  provider: "anthropic",
2950
3085
  providerOptions,
2951
3086
  schema: anthropicLanguageModelOptions
2952
3087
  });
2953
- const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
3088
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions3({
2954
3089
  provider: providerOptionsName,
2955
3090
  providerOptions,
2956
3091
  schema: anthropicLanguageModelOptions
@@ -2964,10 +3099,13 @@ var AnthropicMessagesLanguageModel = class {
2964
3099
  const {
2965
3100
  maxOutputTokens: maxOutputTokensForModel,
2966
3101
  supportsStructuredOutput: modelSupportsStructuredOutput,
3102
+ supportsAdaptiveThinking,
2967
3103
  isKnownModel
2968
3104
  } = getModelCapabilities(this.modelId);
3105
+ const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2969
3106
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2970
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3107
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3108
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
2971
3109
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2972
3110
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2973
3111
  type: "function",
@@ -3002,14 +3140,28 @@ var AnthropicMessagesLanguageModel = class {
3002
3140
  });
3003
3141
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
3004
3142
  prompt,
3005
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3143
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
3006
3144
  warnings,
3007
3145
  cacheControlValidator,
3008
3146
  toolNameMapping
3009
3147
  });
3010
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3148
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3149
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3150
+ reasoning,
3151
+ supportsAdaptiveThinking,
3152
+ maxOutputTokensForModel,
3153
+ warnings
3154
+ });
3155
+ if (reasoningConfig != null) {
3156
+ anthropicOptions.thinking = reasoningConfig.thinking;
3157
+ if (reasoningConfig.effort != null) {
3158
+ anthropicOptions.effort = reasoningConfig.effort;
3159
+ }
3160
+ }
3161
+ }
3162
+ const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
3011
3163
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
3012
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
3164
+ let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
3013
3165
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
3014
3166
  const baseArgs = {
3015
3167
  // model id:
@@ -3046,6 +3198,9 @@ var AnthropicMessagesLanguageModel = class {
3046
3198
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3047
3199
  cache_control: anthropicOptions.cacheControl
3048
3200
  },
3201
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
3202
+ metadata: { user_id: anthropicOptions.metadata.userId }
3203
+ },
3049
3204
  // mcp servers:
3050
3205
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3051
3206
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3067,7 +3222,10 @@ var AnthropicMessagesLanguageModel = class {
3067
3222
  id: anthropicOptions.container.id,
3068
3223
  skills: anthropicOptions.container.skills.map((skill) => ({
3069
3224
  type: skill.type,
3070
- skill_id: skill.skillId,
3225
+ skill_id: skill.type === "custom" ? resolveProviderReference2({
3226
+ reference: skill.providerReference,
3227
+ provider: "anthropic"
3228
+ }) : skill.skillId,
3071
3229
  version: skill.version
3072
3230
  }))
3073
3231
  }
@@ -3169,7 +3327,7 @@ var AnthropicMessagesLanguageModel = class {
3169
3327
  }
3170
3328
  baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
3171
3329
  } else {
3172
- if (topP != null && temperature != null) {
3330
+ if (isAnthropicModel && topP != null && temperature != null) {
3173
3331
  warnings.push({
3174
3332
  type: "unsupported",
3175
3333
  feature: "topP",
@@ -3216,7 +3374,7 @@ var AnthropicMessagesLanguageModel = class {
3216
3374
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3217
3375
  betas.add("fast-mode-2026-02-01");
3218
3376
  }
3219
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
3377
+ if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
3220
3378
  betas.add("fine-grained-tool-streaming-2025-05-14");
3221
3379
  }
3222
3380
  const {
@@ -3230,13 +3388,15 @@ var AnthropicMessagesLanguageModel = class {
3230
3388
  toolChoice: { type: "required" },
3231
3389
  disableParallelToolUse: true,
3232
3390
  cacheControlValidator,
3233
- supportsStructuredOutput: false
3391
+ supportsStructuredOutput: false,
3392
+ supportsStrictTools
3234
3393
  } : {
3235
3394
  tools: tools != null ? tools : [],
3236
3395
  toolChoice,
3237
3396
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3238
3397
  cacheControlValidator,
3239
- supportsStructuredOutput
3398
+ supportsStructuredOutput,
3399
+ supportsStrictTools
3240
3400
  }
3241
3401
  );
3242
3402
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3253,7 +3413,7 @@ var AnthropicMessagesLanguageModel = class {
3253
3413
  ...betas,
3254
3414
  ...toolsBetas,
3255
3415
  ...userSuppliedBetas,
3256
- ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
3416
+ ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
3257
3417
  ]),
3258
3418
  usesJsonResponseTool: jsonResponseTool != null,
3259
3419
  toolNameMapping,
@@ -3265,7 +3425,7 @@ var AnthropicMessagesLanguageModel = class {
3265
3425
  betas,
3266
3426
  headers
3267
3427
  }) {
3268
- return combineHeaders(
3428
+ return combineHeaders2(
3269
3429
  await resolve(this.config.headers),
3270
3430
  headers,
3271
3431
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
@@ -3344,7 +3504,7 @@ var AnthropicMessagesLanguageModel = class {
3344
3504
  headers: await this.getHeaders({ betas, headers: options.headers }),
3345
3505
  body: this.transformRequestBody(args, betas),
3346
3506
  failedResponseHandler: anthropicFailedResponseHandler,
3347
- successfulResponseHandler: createJsonResponseHandler(
3507
+ successfulResponseHandler: createJsonResponseHandler2(
3348
3508
  anthropicMessagesResponseSchema
3349
3509
  ),
3350
3510
  abortSignal: options.abortSignal,
@@ -4516,42 +4676,49 @@ function getModelCapabilities(modelId) {
4516
4676
  return {
4517
4677
  maxOutputTokens: 128e3,
4518
4678
  supportsStructuredOutput: true,
4679
+ supportsAdaptiveThinking: true,
4519
4680
  isKnownModel: true
4520
4681
  };
4521
4682
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4522
4683
  return {
4523
4684
  maxOutputTokens: 64e3,
4524
4685
  supportsStructuredOutput: true,
4686
+ supportsAdaptiveThinking: false,
4525
4687
  isKnownModel: true
4526
4688
  };
4527
4689
  } else if (modelId.includes("claude-opus-4-1")) {
4528
4690
  return {
4529
4691
  maxOutputTokens: 32e3,
4530
4692
  supportsStructuredOutput: true,
4693
+ supportsAdaptiveThinking: false,
4531
4694
  isKnownModel: true
4532
4695
  };
4533
4696
  } else if (modelId.includes("claude-sonnet-4-")) {
4534
4697
  return {
4535
4698
  maxOutputTokens: 64e3,
4536
4699
  supportsStructuredOutput: false,
4700
+ supportsAdaptiveThinking: false,
4537
4701
  isKnownModel: true
4538
4702
  };
4539
4703
  } else if (modelId.includes("claude-opus-4-")) {
4540
4704
  return {
4541
4705
  maxOutputTokens: 32e3,
4542
4706
  supportsStructuredOutput: false,
4707
+ supportsAdaptiveThinking: false,
4543
4708
  isKnownModel: true
4544
4709
  };
4545
4710
  } else if (modelId.includes("claude-3-haiku")) {
4546
4711
  return {
4547
4712
  maxOutputTokens: 4096,
4548
4713
  supportsStructuredOutput: false,
4714
+ supportsAdaptiveThinking: false,
4549
4715
  isKnownModel: true
4550
4716
  };
4551
4717
  } else {
4552
4718
  return {
4553
4719
  maxOutputTokens: 4096,
4554
4720
  supportsStructuredOutput: false,
4721
+ supportsAdaptiveThinking: false,
4555
4722
  isKnownModel: false
4556
4723
  };
4557
4724
  }
@@ -4574,6 +4741,43 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4574
4741
  }
4575
4742
  return hasWebTool20260209 && !hasCodeExecutionTool;
4576
4743
  }
4744
+ function resolveAnthropicReasoningConfig({
4745
+ reasoning,
4746
+ supportsAdaptiveThinking,
4747
+ maxOutputTokensForModel,
4748
+ warnings
4749
+ }) {
4750
+ if (!isCustomReasoning(reasoning)) {
4751
+ return void 0;
4752
+ }
4753
+ if (reasoning === "none") {
4754
+ return { thinking: { type: "disabled" } };
4755
+ }
4756
+ if (supportsAdaptiveThinking) {
4757
+ const effort = mapReasoningToProviderEffort({
4758
+ reasoning,
4759
+ effortMap: {
4760
+ minimal: "low",
4761
+ low: "low",
4762
+ medium: "medium",
4763
+ high: "high",
4764
+ xhigh: "max"
4765
+ },
4766
+ warnings
4767
+ });
4768
+ return { thinking: { type: "adaptive" }, effort };
4769
+ }
4770
+ const budgetTokens = mapReasoningToProviderBudget({
4771
+ reasoning,
4772
+ maxOutputTokens: maxOutputTokensForModel,
4773
+ maxReasoningBudget: maxOutputTokensForModel,
4774
+ warnings
4775
+ });
4776
+ if (budgetTokens == null) {
4777
+ return void 0;
4778
+ }
4779
+ return { thinking: { type: "enabled", budgetTokens } };
4780
+ }
4577
4781
  function mapAnthropicResponseContextManagement(contextManagement) {
4578
4782
  return contextManagement ? {
4579
4783
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4603,15 +4807,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4603
4807
  // src/tool/bash_20241022.ts
4604
4808
  import {
4605
4809
  createProviderToolFactory as createProviderToolFactory2,
4606
- lazySchema as lazySchema12,
4607
- zodSchema as zodSchema12
4810
+ lazySchema as lazySchema13,
4811
+ zodSchema as zodSchema13
4608
4812
  } from "@ai-sdk/provider-utils";
4609
- import { z as z13 } from "zod/v4";
4610
- var bash_20241022InputSchema = lazySchema12(
4611
- () => zodSchema12(
4612
- z13.object({
4613
- command: z13.string(),
4614
- restart: z13.boolean().optional()
4813
+ import { z as z14 } from "zod/v4";
4814
+ var bash_20241022InputSchema = lazySchema13(
4815
+ () => zodSchema13(
4816
+ z14.object({
4817
+ command: z14.string(),
4818
+ restart: z14.boolean().optional()
4615
4819
  })
4616
4820
  )
4617
4821
  );
@@ -4623,15 +4827,15 @@ var bash_20241022 = createProviderToolFactory2({
4623
4827
  // src/tool/bash_20250124.ts
4624
4828
  import {
4625
4829
  createProviderToolFactory as createProviderToolFactory3,
4626
- lazySchema as lazySchema13,
4627
- zodSchema as zodSchema13
4830
+ lazySchema as lazySchema14,
4831
+ zodSchema as zodSchema14
4628
4832
  } from "@ai-sdk/provider-utils";
4629
- import { z as z14 } from "zod/v4";
4630
- var bash_20250124InputSchema = lazySchema13(
4631
- () => zodSchema13(
4632
- z14.object({
4633
- command: z14.string(),
4634
- restart: z14.boolean().optional()
4833
+ import { z as z15 } from "zod/v4";
4834
+ var bash_20250124InputSchema = lazySchema14(
4835
+ () => zodSchema14(
4836
+ z15.object({
4837
+ command: z15.string(),
4838
+ restart: z15.boolean().optional()
4635
4839
  })
4636
4840
  )
4637
4841
  );
@@ -4643,14 +4847,14 @@ var bash_20250124 = createProviderToolFactory3({
4643
4847
  // src/tool/computer_20241022.ts
4644
4848
  import {
4645
4849
  createProviderToolFactory as createProviderToolFactory4,
4646
- lazySchema as lazySchema14,
4647
- zodSchema as zodSchema14
4850
+ lazySchema as lazySchema15,
4851
+ zodSchema as zodSchema15
4648
4852
  } from "@ai-sdk/provider-utils";
4649
- import { z as z15 } from "zod/v4";
4650
- var computer_20241022InputSchema = lazySchema14(
4651
- () => zodSchema14(
4652
- z15.object({
4653
- action: z15.enum([
4853
+ import { z as z16 } from "zod/v4";
4854
+ var computer_20241022InputSchema = lazySchema15(
4855
+ () => zodSchema15(
4856
+ z16.object({
4857
+ action: z16.enum([
4654
4858
  "key",
4655
4859
  "type",
4656
4860
  "mouse_move",
@@ -4662,8 +4866,8 @@ var computer_20241022InputSchema = lazySchema14(
4662
4866
  "screenshot",
4663
4867
  "cursor_position"
4664
4868
  ]),
4665
- coordinate: z15.array(z15.number().int()).optional(),
4666
- text: z15.string().optional()
4869
+ coordinate: z16.array(z16.number().int()).optional(),
4870
+ text: z16.string().optional()
4667
4871
  })
4668
4872
  )
4669
4873
  );
@@ -4675,14 +4879,14 @@ var computer_20241022 = createProviderToolFactory4({
4675
4879
  // src/tool/computer_20250124.ts
4676
4880
  import {
4677
4881
  createProviderToolFactory as createProviderToolFactory5,
4678
- lazySchema as lazySchema15,
4679
- zodSchema as zodSchema15
4882
+ lazySchema as lazySchema16,
4883
+ zodSchema as zodSchema16
4680
4884
  } from "@ai-sdk/provider-utils";
4681
- import { z as z16 } from "zod/v4";
4682
- var computer_20250124InputSchema = lazySchema15(
4683
- () => zodSchema15(
4684
- z16.object({
4685
- action: z16.enum([
4885
+ import { z as z17 } from "zod/v4";
4886
+ var computer_20250124InputSchema = lazySchema16(
4887
+ () => zodSchema16(
4888
+ z17.object({
4889
+ action: z17.enum([
4686
4890
  "key",
4687
4891
  "hold_key",
4688
4892
  "type",
@@ -4700,12 +4904,12 @@ var computer_20250124InputSchema = lazySchema15(
4700
4904
  "wait",
4701
4905
  "screenshot"
4702
4906
  ]),
4703
- coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4704
- duration: z16.number().optional(),
4705
- scroll_amount: z16.number().optional(),
4706
- scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
4707
- start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4708
- text: z16.string().optional()
4907
+ coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4908
+ duration: z17.number().optional(),
4909
+ scroll_amount: z17.number().optional(),
4910
+ scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
4911
+ start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4912
+ text: z17.string().optional()
4709
4913
  })
4710
4914
  )
4711
4915
  );
@@ -4717,14 +4921,14 @@ var computer_20250124 = createProviderToolFactory5({
4717
4921
  // src/tool/computer_20251124.ts
4718
4922
  import {
4719
4923
  createProviderToolFactory as createProviderToolFactory6,
4720
- lazySchema as lazySchema16,
4721
- zodSchema as zodSchema16
4924
+ lazySchema as lazySchema17,
4925
+ zodSchema as zodSchema17
4722
4926
  } from "@ai-sdk/provider-utils";
4723
- import { z as z17 } from "zod/v4";
4724
- var computer_20251124InputSchema = lazySchema16(
4725
- () => zodSchema16(
4726
- z17.object({
4727
- action: z17.enum([
4927
+ import { z as z18 } from "zod/v4";
4928
+ var computer_20251124InputSchema = lazySchema17(
4929
+ () => zodSchema17(
4930
+ z18.object({
4931
+ action: z18.enum([
4728
4932
  "key",
4729
4933
  "hold_key",
4730
4934
  "type",
@@ -4743,18 +4947,18 @@ var computer_20251124InputSchema = lazySchema16(
4743
4947
  "screenshot",
4744
4948
  "zoom"
4745
4949
  ]),
4746
- coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4747
- duration: z17.number().optional(),
4748
- region: z17.tuple([
4749
- z17.number().int(),
4750
- z17.number().int(),
4751
- z17.number().int(),
4752
- z17.number().int()
4950
+ coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
4951
+ duration: z18.number().optional(),
4952
+ region: z18.tuple([
4953
+ z18.number().int(),
4954
+ z18.number().int(),
4955
+ z18.number().int(),
4956
+ z18.number().int()
4753
4957
  ]).optional(),
4754
- scroll_amount: z17.number().optional(),
4755
- scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
4756
- start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4757
- text: z17.string().optional()
4958
+ scroll_amount: z18.number().optional(),
4959
+ scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
4960
+ start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
4961
+ text: z18.string().optional()
4758
4962
  })
4759
4963
  )
4760
4964
  );
@@ -4766,43 +4970,43 @@ var computer_20251124 = createProviderToolFactory6({
4766
4970
  // src/tool/memory_20250818.ts
4767
4971
  import {
4768
4972
  createProviderToolFactory as createProviderToolFactory7,
4769
- lazySchema as lazySchema17,
4770
- zodSchema as zodSchema17
4973
+ lazySchema as lazySchema18,
4974
+ zodSchema as zodSchema18
4771
4975
  } from "@ai-sdk/provider-utils";
4772
- import { z as z18 } from "zod/v4";
4773
- var memory_20250818InputSchema = lazySchema17(
4774
- () => zodSchema17(
4775
- z18.discriminatedUnion("command", [
4776
- z18.object({
4777
- command: z18.literal("view"),
4778
- path: z18.string(),
4779
- view_range: z18.tuple([z18.number(), z18.number()]).optional()
4976
+ import { z as z19 } from "zod/v4";
4977
+ var memory_20250818InputSchema = lazySchema18(
4978
+ () => zodSchema18(
4979
+ z19.discriminatedUnion("command", [
4980
+ z19.object({
4981
+ command: z19.literal("view"),
4982
+ path: z19.string(),
4983
+ view_range: z19.tuple([z19.number(), z19.number()]).optional()
4780
4984
  }),
4781
- z18.object({
4782
- command: z18.literal("create"),
4783
- path: z18.string(),
4784
- file_text: z18.string()
4985
+ z19.object({
4986
+ command: z19.literal("create"),
4987
+ path: z19.string(),
4988
+ file_text: z19.string()
4785
4989
  }),
4786
- z18.object({
4787
- command: z18.literal("str_replace"),
4788
- path: z18.string(),
4789
- old_str: z18.string(),
4790
- new_str: z18.string()
4990
+ z19.object({
4991
+ command: z19.literal("str_replace"),
4992
+ path: z19.string(),
4993
+ old_str: z19.string(),
4994
+ new_str: z19.string()
4791
4995
  }),
4792
- z18.object({
4793
- command: z18.literal("insert"),
4794
- path: z18.string(),
4795
- insert_line: z18.number(),
4796
- insert_text: z18.string()
4996
+ z19.object({
4997
+ command: z19.literal("insert"),
4998
+ path: z19.string(),
4999
+ insert_line: z19.number(),
5000
+ insert_text: z19.string()
4797
5001
  }),
4798
- z18.object({
4799
- command: z18.literal("delete"),
4800
- path: z18.string()
5002
+ z19.object({
5003
+ command: z19.literal("delete"),
5004
+ path: z19.string()
4801
5005
  }),
4802
- z18.object({
4803
- command: z18.literal("rename"),
4804
- old_path: z18.string(),
4805
- new_path: z18.string()
5006
+ z19.object({
5007
+ command: z19.literal("rename"),
5008
+ old_path: z19.string(),
5009
+ new_path: z19.string()
4806
5010
  })
4807
5011
  ])
4808
5012
  )
@@ -4815,37 +5019,11 @@ var memory_20250818 = createProviderToolFactory7({
4815
5019
  // src/tool/text-editor_20241022.ts
4816
5020
  import {
4817
5021
  createProviderToolFactory as createProviderToolFactory8,
4818
- lazySchema as lazySchema18,
4819
- zodSchema as zodSchema18
4820
- } from "@ai-sdk/provider-utils";
4821
- import { z as z19 } from "zod/v4";
4822
- var textEditor_20241022InputSchema = lazySchema18(
4823
- () => zodSchema18(
4824
- z19.object({
4825
- command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4826
- path: z19.string(),
4827
- file_text: z19.string().optional(),
4828
- insert_line: z19.number().int().optional(),
4829
- new_str: z19.string().optional(),
4830
- insert_text: z19.string().optional(),
4831
- old_str: z19.string().optional(),
4832
- view_range: z19.array(z19.number().int()).optional()
4833
- })
4834
- )
4835
- );
4836
- var textEditor_20241022 = createProviderToolFactory8({
4837
- id: "anthropic.text_editor_20241022",
4838
- inputSchema: textEditor_20241022InputSchema
4839
- });
4840
-
4841
- // src/tool/text-editor_20250124.ts
4842
- import {
4843
- createProviderToolFactory as createProviderToolFactory9,
4844
5022
  lazySchema as lazySchema19,
4845
5023
  zodSchema as zodSchema19
4846
5024
  } from "@ai-sdk/provider-utils";
4847
5025
  import { z as z20 } from "zod/v4";
4848
- var textEditor_20250124InputSchema = lazySchema19(
5026
+ var textEditor_20241022InputSchema = lazySchema19(
4849
5027
  () => zodSchema19(
4850
5028
  z20.object({
4851
5029
  command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -4859,22 +5037,22 @@ var textEditor_20250124InputSchema = lazySchema19(
4859
5037
  })
4860
5038
  )
4861
5039
  );
4862
- var textEditor_20250124 = createProviderToolFactory9({
4863
- id: "anthropic.text_editor_20250124",
4864
- inputSchema: textEditor_20250124InputSchema
5040
+ var textEditor_20241022 = createProviderToolFactory8({
5041
+ id: "anthropic.text_editor_20241022",
5042
+ inputSchema: textEditor_20241022InputSchema
4865
5043
  });
4866
5044
 
4867
- // src/tool/text-editor_20250429.ts
5045
+ // src/tool/text-editor_20250124.ts
4868
5046
  import {
4869
- createProviderToolFactory as createProviderToolFactory10,
5047
+ createProviderToolFactory as createProviderToolFactory9,
4870
5048
  lazySchema as lazySchema20,
4871
5049
  zodSchema as zodSchema20
4872
5050
  } from "@ai-sdk/provider-utils";
4873
5051
  import { z as z21 } from "zod/v4";
4874
- var textEditor_20250429InputSchema = lazySchema20(
5052
+ var textEditor_20250124InputSchema = lazySchema20(
4875
5053
  () => zodSchema20(
4876
5054
  z21.object({
4877
- command: z21.enum(["view", "create", "str_replace", "insert"]),
5055
+ command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4878
5056
  path: z21.string(),
4879
5057
  file_text: z21.string().optional(),
4880
5058
  insert_line: z21.number().int().optional(),
@@ -4885,6 +5063,32 @@ var textEditor_20250429InputSchema = lazySchema20(
4885
5063
  })
4886
5064
  )
4887
5065
  );
5066
+ var textEditor_20250124 = createProviderToolFactory9({
5067
+ id: "anthropic.text_editor_20250124",
5068
+ inputSchema: textEditor_20250124InputSchema
5069
+ });
5070
+
5071
+ // src/tool/text-editor_20250429.ts
5072
+ import {
5073
+ createProviderToolFactory as createProviderToolFactory10,
5074
+ lazySchema as lazySchema21,
5075
+ zodSchema as zodSchema21
5076
+ } from "@ai-sdk/provider-utils";
5077
+ import { z as z22 } from "zod/v4";
5078
+ var textEditor_20250429InputSchema = lazySchema21(
5079
+ () => zodSchema21(
5080
+ z22.object({
5081
+ command: z22.enum(["view", "create", "str_replace", "insert"]),
5082
+ path: z22.string(),
5083
+ file_text: z22.string().optional(),
5084
+ insert_line: z22.number().int().optional(),
5085
+ new_str: z22.string().optional(),
5086
+ insert_text: z22.string().optional(),
5087
+ old_str: z22.string().optional(),
5088
+ view_range: z22.array(z22.number().int()).optional()
5089
+ })
5090
+ )
5091
+ );
4888
5092
  var textEditor_20250429 = createProviderToolFactory10({
4889
5093
  id: "anthropic.text_editor_20250429",
4890
5094
  inputSchema: textEditor_20250429InputSchema
@@ -4893,32 +5097,32 @@ var textEditor_20250429 = createProviderToolFactory10({
4893
5097
  // src/tool/tool-search-bm25_20251119.ts
4894
5098
  import {
4895
5099
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
4896
- lazySchema as lazySchema21,
4897
- zodSchema as zodSchema21
5100
+ lazySchema as lazySchema22,
5101
+ zodSchema as zodSchema22
4898
5102
  } from "@ai-sdk/provider-utils";
4899
- import { z as z22 } from "zod/v4";
4900
- var toolSearchBm25_20251119OutputSchema = lazySchema21(
4901
- () => zodSchema21(
4902
- z22.array(
4903
- z22.object({
4904
- type: z22.literal("tool_reference"),
4905
- toolName: z22.string()
5103
+ import { z as z23 } from "zod/v4";
5104
+ var toolSearchBm25_20251119OutputSchema = lazySchema22(
5105
+ () => zodSchema22(
5106
+ z23.array(
5107
+ z23.object({
5108
+ type: z23.literal("tool_reference"),
5109
+ toolName: z23.string()
4906
5110
  })
4907
5111
  )
4908
5112
  )
4909
5113
  );
4910
- var toolSearchBm25_20251119InputSchema = lazySchema21(
4911
- () => zodSchema21(
4912
- z22.object({
5114
+ var toolSearchBm25_20251119InputSchema = lazySchema22(
5115
+ () => zodSchema22(
5116
+ z23.object({
4913
5117
  /**
4914
5118
  * A natural language query to search for tools.
4915
5119
  * Claude will use BM25 text search to find relevant tools.
4916
5120
  */
4917
- query: z22.string(),
5121
+ query: z23.string(),
4918
5122
  /**
4919
5123
  * Maximum number of tools to return. Optional.
4920
5124
  */
4921
- limit: z22.number().optional()
5125
+ limit: z23.number().optional()
4922
5126
  })
4923
5127
  )
4924
5128
  );
@@ -5134,6 +5338,138 @@ var anthropicTools = {
5134
5338
  toolSearchBm25_20251119
5135
5339
  };
5136
5340
 
5341
+ // src/skills/anthropic-skills.ts
5342
+ import {
5343
+ combineHeaders as combineHeaders3,
5344
+ convertBase64ToUint8Array as convertBase64ToUint8Array3,
5345
+ createJsonResponseHandler as createJsonResponseHandler3,
5346
+ getFromApi,
5347
+ postFormDataToApi as postFormDataToApi2,
5348
+ resolve as resolve2
5349
+ } from "@ai-sdk/provider-utils";
5350
+
5351
+ // src/skills/anthropic-skills-api.ts
5352
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
5353
+ import { z as z24 } from "zod/v4";
5354
+ var anthropicSkillResponseSchema = lazySchema23(
5355
+ () => zodSchema23(
5356
+ z24.object({
5357
+ id: z24.string(),
5358
+ display_title: z24.string().nullish(),
5359
+ name: z24.string().nullish(),
5360
+ description: z24.string().nullish(),
5361
+ latest_version: z24.string().nullish(),
5362
+ source: z24.string(),
5363
+ created_at: z24.string(),
5364
+ updated_at: z24.string()
5365
+ })
5366
+ )
5367
+ );
5368
+ var anthropicSkillVersionListResponseSchema = lazySchema23(
5369
+ () => zodSchema23(
5370
+ z24.object({
5371
+ data: z24.array(
5372
+ z24.object({
5373
+ version: z24.string()
5374
+ })
5375
+ )
5376
+ })
5377
+ )
5378
+ );
5379
+ var anthropicSkillVersionResponseSchema = lazySchema23(
5380
+ () => zodSchema23(
5381
+ z24.object({
5382
+ type: z24.string(),
5383
+ skill_id: z24.string(),
5384
+ name: z24.string().nullish(),
5385
+ description: z24.string().nullish()
5386
+ })
5387
+ )
5388
+ );
5389
+
5390
+ // src/skills/anthropic-skills.ts
5391
+ var AnthropicSkills = class {
5392
+ constructor(config) {
5393
+ this.config = config;
5394
+ this.specificationVersion = "v4";
5395
+ }
5396
+ get provider() {
5397
+ return this.config.provider;
5398
+ }
5399
+ async getHeaders() {
5400
+ return combineHeaders3(await resolve2(this.config.headers), {
5401
+ "anthropic-beta": "skills-2025-10-02"
5402
+ });
5403
+ }
5404
+ async fetchVersionMetadata({
5405
+ skillId,
5406
+ version,
5407
+ headers
5408
+ }) {
5409
+ const { value: versionResponse } = await getFromApi({
5410
+ url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
5411
+ headers,
5412
+ failedResponseHandler: anthropicFailedResponseHandler,
5413
+ successfulResponseHandler: createJsonResponseHandler3(
5414
+ anthropicSkillVersionResponseSchema
5415
+ ),
5416
+ fetch: this.config.fetch
5417
+ });
5418
+ return {
5419
+ ...versionResponse.name != null ? { name: versionResponse.name } : {},
5420
+ ...versionResponse.description != null ? { description: versionResponse.description } : {}
5421
+ };
5422
+ }
5423
+ async upload(params) {
5424
+ var _a, _b;
5425
+ const warnings = [];
5426
+ const formData = new FormData();
5427
+ if (params.displayTitle != null) {
5428
+ formData.append("display_title", params.displayTitle);
5429
+ }
5430
+ for (const file of params.files) {
5431
+ const content = typeof file.content === "string" ? convertBase64ToUint8Array3(file.content) : file.content;
5432
+ formData.append("files[]", new Blob([content]), file.path);
5433
+ }
5434
+ const headers = await this.getHeaders();
5435
+ const { value: response } = await postFormDataToApi2({
5436
+ url: `${this.config.baseURL}/skills`,
5437
+ headers,
5438
+ formData,
5439
+ failedResponseHandler: anthropicFailedResponseHandler,
5440
+ successfulResponseHandler: createJsonResponseHandler3(
5441
+ anthropicSkillResponseSchema
5442
+ ),
5443
+ fetch: this.config.fetch
5444
+ });
5445
+ const versionMetadata = response.latest_version != null ? await this.fetchVersionMetadata({
5446
+ skillId: response.id,
5447
+ version: response.latest_version,
5448
+ headers
5449
+ }) : {};
5450
+ const name = (_a = versionMetadata.name) != null ? _a : response.name;
5451
+ const description = (_b = versionMetadata.description) != null ? _b : response.description;
5452
+ return {
5453
+ providerReference: { anthropic: response.id },
5454
+ ...response.display_title != null ? { displayTitle: response.display_title } : {},
5455
+ ...name != null ? { name } : {},
5456
+ ...description != null ? { description } : {},
5457
+ ...response.latest_version != null ? { latestVersion: response.latest_version } : {},
5458
+ providerMetadata: {
5459
+ anthropic: {
5460
+ ...response.source != null ? { source: response.source } : {},
5461
+ ...response.created_at != null ? { createdAt: response.created_at } : {},
5462
+ ...response.updated_at != null ? { updatedAt: response.updated_at } : {}
5463
+ }
5464
+ },
5465
+ warnings
5466
+ };
5467
+ }
5468
+ };
5469
+
5470
+ // src/version.ts
5471
+ var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
5472
+
5137
5473
  // src/anthropic-provider.ts
5138
5474
  function createAnthropic(options = {}) {
5139
5475
  var _a, _b;
@@ -5181,6 +5517,12 @@ function createAnthropic(options = {}) {
5181
5517
  })
5182
5518
  });
5183
5519
  };
5520
+ const createSkills = () => new AnthropicSkills({
5521
+ provider: `${providerName.replace(".messages", "")}.skills`,
5522
+ baseURL,
5523
+ headers: getHeaders,
5524
+ fetch: options.fetch
5525
+ });
5184
5526
  const provider = function(modelId) {
5185
5527
  if (new.target) {
5186
5528
  throw new Error(
@@ -5189,7 +5531,7 @@ function createAnthropic(options = {}) {
5189
5531
  }
5190
5532
  return createChatModel(modelId);
5191
5533
  };
5192
- provider.specificationVersion = "v3";
5534
+ provider.specificationVersion = "v4";
5193
5535
  provider.languageModel = createChatModel;
5194
5536
  provider.chat = createChatModel;
5195
5537
  provider.messages = createChatModel;
@@ -5200,6 +5542,13 @@ function createAnthropic(options = {}) {
5200
5542
  provider.imageModel = (modelId) => {
5201
5543
  throw new NoSuchModelError({ modelId, modelType: "imageModel" });
5202
5544
  };
5545
+ provider.files = () => new AnthropicFiles({
5546
+ provider: providerName,
5547
+ baseURL,
5548
+ headers: getHeaders,
5549
+ fetch: options.fetch
5550
+ });
5551
+ provider.skills = createSkills;
5203
5552
  provider.tools = anthropicTools;
5204
5553
  return provider;
5205
5554
  }