@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.js CHANGED
@@ -18,25 +18,22 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  VERSION: () => VERSION,
24
24
  anthropic: () => anthropic,
25
25
  createAnthropic: () => createAnthropic,
26
26
  forwardAnthropicContainerIdFromLastStep: () => forwardAnthropicContainerIdFromLastStep
27
27
  });
28
- module.exports = __toCommonJS(src_exports);
28
+ module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/anthropic-provider.ts
31
31
  var import_provider4 = require("@ai-sdk/provider");
32
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
33
-
34
- // src/version.ts
35
- var VERSION = true ? "4.0.0-beta.2" : "0.0.0-test";
32
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
36
33
 
37
- // src/anthropic-messages-language-model.ts
38
- var import_provider3 = require("@ai-sdk/provider");
39
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
34
+ // src/anthropic-files.ts
35
+ var import_provider_utils2 = require("@ai-sdk/provider-utils");
36
+ var import_v42 = require("zod/v4");
40
37
 
41
38
  // src/anthropic-error.ts
42
39
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -57,319 +54,396 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
57
54
  errorToMessage: (data) => data.error.message
58
55
  });
59
56
 
60
- // src/anthropic-messages-api.ts
61
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
62
- var import_v42 = require("zod/v4");
63
- var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
57
+ // src/anthropic-files.ts
58
+ var anthropicUploadFileProviderOptions = import_v42.z.object({});
59
+ var anthropicUploadFileResponseSchema = (0, import_provider_utils2.lazySchema)(
64
60
  () => (0, import_provider_utils2.zodSchema)(
65
61
  import_v42.z.object({
66
- type: import_v42.z.literal("message"),
67
- id: import_v42.z.string().nullish(),
68
- model: import_v42.z.string().nullish(),
69
- content: import_v42.z.array(
70
- import_v42.z.discriminatedUnion("type", [
71
- import_v42.z.object({
72
- type: import_v42.z.literal("text"),
73
- text: import_v42.z.string(),
74
- citations: import_v42.z.array(
75
- import_v42.z.discriminatedUnion("type", [
76
- import_v42.z.object({
77
- type: import_v42.z.literal("web_search_result_location"),
78
- cited_text: import_v42.z.string(),
79
- url: import_v42.z.string(),
80
- title: import_v42.z.string(),
81
- encrypted_index: import_v42.z.string()
62
+ id: import_v42.z.string(),
63
+ type: import_v42.z.literal("file"),
64
+ filename: import_v42.z.string(),
65
+ mime_type: import_v42.z.string(),
66
+ size_bytes: import_v42.z.number(),
67
+ created_at: import_v42.z.string(),
68
+ downloadable: import_v42.z.boolean().nullish()
69
+ })
70
+ )
71
+ );
72
+ var AnthropicFiles = class {
73
+ constructor(config) {
74
+ this.config = config;
75
+ this.specificationVersion = "v4";
76
+ }
77
+ get provider() {
78
+ return this.config.provider;
79
+ }
80
+ async uploadFile({
81
+ data,
82
+ mediaType,
83
+ filename,
84
+ providerOptions
85
+ }) {
86
+ var _a, _b;
87
+ const anthropicOptions = await (0, import_provider_utils2.parseProviderOptions)({
88
+ provider: "anthropic",
89
+ providerOptions,
90
+ schema: (0, import_provider_utils2.zodSchema)(anthropicUploadFileProviderOptions)
91
+ });
92
+ const fileBytes = data instanceof Uint8Array ? data : (0, import_provider_utils2.convertBase64ToUint8Array)(data);
93
+ const blob = new Blob([fileBytes], { type: mediaType });
94
+ const formData = new FormData();
95
+ if (filename != null) {
96
+ formData.append("file", blob, filename);
97
+ } else {
98
+ formData.append("file", blob);
99
+ }
100
+ const { value: response } = await (0, import_provider_utils2.postFormDataToApi)({
101
+ url: `${this.config.baseURL}/files`,
102
+ headers: (0, import_provider_utils2.combineHeaders)(this.config.headers(), {
103
+ "anthropic-beta": "files-api-2025-04-14"
104
+ }),
105
+ formData,
106
+ failedResponseHandler: anthropicFailedResponseHandler,
107
+ successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
108
+ anthropicUploadFileResponseSchema
109
+ ),
110
+ fetch: this.config.fetch
111
+ });
112
+ return {
113
+ warnings: [],
114
+ providerReference: { anthropic: response.id },
115
+ mediaType: (_a = response.mime_type) != null ? _a : mediaType,
116
+ filename: (_b = response.filename) != null ? _b : filename,
117
+ providerMetadata: {
118
+ anthropic: {
119
+ filename: response.filename,
120
+ mimeType: response.mime_type,
121
+ sizeBytes: response.size_bytes,
122
+ createdAt: response.created_at,
123
+ ...response.downloadable != null ? { downloadable: response.downloadable } : {}
124
+ }
125
+ }
126
+ };
127
+ }
128
+ };
129
+
130
+ // src/anthropic-messages-language-model.ts
131
+ var import_provider3 = require("@ai-sdk/provider");
132
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
133
+
134
+ // src/anthropic-messages-api.ts
135
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
136
+ var import_v43 = require("zod/v4");
137
+ var anthropicMessagesResponseSchema = (0, import_provider_utils3.lazySchema)(
138
+ () => (0, import_provider_utils3.zodSchema)(
139
+ import_v43.z.object({
140
+ type: import_v43.z.literal("message"),
141
+ id: import_v43.z.string().nullish(),
142
+ model: import_v43.z.string().nullish(),
143
+ content: import_v43.z.array(
144
+ import_v43.z.discriminatedUnion("type", [
145
+ import_v43.z.object({
146
+ type: import_v43.z.literal("text"),
147
+ text: import_v43.z.string(),
148
+ citations: import_v43.z.array(
149
+ import_v43.z.discriminatedUnion("type", [
150
+ import_v43.z.object({
151
+ type: import_v43.z.literal("web_search_result_location"),
152
+ cited_text: import_v43.z.string(),
153
+ url: import_v43.z.string(),
154
+ title: import_v43.z.string(),
155
+ encrypted_index: import_v43.z.string()
82
156
  }),
83
- import_v42.z.object({
84
- type: import_v42.z.literal("page_location"),
85
- cited_text: import_v42.z.string(),
86
- document_index: import_v42.z.number(),
87
- document_title: import_v42.z.string().nullable(),
88
- start_page_number: import_v42.z.number(),
89
- end_page_number: import_v42.z.number()
157
+ import_v43.z.object({
158
+ type: import_v43.z.literal("page_location"),
159
+ cited_text: import_v43.z.string(),
160
+ document_index: import_v43.z.number(),
161
+ document_title: import_v43.z.string().nullable(),
162
+ start_page_number: import_v43.z.number(),
163
+ end_page_number: import_v43.z.number()
90
164
  }),
91
- import_v42.z.object({
92
- type: import_v42.z.literal("char_location"),
93
- cited_text: import_v42.z.string(),
94
- document_index: import_v42.z.number(),
95
- document_title: import_v42.z.string().nullable(),
96
- start_char_index: import_v42.z.number(),
97
- end_char_index: import_v42.z.number()
165
+ import_v43.z.object({
166
+ type: import_v43.z.literal("char_location"),
167
+ cited_text: import_v43.z.string(),
168
+ document_index: import_v43.z.number(),
169
+ document_title: import_v43.z.string().nullable(),
170
+ start_char_index: import_v43.z.number(),
171
+ end_char_index: import_v43.z.number()
98
172
  })
99
173
  ])
100
174
  ).optional()
101
175
  }),
102
- import_v42.z.object({
103
- type: import_v42.z.literal("thinking"),
104
- thinking: import_v42.z.string(),
105
- signature: import_v42.z.string()
176
+ import_v43.z.object({
177
+ type: import_v43.z.literal("thinking"),
178
+ thinking: import_v43.z.string(),
179
+ signature: import_v43.z.string()
106
180
  }),
107
- import_v42.z.object({
108
- type: import_v42.z.literal("redacted_thinking"),
109
- data: import_v42.z.string()
181
+ import_v43.z.object({
182
+ type: import_v43.z.literal("redacted_thinking"),
183
+ data: import_v43.z.string()
110
184
  }),
111
- import_v42.z.object({
112
- type: import_v42.z.literal("compaction"),
113
- content: import_v42.z.string()
185
+ import_v43.z.object({
186
+ type: import_v43.z.literal("compaction"),
187
+ content: import_v43.z.string()
114
188
  }),
115
- import_v42.z.object({
116
- type: import_v42.z.literal("tool_use"),
117
- id: import_v42.z.string(),
118
- name: import_v42.z.string(),
119
- input: import_v42.z.unknown(),
189
+ import_v43.z.object({
190
+ type: import_v43.z.literal("tool_use"),
191
+ id: import_v43.z.string(),
192
+ name: import_v43.z.string(),
193
+ input: import_v43.z.unknown(),
120
194
  // Programmatic tool calling: caller info when triggered from code execution
121
- caller: import_v42.z.union([
122
- import_v42.z.object({
123
- type: import_v42.z.literal("code_execution_20250825"),
124
- tool_id: import_v42.z.string()
195
+ caller: import_v43.z.union([
196
+ import_v43.z.object({
197
+ type: import_v43.z.literal("code_execution_20250825"),
198
+ tool_id: import_v43.z.string()
125
199
  }),
126
- import_v42.z.object({
127
- type: import_v42.z.literal("code_execution_20260120"),
128
- tool_id: import_v42.z.string()
200
+ import_v43.z.object({
201
+ type: import_v43.z.literal("code_execution_20260120"),
202
+ tool_id: import_v43.z.string()
129
203
  }),
130
- import_v42.z.object({
131
- type: import_v42.z.literal("direct")
204
+ import_v43.z.object({
205
+ type: import_v43.z.literal("direct")
132
206
  })
133
207
  ]).optional()
134
208
  }),
135
- import_v42.z.object({
136
- type: import_v42.z.literal("server_tool_use"),
137
- id: import_v42.z.string(),
138
- name: import_v42.z.string(),
139
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
140
- caller: import_v42.z.union([
141
- import_v42.z.object({
142
- type: import_v42.z.literal("code_execution_20260120"),
143
- tool_id: import_v42.z.string()
209
+ import_v43.z.object({
210
+ type: import_v43.z.literal("server_tool_use"),
211
+ id: import_v43.z.string(),
212
+ name: import_v43.z.string(),
213
+ input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
214
+ caller: import_v43.z.union([
215
+ import_v43.z.object({
216
+ type: import_v43.z.literal("code_execution_20260120"),
217
+ tool_id: import_v43.z.string()
144
218
  }),
145
- import_v42.z.object({
146
- type: import_v42.z.literal("direct")
219
+ import_v43.z.object({
220
+ type: import_v43.z.literal("direct")
147
221
  })
148
222
  ]).optional()
149
223
  }),
150
- import_v42.z.object({
151
- type: import_v42.z.literal("mcp_tool_use"),
152
- id: import_v42.z.string(),
153
- name: import_v42.z.string(),
154
- input: import_v42.z.unknown(),
155
- server_name: import_v42.z.string()
224
+ import_v43.z.object({
225
+ type: import_v43.z.literal("mcp_tool_use"),
226
+ id: import_v43.z.string(),
227
+ name: import_v43.z.string(),
228
+ input: import_v43.z.unknown(),
229
+ server_name: import_v43.z.string()
156
230
  }),
157
- import_v42.z.object({
158
- type: import_v42.z.literal("mcp_tool_result"),
159
- tool_use_id: import_v42.z.string(),
160
- is_error: import_v42.z.boolean(),
161
- content: import_v42.z.array(
162
- import_v42.z.union([
163
- import_v42.z.string(),
164
- import_v42.z.object({ type: import_v42.z.literal("text"), text: import_v42.z.string() })
231
+ import_v43.z.object({
232
+ type: import_v43.z.literal("mcp_tool_result"),
233
+ tool_use_id: import_v43.z.string(),
234
+ is_error: import_v43.z.boolean(),
235
+ content: import_v43.z.array(
236
+ import_v43.z.union([
237
+ import_v43.z.string(),
238
+ import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.z.string() })
165
239
  ])
166
240
  )
167
241
  }),
168
- import_v42.z.object({
169
- type: import_v42.z.literal("web_fetch_tool_result"),
170
- tool_use_id: import_v42.z.string(),
171
- content: import_v42.z.union([
172
- import_v42.z.object({
173
- type: import_v42.z.literal("web_fetch_result"),
174
- url: import_v42.z.string(),
175
- retrieved_at: import_v42.z.string(),
176
- content: import_v42.z.object({
177
- type: import_v42.z.literal("document"),
178
- title: import_v42.z.string().nullable(),
179
- citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
180
- source: import_v42.z.union([
181
- import_v42.z.object({
182
- type: import_v42.z.literal("base64"),
183
- media_type: import_v42.z.literal("application/pdf"),
184
- data: import_v42.z.string()
242
+ import_v43.z.object({
243
+ type: import_v43.z.literal("web_fetch_tool_result"),
244
+ tool_use_id: import_v43.z.string(),
245
+ content: import_v43.z.union([
246
+ import_v43.z.object({
247
+ type: import_v43.z.literal("web_fetch_result"),
248
+ url: import_v43.z.string(),
249
+ retrieved_at: import_v43.z.string(),
250
+ content: import_v43.z.object({
251
+ type: import_v43.z.literal("document"),
252
+ title: import_v43.z.string().nullable(),
253
+ citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
254
+ source: import_v43.z.union([
255
+ import_v43.z.object({
256
+ type: import_v43.z.literal("base64"),
257
+ media_type: import_v43.z.literal("application/pdf"),
258
+ data: import_v43.z.string()
185
259
  }),
186
- import_v42.z.object({
187
- type: import_v42.z.literal("text"),
188
- media_type: import_v42.z.literal("text/plain"),
189
- data: import_v42.z.string()
260
+ import_v43.z.object({
261
+ type: import_v43.z.literal("text"),
262
+ media_type: import_v43.z.literal("text/plain"),
263
+ data: import_v43.z.string()
190
264
  })
191
265
  ])
192
266
  })
193
267
  }),
194
- import_v42.z.object({
195
- type: import_v42.z.literal("web_fetch_tool_result_error"),
196
- error_code: import_v42.z.string()
268
+ import_v43.z.object({
269
+ type: import_v43.z.literal("web_fetch_tool_result_error"),
270
+ error_code: import_v43.z.string()
197
271
  })
198
272
  ])
199
273
  }),
200
- import_v42.z.object({
201
- type: import_v42.z.literal("web_search_tool_result"),
202
- tool_use_id: import_v42.z.string(),
203
- content: import_v42.z.union([
204
- import_v42.z.array(
205
- import_v42.z.object({
206
- type: import_v42.z.literal("web_search_result"),
207
- url: import_v42.z.string(),
208
- title: import_v42.z.string(),
209
- encrypted_content: import_v42.z.string(),
210
- page_age: import_v42.z.string().nullish()
274
+ import_v43.z.object({
275
+ type: import_v43.z.literal("web_search_tool_result"),
276
+ tool_use_id: import_v43.z.string(),
277
+ content: import_v43.z.union([
278
+ import_v43.z.array(
279
+ import_v43.z.object({
280
+ type: import_v43.z.literal("web_search_result"),
281
+ url: import_v43.z.string(),
282
+ title: import_v43.z.string(),
283
+ encrypted_content: import_v43.z.string(),
284
+ page_age: import_v43.z.string().nullish()
211
285
  })
212
286
  ),
213
- import_v42.z.object({
214
- type: import_v42.z.literal("web_search_tool_result_error"),
215
- error_code: import_v42.z.string()
287
+ import_v43.z.object({
288
+ type: import_v43.z.literal("web_search_tool_result_error"),
289
+ error_code: import_v43.z.string()
216
290
  })
217
291
  ])
218
292
  }),
219
293
  // code execution results for code_execution_20250522 tool:
220
- import_v42.z.object({
221
- type: import_v42.z.literal("code_execution_tool_result"),
222
- tool_use_id: import_v42.z.string(),
223
- content: import_v42.z.union([
224
- import_v42.z.object({
225
- type: import_v42.z.literal("code_execution_result"),
226
- stdout: import_v42.z.string(),
227
- stderr: import_v42.z.string(),
228
- return_code: import_v42.z.number(),
229
- content: import_v42.z.array(
230
- import_v42.z.object({
231
- type: import_v42.z.literal("code_execution_output"),
232
- file_id: import_v42.z.string()
294
+ import_v43.z.object({
295
+ type: import_v43.z.literal("code_execution_tool_result"),
296
+ tool_use_id: import_v43.z.string(),
297
+ content: import_v43.z.union([
298
+ import_v43.z.object({
299
+ type: import_v43.z.literal("code_execution_result"),
300
+ stdout: import_v43.z.string(),
301
+ stderr: import_v43.z.string(),
302
+ return_code: import_v43.z.number(),
303
+ content: import_v43.z.array(
304
+ import_v43.z.object({
305
+ type: import_v43.z.literal("code_execution_output"),
306
+ file_id: import_v43.z.string()
233
307
  })
234
308
  ).optional().default([])
235
309
  }),
236
- import_v42.z.object({
237
- type: import_v42.z.literal("encrypted_code_execution_result"),
238
- encrypted_stdout: import_v42.z.string(),
239
- stderr: import_v42.z.string(),
240
- return_code: import_v42.z.number(),
241
- content: import_v42.z.array(
242
- import_v42.z.object({
243
- type: import_v42.z.literal("code_execution_output"),
244
- file_id: import_v42.z.string()
310
+ import_v43.z.object({
311
+ type: import_v43.z.literal("encrypted_code_execution_result"),
312
+ encrypted_stdout: import_v43.z.string(),
313
+ stderr: import_v43.z.string(),
314
+ return_code: import_v43.z.number(),
315
+ content: import_v43.z.array(
316
+ import_v43.z.object({
317
+ type: import_v43.z.literal("code_execution_output"),
318
+ file_id: import_v43.z.string()
245
319
  })
246
320
  ).optional().default([])
247
321
  }),
248
- import_v42.z.object({
249
- type: import_v42.z.literal("code_execution_tool_result_error"),
250
- error_code: import_v42.z.string()
322
+ import_v43.z.object({
323
+ type: import_v43.z.literal("code_execution_tool_result_error"),
324
+ error_code: import_v43.z.string()
251
325
  })
252
326
  ])
253
327
  }),
254
328
  // bash code execution results for code_execution_20250825 tool:
255
- import_v42.z.object({
256
- type: import_v42.z.literal("bash_code_execution_tool_result"),
257
- tool_use_id: import_v42.z.string(),
258
- content: import_v42.z.discriminatedUnion("type", [
259
- import_v42.z.object({
260
- type: import_v42.z.literal("bash_code_execution_result"),
261
- content: import_v42.z.array(
262
- import_v42.z.object({
263
- type: import_v42.z.literal("bash_code_execution_output"),
264
- file_id: import_v42.z.string()
329
+ import_v43.z.object({
330
+ type: import_v43.z.literal("bash_code_execution_tool_result"),
331
+ tool_use_id: import_v43.z.string(),
332
+ content: import_v43.z.discriminatedUnion("type", [
333
+ import_v43.z.object({
334
+ type: import_v43.z.literal("bash_code_execution_result"),
335
+ content: import_v43.z.array(
336
+ import_v43.z.object({
337
+ type: import_v43.z.literal("bash_code_execution_output"),
338
+ file_id: import_v43.z.string()
265
339
  })
266
340
  ),
267
- stdout: import_v42.z.string(),
268
- stderr: import_v42.z.string(),
269
- return_code: import_v42.z.number()
341
+ stdout: import_v43.z.string(),
342
+ stderr: import_v43.z.string(),
343
+ return_code: import_v43.z.number()
270
344
  }),
271
- import_v42.z.object({
272
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
273
- error_code: import_v42.z.string()
345
+ import_v43.z.object({
346
+ type: import_v43.z.literal("bash_code_execution_tool_result_error"),
347
+ error_code: import_v43.z.string()
274
348
  })
275
349
  ])
276
350
  }),
277
351
  // text editor code execution results for code_execution_20250825 tool:
278
- import_v42.z.object({
279
- type: import_v42.z.literal("text_editor_code_execution_tool_result"),
280
- tool_use_id: import_v42.z.string(),
281
- content: import_v42.z.discriminatedUnion("type", [
282
- import_v42.z.object({
283
- type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
284
- error_code: import_v42.z.string()
352
+ import_v43.z.object({
353
+ type: import_v43.z.literal("text_editor_code_execution_tool_result"),
354
+ tool_use_id: import_v43.z.string(),
355
+ content: import_v43.z.discriminatedUnion("type", [
356
+ import_v43.z.object({
357
+ type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
358
+ error_code: import_v43.z.string()
285
359
  }),
286
- import_v42.z.object({
287
- type: import_v42.z.literal("text_editor_code_execution_view_result"),
288
- content: import_v42.z.string(),
289
- file_type: import_v42.z.string(),
290
- num_lines: import_v42.z.number().nullable(),
291
- start_line: import_v42.z.number().nullable(),
292
- total_lines: import_v42.z.number().nullable()
360
+ import_v43.z.object({
361
+ type: import_v43.z.literal("text_editor_code_execution_view_result"),
362
+ content: import_v43.z.string(),
363
+ file_type: import_v43.z.string(),
364
+ num_lines: import_v43.z.number().nullable(),
365
+ start_line: import_v43.z.number().nullable(),
366
+ total_lines: import_v43.z.number().nullable()
293
367
  }),
294
- import_v42.z.object({
295
- type: import_v42.z.literal("text_editor_code_execution_create_result"),
296
- is_file_update: import_v42.z.boolean()
368
+ import_v43.z.object({
369
+ type: import_v43.z.literal("text_editor_code_execution_create_result"),
370
+ is_file_update: import_v43.z.boolean()
297
371
  }),
298
- import_v42.z.object({
299
- type: import_v42.z.literal(
372
+ import_v43.z.object({
373
+ type: import_v43.z.literal(
300
374
  "text_editor_code_execution_str_replace_result"
301
375
  ),
302
- lines: import_v42.z.array(import_v42.z.string()).nullable(),
303
- new_lines: import_v42.z.number().nullable(),
304
- new_start: import_v42.z.number().nullable(),
305
- old_lines: import_v42.z.number().nullable(),
306
- old_start: import_v42.z.number().nullable()
376
+ lines: import_v43.z.array(import_v43.z.string()).nullable(),
377
+ new_lines: import_v43.z.number().nullable(),
378
+ new_start: import_v43.z.number().nullable(),
379
+ old_lines: import_v43.z.number().nullable(),
380
+ old_start: import_v43.z.number().nullable()
307
381
  })
308
382
  ])
309
383
  }),
310
384
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
311
- import_v42.z.object({
312
- type: import_v42.z.literal("tool_search_tool_result"),
313
- tool_use_id: import_v42.z.string(),
314
- content: import_v42.z.union([
315
- import_v42.z.object({
316
- type: import_v42.z.literal("tool_search_tool_search_result"),
317
- tool_references: import_v42.z.array(
318
- import_v42.z.object({
319
- type: import_v42.z.literal("tool_reference"),
320
- tool_name: import_v42.z.string()
385
+ import_v43.z.object({
386
+ type: import_v43.z.literal("tool_search_tool_result"),
387
+ tool_use_id: import_v43.z.string(),
388
+ content: import_v43.z.union([
389
+ import_v43.z.object({
390
+ type: import_v43.z.literal("tool_search_tool_search_result"),
391
+ tool_references: import_v43.z.array(
392
+ import_v43.z.object({
393
+ type: import_v43.z.literal("tool_reference"),
394
+ tool_name: import_v43.z.string()
321
395
  })
322
396
  )
323
397
  }),
324
- import_v42.z.object({
325
- type: import_v42.z.literal("tool_search_tool_result_error"),
326
- error_code: import_v42.z.string()
398
+ import_v43.z.object({
399
+ type: import_v43.z.literal("tool_search_tool_result_error"),
400
+ error_code: import_v43.z.string()
327
401
  })
328
402
  ])
329
403
  })
330
404
  ])
331
405
  ),
332
- stop_reason: import_v42.z.string().nullish(),
333
- stop_sequence: import_v42.z.string().nullish(),
334
- usage: import_v42.z.looseObject({
335
- input_tokens: import_v42.z.number(),
336
- output_tokens: import_v42.z.number(),
337
- cache_creation_input_tokens: import_v42.z.number().nullish(),
338
- cache_read_input_tokens: import_v42.z.number().nullish(),
339
- iterations: import_v42.z.array(
340
- import_v42.z.object({
341
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
342
- input_tokens: import_v42.z.number(),
343
- output_tokens: import_v42.z.number()
406
+ stop_reason: import_v43.z.string().nullish(),
407
+ stop_sequence: import_v43.z.string().nullish(),
408
+ usage: import_v43.z.looseObject({
409
+ input_tokens: import_v43.z.number(),
410
+ output_tokens: import_v43.z.number(),
411
+ cache_creation_input_tokens: import_v43.z.number().nullish(),
412
+ cache_read_input_tokens: import_v43.z.number().nullish(),
413
+ iterations: import_v43.z.array(
414
+ import_v43.z.object({
415
+ type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
416
+ input_tokens: import_v43.z.number(),
417
+ output_tokens: import_v43.z.number()
344
418
  })
345
419
  ).nullish()
346
420
  }),
347
- container: import_v42.z.object({
348
- expires_at: import_v42.z.string(),
349
- id: import_v42.z.string(),
350
- skills: import_v42.z.array(
351
- import_v42.z.object({
352
- type: import_v42.z.union([import_v42.z.literal("anthropic"), import_v42.z.literal("custom")]),
353
- skill_id: import_v42.z.string(),
354
- version: import_v42.z.string()
421
+ container: import_v43.z.object({
422
+ expires_at: import_v43.z.string(),
423
+ id: import_v43.z.string(),
424
+ skills: import_v43.z.array(
425
+ import_v43.z.object({
426
+ type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
427
+ skill_id: import_v43.z.string(),
428
+ version: import_v43.z.string()
355
429
  })
356
430
  ).nullish()
357
431
  }).nullish(),
358
- context_management: import_v42.z.object({
359
- applied_edits: import_v42.z.array(
360
- import_v42.z.union([
361
- import_v42.z.object({
362
- type: import_v42.z.literal("clear_tool_uses_20250919"),
363
- cleared_tool_uses: import_v42.z.number(),
364
- cleared_input_tokens: import_v42.z.number()
432
+ context_management: import_v43.z.object({
433
+ applied_edits: import_v43.z.array(
434
+ import_v43.z.union([
435
+ import_v43.z.object({
436
+ type: import_v43.z.literal("clear_tool_uses_20250919"),
437
+ cleared_tool_uses: import_v43.z.number(),
438
+ cleared_input_tokens: import_v43.z.number()
365
439
  }),
366
- import_v42.z.object({
367
- type: import_v42.z.literal("clear_thinking_20251015"),
368
- cleared_thinking_turns: import_v42.z.number(),
369
- cleared_input_tokens: import_v42.z.number()
440
+ import_v43.z.object({
441
+ type: import_v43.z.literal("clear_thinking_20251015"),
442
+ cleared_thinking_turns: import_v43.z.number(),
443
+ cleared_input_tokens: import_v43.z.number()
370
444
  }),
371
- import_v42.z.object({
372
- type: import_v42.z.literal("compact_20260112")
445
+ import_v43.z.object({
446
+ type: import_v43.z.literal("compact_20260112")
373
447
  })
374
448
  ])
375
449
  )
@@ -377,457 +451,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
377
451
  })
378
452
  )
379
453
  );
380
- var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
381
- () => (0, import_provider_utils2.zodSchema)(
382
- import_v42.z.discriminatedUnion("type", [
383
- import_v42.z.object({
384
- type: import_v42.z.literal("message_start"),
385
- message: import_v42.z.object({
386
- id: import_v42.z.string().nullish(),
387
- model: import_v42.z.string().nullish(),
388
- role: import_v42.z.string().nullish(),
389
- usage: import_v42.z.looseObject({
390
- input_tokens: import_v42.z.number(),
391
- cache_creation_input_tokens: import_v42.z.number().nullish(),
392
- cache_read_input_tokens: import_v42.z.number().nullish()
454
+ var anthropicMessagesChunkSchema = (0, import_provider_utils3.lazySchema)(
455
+ () => (0, import_provider_utils3.zodSchema)(
456
+ import_v43.z.discriminatedUnion("type", [
457
+ import_v43.z.object({
458
+ type: import_v43.z.literal("message_start"),
459
+ message: import_v43.z.object({
460
+ id: import_v43.z.string().nullish(),
461
+ model: import_v43.z.string().nullish(),
462
+ role: import_v43.z.string().nullish(),
463
+ usage: import_v43.z.looseObject({
464
+ input_tokens: import_v43.z.number(),
465
+ cache_creation_input_tokens: import_v43.z.number().nullish(),
466
+ cache_read_input_tokens: import_v43.z.number().nullish()
393
467
  }),
394
468
  // Programmatic tool calling: content may be pre-populated for deferred tool calls
395
- content: import_v42.z.array(
396
- import_v42.z.discriminatedUnion("type", [
397
- import_v42.z.object({
398
- type: import_v42.z.literal("tool_use"),
399
- id: import_v42.z.string(),
400
- name: import_v42.z.string(),
401
- input: import_v42.z.unknown(),
402
- caller: import_v42.z.union([
403
- import_v42.z.object({
404
- type: import_v42.z.literal("code_execution_20250825"),
405
- tool_id: import_v42.z.string()
469
+ content: import_v43.z.array(
470
+ import_v43.z.discriminatedUnion("type", [
471
+ import_v43.z.object({
472
+ type: import_v43.z.literal("tool_use"),
473
+ id: import_v43.z.string(),
474
+ name: import_v43.z.string(),
475
+ input: import_v43.z.unknown(),
476
+ caller: import_v43.z.union([
477
+ import_v43.z.object({
478
+ type: import_v43.z.literal("code_execution_20250825"),
479
+ tool_id: import_v43.z.string()
406
480
  }),
407
- import_v42.z.object({
408
- type: import_v42.z.literal("code_execution_20260120"),
409
- tool_id: import_v42.z.string()
481
+ import_v43.z.object({
482
+ type: import_v43.z.literal("code_execution_20260120"),
483
+ tool_id: import_v43.z.string()
410
484
  }),
411
- import_v42.z.object({
412
- type: import_v42.z.literal("direct")
485
+ import_v43.z.object({
486
+ type: import_v43.z.literal("direct")
413
487
  })
414
488
  ]).optional()
415
489
  })
416
490
  ])
417
491
  ).nullish(),
418
- stop_reason: import_v42.z.string().nullish(),
419
- container: import_v42.z.object({
420
- expires_at: import_v42.z.string(),
421
- id: import_v42.z.string()
492
+ stop_reason: import_v43.z.string().nullish(),
493
+ container: import_v43.z.object({
494
+ expires_at: import_v43.z.string(),
495
+ id: import_v43.z.string()
422
496
  }).nullish()
423
497
  })
424
498
  }),
425
- import_v42.z.object({
426
- type: import_v42.z.literal("content_block_start"),
427
- index: import_v42.z.number(),
428
- content_block: import_v42.z.discriminatedUnion("type", [
429
- import_v42.z.object({
430
- type: import_v42.z.literal("text"),
431
- text: import_v42.z.string()
499
+ import_v43.z.object({
500
+ type: import_v43.z.literal("content_block_start"),
501
+ index: import_v43.z.number(),
502
+ content_block: import_v43.z.discriminatedUnion("type", [
503
+ import_v43.z.object({
504
+ type: import_v43.z.literal("text"),
505
+ text: import_v43.z.string()
432
506
  }),
433
- import_v42.z.object({
434
- type: import_v42.z.literal("thinking"),
435
- thinking: import_v42.z.string()
507
+ import_v43.z.object({
508
+ type: import_v43.z.literal("thinking"),
509
+ thinking: import_v43.z.string()
436
510
  }),
437
- import_v42.z.object({
438
- type: import_v42.z.literal("tool_use"),
439
- id: import_v42.z.string(),
440
- name: import_v42.z.string(),
511
+ import_v43.z.object({
512
+ type: import_v43.z.literal("tool_use"),
513
+ id: import_v43.z.string(),
514
+ name: import_v43.z.string(),
441
515
  // Programmatic tool calling: input may be present directly for deferred tool calls
442
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).optional(),
516
+ input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
443
517
  // Programmatic tool calling: caller info when triggered from code execution
444
- caller: import_v42.z.union([
445
- import_v42.z.object({
446
- type: import_v42.z.literal("code_execution_20250825"),
447
- tool_id: import_v42.z.string()
518
+ caller: import_v43.z.union([
519
+ import_v43.z.object({
520
+ type: import_v43.z.literal("code_execution_20250825"),
521
+ tool_id: import_v43.z.string()
448
522
  }),
449
- import_v42.z.object({
450
- type: import_v42.z.literal("code_execution_20260120"),
451
- tool_id: import_v42.z.string()
523
+ import_v43.z.object({
524
+ type: import_v43.z.literal("code_execution_20260120"),
525
+ tool_id: import_v43.z.string()
452
526
  }),
453
- import_v42.z.object({
454
- type: import_v42.z.literal("direct")
527
+ import_v43.z.object({
528
+ type: import_v43.z.literal("direct")
455
529
  })
456
530
  ]).optional()
457
531
  }),
458
- import_v42.z.object({
459
- type: import_v42.z.literal("redacted_thinking"),
460
- data: import_v42.z.string()
532
+ import_v43.z.object({
533
+ type: import_v43.z.literal("redacted_thinking"),
534
+ data: import_v43.z.string()
461
535
  }),
462
- import_v42.z.object({
463
- type: import_v42.z.literal("compaction"),
464
- content: import_v42.z.string().nullish()
536
+ import_v43.z.object({
537
+ type: import_v43.z.literal("compaction"),
538
+ content: import_v43.z.string().nullish()
465
539
  }),
466
- import_v42.z.object({
467
- type: import_v42.z.literal("server_tool_use"),
468
- id: import_v42.z.string(),
469
- name: import_v42.z.string(),
470
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
471
- caller: import_v42.z.union([
472
- import_v42.z.object({
473
- type: import_v42.z.literal("code_execution_20260120"),
474
- tool_id: import_v42.z.string()
540
+ import_v43.z.object({
541
+ type: import_v43.z.literal("server_tool_use"),
542
+ id: import_v43.z.string(),
543
+ name: import_v43.z.string(),
544
+ input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
545
+ caller: import_v43.z.union([
546
+ import_v43.z.object({
547
+ type: import_v43.z.literal("code_execution_20260120"),
548
+ tool_id: import_v43.z.string()
475
549
  }),
476
- import_v42.z.object({
477
- type: import_v42.z.literal("direct")
550
+ import_v43.z.object({
551
+ type: import_v43.z.literal("direct")
478
552
  })
479
553
  ]).optional()
480
554
  }),
481
- import_v42.z.object({
482
- type: import_v42.z.literal("mcp_tool_use"),
483
- id: import_v42.z.string(),
484
- name: import_v42.z.string(),
485
- input: import_v42.z.unknown(),
486
- server_name: import_v42.z.string()
555
+ import_v43.z.object({
556
+ type: import_v43.z.literal("mcp_tool_use"),
557
+ id: import_v43.z.string(),
558
+ name: import_v43.z.string(),
559
+ input: import_v43.z.unknown(),
560
+ server_name: import_v43.z.string()
487
561
  }),
488
- import_v42.z.object({
489
- type: import_v42.z.literal("mcp_tool_result"),
490
- tool_use_id: import_v42.z.string(),
491
- is_error: import_v42.z.boolean(),
492
- content: import_v42.z.array(
493
- import_v42.z.union([
494
- import_v42.z.string(),
495
- import_v42.z.object({ type: import_v42.z.literal("text"), text: import_v42.z.string() })
562
+ import_v43.z.object({
563
+ type: import_v43.z.literal("mcp_tool_result"),
564
+ tool_use_id: import_v43.z.string(),
565
+ is_error: import_v43.z.boolean(),
566
+ content: import_v43.z.array(
567
+ import_v43.z.union([
568
+ import_v43.z.string(),
569
+ import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.z.string() })
496
570
  ])
497
571
  )
498
572
  }),
499
- import_v42.z.object({
500
- type: import_v42.z.literal("web_fetch_tool_result"),
501
- tool_use_id: import_v42.z.string(),
502
- content: import_v42.z.union([
503
- import_v42.z.object({
504
- type: import_v42.z.literal("web_fetch_result"),
505
- url: import_v42.z.string(),
506
- retrieved_at: import_v42.z.string(),
507
- content: import_v42.z.object({
508
- type: import_v42.z.literal("document"),
509
- title: import_v42.z.string().nullable(),
510
- citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
511
- source: import_v42.z.union([
512
- import_v42.z.object({
513
- type: import_v42.z.literal("base64"),
514
- media_type: import_v42.z.literal("application/pdf"),
515
- data: import_v42.z.string()
573
+ import_v43.z.object({
574
+ type: import_v43.z.literal("web_fetch_tool_result"),
575
+ tool_use_id: import_v43.z.string(),
576
+ content: import_v43.z.union([
577
+ import_v43.z.object({
578
+ type: import_v43.z.literal("web_fetch_result"),
579
+ url: import_v43.z.string(),
580
+ retrieved_at: import_v43.z.string(),
581
+ content: import_v43.z.object({
582
+ type: import_v43.z.literal("document"),
583
+ title: import_v43.z.string().nullable(),
584
+ citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
585
+ source: import_v43.z.union([
586
+ import_v43.z.object({
587
+ type: import_v43.z.literal("base64"),
588
+ media_type: import_v43.z.literal("application/pdf"),
589
+ data: import_v43.z.string()
516
590
  }),
517
- import_v42.z.object({
518
- type: import_v42.z.literal("text"),
519
- media_type: import_v42.z.literal("text/plain"),
520
- data: import_v42.z.string()
591
+ import_v43.z.object({
592
+ type: import_v43.z.literal("text"),
593
+ media_type: import_v43.z.literal("text/plain"),
594
+ data: import_v43.z.string()
521
595
  })
522
596
  ])
523
597
  })
524
598
  }),
525
- import_v42.z.object({
526
- type: import_v42.z.literal("web_fetch_tool_result_error"),
527
- error_code: import_v42.z.string()
599
+ import_v43.z.object({
600
+ type: import_v43.z.literal("web_fetch_tool_result_error"),
601
+ error_code: import_v43.z.string()
528
602
  })
529
603
  ])
530
604
  }),
531
- import_v42.z.object({
532
- type: import_v42.z.literal("web_search_tool_result"),
533
- tool_use_id: import_v42.z.string(),
534
- content: import_v42.z.union([
535
- import_v42.z.array(
536
- import_v42.z.object({
537
- type: import_v42.z.literal("web_search_result"),
538
- url: import_v42.z.string(),
539
- title: import_v42.z.string(),
540
- encrypted_content: import_v42.z.string(),
541
- page_age: import_v42.z.string().nullish()
605
+ import_v43.z.object({
606
+ type: import_v43.z.literal("web_search_tool_result"),
607
+ tool_use_id: import_v43.z.string(),
608
+ content: import_v43.z.union([
609
+ import_v43.z.array(
610
+ import_v43.z.object({
611
+ type: import_v43.z.literal("web_search_result"),
612
+ url: import_v43.z.string(),
613
+ title: import_v43.z.string(),
614
+ encrypted_content: import_v43.z.string(),
615
+ page_age: import_v43.z.string().nullish()
542
616
  })
543
617
  ),
544
- import_v42.z.object({
545
- type: import_v42.z.literal("web_search_tool_result_error"),
546
- error_code: import_v42.z.string()
618
+ import_v43.z.object({
619
+ type: import_v43.z.literal("web_search_tool_result_error"),
620
+ error_code: import_v43.z.string()
547
621
  })
548
622
  ])
549
623
  }),
550
624
  // code execution results for code_execution_20250522 tool:
551
- import_v42.z.object({
552
- type: import_v42.z.literal("code_execution_tool_result"),
553
- tool_use_id: import_v42.z.string(),
554
- content: import_v42.z.union([
555
- import_v42.z.object({
556
- type: import_v42.z.literal("code_execution_result"),
557
- stdout: import_v42.z.string(),
558
- stderr: import_v42.z.string(),
559
- return_code: import_v42.z.number(),
560
- content: import_v42.z.array(
561
- import_v42.z.object({
562
- type: import_v42.z.literal("code_execution_output"),
563
- file_id: import_v42.z.string()
625
+ import_v43.z.object({
626
+ type: import_v43.z.literal("code_execution_tool_result"),
627
+ tool_use_id: import_v43.z.string(),
628
+ content: import_v43.z.union([
629
+ import_v43.z.object({
630
+ type: import_v43.z.literal("code_execution_result"),
631
+ stdout: import_v43.z.string(),
632
+ stderr: import_v43.z.string(),
633
+ return_code: import_v43.z.number(),
634
+ content: import_v43.z.array(
635
+ import_v43.z.object({
636
+ type: import_v43.z.literal("code_execution_output"),
637
+ file_id: import_v43.z.string()
564
638
  })
565
639
  ).optional().default([])
566
640
  }),
567
- import_v42.z.object({
568
- type: import_v42.z.literal("encrypted_code_execution_result"),
569
- encrypted_stdout: import_v42.z.string(),
570
- stderr: import_v42.z.string(),
571
- return_code: import_v42.z.number(),
572
- content: import_v42.z.array(
573
- import_v42.z.object({
574
- type: import_v42.z.literal("code_execution_output"),
575
- file_id: import_v42.z.string()
641
+ import_v43.z.object({
642
+ type: import_v43.z.literal("encrypted_code_execution_result"),
643
+ encrypted_stdout: import_v43.z.string(),
644
+ stderr: import_v43.z.string(),
645
+ return_code: import_v43.z.number(),
646
+ content: import_v43.z.array(
647
+ import_v43.z.object({
648
+ type: import_v43.z.literal("code_execution_output"),
649
+ file_id: import_v43.z.string()
576
650
  })
577
651
  ).optional().default([])
578
652
  }),
579
- import_v42.z.object({
580
- type: import_v42.z.literal("code_execution_tool_result_error"),
581
- error_code: import_v42.z.string()
653
+ import_v43.z.object({
654
+ type: import_v43.z.literal("code_execution_tool_result_error"),
655
+ error_code: import_v43.z.string()
582
656
  })
583
657
  ])
584
658
  }),
585
659
  // bash code execution results for code_execution_20250825 tool:
586
- import_v42.z.object({
587
- type: import_v42.z.literal("bash_code_execution_tool_result"),
588
- tool_use_id: import_v42.z.string(),
589
- content: import_v42.z.discriminatedUnion("type", [
590
- import_v42.z.object({
591
- type: import_v42.z.literal("bash_code_execution_result"),
592
- content: import_v42.z.array(
593
- import_v42.z.object({
594
- type: import_v42.z.literal("bash_code_execution_output"),
595
- file_id: import_v42.z.string()
660
+ import_v43.z.object({
661
+ type: import_v43.z.literal("bash_code_execution_tool_result"),
662
+ tool_use_id: import_v43.z.string(),
663
+ content: import_v43.z.discriminatedUnion("type", [
664
+ import_v43.z.object({
665
+ type: import_v43.z.literal("bash_code_execution_result"),
666
+ content: import_v43.z.array(
667
+ import_v43.z.object({
668
+ type: import_v43.z.literal("bash_code_execution_output"),
669
+ file_id: import_v43.z.string()
596
670
  })
597
671
  ),
598
- stdout: import_v42.z.string(),
599
- stderr: import_v42.z.string(),
600
- return_code: import_v42.z.number()
672
+ stdout: import_v43.z.string(),
673
+ stderr: import_v43.z.string(),
674
+ return_code: import_v43.z.number()
601
675
  }),
602
- import_v42.z.object({
603
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
604
- error_code: import_v42.z.string()
676
+ import_v43.z.object({
677
+ type: import_v43.z.literal("bash_code_execution_tool_result_error"),
678
+ error_code: import_v43.z.string()
605
679
  })
606
680
  ])
607
681
  }),
608
682
  // text editor code execution results for code_execution_20250825 tool:
609
- import_v42.z.object({
610
- type: import_v42.z.literal("text_editor_code_execution_tool_result"),
611
- tool_use_id: import_v42.z.string(),
612
- content: import_v42.z.discriminatedUnion("type", [
613
- import_v42.z.object({
614
- type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
615
- error_code: import_v42.z.string()
683
+ import_v43.z.object({
684
+ type: import_v43.z.literal("text_editor_code_execution_tool_result"),
685
+ tool_use_id: import_v43.z.string(),
686
+ content: import_v43.z.discriminatedUnion("type", [
687
+ import_v43.z.object({
688
+ type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
689
+ error_code: import_v43.z.string()
616
690
  }),
617
- import_v42.z.object({
618
- type: import_v42.z.literal("text_editor_code_execution_view_result"),
619
- content: import_v42.z.string(),
620
- file_type: import_v42.z.string(),
621
- num_lines: import_v42.z.number().nullable(),
622
- start_line: import_v42.z.number().nullable(),
623
- total_lines: import_v42.z.number().nullable()
691
+ import_v43.z.object({
692
+ type: import_v43.z.literal("text_editor_code_execution_view_result"),
693
+ content: import_v43.z.string(),
694
+ file_type: import_v43.z.string(),
695
+ num_lines: import_v43.z.number().nullable(),
696
+ start_line: import_v43.z.number().nullable(),
697
+ total_lines: import_v43.z.number().nullable()
624
698
  }),
625
- import_v42.z.object({
626
- type: import_v42.z.literal("text_editor_code_execution_create_result"),
627
- is_file_update: import_v42.z.boolean()
699
+ import_v43.z.object({
700
+ type: import_v43.z.literal("text_editor_code_execution_create_result"),
701
+ is_file_update: import_v43.z.boolean()
628
702
  }),
629
- import_v42.z.object({
630
- type: import_v42.z.literal(
703
+ import_v43.z.object({
704
+ type: import_v43.z.literal(
631
705
  "text_editor_code_execution_str_replace_result"
632
706
  ),
633
- lines: import_v42.z.array(import_v42.z.string()).nullable(),
634
- new_lines: import_v42.z.number().nullable(),
635
- new_start: import_v42.z.number().nullable(),
636
- old_lines: import_v42.z.number().nullable(),
637
- old_start: import_v42.z.number().nullable()
707
+ lines: import_v43.z.array(import_v43.z.string()).nullable(),
708
+ new_lines: import_v43.z.number().nullable(),
709
+ new_start: import_v43.z.number().nullable(),
710
+ old_lines: import_v43.z.number().nullable(),
711
+ old_start: import_v43.z.number().nullable()
638
712
  })
639
713
  ])
640
714
  }),
641
715
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
642
- import_v42.z.object({
643
- type: import_v42.z.literal("tool_search_tool_result"),
644
- tool_use_id: import_v42.z.string(),
645
- content: import_v42.z.union([
646
- import_v42.z.object({
647
- type: import_v42.z.literal("tool_search_tool_search_result"),
648
- tool_references: import_v42.z.array(
649
- import_v42.z.object({
650
- type: import_v42.z.literal("tool_reference"),
651
- tool_name: import_v42.z.string()
716
+ import_v43.z.object({
717
+ type: import_v43.z.literal("tool_search_tool_result"),
718
+ tool_use_id: import_v43.z.string(),
719
+ content: import_v43.z.union([
720
+ import_v43.z.object({
721
+ type: import_v43.z.literal("tool_search_tool_search_result"),
722
+ tool_references: import_v43.z.array(
723
+ import_v43.z.object({
724
+ type: import_v43.z.literal("tool_reference"),
725
+ tool_name: import_v43.z.string()
652
726
  })
653
727
  )
654
728
  }),
655
- import_v42.z.object({
656
- type: import_v42.z.literal("tool_search_tool_result_error"),
657
- error_code: import_v42.z.string()
729
+ import_v43.z.object({
730
+ type: import_v43.z.literal("tool_search_tool_result_error"),
731
+ error_code: import_v43.z.string()
658
732
  })
659
733
  ])
660
734
  })
661
735
  ])
662
736
  }),
663
- import_v42.z.object({
664
- type: import_v42.z.literal("content_block_delta"),
665
- index: import_v42.z.number(),
666
- delta: import_v42.z.discriminatedUnion("type", [
667
- import_v42.z.object({
668
- type: import_v42.z.literal("input_json_delta"),
669
- partial_json: import_v42.z.string()
737
+ import_v43.z.object({
738
+ type: import_v43.z.literal("content_block_delta"),
739
+ index: import_v43.z.number(),
740
+ delta: import_v43.z.discriminatedUnion("type", [
741
+ import_v43.z.object({
742
+ type: import_v43.z.literal("input_json_delta"),
743
+ partial_json: import_v43.z.string()
670
744
  }),
671
- import_v42.z.object({
672
- type: import_v42.z.literal("text_delta"),
673
- text: import_v42.z.string()
745
+ import_v43.z.object({
746
+ type: import_v43.z.literal("text_delta"),
747
+ text: import_v43.z.string()
674
748
  }),
675
- import_v42.z.object({
676
- type: import_v42.z.literal("thinking_delta"),
677
- thinking: import_v42.z.string()
749
+ import_v43.z.object({
750
+ type: import_v43.z.literal("thinking_delta"),
751
+ thinking: import_v43.z.string()
678
752
  }),
679
- import_v42.z.object({
680
- type: import_v42.z.literal("signature_delta"),
681
- signature: import_v42.z.string()
753
+ import_v43.z.object({
754
+ type: import_v43.z.literal("signature_delta"),
755
+ signature: import_v43.z.string()
682
756
  }),
683
- import_v42.z.object({
684
- type: import_v42.z.literal("compaction_delta"),
685
- content: import_v42.z.string().nullish()
757
+ import_v43.z.object({
758
+ type: import_v43.z.literal("compaction_delta"),
759
+ content: import_v43.z.string().nullish()
686
760
  }),
687
- import_v42.z.object({
688
- type: import_v42.z.literal("citations_delta"),
689
- citation: import_v42.z.discriminatedUnion("type", [
690
- import_v42.z.object({
691
- type: import_v42.z.literal("web_search_result_location"),
692
- cited_text: import_v42.z.string(),
693
- url: import_v42.z.string(),
694
- title: import_v42.z.string(),
695
- encrypted_index: import_v42.z.string()
761
+ import_v43.z.object({
762
+ type: import_v43.z.literal("citations_delta"),
763
+ citation: import_v43.z.discriminatedUnion("type", [
764
+ import_v43.z.object({
765
+ type: import_v43.z.literal("web_search_result_location"),
766
+ cited_text: import_v43.z.string(),
767
+ url: import_v43.z.string(),
768
+ title: import_v43.z.string(),
769
+ encrypted_index: import_v43.z.string()
696
770
  }),
697
- import_v42.z.object({
698
- type: import_v42.z.literal("page_location"),
699
- cited_text: import_v42.z.string(),
700
- document_index: import_v42.z.number(),
701
- document_title: import_v42.z.string().nullable(),
702
- start_page_number: import_v42.z.number(),
703
- end_page_number: import_v42.z.number()
771
+ import_v43.z.object({
772
+ type: import_v43.z.literal("page_location"),
773
+ cited_text: import_v43.z.string(),
774
+ document_index: import_v43.z.number(),
775
+ document_title: import_v43.z.string().nullable(),
776
+ start_page_number: import_v43.z.number(),
777
+ end_page_number: import_v43.z.number()
704
778
  }),
705
- import_v42.z.object({
706
- type: import_v42.z.literal("char_location"),
707
- cited_text: import_v42.z.string(),
708
- document_index: import_v42.z.number(),
709
- document_title: import_v42.z.string().nullable(),
710
- start_char_index: import_v42.z.number(),
711
- end_char_index: import_v42.z.number()
779
+ import_v43.z.object({
780
+ type: import_v43.z.literal("char_location"),
781
+ cited_text: import_v43.z.string(),
782
+ document_index: import_v43.z.number(),
783
+ document_title: import_v43.z.string().nullable(),
784
+ start_char_index: import_v43.z.number(),
785
+ end_char_index: import_v43.z.number()
712
786
  })
713
787
  ])
714
788
  })
715
789
  ])
716
790
  }),
717
- import_v42.z.object({
718
- type: import_v42.z.literal("content_block_stop"),
719
- index: import_v42.z.number()
791
+ import_v43.z.object({
792
+ type: import_v43.z.literal("content_block_stop"),
793
+ index: import_v43.z.number()
720
794
  }),
721
- import_v42.z.object({
722
- type: import_v42.z.literal("error"),
723
- error: import_v42.z.object({
724
- type: import_v42.z.string(),
725
- message: import_v42.z.string()
795
+ import_v43.z.object({
796
+ type: import_v43.z.literal("error"),
797
+ error: import_v43.z.object({
798
+ type: import_v43.z.string(),
799
+ message: import_v43.z.string()
726
800
  })
727
801
  }),
728
- import_v42.z.object({
729
- type: import_v42.z.literal("message_delta"),
730
- delta: import_v42.z.object({
731
- stop_reason: import_v42.z.string().nullish(),
732
- stop_sequence: import_v42.z.string().nullish(),
733
- container: import_v42.z.object({
734
- expires_at: import_v42.z.string(),
735
- id: import_v42.z.string(),
736
- skills: import_v42.z.array(
737
- import_v42.z.object({
738
- type: import_v42.z.union([
739
- import_v42.z.literal("anthropic"),
740
- import_v42.z.literal("custom")
802
+ import_v43.z.object({
803
+ type: import_v43.z.literal("message_delta"),
804
+ delta: import_v43.z.object({
805
+ stop_reason: import_v43.z.string().nullish(),
806
+ stop_sequence: import_v43.z.string().nullish(),
807
+ container: import_v43.z.object({
808
+ expires_at: import_v43.z.string(),
809
+ id: import_v43.z.string(),
810
+ skills: import_v43.z.array(
811
+ import_v43.z.object({
812
+ type: import_v43.z.union([
813
+ import_v43.z.literal("anthropic"),
814
+ import_v43.z.literal("custom")
741
815
  ]),
742
- skill_id: import_v42.z.string(),
743
- version: import_v42.z.string()
816
+ skill_id: import_v43.z.string(),
817
+ version: import_v43.z.string()
744
818
  })
745
819
  ).nullish()
746
820
  }).nullish()
747
821
  }),
748
- usage: import_v42.z.looseObject({
749
- input_tokens: import_v42.z.number().nullish(),
750
- output_tokens: import_v42.z.number(),
751
- cache_creation_input_tokens: import_v42.z.number().nullish(),
752
- cache_read_input_tokens: import_v42.z.number().nullish(),
753
- iterations: import_v42.z.array(
754
- import_v42.z.object({
755
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
756
- input_tokens: import_v42.z.number(),
757
- output_tokens: import_v42.z.number()
822
+ usage: import_v43.z.looseObject({
823
+ input_tokens: import_v43.z.number().nullish(),
824
+ output_tokens: import_v43.z.number(),
825
+ cache_creation_input_tokens: import_v43.z.number().nullish(),
826
+ cache_read_input_tokens: import_v43.z.number().nullish(),
827
+ iterations: import_v43.z.array(
828
+ import_v43.z.object({
829
+ type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
830
+ input_tokens: import_v43.z.number(),
831
+ output_tokens: import_v43.z.number()
758
832
  })
759
833
  ).nullish()
760
834
  }),
761
- context_management: import_v42.z.object({
762
- applied_edits: import_v42.z.array(
763
- import_v42.z.union([
764
- import_v42.z.object({
765
- type: import_v42.z.literal("clear_tool_uses_20250919"),
766
- cleared_tool_uses: import_v42.z.number(),
767
- cleared_input_tokens: import_v42.z.number()
835
+ context_management: import_v43.z.object({
836
+ applied_edits: import_v43.z.array(
837
+ import_v43.z.union([
838
+ import_v43.z.object({
839
+ type: import_v43.z.literal("clear_tool_uses_20250919"),
840
+ cleared_tool_uses: import_v43.z.number(),
841
+ cleared_input_tokens: import_v43.z.number()
768
842
  }),
769
- import_v42.z.object({
770
- type: import_v42.z.literal("clear_thinking_20251015"),
771
- cleared_thinking_turns: import_v42.z.number(),
772
- cleared_input_tokens: import_v42.z.number()
843
+ import_v43.z.object({
844
+ type: import_v43.z.literal("clear_thinking_20251015"),
845
+ cleared_thinking_turns: import_v43.z.number(),
846
+ cleared_input_tokens: import_v43.z.number()
773
847
  }),
774
- import_v42.z.object({
775
- type: import_v42.z.literal("compact_20260112")
848
+ import_v43.z.object({
849
+ type: import_v43.z.literal("compact_20260112")
776
850
  })
777
851
  ])
778
852
  )
779
853
  }).nullish()
780
854
  }),
781
- import_v42.z.object({
782
- type: import_v42.z.literal("message_stop")
855
+ import_v43.z.object({
856
+ type: import_v43.z.literal("message_stop")
783
857
  }),
784
- import_v42.z.object({
785
- type: import_v42.z.literal("ping")
858
+ import_v43.z.object({
859
+ type: import_v43.z.literal("ping")
786
860
  })
787
861
  ])
788
862
  )
789
863
  );
790
- var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
791
- () => (0, import_provider_utils2.zodSchema)(
792
- import_v42.z.object({
793
- signature: import_v42.z.string().optional(),
794
- redactedData: import_v42.z.string().optional()
864
+ var anthropicReasoningMetadataSchema = (0, import_provider_utils3.lazySchema)(
865
+ () => (0, import_provider_utils3.zodSchema)(
866
+ import_v43.z.object({
867
+ signature: import_v43.z.string().optional(),
868
+ redactedData: import_v43.z.string().optional()
795
869
  })
796
870
  )
797
871
  );
798
872
 
799
873
  // src/anthropic-messages-options.ts
800
- var import_v43 = require("zod/v4");
801
- var anthropicFilePartProviderOptions = import_v43.z.object({
874
+ var import_v44 = require("zod/v4");
875
+ var anthropicFilePartProviderOptions = import_v44.z.object({
802
876
  /**
803
877
  * Citation configuration for this document.
804
878
  * When enabled, this document will generate citations in the response.
805
879
  */
806
- citations: import_v43.z.object({
880
+ citations: import_v44.z.object({
807
881
  /**
808
882
  * Enable citations for this document
809
883
  */
810
- enabled: import_v43.z.boolean()
884
+ enabled: import_v44.z.boolean()
811
885
  }).optional(),
812
886
  /**
813
887
  * Custom title for the document.
814
888
  * If not provided, the filename will be used.
815
889
  */
816
- title: import_v43.z.string().optional(),
890
+ title: import_v44.z.string().optional(),
817
891
  /**
818
892
  * Context about the document that will be passed to the model
819
893
  * but not used towards cited content.
820
894
  * Useful for storing document metadata as text or stringified JSON.
821
895
  */
822
- context: import_v43.z.string().optional()
896
+ context: import_v44.z.string().optional()
823
897
  });
824
- var anthropicLanguageModelOptions = import_v43.z.object({
898
+ var anthropicLanguageModelOptions = import_v44.z.object({
825
899
  /**
826
900
  * Whether to send reasoning to the model.
827
901
  *
828
902
  * This allows you to deactivate reasoning inputs for models that do not support them.
829
903
  */
830
- sendReasoning: import_v43.z.boolean().optional(),
904
+ sendReasoning: import_v44.z.boolean().optional(),
831
905
  /**
832
906
  * Determines how structured outputs are generated.
833
907
  *
@@ -835,52 +909,66 @@ var anthropicLanguageModelOptions = import_v43.z.object({
835
909
  * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
836
910
  * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
837
911
  */
838
- structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
912
+ structuredOutputMode: import_v44.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
839
913
  /**
840
914
  * Configuration for enabling Claude's extended thinking.
841
915
  *
842
916
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
843
917
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
844
918
  */
845
- thinking: import_v43.z.discriminatedUnion("type", [
846
- import_v43.z.object({
919
+ thinking: import_v44.z.discriminatedUnion("type", [
920
+ import_v44.z.object({
847
921
  /** for Sonnet 4.6, Opus 4.6, and newer models */
848
- type: import_v43.z.literal("adaptive")
922
+ type: import_v44.z.literal("adaptive")
849
923
  }),
850
- import_v43.z.object({
924
+ import_v44.z.object({
851
925
  /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
852
- type: import_v43.z.literal("enabled"),
853
- budgetTokens: import_v43.z.number().optional()
926
+ type: import_v44.z.literal("enabled"),
927
+ budgetTokens: import_v44.z.number().optional()
854
928
  }),
855
- import_v43.z.object({
856
- type: import_v43.z.literal("disabled")
929
+ import_v44.z.object({
930
+ type: import_v44.z.literal("disabled")
857
931
  })
858
932
  ]).optional(),
859
933
  /**
860
934
  * Whether to disable parallel function calling during tool use. Default is false.
861
935
  * When set to true, Claude will use at most one tool per response.
862
936
  */
863
- disableParallelToolUse: import_v43.z.boolean().optional(),
937
+ disableParallelToolUse: import_v44.z.boolean().optional(),
864
938
  /**
865
939
  * Cache control settings for this message.
866
940
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
867
941
  */
868
- cacheControl: import_v43.z.object({
869
- type: import_v43.z.literal("ephemeral"),
870
- ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
942
+ cacheControl: import_v44.z.object({
943
+ type: import_v44.z.literal("ephemeral"),
944
+ ttl: import_v44.z.union([import_v44.z.literal("5m"), import_v44.z.literal("1h")]).optional()
945
+ }).optional(),
946
+ /**
947
+ * Metadata to include with the request.
948
+ *
949
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
950
+ */
951
+ metadata: import_v44.z.object({
952
+ /**
953
+ * An external identifier for the user associated with the request.
954
+ *
955
+ * Should be a UUID, hash value, or other opaque identifier.
956
+ * Must not contain PII (name, email, phone number, etc.).
957
+ */
958
+ userId: import_v44.z.string().optional()
871
959
  }).optional(),
872
960
  /**
873
961
  * MCP servers to be utilized in this request.
874
962
  */
875
- mcpServers: import_v43.z.array(
876
- import_v43.z.object({
877
- type: import_v43.z.literal("url"),
878
- name: import_v43.z.string(),
879
- url: import_v43.z.string(),
880
- authorizationToken: import_v43.z.string().nullish(),
881
- toolConfiguration: import_v43.z.object({
882
- enabled: import_v43.z.boolean().nullish(),
883
- allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
963
+ mcpServers: import_v44.z.array(
964
+ import_v44.z.object({
965
+ type: import_v44.z.literal("url"),
966
+ name: import_v44.z.string(),
967
+ url: import_v44.z.string(),
968
+ authorizationToken: import_v44.z.string().nullish(),
969
+ toolConfiguration: import_v44.z.object({
970
+ enabled: import_v44.z.boolean().nullish(),
971
+ allowedTools: import_v44.z.array(import_v44.z.string()).nullish()
884
972
  }).nullish()
885
973
  })
886
974
  ).optional(),
@@ -889,14 +977,21 @@ var anthropicLanguageModelOptions = import_v43.z.object({
889
977
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
890
978
  * Requires code execution tool to be enabled.
891
979
  */
892
- container: import_v43.z.object({
893
- id: import_v43.z.string().optional(),
894
- skills: import_v43.z.array(
895
- import_v43.z.object({
896
- type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
897
- skillId: import_v43.z.string(),
898
- version: import_v43.z.string().optional()
899
- })
980
+ container: import_v44.z.object({
981
+ id: import_v44.z.string().optional(),
982
+ skills: import_v44.z.array(
983
+ import_v44.z.discriminatedUnion("type", [
984
+ import_v44.z.object({
985
+ type: import_v44.z.literal("anthropic"),
986
+ skillId: import_v44.z.string(),
987
+ version: import_v44.z.string().optional()
988
+ }),
989
+ import_v44.z.object({
990
+ type: import_v44.z.literal("custom"),
991
+ providerReference: import_v44.z.record(import_v44.z.string(), import_v44.z.string()),
992
+ version: import_v44.z.string().optional()
993
+ })
994
+ ])
900
995
  ).optional()
901
996
  }).optional(),
902
997
  /**
@@ -907,65 +1002,65 @@ var anthropicLanguageModelOptions = import_v43.z.object({
907
1002
  *
908
1003
  * @default true
909
1004
  */
910
- toolStreaming: import_v43.z.boolean().optional(),
1005
+ toolStreaming: import_v44.z.boolean().optional(),
911
1006
  /**
912
1007
  * @default 'high'
913
1008
  */
914
- effort: import_v43.z.enum(["low", "medium", "high", "max"]).optional(),
1009
+ effort: import_v44.z.enum(["low", "medium", "high", "max"]).optional(),
915
1010
  /**
916
1011
  * Enable fast mode for faster inference (2.5x faster output token speeds).
917
1012
  * Only supported with claude-opus-4-6.
918
1013
  */
919
- speed: import_v43.z.enum(["fast", "standard"]).optional(),
1014
+ speed: import_v44.z.enum(["fast", "standard"]).optional(),
920
1015
  /**
921
1016
  * A set of beta features to enable.
922
1017
  * Allow a provider to receive the full `betas` set if it needs it.
923
1018
  */
924
- anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
925
- contextManagement: import_v43.z.object({
926
- edits: import_v43.z.array(
927
- import_v43.z.discriminatedUnion("type", [
928
- import_v43.z.object({
929
- type: import_v43.z.literal("clear_tool_uses_20250919"),
930
- trigger: import_v43.z.discriminatedUnion("type", [
931
- import_v43.z.object({
932
- type: import_v43.z.literal("input_tokens"),
933
- value: import_v43.z.number()
1019
+ anthropicBeta: import_v44.z.array(import_v44.z.string()).optional(),
1020
+ contextManagement: import_v44.z.object({
1021
+ edits: import_v44.z.array(
1022
+ import_v44.z.discriminatedUnion("type", [
1023
+ import_v44.z.object({
1024
+ type: import_v44.z.literal("clear_tool_uses_20250919"),
1025
+ trigger: import_v44.z.discriminatedUnion("type", [
1026
+ import_v44.z.object({
1027
+ type: import_v44.z.literal("input_tokens"),
1028
+ value: import_v44.z.number()
934
1029
  }),
935
- import_v43.z.object({
936
- type: import_v43.z.literal("tool_uses"),
937
- value: import_v43.z.number()
1030
+ import_v44.z.object({
1031
+ type: import_v44.z.literal("tool_uses"),
1032
+ value: import_v44.z.number()
938
1033
  })
939
1034
  ]).optional(),
940
- keep: import_v43.z.object({
941
- type: import_v43.z.literal("tool_uses"),
942
- value: import_v43.z.number()
1035
+ keep: import_v44.z.object({
1036
+ type: import_v44.z.literal("tool_uses"),
1037
+ value: import_v44.z.number()
943
1038
  }).optional(),
944
- clearAtLeast: import_v43.z.object({
945
- type: import_v43.z.literal("input_tokens"),
946
- value: import_v43.z.number()
1039
+ clearAtLeast: import_v44.z.object({
1040
+ type: import_v44.z.literal("input_tokens"),
1041
+ value: import_v44.z.number()
947
1042
  }).optional(),
948
- clearToolInputs: import_v43.z.boolean().optional(),
949
- excludeTools: import_v43.z.array(import_v43.z.string()).optional()
1043
+ clearToolInputs: import_v44.z.boolean().optional(),
1044
+ excludeTools: import_v44.z.array(import_v44.z.string()).optional()
950
1045
  }),
951
- import_v43.z.object({
952
- type: import_v43.z.literal("clear_thinking_20251015"),
953
- keep: import_v43.z.union([
954
- import_v43.z.literal("all"),
955
- import_v43.z.object({
956
- type: import_v43.z.literal("thinking_turns"),
957
- value: import_v43.z.number()
1046
+ import_v44.z.object({
1047
+ type: import_v44.z.literal("clear_thinking_20251015"),
1048
+ keep: import_v44.z.union([
1049
+ import_v44.z.literal("all"),
1050
+ import_v44.z.object({
1051
+ type: import_v44.z.literal("thinking_turns"),
1052
+ value: import_v44.z.number()
958
1053
  })
959
1054
  ]).optional()
960
1055
  }),
961
- import_v43.z.object({
962
- type: import_v43.z.literal("compact_20260112"),
963
- trigger: import_v43.z.object({
964
- type: import_v43.z.literal("input_tokens"),
965
- value: import_v43.z.number()
1056
+ import_v44.z.object({
1057
+ type: import_v44.z.literal("compact_20260112"),
1058
+ trigger: import_v44.z.object({
1059
+ type: import_v44.z.literal("input_tokens"),
1060
+ value: import_v44.z.number()
966
1061
  }).optional(),
967
- pauseAfterCompaction: import_v43.z.boolean().optional(),
968
- instructions: import_v43.z.string().optional()
1062
+ pauseAfterCompaction: import_v44.z.boolean().optional(),
1063
+ instructions: import_v44.z.string().optional()
969
1064
  })
970
1065
  ])
971
1066
  )
@@ -1018,91 +1113,42 @@ var CacheControlValidator = class {
1018
1113
  };
1019
1114
 
1020
1115
  // src/tool/text-editor_20250728.ts
1021
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
1022
- var import_v44 = require("zod/v4");
1023
1116
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
1024
- var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1025
- () => (0, import_provider_utils4.zodSchema)(
1026
- import_v44.z.object({
1027
- maxCharacters: import_v44.z.number().optional()
1028
- })
1029
- )
1030
- );
1031
- var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1032
- () => (0, import_provider_utils4.zodSchema)(
1033
- import_v44.z.object({
1034
- command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
1035
- path: import_v44.z.string(),
1036
- file_text: import_v44.z.string().optional(),
1037
- insert_line: import_v44.z.number().int().optional(),
1038
- new_str: import_v44.z.string().optional(),
1039
- insert_text: import_v44.z.string().optional(),
1040
- old_str: import_v44.z.string().optional(),
1041
- view_range: import_v44.z.array(import_v44.z.number().int()).optional()
1042
- })
1043
- )
1044
- );
1045
- var factory = (0, import_provider_utils3.createProviderToolFactory)({
1046
- id: "anthropic.text_editor_20250728",
1047
- inputSchema: textEditor_20250728InputSchema
1048
- });
1049
- var textEditor_20250728 = (args = {}) => {
1050
- return factory(args);
1051
- };
1052
-
1053
- // src/tool/web-search_20260209.ts
1054
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1055
1117
  var import_v45 = require("zod/v4");
1056
- var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
1118
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1119
+ var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
1057
1120
  () => (0, import_provider_utils5.zodSchema)(
1058
1121
  import_v45.z.object({
1059
- maxUses: import_v45.z.number().optional(),
1060
- allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1061
- blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1062
- userLocation: import_v45.z.object({
1063
- type: import_v45.z.literal("approximate"),
1064
- city: import_v45.z.string().optional(),
1065
- region: import_v45.z.string().optional(),
1066
- country: import_v45.z.string().optional(),
1067
- timezone: import_v45.z.string().optional()
1068
- }).optional()
1122
+ maxCharacters: import_v45.z.number().optional()
1069
1123
  })
1070
1124
  )
1071
1125
  );
1072
- var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
1073
- () => (0, import_provider_utils5.zodSchema)(
1074
- import_v45.z.array(
1075
- import_v45.z.object({
1076
- url: import_v45.z.string(),
1077
- title: import_v45.z.string().nullable(),
1078
- pageAge: import_v45.z.string().nullable(),
1079
- encryptedContent: import_v45.z.string(),
1080
- type: import_v45.z.literal("web_search_result")
1081
- })
1082
- )
1083
- )
1084
- );
1085
- var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
1126
+ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
1086
1127
  () => (0, import_provider_utils5.zodSchema)(
1087
1128
  import_v45.z.object({
1088
- query: import_v45.z.string()
1129
+ command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1130
+ path: import_v45.z.string(),
1131
+ file_text: import_v45.z.string().optional(),
1132
+ insert_line: import_v45.z.number().int().optional(),
1133
+ new_str: import_v45.z.string().optional(),
1134
+ insert_text: import_v45.z.string().optional(),
1135
+ old_str: import_v45.z.string().optional(),
1136
+ view_range: import_v45.z.array(import_v45.z.number().int()).optional()
1089
1137
  })
1090
1138
  )
1091
1139
  );
1092
- var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
1093
- id: "anthropic.web_search_20260209",
1094
- inputSchema: webSearch_20260209InputSchema,
1095
- outputSchema: webSearch_20260209OutputSchema,
1096
- supportsDeferredResults: true
1140
+ var factory = (0, import_provider_utils4.createProviderToolFactory)({
1141
+ id: "anthropic.text_editor_20250728",
1142
+ inputSchema: textEditor_20250728InputSchema
1097
1143
  });
1098
- var webSearch_20260209 = (args = {}) => {
1099
- return factory2(args);
1144
+ var textEditor_20250728 = (args = {}) => {
1145
+ return factory(args);
1100
1146
  };
1101
1147
 
1102
- // src/tool/web-search_20250305.ts
1148
+ // src/tool/web-search_20260209.ts
1103
1149
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1104
1150
  var import_v46 = require("zod/v4");
1105
- var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1151
+ var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
1106
1152
  () => (0, import_provider_utils6.zodSchema)(
1107
1153
  import_v46.z.object({
1108
1154
  maxUses: import_v46.z.number().optional(),
@@ -1118,7 +1164,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1118
1164
  })
1119
1165
  )
1120
1166
  );
1121
- var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1167
+ var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
1122
1168
  () => (0, import_provider_utils6.zodSchema)(
1123
1169
  import_v46.z.array(
1124
1170
  import_v46.z.object({
@@ -1131,84 +1177,76 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1131
1177
  )
1132
1178
  )
1133
1179
  );
1134
- var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1180
+ var webSearch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
1135
1181
  () => (0, import_provider_utils6.zodSchema)(
1136
1182
  import_v46.z.object({
1137
1183
  query: import_v46.z.string()
1138
1184
  })
1139
1185
  )
1140
1186
  );
1141
- var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1142
- id: "anthropic.web_search_20250305",
1143
- inputSchema: webSearch_20250305InputSchema,
1144
- outputSchema: webSearch_20250305OutputSchema,
1187
+ var factory2 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1188
+ id: "anthropic.web_search_20260209",
1189
+ inputSchema: webSearch_20260209InputSchema,
1190
+ outputSchema: webSearch_20260209OutputSchema,
1145
1191
  supportsDeferredResults: true
1146
1192
  });
1147
- var webSearch_20250305 = (args = {}) => {
1148
- return factory3(args);
1193
+ var webSearch_20260209 = (args = {}) => {
1194
+ return factory2(args);
1149
1195
  };
1150
1196
 
1151
- // src/tool/web-fetch-20260209.ts
1197
+ // src/tool/web-search_20250305.ts
1152
1198
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1153
1199
  var import_v47 = require("zod/v4");
1154
- var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
1200
+ var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
1155
1201
  () => (0, import_provider_utils7.zodSchema)(
1156
1202
  import_v47.z.object({
1157
1203
  maxUses: import_v47.z.number().optional(),
1158
1204
  allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1159
1205
  blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1160
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1161
- maxContentTokens: import_v47.z.number().optional()
1206
+ userLocation: import_v47.z.object({
1207
+ type: import_v47.z.literal("approximate"),
1208
+ city: import_v47.z.string().optional(),
1209
+ region: import_v47.z.string().optional(),
1210
+ country: import_v47.z.string().optional(),
1211
+ timezone: import_v47.z.string().optional()
1212
+ }).optional()
1162
1213
  })
1163
1214
  )
1164
1215
  );
1165
- var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1216
+ var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
1166
1217
  () => (0, import_provider_utils7.zodSchema)(
1167
- import_v47.z.object({
1168
- type: import_v47.z.literal("web_fetch_result"),
1169
- url: import_v47.z.string(),
1170
- content: import_v47.z.object({
1171
- type: import_v47.z.literal("document"),
1218
+ import_v47.z.array(
1219
+ import_v47.z.object({
1220
+ url: import_v47.z.string(),
1172
1221
  title: import_v47.z.string().nullable(),
1173
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1174
- source: import_v47.z.union([
1175
- import_v47.z.object({
1176
- type: import_v47.z.literal("base64"),
1177
- mediaType: import_v47.z.literal("application/pdf"),
1178
- data: import_v47.z.string()
1179
- }),
1180
- import_v47.z.object({
1181
- type: import_v47.z.literal("text"),
1182
- mediaType: import_v47.z.literal("text/plain"),
1183
- data: import_v47.z.string()
1184
- })
1185
- ])
1186
- }),
1187
- retrievedAt: import_v47.z.string().nullable()
1188
- })
1222
+ pageAge: import_v47.z.string().nullable(),
1223
+ encryptedContent: import_v47.z.string(),
1224
+ type: import_v47.z.literal("web_search_result")
1225
+ })
1226
+ )
1189
1227
  )
1190
1228
  );
1191
- var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1229
+ var webSearch_20250305InputSchema = (0, import_provider_utils7.lazySchema)(
1192
1230
  () => (0, import_provider_utils7.zodSchema)(
1193
1231
  import_v47.z.object({
1194
- url: import_v47.z.string()
1232
+ query: import_v47.z.string()
1195
1233
  })
1196
1234
  )
1197
1235
  );
1198
- var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1199
- id: "anthropic.web_fetch_20260209",
1200
- inputSchema: webFetch_20260209InputSchema,
1201
- outputSchema: webFetch_20260209OutputSchema,
1236
+ var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1237
+ id: "anthropic.web_search_20250305",
1238
+ inputSchema: webSearch_20250305InputSchema,
1239
+ outputSchema: webSearch_20250305OutputSchema,
1202
1240
  supportsDeferredResults: true
1203
1241
  });
1204
- var webFetch_20260209 = (args = {}) => {
1205
- return factory4(args);
1242
+ var webSearch_20250305 = (args = {}) => {
1243
+ return factory3(args);
1206
1244
  };
1207
1245
 
1208
- // src/tool/web-fetch-20250910.ts
1246
+ // src/tool/web-fetch-20260209.ts
1209
1247
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1210
1248
  var import_v48 = require("zod/v4");
1211
- var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1249
+ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
1212
1250
  () => (0, import_provider_utils8.zodSchema)(
1213
1251
  import_v48.z.object({
1214
1252
  maxUses: import_v48.z.number().optional(),
@@ -1219,7 +1257,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1219
1257
  })
1220
1258
  )
1221
1259
  );
1222
- var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1260
+ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
1223
1261
  () => (0, import_provider_utils8.zodSchema)(
1224
1262
  import_v48.z.object({
1225
1263
  type: import_v48.z.literal("web_fetch_result"),
@@ -1245,14 +1283,71 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1245
1283
  })
1246
1284
  )
1247
1285
  );
1248
- var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1286
+ var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
1249
1287
  () => (0, import_provider_utils8.zodSchema)(
1250
1288
  import_v48.z.object({
1251
1289
  url: import_v48.z.string()
1252
1290
  })
1253
1291
  )
1254
1292
  );
1255
- var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1293
+ var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1294
+ id: "anthropic.web_fetch_20260209",
1295
+ inputSchema: webFetch_20260209InputSchema,
1296
+ outputSchema: webFetch_20260209OutputSchema,
1297
+ supportsDeferredResults: true
1298
+ });
1299
+ var webFetch_20260209 = (args = {}) => {
1300
+ return factory4(args);
1301
+ };
1302
+
1303
+ // src/tool/web-fetch-20250910.ts
1304
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1305
+ var import_v49 = require("zod/v4");
1306
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
1307
+ () => (0, import_provider_utils9.zodSchema)(
1308
+ import_v49.z.object({
1309
+ maxUses: import_v49.z.number().optional(),
1310
+ allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1311
+ blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1312
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1313
+ maxContentTokens: import_v49.z.number().optional()
1314
+ })
1315
+ )
1316
+ );
1317
+ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
1318
+ () => (0, import_provider_utils9.zodSchema)(
1319
+ import_v49.z.object({
1320
+ type: import_v49.z.literal("web_fetch_result"),
1321
+ url: import_v49.z.string(),
1322
+ content: import_v49.z.object({
1323
+ type: import_v49.z.literal("document"),
1324
+ title: import_v49.z.string().nullable(),
1325
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1326
+ source: import_v49.z.union([
1327
+ import_v49.z.object({
1328
+ type: import_v49.z.literal("base64"),
1329
+ mediaType: import_v49.z.literal("application/pdf"),
1330
+ data: import_v49.z.string()
1331
+ }),
1332
+ import_v49.z.object({
1333
+ type: import_v49.z.literal("text"),
1334
+ mediaType: import_v49.z.literal("text/plain"),
1335
+ data: import_v49.z.string()
1336
+ })
1337
+ ])
1338
+ }),
1339
+ retrievedAt: import_v49.z.string().nullable()
1340
+ })
1341
+ )
1342
+ );
1343
+ var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
1344
+ () => (0, import_provider_utils9.zodSchema)(
1345
+ import_v49.z.object({
1346
+ url: import_v49.z.string()
1347
+ })
1348
+ )
1349
+ );
1350
+ var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1256
1351
  id: "anthropic.web_fetch_20250910",
1257
1352
  inputSchema: webFetch_20250910InputSchema,
1258
1353
  outputSchema: webFetch_20250910OutputSchema,
@@ -1263,13 +1358,14 @@ var webFetch_20250910 = (args = {}) => {
1263
1358
  };
1264
1359
 
1265
1360
  // src/anthropic-prepare-tools.ts
1266
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1361
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1267
1362
  async function prepareTools({
1268
1363
  tools,
1269
1364
  toolChoice,
1270
1365
  disableParallelToolUse,
1271
1366
  cacheControlValidator,
1272
- supportsStructuredOutput
1367
+ supportsStructuredOutput,
1368
+ supportsStrictTools
1273
1369
  }) {
1274
1370
  var _a;
1275
1371
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1291,13 +1387,20 @@ async function prepareTools({
1291
1387
  const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1292
1388
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1293
1389
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1390
+ if (!supportsStrictTools && tool.strict != null) {
1391
+ toolWarnings.push({
1392
+ type: "unsupported",
1393
+ feature: "strict",
1394
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1395
+ });
1396
+ }
1294
1397
  anthropicTools2.push({
1295
1398
  name: tool.name,
1296
1399
  description: tool.description,
1297
1400
  input_schema: tool.inputSchema,
1298
1401
  cache_control: cacheControl,
1299
1402
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1300
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1403
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1301
1404
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1302
1405
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1303
1406
  ...tool.inputExamples != null ? {
@@ -1405,7 +1508,7 @@ async function prepareTools({
1405
1508
  break;
1406
1509
  }
1407
1510
  case "anthropic.text_editor_20250728": {
1408
- const args = await (0, import_provider_utils9.validateTypes)({
1511
+ const args = await (0, import_provider_utils10.validateTypes)({
1409
1512
  value: tool.args,
1410
1513
  schema: textEditor_20250728ArgsSchema
1411
1514
  });
@@ -1445,7 +1548,7 @@ async function prepareTools({
1445
1548
  }
1446
1549
  case "anthropic.web_fetch_20250910": {
1447
1550
  betas.add("web-fetch-2025-09-10");
1448
- const args = await (0, import_provider_utils9.validateTypes)({
1551
+ const args = await (0, import_provider_utils10.validateTypes)({
1449
1552
  value: tool.args,
1450
1553
  schema: webFetch_20250910ArgsSchema
1451
1554
  });
@@ -1463,7 +1566,7 @@ async function prepareTools({
1463
1566
  }
1464
1567
  case "anthropic.web_fetch_20260209": {
1465
1568
  betas.add("code-execution-web-tools-2026-02-09");
1466
- const args = await (0, import_provider_utils9.validateTypes)({
1569
+ const args = await (0, import_provider_utils10.validateTypes)({
1467
1570
  value: tool.args,
1468
1571
  schema: webFetch_20260209ArgsSchema
1469
1572
  });
@@ -1480,7 +1583,7 @@ async function prepareTools({
1480
1583
  break;
1481
1584
  }
1482
1585
  case "anthropic.web_search_20250305": {
1483
- const args = await (0, import_provider_utils9.validateTypes)({
1586
+ const args = await (0, import_provider_utils10.validateTypes)({
1484
1587
  value: tool.args,
1485
1588
  schema: webSearch_20250305ArgsSchema
1486
1589
  });
@@ -1497,7 +1600,7 @@ async function prepareTools({
1497
1600
  }
1498
1601
  case "anthropic.web_search_20260209": {
1499
1602
  betas.add("code-execution-web-tools-2026-02-09");
1500
- const args = await (0, import_provider_utils9.validateTypes)({
1603
+ const args = await (0, import_provider_utils10.validateTypes)({
1501
1604
  value: tool.args,
1502
1605
  schema: webSearch_20260209ArgsSchema
1503
1606
  });
@@ -1513,7 +1616,6 @@ async function prepareTools({
1513
1616
  break;
1514
1617
  }
1515
1618
  case "anthropic.tool_search_regex_20251119": {
1516
- betas.add("advanced-tool-use-2025-11-20");
1517
1619
  anthropicTools2.push({
1518
1620
  type: "tool_search_tool_regex_20251119",
1519
1621
  name: "tool_search_tool_regex"
@@ -1521,7 +1623,6 @@ async function prepareTools({
1521
1623
  break;
1522
1624
  }
1523
1625
  case "anthropic.tool_search_bm25_20251119": {
1524
- betas.add("advanced-tool-use-2025-11-20");
1525
1626
  anthropicTools2.push({
1526
1627
  type: "tool_search_tool_bm25_20251119",
1527
1628
  name: "tool_search_tool_bm25"
@@ -1641,35 +1742,35 @@ function convertAnthropicMessagesUsage({
1641
1742
 
1642
1743
  // src/convert-to-anthropic-messages-prompt.ts
1643
1744
  var import_provider2 = require("@ai-sdk/provider");
1644
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
1745
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
1645
1746
 
1646
1747
  // src/tool/code-execution_20250522.ts
1647
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1648
- var import_v49 = require("zod/v4");
1649
- var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
1650
- () => (0, import_provider_utils10.zodSchema)(
1651
- import_v49.z.object({
1652
- type: import_v49.z.literal("code_execution_result"),
1653
- stdout: import_v49.z.string(),
1654
- stderr: import_v49.z.string(),
1655
- return_code: import_v49.z.number(),
1656
- content: import_v49.z.array(
1657
- import_v49.z.object({
1658
- type: import_v49.z.literal("code_execution_output"),
1659
- file_id: import_v49.z.string()
1748
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1749
+ var import_v410 = require("zod/v4");
1750
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
1751
+ () => (0, import_provider_utils11.zodSchema)(
1752
+ import_v410.z.object({
1753
+ type: import_v410.z.literal("code_execution_result"),
1754
+ stdout: import_v410.z.string(),
1755
+ stderr: import_v410.z.string(),
1756
+ return_code: import_v410.z.number(),
1757
+ content: import_v410.z.array(
1758
+ import_v410.z.object({
1759
+ type: import_v410.z.literal("code_execution_output"),
1760
+ file_id: import_v410.z.string()
1660
1761
  })
1661
1762
  ).optional().default([])
1662
1763
  })
1663
1764
  )
1664
1765
  );
1665
- var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
1666
- () => (0, import_provider_utils10.zodSchema)(
1667
- import_v49.z.object({
1668
- code: import_v49.z.string()
1766
+ var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
1767
+ () => (0, import_provider_utils11.zodSchema)(
1768
+ import_v410.z.object({
1769
+ code: import_v410.z.string()
1669
1770
  })
1670
1771
  )
1671
1772
  );
1672
- var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1773
+ var factory6 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1673
1774
  id: "anthropic.code_execution_20250522",
1674
1775
  inputSchema: codeExecution_20250522InputSchema,
1675
1776
  outputSchema: codeExecution_20250522OutputSchema
@@ -1679,118 +1780,9 @@ var codeExecution_20250522 = (args = {}) => {
1679
1780
  };
1680
1781
 
1681
1782
  // src/tool/code-execution_20250825.ts
1682
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1683
- var import_v410 = require("zod/v4");
1684
- var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
1685
- () => (0, import_provider_utils11.zodSchema)(
1686
- import_v410.z.discriminatedUnion("type", [
1687
- import_v410.z.object({
1688
- type: import_v410.z.literal("code_execution_result"),
1689
- stdout: import_v410.z.string(),
1690
- stderr: import_v410.z.string(),
1691
- return_code: import_v410.z.number(),
1692
- content: import_v410.z.array(
1693
- import_v410.z.object({
1694
- type: import_v410.z.literal("code_execution_output"),
1695
- file_id: import_v410.z.string()
1696
- })
1697
- ).optional().default([])
1698
- }),
1699
- import_v410.z.object({
1700
- type: import_v410.z.literal("bash_code_execution_result"),
1701
- content: import_v410.z.array(
1702
- import_v410.z.object({
1703
- type: import_v410.z.literal("bash_code_execution_output"),
1704
- file_id: import_v410.z.string()
1705
- })
1706
- ),
1707
- stdout: import_v410.z.string(),
1708
- stderr: import_v410.z.string(),
1709
- return_code: import_v410.z.number()
1710
- }),
1711
- import_v410.z.object({
1712
- type: import_v410.z.literal("bash_code_execution_tool_result_error"),
1713
- error_code: import_v410.z.string()
1714
- }),
1715
- import_v410.z.object({
1716
- type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
1717
- error_code: import_v410.z.string()
1718
- }),
1719
- import_v410.z.object({
1720
- type: import_v410.z.literal("text_editor_code_execution_view_result"),
1721
- content: import_v410.z.string(),
1722
- file_type: import_v410.z.string(),
1723
- num_lines: import_v410.z.number().nullable(),
1724
- start_line: import_v410.z.number().nullable(),
1725
- total_lines: import_v410.z.number().nullable()
1726
- }),
1727
- import_v410.z.object({
1728
- type: import_v410.z.literal("text_editor_code_execution_create_result"),
1729
- is_file_update: import_v410.z.boolean()
1730
- }),
1731
- import_v410.z.object({
1732
- type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
1733
- lines: import_v410.z.array(import_v410.z.string()).nullable(),
1734
- new_lines: import_v410.z.number().nullable(),
1735
- new_start: import_v410.z.number().nullable(),
1736
- old_lines: import_v410.z.number().nullable(),
1737
- old_start: import_v410.z.number().nullable()
1738
- })
1739
- ])
1740
- )
1741
- );
1742
- var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
1743
- () => (0, import_provider_utils11.zodSchema)(
1744
- import_v410.z.discriminatedUnion("type", [
1745
- // Programmatic tool calling format (mapped from { code } by AI SDK)
1746
- import_v410.z.object({
1747
- type: import_v410.z.literal("programmatic-tool-call"),
1748
- code: import_v410.z.string()
1749
- }),
1750
- import_v410.z.object({
1751
- type: import_v410.z.literal("bash_code_execution"),
1752
- command: import_v410.z.string()
1753
- }),
1754
- import_v410.z.discriminatedUnion("command", [
1755
- import_v410.z.object({
1756
- type: import_v410.z.literal("text_editor_code_execution"),
1757
- command: import_v410.z.literal("view"),
1758
- path: import_v410.z.string()
1759
- }),
1760
- import_v410.z.object({
1761
- type: import_v410.z.literal("text_editor_code_execution"),
1762
- command: import_v410.z.literal("create"),
1763
- path: import_v410.z.string(),
1764
- file_text: import_v410.z.string().nullish()
1765
- }),
1766
- import_v410.z.object({
1767
- type: import_v410.z.literal("text_editor_code_execution"),
1768
- command: import_v410.z.literal("str_replace"),
1769
- path: import_v410.z.string(),
1770
- old_str: import_v410.z.string(),
1771
- new_str: import_v410.z.string()
1772
- })
1773
- ])
1774
- ])
1775
- )
1776
- );
1777
- var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1778
- id: "anthropic.code_execution_20250825",
1779
- inputSchema: codeExecution_20250825InputSchema,
1780
- outputSchema: codeExecution_20250825OutputSchema,
1781
- // Programmatic tool calling: tool results may be deferred to a later turn
1782
- // when code execution triggers a client-executed tool that needs to be
1783
- // resolved before the code execution result can be returned.
1784
- supportsDeferredResults: true
1785
- });
1786
- var codeExecution_20250825 = (args = {}) => {
1787
- return factory7(args);
1788
- };
1789
-
1790
- // src/tool/code-execution_20260120.ts
1791
1783
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
1792
1784
  var import_v411 = require("zod/v4");
1793
- var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
1785
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
1794
1786
  () => (0, import_provider_utils12.zodSchema)(
1795
1787
  import_v411.z.discriminatedUnion("type", [
1796
1788
  import_v411.z.object({
@@ -1805,18 +1797,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
1805
1797
  })
1806
1798
  ).optional().default([])
1807
1799
  }),
1808
- import_v411.z.object({
1809
- type: import_v411.z.literal("encrypted_code_execution_result"),
1810
- encrypted_stdout: import_v411.z.string(),
1811
- stderr: import_v411.z.string(),
1812
- return_code: import_v411.z.number(),
1813
- content: import_v411.z.array(
1814
- import_v411.z.object({
1815
- type: import_v411.z.literal("code_execution_output"),
1816
- file_id: import_v411.z.string()
1817
- })
1818
- ).optional().default([])
1819
- }),
1820
1800
  import_v411.z.object({
1821
1801
  type: import_v411.z.literal("bash_code_execution_result"),
1822
1802
  content: import_v411.z.array(
@@ -1860,9 +1840,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
1860
1840
  ])
1861
1841
  )
1862
1842
  );
1863
- var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1843
+ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
1864
1844
  () => (0, import_provider_utils12.zodSchema)(
1865
1845
  import_v411.z.discriminatedUnion("type", [
1846
+ // Programmatic tool calling format (mapped from { code } by AI SDK)
1866
1847
  import_v411.z.object({
1867
1848
  type: import_v411.z.literal("programmatic-tool-call"),
1868
1849
  code: import_v411.z.string()
@@ -1894,7 +1875,127 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1894
1875
  ])
1895
1876
  )
1896
1877
  );
1897
- var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1878
+ var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1879
+ id: "anthropic.code_execution_20250825",
1880
+ inputSchema: codeExecution_20250825InputSchema,
1881
+ outputSchema: codeExecution_20250825OutputSchema,
1882
+ // Programmatic tool calling: tool results may be deferred to a later turn
1883
+ // when code execution triggers a client-executed tool that needs to be
1884
+ // resolved before the code execution result can be returned.
1885
+ supportsDeferredResults: true
1886
+ });
1887
+ var codeExecution_20250825 = (args = {}) => {
1888
+ return factory7(args);
1889
+ };
1890
+
1891
+ // src/tool/code-execution_20260120.ts
1892
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1893
+ var import_v412 = require("zod/v4");
1894
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
1895
+ () => (0, import_provider_utils13.zodSchema)(
1896
+ import_v412.z.discriminatedUnion("type", [
1897
+ import_v412.z.object({
1898
+ type: import_v412.z.literal("code_execution_result"),
1899
+ stdout: import_v412.z.string(),
1900
+ stderr: import_v412.z.string(),
1901
+ return_code: import_v412.z.number(),
1902
+ content: import_v412.z.array(
1903
+ import_v412.z.object({
1904
+ type: import_v412.z.literal("code_execution_output"),
1905
+ file_id: import_v412.z.string()
1906
+ })
1907
+ ).optional().default([])
1908
+ }),
1909
+ import_v412.z.object({
1910
+ type: import_v412.z.literal("encrypted_code_execution_result"),
1911
+ encrypted_stdout: import_v412.z.string(),
1912
+ stderr: import_v412.z.string(),
1913
+ return_code: import_v412.z.number(),
1914
+ content: import_v412.z.array(
1915
+ import_v412.z.object({
1916
+ type: import_v412.z.literal("code_execution_output"),
1917
+ file_id: import_v412.z.string()
1918
+ })
1919
+ ).optional().default([])
1920
+ }),
1921
+ import_v412.z.object({
1922
+ type: import_v412.z.literal("bash_code_execution_result"),
1923
+ content: import_v412.z.array(
1924
+ import_v412.z.object({
1925
+ type: import_v412.z.literal("bash_code_execution_output"),
1926
+ file_id: import_v412.z.string()
1927
+ })
1928
+ ),
1929
+ stdout: import_v412.z.string(),
1930
+ stderr: import_v412.z.string(),
1931
+ return_code: import_v412.z.number()
1932
+ }),
1933
+ import_v412.z.object({
1934
+ type: import_v412.z.literal("bash_code_execution_tool_result_error"),
1935
+ error_code: import_v412.z.string()
1936
+ }),
1937
+ import_v412.z.object({
1938
+ type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
1939
+ error_code: import_v412.z.string()
1940
+ }),
1941
+ import_v412.z.object({
1942
+ type: import_v412.z.literal("text_editor_code_execution_view_result"),
1943
+ content: import_v412.z.string(),
1944
+ file_type: import_v412.z.string(),
1945
+ num_lines: import_v412.z.number().nullable(),
1946
+ start_line: import_v412.z.number().nullable(),
1947
+ total_lines: import_v412.z.number().nullable()
1948
+ }),
1949
+ import_v412.z.object({
1950
+ type: import_v412.z.literal("text_editor_code_execution_create_result"),
1951
+ is_file_update: import_v412.z.boolean()
1952
+ }),
1953
+ import_v412.z.object({
1954
+ type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
1955
+ lines: import_v412.z.array(import_v412.z.string()).nullable(),
1956
+ new_lines: import_v412.z.number().nullable(),
1957
+ new_start: import_v412.z.number().nullable(),
1958
+ old_lines: import_v412.z.number().nullable(),
1959
+ old_start: import_v412.z.number().nullable()
1960
+ })
1961
+ ])
1962
+ )
1963
+ );
1964
+ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
1965
+ () => (0, import_provider_utils13.zodSchema)(
1966
+ import_v412.z.discriminatedUnion("type", [
1967
+ import_v412.z.object({
1968
+ type: import_v412.z.literal("programmatic-tool-call"),
1969
+ code: import_v412.z.string()
1970
+ }),
1971
+ import_v412.z.object({
1972
+ type: import_v412.z.literal("bash_code_execution"),
1973
+ command: import_v412.z.string()
1974
+ }),
1975
+ import_v412.z.discriminatedUnion("command", [
1976
+ import_v412.z.object({
1977
+ type: import_v412.z.literal("text_editor_code_execution"),
1978
+ command: import_v412.z.literal("view"),
1979
+ path: import_v412.z.string()
1980
+ }),
1981
+ import_v412.z.object({
1982
+ type: import_v412.z.literal("text_editor_code_execution"),
1983
+ command: import_v412.z.literal("create"),
1984
+ path: import_v412.z.string(),
1985
+ file_text: import_v412.z.string().nullish()
1986
+ }),
1987
+ import_v412.z.object({
1988
+ type: import_v412.z.literal("text_editor_code_execution"),
1989
+ command: import_v412.z.literal("str_replace"),
1990
+ path: import_v412.z.string(),
1991
+ old_str: import_v412.z.string(),
1992
+ new_str: import_v412.z.string()
1993
+ })
1994
+ ])
1995
+ ])
1996
+ )
1997
+ );
1998
+ var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
1898
1999
  id: "anthropic.code_execution_20260120",
1899
2000
  inputSchema: codeExecution_20260120InputSchema,
1900
2001
  outputSchema: codeExecution_20260120OutputSchema,
@@ -1905,21 +2006,21 @@ var codeExecution_20260120 = (args = {}) => {
1905
2006
  };
1906
2007
 
1907
2008
  // src/tool/tool-search-regex_20251119.ts
1908
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1909
- var import_v412 = require("zod/v4");
1910
- var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
1911
- () => (0, import_provider_utils13.zodSchema)(
1912
- import_v412.z.array(
1913
- import_v412.z.object({
1914
- type: import_v412.z.literal("tool_reference"),
1915
- toolName: import_v412.z.string()
2009
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2010
+ var import_v413 = require("zod/v4");
2011
+ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
2012
+ () => (0, import_provider_utils14.zodSchema)(
2013
+ import_v413.z.array(
2014
+ import_v413.z.object({
2015
+ type: import_v413.z.literal("tool_reference"),
2016
+ toolName: import_v413.z.string()
1916
2017
  })
1917
2018
  )
1918
2019
  )
1919
2020
  );
1920
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
1921
- () => (0, import_provider_utils13.zodSchema)(
1922
- import_v412.z.object({
2021
+ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
2022
+ () => (0, import_provider_utils14.zodSchema)(
2023
+ import_v413.z.object({
1923
2024
  /**
1924
2025
  * A regex pattern to search for tools.
1925
2026
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1930,15 +2031,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
1930
2031
  * - "database.*query|query.*database" - OR patterns for flexibility
1931
2032
  * - "(?i)slack" - case-insensitive search
1932
2033
  */
1933
- pattern: import_v412.z.string(),
2034
+ pattern: import_v413.z.string(),
1934
2035
  /**
1935
2036
  * Maximum number of tools to return. Optional.
1936
2037
  */
1937
- limit: import_v412.z.number().optional()
2038
+ limit: import_v413.z.number().optional()
1938
2039
  })
1939
2040
  )
1940
2041
  );
1941
- var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2042
+ var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
1942
2043
  id: "anthropic.tool_search_regex_20251119",
1943
2044
  inputSchema: toolSearchRegex_20251119InputSchema,
1944
2045
  outputSchema: toolSearchRegex_20251119OutputSchema,
@@ -1951,7 +2052,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
1951
2052
  // src/convert-to-anthropic-messages-prompt.ts
1952
2053
  function convertToString(data) {
1953
2054
  if (typeof data === "string") {
1954
- return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
2055
+ return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
1955
2056
  }
1956
2057
  if (data instanceof Uint8Array) {
1957
2058
  return new TextDecoder().decode(data);
@@ -1989,7 +2090,7 @@ async function convertToAnthropicMessagesPrompt({
1989
2090
  const messages = [];
1990
2091
  async function shouldEnableCitations(providerMetadata) {
1991
2092
  var _a2, _b2;
1992
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2093
+ const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
1993
2094
  provider: "anthropic",
1994
2095
  providerOptions: providerMetadata,
1995
2096
  schema: anthropicFilePartProviderOptions
@@ -1997,7 +2098,7 @@ async function convertToAnthropicMessagesPrompt({
1997
2098
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1998
2099
  }
1999
2100
  async function getDocumentMetadata(providerMetadata) {
2000
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2101
+ const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
2001
2102
  provider: "anthropic",
2002
2103
  providerOptions: providerMetadata,
2003
2104
  schema: anthropicFilePartProviderOptions
@@ -2054,7 +2155,26 @@ async function convertToAnthropicMessagesPrompt({
2054
2155
  break;
2055
2156
  }
2056
2157
  case "file": {
2057
- if (part.mediaType.startsWith("image/")) {
2158
+ if ((0, import_provider_utils15.isProviderReference)(part.data)) {
2159
+ const fileId = (0, import_provider_utils15.resolveProviderReference)({
2160
+ reference: part.data,
2161
+ provider: "anthropic"
2162
+ });
2163
+ betas.add("files-api-2025-04-14");
2164
+ if (part.mediaType.startsWith("image/")) {
2165
+ anthropicContent.push({
2166
+ type: "image",
2167
+ source: { type: "file", file_id: fileId },
2168
+ cache_control: cacheControl
2169
+ });
2170
+ } else {
2171
+ anthropicContent.push({
2172
+ type: "document",
2173
+ source: { type: "file", file_id: fileId },
2174
+ cache_control: cacheControl
2175
+ });
2176
+ }
2177
+ } else if (part.mediaType.startsWith("image/")) {
2058
2178
  anthropicContent.push({
2059
2179
  type: "image",
2060
2180
  source: isUrlData(part.data) ? {
@@ -2063,7 +2183,7 @@ async function convertToAnthropicMessagesPrompt({
2063
2183
  } : {
2064
2184
  type: "base64",
2065
2185
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2066
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2186
+ data: (0, import_provider_utils15.convertToBase64)(part.data)
2067
2187
  },
2068
2188
  cache_control: cacheControl
2069
2189
  });
@@ -2083,7 +2203,7 @@ async function convertToAnthropicMessagesPrompt({
2083
2203
  } : {
2084
2204
  type: "base64",
2085
2205
  media_type: "application/pdf",
2086
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2206
+ data: (0, import_provider_utils15.convertToBase64)(part.data)
2087
2207
  },
2088
2208
  title: (_b = metadata.title) != null ? _b : part.filename,
2089
2209
  ...metadata.context && { context: metadata.context },
@@ -2221,7 +2341,7 @@ async function convertToAnthropicMessagesPrompt({
2221
2341
  return void 0;
2222
2342
  }
2223
2343
  }
2224
- }).filter(import_provider_utils14.isNonNullable);
2344
+ }).filter(import_provider_utils15.isNonNullable);
2225
2345
  break;
2226
2346
  case "text":
2227
2347
  case "error-text":
@@ -2297,7 +2417,7 @@ async function convertToAnthropicMessagesPrompt({
2297
2417
  }
2298
2418
  case "reasoning": {
2299
2419
  if (sendReasoning) {
2300
- const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
2420
+ const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
2301
2421
  provider: "anthropic",
2302
2422
  providerOptions: part.providerOptions,
2303
2423
  schema: anthropicReasoningMetadataSchema
@@ -2503,7 +2623,7 @@ async function convertToAnthropicMessagesPrompt({
2503
2623
  break;
2504
2624
  }
2505
2625
  if (output.value.type === "code_execution_result") {
2506
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2626
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2507
2627
  value: output.value,
2508
2628
  schema: codeExecution_20250522OutputSchema
2509
2629
  });
@@ -2520,7 +2640,7 @@ async function convertToAnthropicMessagesPrompt({
2520
2640
  cache_control: cacheControl
2521
2641
  });
2522
2642
  } else if (output.value.type === "encrypted_code_execution_result") {
2523
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2643
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2524
2644
  value: output.value,
2525
2645
  schema: codeExecution_20260120OutputSchema
2526
2646
  });
@@ -2539,7 +2659,7 @@ async function convertToAnthropicMessagesPrompt({
2539
2659
  });
2540
2660
  }
2541
2661
  } else {
2542
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2662
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2543
2663
  value: output.value,
2544
2664
  schema: codeExecution_20250825OutputSchema
2545
2665
  });
@@ -2608,7 +2728,7 @@ async function convertToAnthropicMessagesPrompt({
2608
2728
  });
2609
2729
  break;
2610
2730
  }
2611
- const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
2731
+ const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
2612
2732
  value: output.value,
2613
2733
  schema: webFetch_20250910OutputSchema
2614
2734
  });
@@ -2643,7 +2763,7 @@ async function convertToAnthropicMessagesPrompt({
2643
2763
  });
2644
2764
  break;
2645
2765
  }
2646
- const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
2766
+ const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
2647
2767
  value: output.value,
2648
2768
  schema: webSearch_20250305OutputSchema
2649
2769
  });
@@ -2670,7 +2790,7 @@ async function convertToAnthropicMessagesPrompt({
2670
2790
  });
2671
2791
  break;
2672
2792
  }
2673
- const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
2793
+ const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
2674
2794
  value: output.value,
2675
2795
  schema: toolSearchRegex_20251119OutputSchema
2676
2796
  });
@@ -2830,11 +2950,11 @@ function createCitationSource(citation, citationDocuments, generateId3) {
2830
2950
  }
2831
2951
  var AnthropicMessagesLanguageModel = class {
2832
2952
  constructor(modelId, config) {
2833
- this.specificationVersion = "v3";
2953
+ this.specificationVersion = "v4";
2834
2954
  var _a;
2835
2955
  this.modelId = modelId;
2836
2956
  this.config = config;
2837
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
2957
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
2838
2958
  }
2839
2959
  supportsUrl(url) {
2840
2960
  return url.protocol === "https:";
@@ -2869,10 +2989,11 @@ var AnthropicMessagesLanguageModel = class {
2869
2989
  seed,
2870
2990
  tools,
2871
2991
  toolChoice,
2992
+ reasoning,
2872
2993
  providerOptions,
2873
2994
  stream
2874
2995
  }) {
2875
- var _a, _b, _c, _d, _e, _f, _g;
2996
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2876
2997
  const warnings = [];
2877
2998
  if (frequencyPenalty != null) {
2878
2999
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2908,12 +3029,12 @@ var AnthropicMessagesLanguageModel = class {
2908
3029
  }
2909
3030
  }
2910
3031
  const providerOptionsName = this.providerOptionsName;
2911
- const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
3032
+ const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
2912
3033
  provider: "anthropic",
2913
3034
  providerOptions,
2914
3035
  schema: anthropicLanguageModelOptions
2915
3036
  });
2916
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
3037
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
2917
3038
  provider: providerOptionsName,
2918
3039
  providerOptions,
2919
3040
  schema: anthropicLanguageModelOptions
@@ -2927,10 +3048,13 @@ var AnthropicMessagesLanguageModel = class {
2927
3048
  const {
2928
3049
  maxOutputTokens: maxOutputTokensForModel,
2929
3050
  supportsStructuredOutput: modelSupportsStructuredOutput,
3051
+ supportsAdaptiveThinking,
2930
3052
  isKnownModel
2931
3053
  } = getModelCapabilities(this.modelId);
3054
+ const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2932
3055
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2933
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3056
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3057
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
2934
3058
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2935
3059
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2936
3060
  type: "function",
@@ -2940,7 +3064,7 @@ var AnthropicMessagesLanguageModel = class {
2940
3064
  } : void 0;
2941
3065
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
2942
3066
  const cacheControlValidator = new CacheControlValidator();
2943
- const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
3067
+ const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
2944
3068
  tools,
2945
3069
  providerToolNames: {
2946
3070
  "anthropic.code_execution_20250522": "code_execution",
@@ -2965,14 +3089,28 @@ var AnthropicMessagesLanguageModel = class {
2965
3089
  });
2966
3090
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2967
3091
  prompt,
2968
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3092
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
2969
3093
  warnings,
2970
3094
  cacheControlValidator,
2971
3095
  toolNameMapping
2972
3096
  });
2973
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3097
+ if ((0, import_provider_utils16.isCustomReasoning)(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3098
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3099
+ reasoning,
3100
+ supportsAdaptiveThinking,
3101
+ maxOutputTokensForModel,
3102
+ warnings
3103
+ });
3104
+ if (reasoningConfig != null) {
3105
+ anthropicOptions.thinking = reasoningConfig.thinking;
3106
+ if (reasoningConfig.effort != null) {
3107
+ anthropicOptions.effort = reasoningConfig.effort;
3108
+ }
3109
+ }
3110
+ }
3111
+ const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
2974
3112
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
2975
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
3113
+ let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
2976
3114
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2977
3115
  const baseArgs = {
2978
3116
  // model id:
@@ -3009,6 +3147,9 @@ var AnthropicMessagesLanguageModel = class {
3009
3147
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3010
3148
  cache_control: anthropicOptions.cacheControl
3011
3149
  },
3150
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
3151
+ metadata: { user_id: anthropicOptions.metadata.userId }
3152
+ },
3012
3153
  // mcp servers:
3013
3154
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3014
3155
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3030,7 +3171,10 @@ var AnthropicMessagesLanguageModel = class {
3030
3171
  id: anthropicOptions.container.id,
3031
3172
  skills: anthropicOptions.container.skills.map((skill) => ({
3032
3173
  type: skill.type,
3033
- skill_id: skill.skillId,
3174
+ skill_id: skill.type === "custom" ? (0, import_provider_utils16.resolveProviderReference)({
3175
+ reference: skill.providerReference,
3176
+ provider: "anthropic"
3177
+ }) : skill.skillId,
3034
3178
  version: skill.version
3035
3179
  }))
3036
3180
  }
@@ -3132,7 +3276,7 @@ var AnthropicMessagesLanguageModel = class {
3132
3276
  }
3133
3277
  baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
3134
3278
  } else {
3135
- if (topP != null && temperature != null) {
3279
+ if (isAnthropicModel && topP != null && temperature != null) {
3136
3280
  warnings.push({
3137
3281
  type: "unsupported",
3138
3282
  feature: "topP",
@@ -3179,7 +3323,7 @@ var AnthropicMessagesLanguageModel = class {
3179
3323
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3180
3324
  betas.add("fast-mode-2026-02-01");
3181
3325
  }
3182
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
3326
+ if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
3183
3327
  betas.add("fine-grained-tool-streaming-2025-05-14");
3184
3328
  }
3185
3329
  const {
@@ -3193,13 +3337,15 @@ var AnthropicMessagesLanguageModel = class {
3193
3337
  toolChoice: { type: "required" },
3194
3338
  disableParallelToolUse: true,
3195
3339
  cacheControlValidator,
3196
- supportsStructuredOutput: false
3340
+ supportsStructuredOutput: false,
3341
+ supportsStrictTools
3197
3342
  } : {
3198
3343
  tools: tools != null ? tools : [],
3199
3344
  toolChoice,
3200
3345
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3201
3346
  cacheControlValidator,
3202
- supportsStructuredOutput
3347
+ supportsStructuredOutput,
3348
+ supportsStrictTools
3203
3349
  }
3204
3350
  );
3205
3351
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3216,7 +3362,7 @@ var AnthropicMessagesLanguageModel = class {
3216
3362
  ...betas,
3217
3363
  ...toolsBetas,
3218
3364
  ...userSuppliedBetas,
3219
- ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
3365
+ ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
3220
3366
  ]),
3221
3367
  usesJsonResponseTool: jsonResponseTool != null,
3222
3368
  toolNameMapping,
@@ -3228,15 +3374,15 @@ var AnthropicMessagesLanguageModel = class {
3228
3374
  betas,
3229
3375
  headers
3230
3376
  }) {
3231
- return (0, import_provider_utils15.combineHeaders)(
3232
- await (0, import_provider_utils15.resolve)(this.config.headers),
3377
+ return (0, import_provider_utils16.combineHeaders)(
3378
+ await (0, import_provider_utils16.resolve)(this.config.headers),
3233
3379
  headers,
3234
3380
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3235
3381
  );
3236
3382
  }
3237
3383
  async getBetasFromHeaders(requestHeaders) {
3238
3384
  var _a, _b;
3239
- const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3385
+ const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3240
3386
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3241
3387
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3242
3388
  return new Set(
@@ -3302,12 +3448,12 @@ var AnthropicMessagesLanguageModel = class {
3302
3448
  responseHeaders,
3303
3449
  value: response,
3304
3450
  rawValue: rawResponse
3305
- } = await (0, import_provider_utils15.postJsonToApi)({
3451
+ } = await (0, import_provider_utils16.postJsonToApi)({
3306
3452
  url: this.buildRequestUrl(false),
3307
3453
  headers: await this.getHeaders({ betas, headers: options.headers }),
3308
3454
  body: this.transformRequestBody(args, betas),
3309
3455
  failedResponseHandler: anthropicFailedResponseHandler,
3310
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3456
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3311
3457
  anthropicMessagesResponseSchema
3312
3458
  ),
3313
3459
  abortSignal: options.abortSignal,
@@ -3722,12 +3868,12 @@ var AnthropicMessagesLanguageModel = class {
3722
3868
  body.tools
3723
3869
  );
3724
3870
  const url = this.buildRequestUrl(true);
3725
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
3871
+ const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
3726
3872
  url,
3727
3873
  headers: await this.getHeaders({ betas, headers: options.headers }),
3728
3874
  body: this.transformRequestBody(body, betas),
3729
3875
  failedResponseHandler: anthropicFailedResponseHandler,
3730
- successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
3876
+ successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
3731
3877
  anthropicMessagesChunkSchema
3732
3878
  ),
3733
3879
  abortSignal: options.abortSignal,
@@ -4479,42 +4625,49 @@ function getModelCapabilities(modelId) {
4479
4625
  return {
4480
4626
  maxOutputTokens: 128e3,
4481
4627
  supportsStructuredOutput: true,
4628
+ supportsAdaptiveThinking: true,
4482
4629
  isKnownModel: true
4483
4630
  };
4484
4631
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4485
4632
  return {
4486
4633
  maxOutputTokens: 64e3,
4487
4634
  supportsStructuredOutput: true,
4635
+ supportsAdaptiveThinking: false,
4488
4636
  isKnownModel: true
4489
4637
  };
4490
4638
  } else if (modelId.includes("claude-opus-4-1")) {
4491
4639
  return {
4492
4640
  maxOutputTokens: 32e3,
4493
4641
  supportsStructuredOutput: true,
4642
+ supportsAdaptiveThinking: false,
4494
4643
  isKnownModel: true
4495
4644
  };
4496
4645
  } else if (modelId.includes("claude-sonnet-4-")) {
4497
4646
  return {
4498
4647
  maxOutputTokens: 64e3,
4499
4648
  supportsStructuredOutput: false,
4649
+ supportsAdaptiveThinking: false,
4500
4650
  isKnownModel: true
4501
4651
  };
4502
4652
  } else if (modelId.includes("claude-opus-4-")) {
4503
4653
  return {
4504
4654
  maxOutputTokens: 32e3,
4505
4655
  supportsStructuredOutput: false,
4656
+ supportsAdaptiveThinking: false,
4506
4657
  isKnownModel: true
4507
4658
  };
4508
4659
  } else if (modelId.includes("claude-3-haiku")) {
4509
4660
  return {
4510
4661
  maxOutputTokens: 4096,
4511
4662
  supportsStructuredOutput: false,
4663
+ supportsAdaptiveThinking: false,
4512
4664
  isKnownModel: true
4513
4665
  };
4514
4666
  } else {
4515
4667
  return {
4516
4668
  maxOutputTokens: 4096,
4517
4669
  supportsStructuredOutput: false,
4670
+ supportsAdaptiveThinking: false,
4518
4671
  isKnownModel: false
4519
4672
  };
4520
4673
  }
@@ -4537,6 +4690,43 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4537
4690
  }
4538
4691
  return hasWebTool20260209 && !hasCodeExecutionTool;
4539
4692
  }
4693
+ function resolveAnthropicReasoningConfig({
4694
+ reasoning,
4695
+ supportsAdaptiveThinking,
4696
+ maxOutputTokensForModel,
4697
+ warnings
4698
+ }) {
4699
+ if (!(0, import_provider_utils16.isCustomReasoning)(reasoning)) {
4700
+ return void 0;
4701
+ }
4702
+ if (reasoning === "none") {
4703
+ return { thinking: { type: "disabled" } };
4704
+ }
4705
+ if (supportsAdaptiveThinking) {
4706
+ const effort = (0, import_provider_utils16.mapReasoningToProviderEffort)({
4707
+ reasoning,
4708
+ effortMap: {
4709
+ minimal: "low",
4710
+ low: "low",
4711
+ medium: "medium",
4712
+ high: "high",
4713
+ xhigh: "max"
4714
+ },
4715
+ warnings
4716
+ });
4717
+ return { thinking: { type: "adaptive" }, effort };
4718
+ }
4719
+ const budgetTokens = (0, import_provider_utils16.mapReasoningToProviderBudget)({
4720
+ reasoning,
4721
+ maxOutputTokens: maxOutputTokensForModel,
4722
+ maxReasoningBudget: maxOutputTokensForModel,
4723
+ warnings
4724
+ });
4725
+ if (budgetTokens == null) {
4726
+ return void 0;
4727
+ }
4728
+ return { thinking: { type: "enabled", budgetTokens } };
4729
+ }
4540
4730
  function mapAnthropicResponseContextManagement(contextManagement) {
4541
4731
  return contextManagement ? {
4542
4732
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4564,44 +4754,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4564
4754
  }
4565
4755
 
4566
4756
  // src/tool/bash_20241022.ts
4567
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4568
- var import_v413 = require("zod/v4");
4569
- var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
4570
- () => (0, import_provider_utils16.zodSchema)(
4571
- import_v413.z.object({
4572
- command: import_v413.z.string(),
4573
- restart: import_v413.z.boolean().optional()
4757
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4758
+ var import_v414 = require("zod/v4");
4759
+ var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4760
+ () => (0, import_provider_utils17.zodSchema)(
4761
+ import_v414.z.object({
4762
+ command: import_v414.z.string(),
4763
+ restart: import_v414.z.boolean().optional()
4574
4764
  })
4575
4765
  )
4576
4766
  );
4577
- var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
4767
+ var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
4578
4768
  id: "anthropic.bash_20241022",
4579
4769
  inputSchema: bash_20241022InputSchema
4580
4770
  });
4581
4771
 
4582
4772
  // src/tool/bash_20250124.ts
4583
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4584
- var import_v414 = require("zod/v4");
4585
- var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
4586
- () => (0, import_provider_utils17.zodSchema)(
4587
- import_v414.z.object({
4588
- command: import_v414.z.string(),
4589
- restart: import_v414.z.boolean().optional()
4773
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4774
+ var import_v415 = require("zod/v4");
4775
+ var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4776
+ () => (0, import_provider_utils18.zodSchema)(
4777
+ import_v415.z.object({
4778
+ command: import_v415.z.string(),
4779
+ restart: import_v415.z.boolean().optional()
4590
4780
  })
4591
4781
  )
4592
4782
  );
4593
- var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
4783
+ var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
4594
4784
  id: "anthropic.bash_20250124",
4595
4785
  inputSchema: bash_20250124InputSchema
4596
4786
  });
4597
4787
 
4598
4788
  // src/tool/computer_20241022.ts
4599
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4600
- var import_v415 = require("zod/v4");
4601
- var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4602
- () => (0, import_provider_utils18.zodSchema)(
4603
- import_v415.z.object({
4604
- action: import_v415.z.enum([
4789
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
4790
+ var import_v416 = require("zod/v4");
4791
+ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4792
+ () => (0, import_provider_utils19.zodSchema)(
4793
+ import_v416.z.object({
4794
+ action: import_v416.z.enum([
4605
4795
  "key",
4606
4796
  "type",
4607
4797
  "mouse_move",
@@ -4613,23 +4803,23 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4613
4803
  "screenshot",
4614
4804
  "cursor_position"
4615
4805
  ]),
4616
- coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
4617
- text: import_v415.z.string().optional()
4806
+ coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
4807
+ text: import_v416.z.string().optional()
4618
4808
  })
4619
4809
  )
4620
4810
  );
4621
- var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
4811
+ var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
4622
4812
  id: "anthropic.computer_20241022",
4623
4813
  inputSchema: computer_20241022InputSchema
4624
4814
  });
4625
4815
 
4626
4816
  // src/tool/computer_20250124.ts
4627
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4628
- var import_v416 = require("zod/v4");
4629
- var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4630
- () => (0, import_provider_utils19.zodSchema)(
4631
- import_v416.z.object({
4632
- action: import_v416.z.enum([
4817
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
4818
+ var import_v417 = require("zod/v4");
4819
+ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4820
+ () => (0, import_provider_utils20.zodSchema)(
4821
+ import_v417.z.object({
4822
+ action: import_v417.z.enum([
4633
4823
  "key",
4634
4824
  "hold_key",
4635
4825
  "type",
@@ -4647,27 +4837,27 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4647
4837
  "wait",
4648
4838
  "screenshot"
4649
4839
  ]),
4650
- coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4651
- duration: import_v416.z.number().optional(),
4652
- scroll_amount: import_v416.z.number().optional(),
4653
- scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
4654
- start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4655
- text: import_v416.z.string().optional()
4840
+ coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4841
+ duration: import_v417.z.number().optional(),
4842
+ scroll_amount: import_v417.z.number().optional(),
4843
+ scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4844
+ start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4845
+ text: import_v417.z.string().optional()
4656
4846
  })
4657
4847
  )
4658
4848
  );
4659
- var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
4849
+ var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
4660
4850
  id: "anthropic.computer_20250124",
4661
4851
  inputSchema: computer_20250124InputSchema
4662
4852
  });
4663
4853
 
4664
4854
  // src/tool/computer_20251124.ts
4665
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4666
- var import_v417 = require("zod/v4");
4667
- var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4668
- () => (0, import_provider_utils20.zodSchema)(
4669
- import_v417.z.object({
4670
- action: import_v417.z.enum([
4855
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
4856
+ var import_v418 = require("zod/v4");
4857
+ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
4858
+ () => (0, import_provider_utils21.zodSchema)(
4859
+ import_v418.z.object({
4860
+ action: import_v418.z.enum([
4671
4861
  "key",
4672
4862
  "hold_key",
4673
4863
  "type",
@@ -4686,97 +4876,75 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4686
4876
  "screenshot",
4687
4877
  "zoom"
4688
4878
  ]),
4689
- coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4690
- duration: import_v417.z.number().optional(),
4691
- region: import_v417.z.tuple([
4692
- import_v417.z.number().int(),
4693
- import_v417.z.number().int(),
4694
- import_v417.z.number().int(),
4695
- import_v417.z.number().int()
4879
+ coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
4880
+ duration: import_v418.z.number().optional(),
4881
+ region: import_v418.z.tuple([
4882
+ import_v418.z.number().int(),
4883
+ import_v418.z.number().int(),
4884
+ import_v418.z.number().int(),
4885
+ import_v418.z.number().int()
4696
4886
  ]).optional(),
4697
- scroll_amount: import_v417.z.number().optional(),
4698
- scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4699
- start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4700
- text: import_v417.z.string().optional()
4887
+ scroll_amount: import_v418.z.number().optional(),
4888
+ scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
4889
+ start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
4890
+ text: import_v418.z.string().optional()
4701
4891
  })
4702
4892
  )
4703
4893
  );
4704
- var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
4894
+ var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
4705
4895
  id: "anthropic.computer_20251124",
4706
4896
  inputSchema: computer_20251124InputSchema
4707
4897
  });
4708
4898
 
4709
4899
  // src/tool/memory_20250818.ts
4710
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
4711
- var import_v418 = require("zod/v4");
4712
- var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
4713
- () => (0, import_provider_utils21.zodSchema)(
4714
- import_v418.z.discriminatedUnion("command", [
4715
- import_v418.z.object({
4716
- command: import_v418.z.literal("view"),
4717
- path: import_v418.z.string(),
4718
- view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
4900
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
4901
+ var import_v419 = require("zod/v4");
4902
+ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
4903
+ () => (0, import_provider_utils22.zodSchema)(
4904
+ import_v419.z.discriminatedUnion("command", [
4905
+ import_v419.z.object({
4906
+ command: import_v419.z.literal("view"),
4907
+ path: import_v419.z.string(),
4908
+ view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
4719
4909
  }),
4720
- import_v418.z.object({
4721
- command: import_v418.z.literal("create"),
4722
- path: import_v418.z.string(),
4723
- file_text: import_v418.z.string()
4910
+ import_v419.z.object({
4911
+ command: import_v419.z.literal("create"),
4912
+ path: import_v419.z.string(),
4913
+ file_text: import_v419.z.string()
4724
4914
  }),
4725
- import_v418.z.object({
4726
- command: import_v418.z.literal("str_replace"),
4727
- path: import_v418.z.string(),
4728
- old_str: import_v418.z.string(),
4729
- new_str: import_v418.z.string()
4915
+ import_v419.z.object({
4916
+ command: import_v419.z.literal("str_replace"),
4917
+ path: import_v419.z.string(),
4918
+ old_str: import_v419.z.string(),
4919
+ new_str: import_v419.z.string()
4730
4920
  }),
4731
- import_v418.z.object({
4732
- command: import_v418.z.literal("insert"),
4733
- path: import_v418.z.string(),
4734
- insert_line: import_v418.z.number(),
4735
- insert_text: import_v418.z.string()
4921
+ import_v419.z.object({
4922
+ command: import_v419.z.literal("insert"),
4923
+ path: import_v419.z.string(),
4924
+ insert_line: import_v419.z.number(),
4925
+ insert_text: import_v419.z.string()
4736
4926
  }),
4737
- import_v418.z.object({
4738
- command: import_v418.z.literal("delete"),
4739
- path: import_v418.z.string()
4927
+ import_v419.z.object({
4928
+ command: import_v419.z.literal("delete"),
4929
+ path: import_v419.z.string()
4740
4930
  }),
4741
- import_v418.z.object({
4742
- command: import_v418.z.literal("rename"),
4743
- old_path: import_v418.z.string(),
4744
- new_path: import_v418.z.string()
4931
+ import_v419.z.object({
4932
+ command: import_v419.z.literal("rename"),
4933
+ old_path: import_v419.z.string(),
4934
+ new_path: import_v419.z.string()
4745
4935
  })
4746
4936
  ])
4747
4937
  )
4748
4938
  );
4749
- var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
4939
+ var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
4750
4940
  id: "anthropic.memory_20250818",
4751
4941
  inputSchema: memory_20250818InputSchema
4752
4942
  });
4753
4943
 
4754
4944
  // src/tool/text-editor_20241022.ts
4755
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
4756
- var import_v419 = require("zod/v4");
4757
- var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
4758
- () => (0, import_provider_utils22.zodSchema)(
4759
- import_v419.z.object({
4760
- command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4761
- path: import_v419.z.string(),
4762
- file_text: import_v419.z.string().optional(),
4763
- insert_line: import_v419.z.number().int().optional(),
4764
- new_str: import_v419.z.string().optional(),
4765
- insert_text: import_v419.z.string().optional(),
4766
- old_str: import_v419.z.string().optional(),
4767
- view_range: import_v419.z.array(import_v419.z.number().int()).optional()
4768
- })
4769
- )
4770
- );
4771
- var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
4772
- id: "anthropic.text_editor_20241022",
4773
- inputSchema: textEditor_20241022InputSchema
4774
- });
4775
-
4776
- // src/tool/text-editor_20250124.ts
4777
4945
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
4778
4946
  var import_v420 = require("zod/v4");
4779
- var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
4947
+ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
4780
4948
  () => (0, import_provider_utils23.zodSchema)(
4781
4949
  import_v420.z.object({
4782
4950
  command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -4790,18 +4958,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
4790
4958
  })
4791
4959
  )
4792
4960
  );
4793
- var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
4794
- id: "anthropic.text_editor_20250124",
4795
- inputSchema: textEditor_20250124InputSchema
4961
+ var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
4962
+ id: "anthropic.text_editor_20241022",
4963
+ inputSchema: textEditor_20241022InputSchema
4796
4964
  });
4797
4965
 
4798
- // src/tool/text-editor_20250429.ts
4966
+ // src/tool/text-editor_20250124.ts
4799
4967
  var import_provider_utils24 = require("@ai-sdk/provider-utils");
4800
4968
  var import_v421 = require("zod/v4");
4801
- var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
4969
+ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
4802
4970
  () => (0, import_provider_utils24.zodSchema)(
4803
4971
  import_v421.z.object({
4804
- command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
4972
+ command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4805
4973
  path: import_v421.z.string(),
4806
4974
  file_text: import_v421.z.string().optional(),
4807
4975
  insert_line: import_v421.z.number().int().optional(),
@@ -4812,40 +4980,62 @@ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
4812
4980
  })
4813
4981
  )
4814
4982
  );
4815
- var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
4816
- id: "anthropic.text_editor_20250429",
4817
- inputSchema: textEditor_20250429InputSchema
4983
+ var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
4984
+ id: "anthropic.text_editor_20250124",
4985
+ inputSchema: textEditor_20250124InputSchema
4818
4986
  });
4819
4987
 
4820
- // src/tool/tool-search-bm25_20251119.ts
4988
+ // src/tool/text-editor_20250429.ts
4821
4989
  var import_provider_utils25 = require("@ai-sdk/provider-utils");
4822
4990
  var import_v422 = require("zod/v4");
4823
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
4991
+ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
4824
4992
  () => (0, import_provider_utils25.zodSchema)(
4825
- import_v422.z.array(
4826
- import_v422.z.object({
4827
- type: import_v422.z.literal("tool_reference"),
4828
- toolName: import_v422.z.string()
4993
+ import_v422.z.object({
4994
+ command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
4995
+ path: import_v422.z.string(),
4996
+ file_text: import_v422.z.string().optional(),
4997
+ insert_line: import_v422.z.number().int().optional(),
4998
+ new_str: import_v422.z.string().optional(),
4999
+ insert_text: import_v422.z.string().optional(),
5000
+ old_str: import_v422.z.string().optional(),
5001
+ view_range: import_v422.z.array(import_v422.z.number().int()).optional()
5002
+ })
5003
+ )
5004
+ );
5005
+ var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
5006
+ id: "anthropic.text_editor_20250429",
5007
+ inputSchema: textEditor_20250429InputSchema
5008
+ });
5009
+
5010
+ // src/tool/tool-search-bm25_20251119.ts
5011
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
5012
+ var import_v423 = require("zod/v4");
5013
+ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
5014
+ () => (0, import_provider_utils26.zodSchema)(
5015
+ import_v423.z.array(
5016
+ import_v423.z.object({
5017
+ type: import_v423.z.literal("tool_reference"),
5018
+ toolName: import_v423.z.string()
4829
5019
  })
4830
5020
  )
4831
5021
  )
4832
5022
  );
4833
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
4834
- () => (0, import_provider_utils25.zodSchema)(
4835
- import_v422.z.object({
5023
+ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
5024
+ () => (0, import_provider_utils26.zodSchema)(
5025
+ import_v423.z.object({
4836
5026
  /**
4837
5027
  * A natural language query to search for tools.
4838
5028
  * Claude will use BM25 text search to find relevant tools.
4839
5029
  */
4840
- query: import_v422.z.string(),
5030
+ query: import_v423.z.string(),
4841
5031
  /**
4842
5032
  * Maximum number of tools to return. Optional.
4843
5033
  */
4844
- limit: import_v422.z.number().optional()
5034
+ limit: import_v423.z.number().optional()
4845
5035
  })
4846
5036
  )
4847
5037
  );
4848
- var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
5038
+ var factory10 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4849
5039
  id: "anthropic.tool_search_bm25_20251119",
4850
5040
  inputSchema: toolSearchBm25_20251119InputSchema,
4851
5041
  outputSchema: toolSearchBm25_20251119OutputSchema,
@@ -5057,11 +5247,136 @@ var anthropicTools = {
5057
5247
  toolSearchBm25_20251119
5058
5248
  };
5059
5249
 
5250
+ // src/skills/anthropic-skills.ts
5251
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
5252
+
5253
+ // src/skills/anthropic-skills-api.ts
5254
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
5255
+ var import_v424 = require("zod/v4");
5256
+ var anthropicSkillResponseSchema = (0, import_provider_utils27.lazySchema)(
5257
+ () => (0, import_provider_utils27.zodSchema)(
5258
+ import_v424.z.object({
5259
+ id: import_v424.z.string(),
5260
+ display_title: import_v424.z.string().nullish(),
5261
+ name: import_v424.z.string().nullish(),
5262
+ description: import_v424.z.string().nullish(),
5263
+ latest_version: import_v424.z.string().nullish(),
5264
+ source: import_v424.z.string(),
5265
+ created_at: import_v424.z.string(),
5266
+ updated_at: import_v424.z.string()
5267
+ })
5268
+ )
5269
+ );
5270
+ var anthropicSkillVersionListResponseSchema = (0, import_provider_utils27.lazySchema)(
5271
+ () => (0, import_provider_utils27.zodSchema)(
5272
+ import_v424.z.object({
5273
+ data: import_v424.z.array(
5274
+ import_v424.z.object({
5275
+ version: import_v424.z.string()
5276
+ })
5277
+ )
5278
+ })
5279
+ )
5280
+ );
5281
+ var anthropicSkillVersionResponseSchema = (0, import_provider_utils27.lazySchema)(
5282
+ () => (0, import_provider_utils27.zodSchema)(
5283
+ import_v424.z.object({
5284
+ type: import_v424.z.string(),
5285
+ skill_id: import_v424.z.string(),
5286
+ name: import_v424.z.string().nullish(),
5287
+ description: import_v424.z.string().nullish()
5288
+ })
5289
+ )
5290
+ );
5291
+
5292
+ // src/skills/anthropic-skills.ts
5293
+ var AnthropicSkills = class {
5294
+ constructor(config) {
5295
+ this.config = config;
5296
+ this.specificationVersion = "v4";
5297
+ }
5298
+ get provider() {
5299
+ return this.config.provider;
5300
+ }
5301
+ async getHeaders() {
5302
+ return (0, import_provider_utils28.combineHeaders)(await (0, import_provider_utils28.resolve)(this.config.headers), {
5303
+ "anthropic-beta": "skills-2025-10-02"
5304
+ });
5305
+ }
5306
+ async fetchVersionMetadata({
5307
+ skillId,
5308
+ version,
5309
+ headers
5310
+ }) {
5311
+ const { value: versionResponse } = await (0, import_provider_utils28.getFromApi)({
5312
+ url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
5313
+ headers,
5314
+ failedResponseHandler: anthropicFailedResponseHandler,
5315
+ successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
5316
+ anthropicSkillVersionResponseSchema
5317
+ ),
5318
+ fetch: this.config.fetch
5319
+ });
5320
+ return {
5321
+ ...versionResponse.name != null ? { name: versionResponse.name } : {},
5322
+ ...versionResponse.description != null ? { description: versionResponse.description } : {}
5323
+ };
5324
+ }
5325
+ async upload(params) {
5326
+ var _a, _b;
5327
+ const warnings = [];
5328
+ const formData = new FormData();
5329
+ if (params.displayTitle != null) {
5330
+ formData.append("display_title", params.displayTitle);
5331
+ }
5332
+ for (const file of params.files) {
5333
+ const content = typeof file.content === "string" ? (0, import_provider_utils28.convertBase64ToUint8Array)(file.content) : file.content;
5334
+ formData.append("files[]", new Blob([content]), file.path);
5335
+ }
5336
+ const headers = await this.getHeaders();
5337
+ const { value: response } = await (0, import_provider_utils28.postFormDataToApi)({
5338
+ url: `${this.config.baseURL}/skills`,
5339
+ headers,
5340
+ formData,
5341
+ failedResponseHandler: anthropicFailedResponseHandler,
5342
+ successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
5343
+ anthropicSkillResponseSchema
5344
+ ),
5345
+ fetch: this.config.fetch
5346
+ });
5347
+ const versionMetadata = response.latest_version != null ? await this.fetchVersionMetadata({
5348
+ skillId: response.id,
5349
+ version: response.latest_version,
5350
+ headers
5351
+ }) : {};
5352
+ const name = (_a = versionMetadata.name) != null ? _a : response.name;
5353
+ const description = (_b = versionMetadata.description) != null ? _b : response.description;
5354
+ return {
5355
+ providerReference: { anthropic: response.id },
5356
+ ...response.display_title != null ? { displayTitle: response.display_title } : {},
5357
+ ...name != null ? { name } : {},
5358
+ ...description != null ? { description } : {},
5359
+ ...response.latest_version != null ? { latestVersion: response.latest_version } : {},
5360
+ providerMetadata: {
5361
+ anthropic: {
5362
+ ...response.source != null ? { source: response.source } : {},
5363
+ ...response.created_at != null ? { createdAt: response.created_at } : {},
5364
+ ...response.updated_at != null ? { updatedAt: response.updated_at } : {}
5365
+ }
5366
+ },
5367
+ warnings
5368
+ };
5369
+ }
5370
+ };
5371
+
5372
+ // src/version.ts
5373
+ var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
5374
+
5060
5375
  // src/anthropic-provider.ts
5061
5376
  function createAnthropic(options = {}) {
5062
5377
  var _a, _b;
5063
- const baseURL = (_a = (0, import_provider_utils26.withoutTrailingSlash)(
5064
- (0, import_provider_utils26.loadOptionalSetting)({
5378
+ const baseURL = (_a = (0, import_provider_utils29.withoutTrailingSlash)(
5379
+ (0, import_provider_utils29.loadOptionalSetting)({
5065
5380
  settingValue: options.baseURL,
5066
5381
  environmentVariableName: "ANTHROPIC_BASE_URL"
5067
5382
  })
@@ -5075,13 +5390,13 @@ function createAnthropic(options = {}) {
5075
5390
  }
5076
5391
  const getHeaders = () => {
5077
5392
  const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
5078
- "x-api-key": (0, import_provider_utils26.loadApiKey)({
5393
+ "x-api-key": (0, import_provider_utils29.loadApiKey)({
5079
5394
  apiKey: options.apiKey,
5080
5395
  environmentVariableName: "ANTHROPIC_API_KEY",
5081
5396
  description: "Anthropic"
5082
5397
  })
5083
5398
  };
5084
- return (0, import_provider_utils26.withUserAgentSuffix)(
5399
+ return (0, import_provider_utils29.withUserAgentSuffix)(
5085
5400
  {
5086
5401
  "anthropic-version": "2023-06-01",
5087
5402
  ...authHeaders,
@@ -5097,13 +5412,19 @@ function createAnthropic(options = {}) {
5097
5412
  baseURL,
5098
5413
  headers: getHeaders,
5099
5414
  fetch: options.fetch,
5100
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils26.generateId,
5415
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils29.generateId,
5101
5416
  supportedUrls: () => ({
5102
5417
  "image/*": [/^https?:\/\/.*$/],
5103
5418
  "application/pdf": [/^https?:\/\/.*$/]
5104
5419
  })
5105
5420
  });
5106
5421
  };
5422
+ const createSkills = () => new AnthropicSkills({
5423
+ provider: `${providerName.replace(".messages", "")}.skills`,
5424
+ baseURL,
5425
+ headers: getHeaders,
5426
+ fetch: options.fetch
5427
+ });
5107
5428
  const provider = function(modelId) {
5108
5429
  if (new.target) {
5109
5430
  throw new Error(
@@ -5112,7 +5433,7 @@ function createAnthropic(options = {}) {
5112
5433
  }
5113
5434
  return createChatModel(modelId);
5114
5435
  };
5115
- provider.specificationVersion = "v3";
5436
+ provider.specificationVersion = "v4";
5116
5437
  provider.languageModel = createChatModel;
5117
5438
  provider.chat = createChatModel;
5118
5439
  provider.messages = createChatModel;
@@ -5123,6 +5444,13 @@ function createAnthropic(options = {}) {
5123
5444
  provider.imageModel = (modelId) => {
5124
5445
  throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
5125
5446
  };
5447
+ provider.files = () => new AnthropicFiles({
5448
+ provider: providerName,
5449
+ baseURL,
5450
+ headers: getHeaders,
5451
+ fetch: options.fetch
5452
+ });
5453
+ provider.skills = createSkills;
5126
5454
  provider.tools = anthropicTools;
5127
5455
  return provider;
5128
5456
  }