@ai-sdk/anthropic 4.0.0-beta.3 → 4.0.0-beta.32

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
@@ -1,375 +1,451 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- VERSION: () => VERSION,
24
- anthropic: () => anthropic,
25
- createAnthropic: () => createAnthropic,
26
- forwardAnthropicContainerIdFromLastStep: () => forwardAnthropicContainerIdFromLastStep
27
- });
28
- module.exports = __toCommonJS(src_exports);
29
-
30
1
  // src/anthropic-provider.ts
31
- var import_provider4 = require("@ai-sdk/provider");
32
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ InvalidArgumentError,
4
+ NoSuchModelError
5
+ } from "@ai-sdk/provider";
6
+ import {
7
+ generateId as generateId2,
8
+ loadApiKey,
9
+ loadOptionalSetting,
10
+ withoutTrailingSlash,
11
+ withUserAgentSuffix
12
+ } from "@ai-sdk/provider-utils";
33
13
 
34
- // src/version.ts
35
- var VERSION = true ? "4.0.0-beta.3" : "0.0.0-test";
36
-
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");
14
+ // src/anthropic-files.ts
15
+ import {
16
+ combineHeaders,
17
+ convertBase64ToUint8Array,
18
+ createJsonResponseHandler,
19
+ lazySchema as lazySchema2,
20
+ postFormDataToApi,
21
+ zodSchema as zodSchema2
22
+ } from "@ai-sdk/provider-utils";
23
+ import { z as z2 } from "zod/v4";
40
24
 
41
25
  // src/anthropic-error.ts
42
- var import_provider_utils = require("@ai-sdk/provider-utils");
43
- var import_v4 = require("zod/v4");
44
- var anthropicErrorDataSchema = (0, import_provider_utils.lazySchema)(
45
- () => (0, import_provider_utils.zodSchema)(
46
- import_v4.z.object({
47
- type: import_v4.z.literal("error"),
48
- error: import_v4.z.object({
49
- type: import_v4.z.string(),
50
- message: import_v4.z.string()
26
+ import {
27
+ createJsonErrorResponseHandler,
28
+ lazySchema,
29
+ zodSchema
30
+ } from "@ai-sdk/provider-utils";
31
+ import { z } from "zod/v4";
32
+ var anthropicErrorDataSchema = lazySchema(
33
+ () => zodSchema(
34
+ z.object({
35
+ type: z.literal("error"),
36
+ error: z.object({
37
+ type: z.string(),
38
+ message: z.string()
51
39
  })
52
40
  })
53
41
  )
54
42
  );
55
- var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
43
+ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
56
44
  errorSchema: anthropicErrorDataSchema,
57
45
  errorToMessage: (data) => data.error.message
58
46
  });
59
47
 
48
+ // src/anthropic-files.ts
49
+ var anthropicUploadFileResponseSchema = lazySchema2(
50
+ () => zodSchema2(
51
+ z2.object({
52
+ id: z2.string(),
53
+ type: z2.literal("file"),
54
+ filename: z2.string(),
55
+ mime_type: z2.string(),
56
+ size_bytes: z2.number(),
57
+ created_at: z2.string(),
58
+ downloadable: z2.boolean().nullish()
59
+ })
60
+ )
61
+ );
62
+ var AnthropicFiles = class {
63
+ constructor(config) {
64
+ this.config = config;
65
+ this.specificationVersion = "v4";
66
+ }
67
+ get provider() {
68
+ return this.config.provider;
69
+ }
70
+ async uploadFile({
71
+ data,
72
+ mediaType,
73
+ filename
74
+ }) {
75
+ var _a, _b;
76
+ const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
77
+ const blob = new Blob([fileBytes], { type: mediaType });
78
+ const formData = new FormData();
79
+ if (filename != null) {
80
+ formData.append("file", blob, filename);
81
+ } else {
82
+ formData.append("file", blob);
83
+ }
84
+ const { value: response } = await postFormDataToApi({
85
+ url: `${this.config.baseURL}/files`,
86
+ headers: combineHeaders(this.config.headers(), {
87
+ "anthropic-beta": "files-api-2025-04-14"
88
+ }),
89
+ formData,
90
+ failedResponseHandler: anthropicFailedResponseHandler,
91
+ successfulResponseHandler: createJsonResponseHandler(
92
+ anthropicUploadFileResponseSchema
93
+ ),
94
+ fetch: this.config.fetch
95
+ });
96
+ return {
97
+ warnings: [],
98
+ providerReference: { anthropic: response.id },
99
+ mediaType: (_a = response.mime_type) != null ? _a : mediaType,
100
+ filename: (_b = response.filename) != null ? _b : filename,
101
+ providerMetadata: {
102
+ anthropic: {
103
+ filename: response.filename,
104
+ mimeType: response.mime_type,
105
+ sizeBytes: response.size_bytes,
106
+ createdAt: response.created_at,
107
+ ...response.downloadable != null ? { downloadable: response.downloadable } : {}
108
+ }
109
+ }
110
+ };
111
+ }
112
+ };
113
+
114
+ // src/anthropic-messages-language-model.ts
115
+ import {
116
+ APICallError
117
+ } from "@ai-sdk/provider";
118
+ import {
119
+ combineHeaders as combineHeaders2,
120
+ createEventSourceResponseHandler,
121
+ createJsonResponseHandler as createJsonResponseHandler2,
122
+ createToolNameMapping,
123
+ generateId,
124
+ isCustomReasoning,
125
+ mapReasoningToProviderBudget,
126
+ mapReasoningToProviderEffort,
127
+ parseProviderOptions as parseProviderOptions2,
128
+ postJsonToApi,
129
+ resolve,
130
+ resolveProviderReference as resolveProviderReference2,
131
+ serializeModelOptions,
132
+ WORKFLOW_SERIALIZE,
133
+ WORKFLOW_DESERIALIZE
134
+ } from "@ai-sdk/provider-utils";
135
+
60
136
  // 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)(
64
- () => (0, import_provider_utils2.zodSchema)(
65
- 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()
137
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
138
+ import { z as z3 } from "zod/v4";
139
+ var anthropicMessagesResponseSchema = lazySchema3(
140
+ () => zodSchema3(
141
+ z3.object({
142
+ type: z3.literal("message"),
143
+ id: z3.string().nullish(),
144
+ model: z3.string().nullish(),
145
+ content: z3.array(
146
+ z3.discriminatedUnion("type", [
147
+ z3.object({
148
+ type: z3.literal("text"),
149
+ text: z3.string(),
150
+ citations: z3.array(
151
+ z3.discriminatedUnion("type", [
152
+ z3.object({
153
+ type: z3.literal("web_search_result_location"),
154
+ cited_text: z3.string(),
155
+ url: z3.string(),
156
+ title: z3.string(),
157
+ encrypted_index: z3.string()
82
158
  }),
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()
159
+ z3.object({
160
+ type: z3.literal("page_location"),
161
+ cited_text: z3.string(),
162
+ document_index: z3.number(),
163
+ document_title: z3.string().nullable(),
164
+ start_page_number: z3.number(),
165
+ end_page_number: z3.number()
90
166
  }),
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()
167
+ z3.object({
168
+ type: z3.literal("char_location"),
169
+ cited_text: z3.string(),
170
+ document_index: z3.number(),
171
+ document_title: z3.string().nullable(),
172
+ start_char_index: z3.number(),
173
+ end_char_index: z3.number()
98
174
  })
99
175
  ])
100
176
  ).optional()
101
177
  }),
102
- import_v42.z.object({
103
- type: import_v42.z.literal("thinking"),
104
- thinking: import_v42.z.string(),
105
- signature: import_v42.z.string()
178
+ z3.object({
179
+ type: z3.literal("thinking"),
180
+ thinking: z3.string(),
181
+ signature: z3.string()
106
182
  }),
107
- import_v42.z.object({
108
- type: import_v42.z.literal("redacted_thinking"),
109
- data: import_v42.z.string()
183
+ z3.object({
184
+ type: z3.literal("redacted_thinking"),
185
+ data: z3.string()
110
186
  }),
111
- import_v42.z.object({
112
- type: import_v42.z.literal("compaction"),
113
- content: import_v42.z.string()
187
+ z3.object({
188
+ type: z3.literal("compaction"),
189
+ content: z3.string()
114
190
  }),
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(),
191
+ z3.object({
192
+ type: z3.literal("tool_use"),
193
+ id: z3.string(),
194
+ name: z3.string(),
195
+ input: z3.unknown(),
120
196
  // 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()
197
+ caller: z3.union([
198
+ z3.object({
199
+ type: z3.literal("code_execution_20250825"),
200
+ tool_id: z3.string()
125
201
  }),
126
- import_v42.z.object({
127
- type: import_v42.z.literal("code_execution_20260120"),
128
- tool_id: import_v42.z.string()
202
+ z3.object({
203
+ type: z3.literal("code_execution_20260120"),
204
+ tool_id: z3.string()
129
205
  }),
130
- import_v42.z.object({
131
- type: import_v42.z.literal("direct")
206
+ z3.object({
207
+ type: z3.literal("direct")
132
208
  })
133
209
  ]).optional()
134
210
  }),
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()
211
+ z3.object({
212
+ type: z3.literal("server_tool_use"),
213
+ id: z3.string(),
214
+ name: z3.string(),
215
+ input: z3.record(z3.string(), z3.unknown()).nullish(),
216
+ caller: z3.union([
217
+ z3.object({
218
+ type: z3.literal("code_execution_20260120"),
219
+ tool_id: z3.string()
144
220
  }),
145
- import_v42.z.object({
146
- type: import_v42.z.literal("direct")
221
+ z3.object({
222
+ type: z3.literal("direct")
147
223
  })
148
224
  ]).optional()
149
225
  }),
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()
226
+ z3.object({
227
+ type: z3.literal("mcp_tool_use"),
228
+ id: z3.string(),
229
+ name: z3.string(),
230
+ input: z3.unknown(),
231
+ server_name: z3.string()
156
232
  }),
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() })
233
+ z3.object({
234
+ type: z3.literal("mcp_tool_result"),
235
+ tool_use_id: z3.string(),
236
+ is_error: z3.boolean(),
237
+ content: z3.array(
238
+ z3.union([
239
+ z3.string(),
240
+ z3.object({ type: z3.literal("text"), text: z3.string() })
165
241
  ])
166
242
  )
167
243
  }),
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()
244
+ z3.object({
245
+ type: z3.literal("web_fetch_tool_result"),
246
+ tool_use_id: z3.string(),
247
+ content: z3.union([
248
+ z3.object({
249
+ type: z3.literal("web_fetch_result"),
250
+ url: z3.string(),
251
+ retrieved_at: z3.string(),
252
+ content: z3.object({
253
+ type: z3.literal("document"),
254
+ title: z3.string().nullable(),
255
+ citations: z3.object({ enabled: z3.boolean() }).optional(),
256
+ source: z3.union([
257
+ z3.object({
258
+ type: z3.literal("base64"),
259
+ media_type: z3.literal("application/pdf"),
260
+ data: z3.string()
185
261
  }),
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()
262
+ z3.object({
263
+ type: z3.literal("text"),
264
+ media_type: z3.literal("text/plain"),
265
+ data: z3.string()
190
266
  })
191
267
  ])
192
268
  })
193
269
  }),
194
- import_v42.z.object({
195
- type: import_v42.z.literal("web_fetch_tool_result_error"),
196
- error_code: import_v42.z.string()
270
+ z3.object({
271
+ type: z3.literal("web_fetch_tool_result_error"),
272
+ error_code: z3.string()
197
273
  })
198
274
  ])
199
275
  }),
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()
276
+ z3.object({
277
+ type: z3.literal("web_search_tool_result"),
278
+ tool_use_id: z3.string(),
279
+ content: z3.union([
280
+ z3.array(
281
+ z3.object({
282
+ type: z3.literal("web_search_result"),
283
+ url: z3.string(),
284
+ title: z3.string(),
285
+ encrypted_content: z3.string(),
286
+ page_age: z3.string().nullish()
211
287
  })
212
288
  ),
213
- import_v42.z.object({
214
- type: import_v42.z.literal("web_search_tool_result_error"),
215
- error_code: import_v42.z.string()
289
+ z3.object({
290
+ type: z3.literal("web_search_tool_result_error"),
291
+ error_code: z3.string()
216
292
  })
217
293
  ])
218
294
  }),
219
295
  // 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()
296
+ z3.object({
297
+ type: z3.literal("code_execution_tool_result"),
298
+ tool_use_id: z3.string(),
299
+ content: z3.union([
300
+ z3.object({
301
+ type: z3.literal("code_execution_result"),
302
+ stdout: z3.string(),
303
+ stderr: z3.string(),
304
+ return_code: z3.number(),
305
+ content: z3.array(
306
+ z3.object({
307
+ type: z3.literal("code_execution_output"),
308
+ file_id: z3.string()
233
309
  })
234
310
  ).optional().default([])
235
311
  }),
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()
312
+ z3.object({
313
+ type: z3.literal("encrypted_code_execution_result"),
314
+ encrypted_stdout: z3.string(),
315
+ stderr: z3.string(),
316
+ return_code: z3.number(),
317
+ content: z3.array(
318
+ z3.object({
319
+ type: z3.literal("code_execution_output"),
320
+ file_id: z3.string()
245
321
  })
246
322
  ).optional().default([])
247
323
  }),
248
- import_v42.z.object({
249
- type: import_v42.z.literal("code_execution_tool_result_error"),
250
- error_code: import_v42.z.string()
324
+ z3.object({
325
+ type: z3.literal("code_execution_tool_result_error"),
326
+ error_code: z3.string()
251
327
  })
252
328
  ])
253
329
  }),
254
330
  // 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()
331
+ z3.object({
332
+ type: z3.literal("bash_code_execution_tool_result"),
333
+ tool_use_id: z3.string(),
334
+ content: z3.discriminatedUnion("type", [
335
+ z3.object({
336
+ type: z3.literal("bash_code_execution_result"),
337
+ content: z3.array(
338
+ z3.object({
339
+ type: z3.literal("bash_code_execution_output"),
340
+ file_id: z3.string()
265
341
  })
266
342
  ),
267
- stdout: import_v42.z.string(),
268
- stderr: import_v42.z.string(),
269
- return_code: import_v42.z.number()
343
+ stdout: z3.string(),
344
+ stderr: z3.string(),
345
+ return_code: z3.number()
270
346
  }),
271
- import_v42.z.object({
272
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
273
- error_code: import_v42.z.string()
347
+ z3.object({
348
+ type: z3.literal("bash_code_execution_tool_result_error"),
349
+ error_code: z3.string()
274
350
  })
275
351
  ])
276
352
  }),
277
353
  // 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()
354
+ z3.object({
355
+ type: z3.literal("text_editor_code_execution_tool_result"),
356
+ tool_use_id: z3.string(),
357
+ content: z3.discriminatedUnion("type", [
358
+ z3.object({
359
+ type: z3.literal("text_editor_code_execution_tool_result_error"),
360
+ error_code: z3.string()
285
361
  }),
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()
362
+ z3.object({
363
+ type: z3.literal("text_editor_code_execution_view_result"),
364
+ content: z3.string(),
365
+ file_type: z3.string(),
366
+ num_lines: z3.number().nullable(),
367
+ start_line: z3.number().nullable(),
368
+ total_lines: z3.number().nullable()
293
369
  }),
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()
370
+ z3.object({
371
+ type: z3.literal("text_editor_code_execution_create_result"),
372
+ is_file_update: z3.boolean()
297
373
  }),
298
- import_v42.z.object({
299
- type: import_v42.z.literal(
374
+ z3.object({
375
+ type: z3.literal(
300
376
  "text_editor_code_execution_str_replace_result"
301
377
  ),
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()
378
+ lines: z3.array(z3.string()).nullable(),
379
+ new_lines: z3.number().nullable(),
380
+ new_start: z3.number().nullable(),
381
+ old_lines: z3.number().nullable(),
382
+ old_start: z3.number().nullable()
307
383
  })
308
384
  ])
309
385
  }),
310
386
  // 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()
387
+ z3.object({
388
+ type: z3.literal("tool_search_tool_result"),
389
+ tool_use_id: z3.string(),
390
+ content: z3.union([
391
+ z3.object({
392
+ type: z3.literal("tool_search_tool_search_result"),
393
+ tool_references: z3.array(
394
+ z3.object({
395
+ type: z3.literal("tool_reference"),
396
+ tool_name: z3.string()
321
397
  })
322
398
  )
323
399
  }),
324
- import_v42.z.object({
325
- type: import_v42.z.literal("tool_search_tool_result_error"),
326
- error_code: import_v42.z.string()
400
+ z3.object({
401
+ type: z3.literal("tool_search_tool_result_error"),
402
+ error_code: z3.string()
327
403
  })
328
404
  ])
329
405
  })
330
406
  ])
331
407
  ),
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()
408
+ stop_reason: z3.string().nullish(),
409
+ stop_sequence: z3.string().nullish(),
410
+ usage: z3.looseObject({
411
+ input_tokens: z3.number(),
412
+ output_tokens: z3.number(),
413
+ cache_creation_input_tokens: z3.number().nullish(),
414
+ cache_read_input_tokens: z3.number().nullish(),
415
+ iterations: z3.array(
416
+ z3.object({
417
+ type: z3.union([z3.literal("compaction"), z3.literal("message")]),
418
+ input_tokens: z3.number(),
419
+ output_tokens: z3.number()
344
420
  })
345
421
  ).nullish()
346
422
  }),
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()
423
+ container: z3.object({
424
+ expires_at: z3.string(),
425
+ id: z3.string(),
426
+ skills: z3.array(
427
+ z3.object({
428
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
429
+ skill_id: z3.string(),
430
+ version: z3.string()
355
431
  })
356
432
  ).nullish()
357
433
  }).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()
434
+ context_management: z3.object({
435
+ applied_edits: z3.array(
436
+ z3.union([
437
+ z3.object({
438
+ type: z3.literal("clear_tool_uses_20250919"),
439
+ cleared_tool_uses: z3.number(),
440
+ cleared_input_tokens: z3.number()
365
441
  }),
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()
442
+ z3.object({
443
+ type: z3.literal("clear_thinking_20251015"),
444
+ cleared_thinking_turns: z3.number(),
445
+ cleared_input_tokens: z3.number()
370
446
  }),
371
- import_v42.z.object({
372
- type: import_v42.z.literal("compact_20260112")
447
+ z3.object({
448
+ type: z3.literal("compact_20260112")
373
449
  })
374
450
  ])
375
451
  )
@@ -377,457 +453,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
377
453
  })
378
454
  )
379
455
  );
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()
456
+ var anthropicMessagesChunkSchema = lazySchema3(
457
+ () => zodSchema3(
458
+ z3.discriminatedUnion("type", [
459
+ z3.object({
460
+ type: z3.literal("message_start"),
461
+ message: z3.object({
462
+ id: z3.string().nullish(),
463
+ model: z3.string().nullish(),
464
+ role: z3.string().nullish(),
465
+ usage: z3.looseObject({
466
+ input_tokens: z3.number(),
467
+ cache_creation_input_tokens: z3.number().nullish(),
468
+ cache_read_input_tokens: z3.number().nullish()
393
469
  }),
394
470
  // 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()
471
+ content: z3.array(
472
+ z3.discriminatedUnion("type", [
473
+ z3.object({
474
+ type: z3.literal("tool_use"),
475
+ id: z3.string(),
476
+ name: z3.string(),
477
+ input: z3.unknown(),
478
+ caller: z3.union([
479
+ z3.object({
480
+ type: z3.literal("code_execution_20250825"),
481
+ tool_id: z3.string()
406
482
  }),
407
- import_v42.z.object({
408
- type: import_v42.z.literal("code_execution_20260120"),
409
- tool_id: import_v42.z.string()
483
+ z3.object({
484
+ type: z3.literal("code_execution_20260120"),
485
+ tool_id: z3.string()
410
486
  }),
411
- import_v42.z.object({
412
- type: import_v42.z.literal("direct")
487
+ z3.object({
488
+ type: z3.literal("direct")
413
489
  })
414
490
  ]).optional()
415
491
  })
416
492
  ])
417
493
  ).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()
494
+ stop_reason: z3.string().nullish(),
495
+ container: z3.object({
496
+ expires_at: z3.string(),
497
+ id: z3.string()
422
498
  }).nullish()
423
499
  })
424
500
  }),
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()
501
+ z3.object({
502
+ type: z3.literal("content_block_start"),
503
+ index: z3.number(),
504
+ content_block: z3.discriminatedUnion("type", [
505
+ z3.object({
506
+ type: z3.literal("text"),
507
+ text: z3.string()
432
508
  }),
433
- import_v42.z.object({
434
- type: import_v42.z.literal("thinking"),
435
- thinking: import_v42.z.string()
509
+ z3.object({
510
+ type: z3.literal("thinking"),
511
+ thinking: z3.string()
436
512
  }),
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(),
513
+ z3.object({
514
+ type: z3.literal("tool_use"),
515
+ id: z3.string(),
516
+ name: z3.string(),
441
517
  // 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(),
518
+ input: z3.record(z3.string(), z3.unknown()).optional(),
443
519
  // 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()
520
+ caller: z3.union([
521
+ z3.object({
522
+ type: z3.literal("code_execution_20250825"),
523
+ tool_id: z3.string()
448
524
  }),
449
- import_v42.z.object({
450
- type: import_v42.z.literal("code_execution_20260120"),
451
- tool_id: import_v42.z.string()
525
+ z3.object({
526
+ type: z3.literal("code_execution_20260120"),
527
+ tool_id: z3.string()
452
528
  }),
453
- import_v42.z.object({
454
- type: import_v42.z.literal("direct")
529
+ z3.object({
530
+ type: z3.literal("direct")
455
531
  })
456
532
  ]).optional()
457
533
  }),
458
- import_v42.z.object({
459
- type: import_v42.z.literal("redacted_thinking"),
460
- data: import_v42.z.string()
534
+ z3.object({
535
+ type: z3.literal("redacted_thinking"),
536
+ data: z3.string()
461
537
  }),
462
- import_v42.z.object({
463
- type: import_v42.z.literal("compaction"),
464
- content: import_v42.z.string().nullish()
538
+ z3.object({
539
+ type: z3.literal("compaction"),
540
+ content: z3.string().nullish()
465
541
  }),
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()
542
+ z3.object({
543
+ type: z3.literal("server_tool_use"),
544
+ id: z3.string(),
545
+ name: z3.string(),
546
+ input: z3.record(z3.string(), z3.unknown()).nullish(),
547
+ caller: z3.union([
548
+ z3.object({
549
+ type: z3.literal("code_execution_20260120"),
550
+ tool_id: z3.string()
475
551
  }),
476
- import_v42.z.object({
477
- type: import_v42.z.literal("direct")
552
+ z3.object({
553
+ type: z3.literal("direct")
478
554
  })
479
555
  ]).optional()
480
556
  }),
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()
557
+ z3.object({
558
+ type: z3.literal("mcp_tool_use"),
559
+ id: z3.string(),
560
+ name: z3.string(),
561
+ input: z3.unknown(),
562
+ server_name: z3.string()
487
563
  }),
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() })
564
+ z3.object({
565
+ type: z3.literal("mcp_tool_result"),
566
+ tool_use_id: z3.string(),
567
+ is_error: z3.boolean(),
568
+ content: z3.array(
569
+ z3.union([
570
+ z3.string(),
571
+ z3.object({ type: z3.literal("text"), text: z3.string() })
496
572
  ])
497
573
  )
498
574
  }),
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()
575
+ z3.object({
576
+ type: z3.literal("web_fetch_tool_result"),
577
+ tool_use_id: z3.string(),
578
+ content: z3.union([
579
+ z3.object({
580
+ type: z3.literal("web_fetch_result"),
581
+ url: z3.string(),
582
+ retrieved_at: z3.string(),
583
+ content: z3.object({
584
+ type: z3.literal("document"),
585
+ title: z3.string().nullable(),
586
+ citations: z3.object({ enabled: z3.boolean() }).optional(),
587
+ source: z3.union([
588
+ z3.object({
589
+ type: z3.literal("base64"),
590
+ media_type: z3.literal("application/pdf"),
591
+ data: z3.string()
516
592
  }),
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()
593
+ z3.object({
594
+ type: z3.literal("text"),
595
+ media_type: z3.literal("text/plain"),
596
+ data: z3.string()
521
597
  })
522
598
  ])
523
599
  })
524
600
  }),
525
- import_v42.z.object({
526
- type: import_v42.z.literal("web_fetch_tool_result_error"),
527
- error_code: import_v42.z.string()
601
+ z3.object({
602
+ type: z3.literal("web_fetch_tool_result_error"),
603
+ error_code: z3.string()
528
604
  })
529
605
  ])
530
606
  }),
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()
607
+ z3.object({
608
+ type: z3.literal("web_search_tool_result"),
609
+ tool_use_id: z3.string(),
610
+ content: z3.union([
611
+ z3.array(
612
+ z3.object({
613
+ type: z3.literal("web_search_result"),
614
+ url: z3.string(),
615
+ title: z3.string(),
616
+ encrypted_content: z3.string(),
617
+ page_age: z3.string().nullish()
542
618
  })
543
619
  ),
544
- import_v42.z.object({
545
- type: import_v42.z.literal("web_search_tool_result_error"),
546
- error_code: import_v42.z.string()
620
+ z3.object({
621
+ type: z3.literal("web_search_tool_result_error"),
622
+ error_code: z3.string()
547
623
  })
548
624
  ])
549
625
  }),
550
626
  // 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()
627
+ z3.object({
628
+ type: z3.literal("code_execution_tool_result"),
629
+ tool_use_id: z3.string(),
630
+ content: z3.union([
631
+ z3.object({
632
+ type: z3.literal("code_execution_result"),
633
+ stdout: z3.string(),
634
+ stderr: z3.string(),
635
+ return_code: z3.number(),
636
+ content: z3.array(
637
+ z3.object({
638
+ type: z3.literal("code_execution_output"),
639
+ file_id: z3.string()
564
640
  })
565
641
  ).optional().default([])
566
642
  }),
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()
643
+ z3.object({
644
+ type: z3.literal("encrypted_code_execution_result"),
645
+ encrypted_stdout: z3.string(),
646
+ stderr: z3.string(),
647
+ return_code: z3.number(),
648
+ content: z3.array(
649
+ z3.object({
650
+ type: z3.literal("code_execution_output"),
651
+ file_id: z3.string()
576
652
  })
577
653
  ).optional().default([])
578
654
  }),
579
- import_v42.z.object({
580
- type: import_v42.z.literal("code_execution_tool_result_error"),
581
- error_code: import_v42.z.string()
655
+ z3.object({
656
+ type: z3.literal("code_execution_tool_result_error"),
657
+ error_code: z3.string()
582
658
  })
583
659
  ])
584
660
  }),
585
661
  // 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()
662
+ z3.object({
663
+ type: z3.literal("bash_code_execution_tool_result"),
664
+ tool_use_id: z3.string(),
665
+ content: z3.discriminatedUnion("type", [
666
+ z3.object({
667
+ type: z3.literal("bash_code_execution_result"),
668
+ content: z3.array(
669
+ z3.object({
670
+ type: z3.literal("bash_code_execution_output"),
671
+ file_id: z3.string()
596
672
  })
597
673
  ),
598
- stdout: import_v42.z.string(),
599
- stderr: import_v42.z.string(),
600
- return_code: import_v42.z.number()
674
+ stdout: z3.string(),
675
+ stderr: z3.string(),
676
+ return_code: z3.number()
601
677
  }),
602
- import_v42.z.object({
603
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
604
- error_code: import_v42.z.string()
678
+ z3.object({
679
+ type: z3.literal("bash_code_execution_tool_result_error"),
680
+ error_code: z3.string()
605
681
  })
606
682
  ])
607
683
  }),
608
684
  // 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()
685
+ z3.object({
686
+ type: z3.literal("text_editor_code_execution_tool_result"),
687
+ tool_use_id: z3.string(),
688
+ content: z3.discriminatedUnion("type", [
689
+ z3.object({
690
+ type: z3.literal("text_editor_code_execution_tool_result_error"),
691
+ error_code: z3.string()
616
692
  }),
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()
693
+ z3.object({
694
+ type: z3.literal("text_editor_code_execution_view_result"),
695
+ content: z3.string(),
696
+ file_type: z3.string(),
697
+ num_lines: z3.number().nullable(),
698
+ start_line: z3.number().nullable(),
699
+ total_lines: z3.number().nullable()
624
700
  }),
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()
701
+ z3.object({
702
+ type: z3.literal("text_editor_code_execution_create_result"),
703
+ is_file_update: z3.boolean()
628
704
  }),
629
- import_v42.z.object({
630
- type: import_v42.z.literal(
705
+ z3.object({
706
+ type: z3.literal(
631
707
  "text_editor_code_execution_str_replace_result"
632
708
  ),
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()
709
+ lines: z3.array(z3.string()).nullable(),
710
+ new_lines: z3.number().nullable(),
711
+ new_start: z3.number().nullable(),
712
+ old_lines: z3.number().nullable(),
713
+ old_start: z3.number().nullable()
638
714
  })
639
715
  ])
640
716
  }),
641
717
  // 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()
718
+ z3.object({
719
+ type: z3.literal("tool_search_tool_result"),
720
+ tool_use_id: z3.string(),
721
+ content: z3.union([
722
+ z3.object({
723
+ type: z3.literal("tool_search_tool_search_result"),
724
+ tool_references: z3.array(
725
+ z3.object({
726
+ type: z3.literal("tool_reference"),
727
+ tool_name: z3.string()
652
728
  })
653
729
  )
654
730
  }),
655
- import_v42.z.object({
656
- type: import_v42.z.literal("tool_search_tool_result_error"),
657
- error_code: import_v42.z.string()
731
+ z3.object({
732
+ type: z3.literal("tool_search_tool_result_error"),
733
+ error_code: z3.string()
658
734
  })
659
735
  ])
660
736
  })
661
737
  ])
662
738
  }),
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()
739
+ z3.object({
740
+ type: z3.literal("content_block_delta"),
741
+ index: z3.number(),
742
+ delta: z3.discriminatedUnion("type", [
743
+ z3.object({
744
+ type: z3.literal("input_json_delta"),
745
+ partial_json: z3.string()
670
746
  }),
671
- import_v42.z.object({
672
- type: import_v42.z.literal("text_delta"),
673
- text: import_v42.z.string()
747
+ z3.object({
748
+ type: z3.literal("text_delta"),
749
+ text: z3.string()
674
750
  }),
675
- import_v42.z.object({
676
- type: import_v42.z.literal("thinking_delta"),
677
- thinking: import_v42.z.string()
751
+ z3.object({
752
+ type: z3.literal("thinking_delta"),
753
+ thinking: z3.string()
678
754
  }),
679
- import_v42.z.object({
680
- type: import_v42.z.literal("signature_delta"),
681
- signature: import_v42.z.string()
755
+ z3.object({
756
+ type: z3.literal("signature_delta"),
757
+ signature: z3.string()
682
758
  }),
683
- import_v42.z.object({
684
- type: import_v42.z.literal("compaction_delta"),
685
- content: import_v42.z.string().nullish()
759
+ z3.object({
760
+ type: z3.literal("compaction_delta"),
761
+ content: z3.string().nullish()
686
762
  }),
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()
763
+ z3.object({
764
+ type: z3.literal("citations_delta"),
765
+ citation: z3.discriminatedUnion("type", [
766
+ z3.object({
767
+ type: z3.literal("web_search_result_location"),
768
+ cited_text: z3.string(),
769
+ url: z3.string(),
770
+ title: z3.string(),
771
+ encrypted_index: z3.string()
696
772
  }),
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()
773
+ z3.object({
774
+ type: z3.literal("page_location"),
775
+ cited_text: z3.string(),
776
+ document_index: z3.number(),
777
+ document_title: z3.string().nullable(),
778
+ start_page_number: z3.number(),
779
+ end_page_number: z3.number()
704
780
  }),
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()
781
+ z3.object({
782
+ type: z3.literal("char_location"),
783
+ cited_text: z3.string(),
784
+ document_index: z3.number(),
785
+ document_title: z3.string().nullable(),
786
+ start_char_index: z3.number(),
787
+ end_char_index: z3.number()
712
788
  })
713
789
  ])
714
790
  })
715
791
  ])
716
792
  }),
717
- import_v42.z.object({
718
- type: import_v42.z.literal("content_block_stop"),
719
- index: import_v42.z.number()
793
+ z3.object({
794
+ type: z3.literal("content_block_stop"),
795
+ index: z3.number()
720
796
  }),
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()
797
+ z3.object({
798
+ type: z3.literal("error"),
799
+ error: z3.object({
800
+ type: z3.string(),
801
+ message: z3.string()
726
802
  })
727
803
  }),
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")
804
+ z3.object({
805
+ type: z3.literal("message_delta"),
806
+ delta: z3.object({
807
+ stop_reason: z3.string().nullish(),
808
+ stop_sequence: z3.string().nullish(),
809
+ container: z3.object({
810
+ expires_at: z3.string(),
811
+ id: z3.string(),
812
+ skills: z3.array(
813
+ z3.object({
814
+ type: z3.union([
815
+ z3.literal("anthropic"),
816
+ z3.literal("custom")
741
817
  ]),
742
- skill_id: import_v42.z.string(),
743
- version: import_v42.z.string()
818
+ skill_id: z3.string(),
819
+ version: z3.string()
744
820
  })
745
821
  ).nullish()
746
822
  }).nullish()
747
823
  }),
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()
824
+ usage: z3.looseObject({
825
+ input_tokens: z3.number().nullish(),
826
+ output_tokens: z3.number(),
827
+ cache_creation_input_tokens: z3.number().nullish(),
828
+ cache_read_input_tokens: z3.number().nullish(),
829
+ iterations: z3.array(
830
+ z3.object({
831
+ type: z3.union([z3.literal("compaction"), z3.literal("message")]),
832
+ input_tokens: z3.number(),
833
+ output_tokens: z3.number()
758
834
  })
759
835
  ).nullish()
760
836
  }),
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()
837
+ context_management: z3.object({
838
+ applied_edits: z3.array(
839
+ z3.union([
840
+ z3.object({
841
+ type: z3.literal("clear_tool_uses_20250919"),
842
+ cleared_tool_uses: z3.number(),
843
+ cleared_input_tokens: z3.number()
768
844
  }),
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()
845
+ z3.object({
846
+ type: z3.literal("clear_thinking_20251015"),
847
+ cleared_thinking_turns: z3.number(),
848
+ cleared_input_tokens: z3.number()
773
849
  }),
774
- import_v42.z.object({
775
- type: import_v42.z.literal("compact_20260112")
850
+ z3.object({
851
+ type: z3.literal("compact_20260112")
776
852
  })
777
853
  ])
778
854
  )
779
855
  }).nullish()
780
856
  }),
781
- import_v42.z.object({
782
- type: import_v42.z.literal("message_stop")
857
+ z3.object({
858
+ type: z3.literal("message_stop")
783
859
  }),
784
- import_v42.z.object({
785
- type: import_v42.z.literal("ping")
860
+ z3.object({
861
+ type: z3.literal("ping")
786
862
  })
787
863
  ])
788
864
  )
789
865
  );
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()
866
+ var anthropicReasoningMetadataSchema = lazySchema3(
867
+ () => zodSchema3(
868
+ z3.object({
869
+ signature: z3.string().optional(),
870
+ redactedData: z3.string().optional()
795
871
  })
796
872
  )
797
873
  );
798
874
 
799
875
  // src/anthropic-messages-options.ts
800
- var import_v43 = require("zod/v4");
801
- var anthropicFilePartProviderOptions = import_v43.z.object({
876
+ import { z as z4 } from "zod/v4";
877
+ var anthropicFilePartProviderOptions = z4.object({
802
878
  /**
803
879
  * Citation configuration for this document.
804
880
  * When enabled, this document will generate citations in the response.
805
881
  */
806
- citations: import_v43.z.object({
882
+ citations: z4.object({
807
883
  /**
808
884
  * Enable citations for this document
809
885
  */
810
- enabled: import_v43.z.boolean()
886
+ enabled: z4.boolean()
811
887
  }).optional(),
812
888
  /**
813
889
  * Custom title for the document.
814
890
  * If not provided, the filename will be used.
815
891
  */
816
- title: import_v43.z.string().optional(),
892
+ title: z4.string().optional(),
817
893
  /**
818
894
  * Context about the document that will be passed to the model
819
895
  * but not used towards cited content.
820
896
  * Useful for storing document metadata as text or stringified JSON.
821
897
  */
822
- context: import_v43.z.string().optional()
898
+ context: z4.string().optional()
823
899
  });
824
- var anthropicLanguageModelOptions = import_v43.z.object({
900
+ var anthropicLanguageModelOptions = z4.object({
825
901
  /**
826
902
  * Whether to send reasoning to the model.
827
903
  *
828
904
  * This allows you to deactivate reasoning inputs for models that do not support them.
829
905
  */
830
- sendReasoning: import_v43.z.boolean().optional(),
906
+ sendReasoning: z4.boolean().optional(),
831
907
  /**
832
908
  * Determines how structured outputs are generated.
833
909
  *
@@ -835,52 +911,72 @@ var anthropicLanguageModelOptions = import_v43.z.object({
835
911
  * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
836
912
  * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
837
913
  */
838
- structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
914
+ structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional(),
839
915
  /**
840
916
  * Configuration for enabling Claude's extended thinking.
841
917
  *
842
918
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
843
919
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
844
920
  */
845
- thinking: import_v43.z.discriminatedUnion("type", [
846
- import_v43.z.object({
921
+ thinking: z4.discriminatedUnion("type", [
922
+ z4.object({
847
923
  /** for Sonnet 4.6, Opus 4.6, and newer models */
848
- type: import_v43.z.literal("adaptive")
924
+ type: z4.literal("adaptive"),
925
+ /**
926
+ * Controls whether thinking content is included in the response.
927
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
928
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
929
+ */
930
+ display: z4.enum(["omitted", "summarized"]).optional()
849
931
  }),
850
- import_v43.z.object({
932
+ z4.object({
851
933
  /** 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()
934
+ type: z4.literal("enabled"),
935
+ budgetTokens: z4.number().optional()
854
936
  }),
855
- import_v43.z.object({
856
- type: import_v43.z.literal("disabled")
937
+ z4.object({
938
+ type: z4.literal("disabled")
857
939
  })
858
940
  ]).optional(),
859
941
  /**
860
942
  * Whether to disable parallel function calling during tool use. Default is false.
861
943
  * When set to true, Claude will use at most one tool per response.
862
944
  */
863
- disableParallelToolUse: import_v43.z.boolean().optional(),
945
+ disableParallelToolUse: z4.boolean().optional(),
864
946
  /**
865
947
  * Cache control settings for this message.
866
948
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
867
949
  */
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()
950
+ cacheControl: z4.object({
951
+ type: z4.literal("ephemeral"),
952
+ ttl: z4.union([z4.literal("5m"), z4.literal("1h")]).optional()
953
+ }).optional(),
954
+ /**
955
+ * Metadata to include with the request.
956
+ *
957
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
958
+ */
959
+ metadata: z4.object({
960
+ /**
961
+ * An external identifier for the user associated with the request.
962
+ *
963
+ * Should be a UUID, hash value, or other opaque identifier.
964
+ * Must not contain PII (name, email, phone number, etc.).
965
+ */
966
+ userId: z4.string().optional()
871
967
  }).optional(),
872
968
  /**
873
969
  * MCP servers to be utilized in this request.
874
970
  */
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()
971
+ mcpServers: z4.array(
972
+ z4.object({
973
+ type: z4.literal("url"),
974
+ name: z4.string(),
975
+ url: z4.string(),
976
+ authorizationToken: z4.string().nullish(),
977
+ toolConfiguration: z4.object({
978
+ enabled: z4.boolean().nullish(),
979
+ allowedTools: z4.array(z4.string()).nullish()
884
980
  }).nullish()
885
981
  })
886
982
  ).optional(),
@@ -889,83 +985,112 @@ var anthropicLanguageModelOptions = import_v43.z.object({
889
985
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
890
986
  * Requires code execution tool to be enabled.
891
987
  */
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
- })
988
+ container: z4.object({
989
+ id: z4.string().optional(),
990
+ skills: z4.array(
991
+ z4.discriminatedUnion("type", [
992
+ z4.object({
993
+ type: z4.literal("anthropic"),
994
+ skillId: z4.string(),
995
+ version: z4.string().optional()
996
+ }),
997
+ z4.object({
998
+ type: z4.literal("custom"),
999
+ providerReference: z4.record(z4.string(), z4.string()),
1000
+ version: z4.string().optional()
1001
+ })
1002
+ ])
900
1003
  ).optional()
901
1004
  }).optional(),
902
1005
  /**
903
- * Whether to enable tool streaming (and structured output streaming).
904
- *
905
- * When set to false, the model will return all tool calls and results
906
- * at once after a delay.
1006
+ * Whether to enable fine-grained (eager) streaming of tool call inputs
1007
+ * and structured outputs for every function tool in the request. When
1008
+ * true (the default), each function tool receives a default of
1009
+ * `eager_input_streaming: true` unless it explicitly sets
1010
+ * `providerOptions.anthropic.eagerInputStreaming`.
907
1011
  *
908
1012
  * @default true
909
1013
  */
910
- toolStreaming: import_v43.z.boolean().optional(),
1014
+ toolStreaming: z4.boolean().optional(),
911
1015
  /**
912
1016
  * @default 'high'
913
1017
  */
914
- effort: import_v43.z.enum(["low", "medium", "high", "max"]).optional(),
1018
+ effort: z4.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
1019
+ /**
1020
+ * Task budget for agentic turns. Informs the model of the total token budget
1021
+ * available for the current task, allowing it to prioritize work and wind down
1022
+ * gracefully as the budget is consumed.
1023
+ *
1024
+ * Advisory only — does not enforce a hard token limit.
1025
+ */
1026
+ taskBudget: z4.object({
1027
+ type: z4.literal("tokens"),
1028
+ total: z4.number().int().min(2e4),
1029
+ remaining: z4.number().int().min(0).optional()
1030
+ }).optional(),
915
1031
  /**
916
1032
  * Enable fast mode for faster inference (2.5x faster output token speeds).
917
1033
  * Only supported with claude-opus-4-6.
918
1034
  */
919
- speed: import_v43.z.enum(["fast", "standard"]).optional(),
1035
+ speed: z4.enum(["fast", "standard"]).optional(),
1036
+ /**
1037
+ * Controls where model inference runs for this request.
1038
+ *
1039
+ * - `"global"`: Inference may run in any available geography (default).
1040
+ * - `"us"`: Inference runs only in US-based infrastructure.
1041
+ *
1042
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
1043
+ */
1044
+ inferenceGeo: z4.enum(["us", "global"]).optional(),
920
1045
  /**
921
1046
  * A set of beta features to enable.
922
1047
  * Allow a provider to receive the full `betas` set if it needs it.
923
1048
  */
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()
1049
+ anthropicBeta: z4.array(z4.string()).optional(),
1050
+ contextManagement: z4.object({
1051
+ edits: z4.array(
1052
+ z4.discriminatedUnion("type", [
1053
+ z4.object({
1054
+ type: z4.literal("clear_tool_uses_20250919"),
1055
+ trigger: z4.discriminatedUnion("type", [
1056
+ z4.object({
1057
+ type: z4.literal("input_tokens"),
1058
+ value: z4.number()
934
1059
  }),
935
- import_v43.z.object({
936
- type: import_v43.z.literal("tool_uses"),
937
- value: import_v43.z.number()
1060
+ z4.object({
1061
+ type: z4.literal("tool_uses"),
1062
+ value: z4.number()
938
1063
  })
939
1064
  ]).optional(),
940
- keep: import_v43.z.object({
941
- type: import_v43.z.literal("tool_uses"),
942
- value: import_v43.z.number()
1065
+ keep: z4.object({
1066
+ type: z4.literal("tool_uses"),
1067
+ value: z4.number()
943
1068
  }).optional(),
944
- clearAtLeast: import_v43.z.object({
945
- type: import_v43.z.literal("input_tokens"),
946
- value: import_v43.z.number()
1069
+ clearAtLeast: z4.object({
1070
+ type: z4.literal("input_tokens"),
1071
+ value: z4.number()
947
1072
  }).optional(),
948
- clearToolInputs: import_v43.z.boolean().optional(),
949
- excludeTools: import_v43.z.array(import_v43.z.string()).optional()
1073
+ clearToolInputs: z4.boolean().optional(),
1074
+ excludeTools: z4.array(z4.string()).optional()
950
1075
  }),
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()
1076
+ z4.object({
1077
+ type: z4.literal("clear_thinking_20251015"),
1078
+ keep: z4.union([
1079
+ z4.literal("all"),
1080
+ z4.object({
1081
+ type: z4.literal("thinking_turns"),
1082
+ value: z4.number()
958
1083
  })
959
1084
  ]).optional()
960
1085
  }),
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()
1086
+ z4.object({
1087
+ type: z4.literal("compact_20260112"),
1088
+ trigger: z4.object({
1089
+ type: z4.literal("input_tokens"),
1090
+ value: z4.number()
966
1091
  }).optional(),
967
- pauseAfterCompaction: import_v43.z.boolean().optional(),
968
- instructions: import_v43.z.string().optional()
1092
+ pauseAfterCompaction: z4.boolean().optional(),
1093
+ instructions: z4.string().optional()
969
1094
  })
970
1095
  ])
971
1096
  )
@@ -973,7 +1098,9 @@ var anthropicLanguageModelOptions = import_v43.z.object({
973
1098
  });
974
1099
 
975
1100
  // src/anthropic-prepare-tools.ts
976
- var import_provider = require("@ai-sdk/provider");
1101
+ import {
1102
+ UnsupportedFunctionalityError
1103
+ } from "@ai-sdk/provider";
977
1104
 
978
1105
  // src/get-cache-control.ts
979
1106
  var MAX_CACHE_BREAKPOINTS = 4;
@@ -1018,31 +1145,31 @@ var CacheControlValidator = class {
1018
1145
  };
1019
1146
 
1020
1147
  // src/tool/text-editor_20250728.ts
1021
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
1022
- var import_v44 = require("zod/v4");
1023
- 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()
1148
+ import { createProviderToolFactory } from "@ai-sdk/provider-utils";
1149
+ import { z as z5 } from "zod/v4";
1150
+ import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
1151
+ var textEditor_20250728ArgsSchema = lazySchema4(
1152
+ () => zodSchema4(
1153
+ z5.object({
1154
+ maxCharacters: z5.number().optional()
1028
1155
  })
1029
1156
  )
1030
1157
  );
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()
1158
+ var textEditor_20250728InputSchema = lazySchema4(
1159
+ () => zodSchema4(
1160
+ z5.object({
1161
+ command: z5.enum(["view", "create", "str_replace", "insert"]),
1162
+ path: z5.string(),
1163
+ file_text: z5.string().optional(),
1164
+ insert_line: z5.number().int().optional(),
1165
+ new_str: z5.string().optional(),
1166
+ insert_text: z5.string().optional(),
1167
+ old_str: z5.string().optional(),
1168
+ view_range: z5.array(z5.number().int()).optional()
1042
1169
  })
1043
1170
  )
1044
1171
  );
1045
- var factory = (0, import_provider_utils3.createProviderToolFactory)({
1172
+ var factory = createProviderToolFactory({
1046
1173
  id: "anthropic.text_editor_20250728",
1047
1174
  inputSchema: textEditor_20250728InputSchema
1048
1175
  });
@@ -1051,45 +1178,49 @@ var textEditor_20250728 = (args = {}) => {
1051
1178
  };
1052
1179
 
1053
1180
  // src/tool/web-search_20260209.ts
1054
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1055
- var import_v45 = require("zod/v4");
1056
- var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
1057
- () => (0, import_provider_utils5.zodSchema)(
1058
- 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()
1181
+ import {
1182
+ createProviderToolFactoryWithOutputSchema,
1183
+ lazySchema as lazySchema5,
1184
+ zodSchema as zodSchema5
1185
+ } from "@ai-sdk/provider-utils";
1186
+ import { z as z6 } from "zod/v4";
1187
+ var webSearch_20260209ArgsSchema = lazySchema5(
1188
+ () => zodSchema5(
1189
+ z6.object({
1190
+ maxUses: z6.number().optional(),
1191
+ allowedDomains: z6.array(z6.string()).optional(),
1192
+ blockedDomains: z6.array(z6.string()).optional(),
1193
+ userLocation: z6.object({
1194
+ type: z6.literal("approximate"),
1195
+ city: z6.string().optional(),
1196
+ region: z6.string().optional(),
1197
+ country: z6.string().optional(),
1198
+ timezone: z6.string().optional()
1068
1199
  }).optional()
1069
1200
  })
1070
1201
  )
1071
1202
  );
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")
1203
+ var webSearch_20260209OutputSchema = lazySchema5(
1204
+ () => zodSchema5(
1205
+ z6.array(
1206
+ z6.object({
1207
+ url: z6.string(),
1208
+ title: z6.string().nullable(),
1209
+ pageAge: z6.string().nullable(),
1210
+ encryptedContent: z6.string(),
1211
+ type: z6.literal("web_search_result")
1081
1212
  })
1082
1213
  )
1083
1214
  )
1084
1215
  );
1085
- var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
1086
- () => (0, import_provider_utils5.zodSchema)(
1087
- import_v45.z.object({
1088
- query: import_v45.z.string()
1216
+ var webSearch_20260209InputSchema = lazySchema5(
1217
+ () => zodSchema5(
1218
+ z6.object({
1219
+ query: z6.string()
1089
1220
  })
1090
1221
  )
1091
1222
  );
1092
- var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
1223
+ var factory2 = createProviderToolFactoryWithOutputSchema({
1093
1224
  id: "anthropic.web_search_20260209",
1094
1225
  inputSchema: webSearch_20260209InputSchema,
1095
1226
  outputSchema: webSearch_20260209OutputSchema,
@@ -1100,45 +1231,49 @@ var webSearch_20260209 = (args = {}) => {
1100
1231
  };
1101
1232
 
1102
1233
  // src/tool/web-search_20250305.ts
1103
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1104
- var import_v46 = require("zod/v4");
1105
- var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1106
- () => (0, import_provider_utils6.zodSchema)(
1107
- import_v46.z.object({
1108
- maxUses: import_v46.z.number().optional(),
1109
- allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1110
- blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1111
- userLocation: import_v46.z.object({
1112
- type: import_v46.z.literal("approximate"),
1113
- city: import_v46.z.string().optional(),
1114
- region: import_v46.z.string().optional(),
1115
- country: import_v46.z.string().optional(),
1116
- timezone: import_v46.z.string().optional()
1234
+ import {
1235
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1236
+ lazySchema as lazySchema6,
1237
+ zodSchema as zodSchema6
1238
+ } from "@ai-sdk/provider-utils";
1239
+ import { z as z7 } from "zod/v4";
1240
+ var webSearch_20250305ArgsSchema = lazySchema6(
1241
+ () => zodSchema6(
1242
+ z7.object({
1243
+ maxUses: z7.number().optional(),
1244
+ allowedDomains: z7.array(z7.string()).optional(),
1245
+ blockedDomains: z7.array(z7.string()).optional(),
1246
+ userLocation: z7.object({
1247
+ type: z7.literal("approximate"),
1248
+ city: z7.string().optional(),
1249
+ region: z7.string().optional(),
1250
+ country: z7.string().optional(),
1251
+ timezone: z7.string().optional()
1117
1252
  }).optional()
1118
1253
  })
1119
1254
  )
1120
1255
  );
1121
- var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1122
- () => (0, import_provider_utils6.zodSchema)(
1123
- import_v46.z.array(
1124
- import_v46.z.object({
1125
- url: import_v46.z.string(),
1126
- title: import_v46.z.string().nullable(),
1127
- pageAge: import_v46.z.string().nullable(),
1128
- encryptedContent: import_v46.z.string(),
1129
- type: import_v46.z.literal("web_search_result")
1256
+ var webSearch_20250305OutputSchema = lazySchema6(
1257
+ () => zodSchema6(
1258
+ z7.array(
1259
+ z7.object({
1260
+ url: z7.string(),
1261
+ title: z7.string().nullable(),
1262
+ pageAge: z7.string().nullable(),
1263
+ encryptedContent: z7.string(),
1264
+ type: z7.literal("web_search_result")
1130
1265
  })
1131
1266
  )
1132
1267
  )
1133
1268
  );
1134
- var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1135
- () => (0, import_provider_utils6.zodSchema)(
1136
- import_v46.z.object({
1137
- query: import_v46.z.string()
1269
+ var webSearch_20250305InputSchema = lazySchema6(
1270
+ () => zodSchema6(
1271
+ z7.object({
1272
+ query: z7.string()
1138
1273
  })
1139
1274
  )
1140
1275
  );
1141
- var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1276
+ var factory3 = createProviderToolFactoryWithOutputSchema2({
1142
1277
  id: "anthropic.web_search_20250305",
1143
1278
  inputSchema: webSearch_20250305InputSchema,
1144
1279
  outputSchema: webSearch_20250305OutputSchema,
@@ -1149,53 +1284,57 @@ var webSearch_20250305 = (args = {}) => {
1149
1284
  };
1150
1285
 
1151
1286
  // src/tool/web-fetch-20260209.ts
1152
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1153
- var import_v47 = require("zod/v4");
1154
- var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
1155
- () => (0, import_provider_utils7.zodSchema)(
1156
- import_v47.z.object({
1157
- maxUses: import_v47.z.number().optional(),
1158
- allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1159
- 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()
1287
+ import {
1288
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1289
+ lazySchema as lazySchema7,
1290
+ zodSchema as zodSchema7
1291
+ } from "@ai-sdk/provider-utils";
1292
+ import { z as z8 } from "zod/v4";
1293
+ var webFetch_20260209ArgsSchema = lazySchema7(
1294
+ () => zodSchema7(
1295
+ z8.object({
1296
+ maxUses: z8.number().optional(),
1297
+ allowedDomains: z8.array(z8.string()).optional(),
1298
+ blockedDomains: z8.array(z8.string()).optional(),
1299
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1300
+ maxContentTokens: z8.number().optional()
1162
1301
  })
1163
1302
  )
1164
1303
  );
1165
- var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1166
- () => (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"),
1172
- 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()
1304
+ var webFetch_20260209OutputSchema = lazySchema7(
1305
+ () => zodSchema7(
1306
+ z8.object({
1307
+ type: z8.literal("web_fetch_result"),
1308
+ url: z8.string(),
1309
+ content: z8.object({
1310
+ type: z8.literal("document"),
1311
+ title: z8.string().nullable(),
1312
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1313
+ source: z8.union([
1314
+ z8.object({
1315
+ type: z8.literal("base64"),
1316
+ mediaType: z8.literal("application/pdf"),
1317
+ data: z8.string()
1179
1318
  }),
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()
1319
+ z8.object({
1320
+ type: z8.literal("text"),
1321
+ mediaType: z8.literal("text/plain"),
1322
+ data: z8.string()
1184
1323
  })
1185
1324
  ])
1186
1325
  }),
1187
- retrievedAt: import_v47.z.string().nullable()
1326
+ retrievedAt: z8.string().nullable()
1188
1327
  })
1189
1328
  )
1190
1329
  );
1191
- var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1192
- () => (0, import_provider_utils7.zodSchema)(
1193
- import_v47.z.object({
1194
- url: import_v47.z.string()
1330
+ var webFetch_20260209InputSchema = lazySchema7(
1331
+ () => zodSchema7(
1332
+ z8.object({
1333
+ url: z8.string()
1195
1334
  })
1196
1335
  )
1197
1336
  );
1198
- var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1337
+ var factory4 = createProviderToolFactoryWithOutputSchema3({
1199
1338
  id: "anthropic.web_fetch_20260209",
1200
1339
  inputSchema: webFetch_20260209InputSchema,
1201
1340
  outputSchema: webFetch_20260209OutputSchema,
@@ -1206,53 +1345,57 @@ var webFetch_20260209 = (args = {}) => {
1206
1345
  };
1207
1346
 
1208
1347
  // src/tool/web-fetch-20250910.ts
1209
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1210
- var import_v48 = require("zod/v4");
1211
- var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1212
- () => (0, import_provider_utils8.zodSchema)(
1213
- import_v48.z.object({
1214
- maxUses: import_v48.z.number().optional(),
1215
- allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1216
- blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1217
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1218
- maxContentTokens: import_v48.z.number().optional()
1348
+ import {
1349
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1350
+ lazySchema as lazySchema8,
1351
+ zodSchema as zodSchema8
1352
+ } from "@ai-sdk/provider-utils";
1353
+ import { z as z9 } from "zod/v4";
1354
+ var webFetch_20250910ArgsSchema = lazySchema8(
1355
+ () => zodSchema8(
1356
+ z9.object({
1357
+ maxUses: z9.number().optional(),
1358
+ allowedDomains: z9.array(z9.string()).optional(),
1359
+ blockedDomains: z9.array(z9.string()).optional(),
1360
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1361
+ maxContentTokens: z9.number().optional()
1219
1362
  })
1220
1363
  )
1221
1364
  );
1222
- var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1223
- () => (0, import_provider_utils8.zodSchema)(
1224
- import_v48.z.object({
1225
- type: import_v48.z.literal("web_fetch_result"),
1226
- url: import_v48.z.string(),
1227
- content: import_v48.z.object({
1228
- type: import_v48.z.literal("document"),
1229
- title: import_v48.z.string().nullable(),
1230
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1231
- source: import_v48.z.union([
1232
- import_v48.z.object({
1233
- type: import_v48.z.literal("base64"),
1234
- mediaType: import_v48.z.literal("application/pdf"),
1235
- data: import_v48.z.string()
1365
+ var webFetch_20250910OutputSchema = lazySchema8(
1366
+ () => zodSchema8(
1367
+ z9.object({
1368
+ type: z9.literal("web_fetch_result"),
1369
+ url: z9.string(),
1370
+ content: z9.object({
1371
+ type: z9.literal("document"),
1372
+ title: z9.string().nullable(),
1373
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1374
+ source: z9.union([
1375
+ z9.object({
1376
+ type: z9.literal("base64"),
1377
+ mediaType: z9.literal("application/pdf"),
1378
+ data: z9.string()
1236
1379
  }),
1237
- import_v48.z.object({
1238
- type: import_v48.z.literal("text"),
1239
- mediaType: import_v48.z.literal("text/plain"),
1240
- data: import_v48.z.string()
1380
+ z9.object({
1381
+ type: z9.literal("text"),
1382
+ mediaType: z9.literal("text/plain"),
1383
+ data: z9.string()
1241
1384
  })
1242
1385
  ])
1243
1386
  }),
1244
- retrievedAt: import_v48.z.string().nullable()
1387
+ retrievedAt: z9.string().nullable()
1245
1388
  })
1246
1389
  )
1247
1390
  );
1248
- var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1249
- () => (0, import_provider_utils8.zodSchema)(
1250
- import_v48.z.object({
1251
- url: import_v48.z.string()
1391
+ var webFetch_20250910InputSchema = lazySchema8(
1392
+ () => zodSchema8(
1393
+ z9.object({
1394
+ url: z9.string()
1252
1395
  })
1253
1396
  )
1254
1397
  );
1255
- var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1398
+ var factory5 = createProviderToolFactoryWithOutputSchema4({
1256
1399
  id: "anthropic.web_fetch_20250910",
1257
1400
  inputSchema: webFetch_20250910InputSchema,
1258
1401
  outputSchema: webFetch_20250910OutputSchema,
@@ -1263,15 +1406,17 @@ var webFetch_20250910 = (args = {}) => {
1263
1406
  };
1264
1407
 
1265
1408
  // src/anthropic-prepare-tools.ts
1266
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1409
+ import { validateTypes } from "@ai-sdk/provider-utils";
1267
1410
  async function prepareTools({
1268
1411
  tools,
1269
1412
  toolChoice,
1270
1413
  disableParallelToolUse,
1271
1414
  cacheControlValidator,
1272
- supportsStructuredOutput
1415
+ supportsStructuredOutput,
1416
+ supportsStrictTools,
1417
+ defaultEagerInputStreaming = false
1273
1418
  }) {
1274
- var _a;
1419
+ var _a, _b;
1275
1420
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
1276
1421
  const toolWarnings = [];
1277
1422
  const betas = /* @__PURE__ */ new Set();
@@ -1288,16 +1433,23 @@ async function prepareTools({
1288
1433
  canCache: true
1289
1434
  });
1290
1435
  const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
1291
- const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1436
+ const eagerInputStreaming = (_b = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming) != null ? _b : defaultEagerInputStreaming;
1292
1437
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1293
1438
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1439
+ if (!supportsStrictTools && tool.strict != null) {
1440
+ toolWarnings.push({
1441
+ type: "unsupported",
1442
+ feature: "strict",
1443
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1444
+ });
1445
+ }
1294
1446
  anthropicTools2.push({
1295
1447
  name: tool.name,
1296
1448
  description: tool.description,
1297
1449
  input_schema: tool.inputSchema,
1298
1450
  cache_control: cacheControl,
1299
1451
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1300
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1452
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1301
1453
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1302
1454
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1303
1455
  ...tool.inputExamples != null ? {
@@ -1405,7 +1557,7 @@ async function prepareTools({
1405
1557
  break;
1406
1558
  }
1407
1559
  case "anthropic.text_editor_20250728": {
1408
- const args = await (0, import_provider_utils9.validateTypes)({
1560
+ const args = await validateTypes({
1409
1561
  value: tool.args,
1410
1562
  schema: textEditor_20250728ArgsSchema
1411
1563
  });
@@ -1445,7 +1597,7 @@ async function prepareTools({
1445
1597
  }
1446
1598
  case "anthropic.web_fetch_20250910": {
1447
1599
  betas.add("web-fetch-2025-09-10");
1448
- const args = await (0, import_provider_utils9.validateTypes)({
1600
+ const args = await validateTypes({
1449
1601
  value: tool.args,
1450
1602
  schema: webFetch_20250910ArgsSchema
1451
1603
  });
@@ -1463,7 +1615,7 @@ async function prepareTools({
1463
1615
  }
1464
1616
  case "anthropic.web_fetch_20260209": {
1465
1617
  betas.add("code-execution-web-tools-2026-02-09");
1466
- const args = await (0, import_provider_utils9.validateTypes)({
1618
+ const args = await validateTypes({
1467
1619
  value: tool.args,
1468
1620
  schema: webFetch_20260209ArgsSchema
1469
1621
  });
@@ -1480,7 +1632,7 @@ async function prepareTools({
1480
1632
  break;
1481
1633
  }
1482
1634
  case "anthropic.web_search_20250305": {
1483
- const args = await (0, import_provider_utils9.validateTypes)({
1635
+ const args = await validateTypes({
1484
1636
  value: tool.args,
1485
1637
  schema: webSearch_20250305ArgsSchema
1486
1638
  });
@@ -1497,7 +1649,7 @@ async function prepareTools({
1497
1649
  }
1498
1650
  case "anthropic.web_search_20260209": {
1499
1651
  betas.add("code-execution-web-tools-2026-02-09");
1500
- const args = await (0, import_provider_utils9.validateTypes)({
1652
+ const args = await validateTypes({
1501
1653
  value: tool.args,
1502
1654
  schema: webSearch_20260209ArgsSchema
1503
1655
  });
@@ -1513,7 +1665,6 @@ async function prepareTools({
1513
1665
  break;
1514
1666
  }
1515
1667
  case "anthropic.tool_search_regex_20251119": {
1516
- betas.add("advanced-tool-use-2025-11-20");
1517
1668
  anthropicTools2.push({
1518
1669
  type: "tool_search_tool_regex_20251119",
1519
1670
  name: "tool_search_tool_regex"
@@ -1521,7 +1672,6 @@ async function prepareTools({
1521
1672
  break;
1522
1673
  }
1523
1674
  case "anthropic.tool_search_bm25_20251119": {
1524
- betas.add("advanced-tool-use-2025-11-20");
1525
1675
  anthropicTools2.push({
1526
1676
  type: "tool_search_tool_bm25_20251119",
1527
1677
  name: "tool_search_tool_bm25"
@@ -1592,7 +1742,7 @@ async function prepareTools({
1592
1742
  };
1593
1743
  default: {
1594
1744
  const _exhaustiveCheck = type;
1595
- throw new import_provider.UnsupportedFunctionalityError({
1745
+ throw new UnsupportedFunctionalityError({
1596
1746
  functionality: `tool choice type: ${_exhaustiveCheck}`
1597
1747
  });
1598
1748
  }
@@ -1640,36 +1790,50 @@ function convertAnthropicMessagesUsage({
1640
1790
  }
1641
1791
 
1642
1792
  // src/convert-to-anthropic-messages-prompt.ts
1643
- var import_provider2 = require("@ai-sdk/provider");
1644
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
1793
+ import {
1794
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1795
+ } from "@ai-sdk/provider";
1796
+ import {
1797
+ convertBase64ToUint8Array as convertBase64ToUint8Array2,
1798
+ convertToBase64,
1799
+ isProviderReference,
1800
+ parseProviderOptions,
1801
+ resolveProviderReference,
1802
+ validateTypes as validateTypes2,
1803
+ isNonNullable
1804
+ } from "@ai-sdk/provider-utils";
1645
1805
 
1646
1806
  // 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()
1807
+ import {
1808
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1809
+ lazySchema as lazySchema9,
1810
+ zodSchema as zodSchema9
1811
+ } from "@ai-sdk/provider-utils";
1812
+ import { z as z10 } from "zod/v4";
1813
+ var codeExecution_20250522OutputSchema = lazySchema9(
1814
+ () => zodSchema9(
1815
+ z10.object({
1816
+ type: z10.literal("code_execution_result"),
1817
+ stdout: z10.string(),
1818
+ stderr: z10.string(),
1819
+ return_code: z10.number(),
1820
+ content: z10.array(
1821
+ z10.object({
1822
+ type: z10.literal("code_execution_output"),
1823
+ file_id: z10.string()
1660
1824
  })
1661
1825
  ).optional().default([])
1662
1826
  })
1663
1827
  )
1664
1828
  );
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()
1829
+ var codeExecution_20250522InputSchema = lazySchema9(
1830
+ () => zodSchema9(
1831
+ z10.object({
1832
+ code: z10.string()
1669
1833
  })
1670
1834
  )
1671
1835
  );
1672
- var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1836
+ var factory6 = createProviderToolFactoryWithOutputSchema5({
1673
1837
  id: "anthropic.code_execution_20250522",
1674
1838
  inputSchema: codeExecution_20250522InputSchema,
1675
1839
  outputSchema: codeExecution_20250522OutputSchema
@@ -1679,102 +1843,106 @@ var codeExecution_20250522 = (args = {}) => {
1679
1843
  };
1680
1844
 
1681
1845
  // 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()
1846
+ import {
1847
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1848
+ lazySchema as lazySchema10,
1849
+ zodSchema as zodSchema10
1850
+ } from "@ai-sdk/provider-utils";
1851
+ import { z as z11 } from "zod/v4";
1852
+ var codeExecution_20250825OutputSchema = lazySchema10(
1853
+ () => zodSchema10(
1854
+ z11.discriminatedUnion("type", [
1855
+ z11.object({
1856
+ type: z11.literal("code_execution_result"),
1857
+ stdout: z11.string(),
1858
+ stderr: z11.string(),
1859
+ return_code: z11.number(),
1860
+ content: z11.array(
1861
+ z11.object({
1862
+ type: z11.literal("code_execution_output"),
1863
+ file_id: z11.string()
1696
1864
  })
1697
1865
  ).optional().default([])
1698
1866
  }),
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()
1867
+ z11.object({
1868
+ type: z11.literal("bash_code_execution_result"),
1869
+ content: z11.array(
1870
+ z11.object({
1871
+ type: z11.literal("bash_code_execution_output"),
1872
+ file_id: z11.string()
1705
1873
  })
1706
1874
  ),
1707
- stdout: import_v410.z.string(),
1708
- stderr: import_v410.z.string(),
1709
- return_code: import_v410.z.number()
1875
+ stdout: z11.string(),
1876
+ stderr: z11.string(),
1877
+ return_code: z11.number()
1710
1878
  }),
1711
- import_v410.z.object({
1712
- type: import_v410.z.literal("bash_code_execution_tool_result_error"),
1713
- error_code: import_v410.z.string()
1879
+ z11.object({
1880
+ type: z11.literal("bash_code_execution_tool_result_error"),
1881
+ error_code: z11.string()
1714
1882
  }),
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()
1883
+ z11.object({
1884
+ type: z11.literal("text_editor_code_execution_tool_result_error"),
1885
+ error_code: z11.string()
1718
1886
  }),
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()
1887
+ z11.object({
1888
+ type: z11.literal("text_editor_code_execution_view_result"),
1889
+ content: z11.string(),
1890
+ file_type: z11.string(),
1891
+ num_lines: z11.number().nullable(),
1892
+ start_line: z11.number().nullable(),
1893
+ total_lines: z11.number().nullable()
1726
1894
  }),
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()
1895
+ z11.object({
1896
+ type: z11.literal("text_editor_code_execution_create_result"),
1897
+ is_file_update: z11.boolean()
1730
1898
  }),
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()
1899
+ z11.object({
1900
+ type: z11.literal("text_editor_code_execution_str_replace_result"),
1901
+ lines: z11.array(z11.string()).nullable(),
1902
+ new_lines: z11.number().nullable(),
1903
+ new_start: z11.number().nullable(),
1904
+ old_lines: z11.number().nullable(),
1905
+ old_start: z11.number().nullable()
1738
1906
  })
1739
1907
  ])
1740
1908
  )
1741
1909
  );
1742
- var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
1743
- () => (0, import_provider_utils11.zodSchema)(
1744
- import_v410.z.discriminatedUnion("type", [
1910
+ var codeExecution_20250825InputSchema = lazySchema10(
1911
+ () => zodSchema10(
1912
+ z11.discriminatedUnion("type", [
1745
1913
  // 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()
1914
+ z11.object({
1915
+ type: z11.literal("programmatic-tool-call"),
1916
+ code: z11.string()
1749
1917
  }),
1750
- import_v410.z.object({
1751
- type: import_v410.z.literal("bash_code_execution"),
1752
- command: import_v410.z.string()
1918
+ z11.object({
1919
+ type: z11.literal("bash_code_execution"),
1920
+ command: z11.string()
1753
1921
  }),
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()
1922
+ z11.discriminatedUnion("command", [
1923
+ z11.object({
1924
+ type: z11.literal("text_editor_code_execution"),
1925
+ command: z11.literal("view"),
1926
+ path: z11.string()
1759
1927
  }),
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()
1928
+ z11.object({
1929
+ type: z11.literal("text_editor_code_execution"),
1930
+ command: z11.literal("create"),
1931
+ path: z11.string(),
1932
+ file_text: z11.string().nullish()
1765
1933
  }),
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()
1934
+ z11.object({
1935
+ type: z11.literal("text_editor_code_execution"),
1936
+ command: z11.literal("str_replace"),
1937
+ path: z11.string(),
1938
+ old_str: z11.string(),
1939
+ new_str: z11.string()
1772
1940
  })
1773
1941
  ])
1774
1942
  ])
1775
1943
  )
1776
1944
  );
1777
- var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1945
+ var factory7 = createProviderToolFactoryWithOutputSchema6({
1778
1946
  id: "anthropic.code_execution_20250825",
1779
1947
  inputSchema: codeExecution_20250825InputSchema,
1780
1948
  outputSchema: codeExecution_20250825OutputSchema,
@@ -1788,113 +1956,117 @@ var codeExecution_20250825 = (args = {}) => {
1788
1956
  };
1789
1957
 
1790
1958
  // src/tool/code-execution_20260120.ts
1791
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1792
- var import_v411 = require("zod/v4");
1793
- var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
1794
- () => (0, import_provider_utils12.zodSchema)(
1795
- import_v411.z.discriminatedUnion("type", [
1796
- import_v411.z.object({
1797
- type: import_v411.z.literal("code_execution_result"),
1798
- stdout: import_v411.z.string(),
1799
- stderr: import_v411.z.string(),
1800
- return_code: import_v411.z.number(),
1801
- content: import_v411.z.array(
1802
- import_v411.z.object({
1803
- type: import_v411.z.literal("code_execution_output"),
1804
- file_id: import_v411.z.string()
1959
+ import {
1960
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
1961
+ lazySchema as lazySchema11,
1962
+ zodSchema as zodSchema11
1963
+ } from "@ai-sdk/provider-utils";
1964
+ import { z as z12 } from "zod/v4";
1965
+ var codeExecution_20260120OutputSchema = lazySchema11(
1966
+ () => zodSchema11(
1967
+ z12.discriminatedUnion("type", [
1968
+ z12.object({
1969
+ type: z12.literal("code_execution_result"),
1970
+ stdout: z12.string(),
1971
+ stderr: z12.string(),
1972
+ return_code: z12.number(),
1973
+ content: z12.array(
1974
+ z12.object({
1975
+ type: z12.literal("code_execution_output"),
1976
+ file_id: z12.string()
1805
1977
  })
1806
1978
  ).optional().default([])
1807
1979
  }),
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()
1980
+ z12.object({
1981
+ type: z12.literal("encrypted_code_execution_result"),
1982
+ encrypted_stdout: z12.string(),
1983
+ stderr: z12.string(),
1984
+ return_code: z12.number(),
1985
+ content: z12.array(
1986
+ z12.object({
1987
+ type: z12.literal("code_execution_output"),
1988
+ file_id: z12.string()
1817
1989
  })
1818
1990
  ).optional().default([])
1819
1991
  }),
1820
- import_v411.z.object({
1821
- type: import_v411.z.literal("bash_code_execution_result"),
1822
- content: import_v411.z.array(
1823
- import_v411.z.object({
1824
- type: import_v411.z.literal("bash_code_execution_output"),
1825
- file_id: import_v411.z.string()
1992
+ z12.object({
1993
+ type: z12.literal("bash_code_execution_result"),
1994
+ content: z12.array(
1995
+ z12.object({
1996
+ type: z12.literal("bash_code_execution_output"),
1997
+ file_id: z12.string()
1826
1998
  })
1827
1999
  ),
1828
- stdout: import_v411.z.string(),
1829
- stderr: import_v411.z.string(),
1830
- return_code: import_v411.z.number()
2000
+ stdout: z12.string(),
2001
+ stderr: z12.string(),
2002
+ return_code: z12.number()
1831
2003
  }),
1832
- import_v411.z.object({
1833
- type: import_v411.z.literal("bash_code_execution_tool_result_error"),
1834
- error_code: import_v411.z.string()
2004
+ z12.object({
2005
+ type: z12.literal("bash_code_execution_tool_result_error"),
2006
+ error_code: z12.string()
1835
2007
  }),
1836
- import_v411.z.object({
1837
- type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
1838
- error_code: import_v411.z.string()
2008
+ z12.object({
2009
+ type: z12.literal("text_editor_code_execution_tool_result_error"),
2010
+ error_code: z12.string()
1839
2011
  }),
1840
- import_v411.z.object({
1841
- type: import_v411.z.literal("text_editor_code_execution_view_result"),
1842
- content: import_v411.z.string(),
1843
- file_type: import_v411.z.string(),
1844
- num_lines: import_v411.z.number().nullable(),
1845
- start_line: import_v411.z.number().nullable(),
1846
- total_lines: import_v411.z.number().nullable()
2012
+ z12.object({
2013
+ type: z12.literal("text_editor_code_execution_view_result"),
2014
+ content: z12.string(),
2015
+ file_type: z12.string(),
2016
+ num_lines: z12.number().nullable(),
2017
+ start_line: z12.number().nullable(),
2018
+ total_lines: z12.number().nullable()
1847
2019
  }),
1848
- import_v411.z.object({
1849
- type: import_v411.z.literal("text_editor_code_execution_create_result"),
1850
- is_file_update: import_v411.z.boolean()
2020
+ z12.object({
2021
+ type: z12.literal("text_editor_code_execution_create_result"),
2022
+ is_file_update: z12.boolean()
1851
2023
  }),
1852
- import_v411.z.object({
1853
- type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
1854
- lines: import_v411.z.array(import_v411.z.string()).nullable(),
1855
- new_lines: import_v411.z.number().nullable(),
1856
- new_start: import_v411.z.number().nullable(),
1857
- old_lines: import_v411.z.number().nullable(),
1858
- old_start: import_v411.z.number().nullable()
2024
+ z12.object({
2025
+ type: z12.literal("text_editor_code_execution_str_replace_result"),
2026
+ lines: z12.array(z12.string()).nullable(),
2027
+ new_lines: z12.number().nullable(),
2028
+ new_start: z12.number().nullable(),
2029
+ old_lines: z12.number().nullable(),
2030
+ old_start: z12.number().nullable()
1859
2031
  })
1860
2032
  ])
1861
2033
  )
1862
2034
  );
1863
- var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1864
- () => (0, import_provider_utils12.zodSchema)(
1865
- import_v411.z.discriminatedUnion("type", [
1866
- import_v411.z.object({
1867
- type: import_v411.z.literal("programmatic-tool-call"),
1868
- code: import_v411.z.string()
2035
+ var codeExecution_20260120InputSchema = lazySchema11(
2036
+ () => zodSchema11(
2037
+ z12.discriminatedUnion("type", [
2038
+ z12.object({
2039
+ type: z12.literal("programmatic-tool-call"),
2040
+ code: z12.string()
1869
2041
  }),
1870
- import_v411.z.object({
1871
- type: import_v411.z.literal("bash_code_execution"),
1872
- command: import_v411.z.string()
2042
+ z12.object({
2043
+ type: z12.literal("bash_code_execution"),
2044
+ command: z12.string()
1873
2045
  }),
1874
- import_v411.z.discriminatedUnion("command", [
1875
- import_v411.z.object({
1876
- type: import_v411.z.literal("text_editor_code_execution"),
1877
- command: import_v411.z.literal("view"),
1878
- path: import_v411.z.string()
2046
+ z12.discriminatedUnion("command", [
2047
+ z12.object({
2048
+ type: z12.literal("text_editor_code_execution"),
2049
+ command: z12.literal("view"),
2050
+ path: z12.string()
1879
2051
  }),
1880
- import_v411.z.object({
1881
- type: import_v411.z.literal("text_editor_code_execution"),
1882
- command: import_v411.z.literal("create"),
1883
- path: import_v411.z.string(),
1884
- file_text: import_v411.z.string().nullish()
2052
+ z12.object({
2053
+ type: z12.literal("text_editor_code_execution"),
2054
+ command: z12.literal("create"),
2055
+ path: z12.string(),
2056
+ file_text: z12.string().nullish()
1885
2057
  }),
1886
- import_v411.z.object({
1887
- type: import_v411.z.literal("text_editor_code_execution"),
1888
- command: import_v411.z.literal("str_replace"),
1889
- path: import_v411.z.string(),
1890
- old_str: import_v411.z.string(),
1891
- new_str: import_v411.z.string()
2058
+ z12.object({
2059
+ type: z12.literal("text_editor_code_execution"),
2060
+ command: z12.literal("str_replace"),
2061
+ path: z12.string(),
2062
+ old_str: z12.string(),
2063
+ new_str: z12.string()
1892
2064
  })
1893
2065
  ])
1894
2066
  ])
1895
2067
  )
1896
2068
  );
1897
- var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
2069
+ var factory8 = createProviderToolFactoryWithOutputSchema7({
1898
2070
  id: "anthropic.code_execution_20260120",
1899
2071
  inputSchema: codeExecution_20260120InputSchema,
1900
2072
  outputSchema: codeExecution_20260120OutputSchema,
@@ -1905,21 +2077,25 @@ var codeExecution_20260120 = (args = {}) => {
1905
2077
  };
1906
2078
 
1907
2079
  // 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()
2080
+ import {
2081
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2082
+ lazySchema as lazySchema12,
2083
+ zodSchema as zodSchema12
2084
+ } from "@ai-sdk/provider-utils";
2085
+ import { z as z13 } from "zod/v4";
2086
+ var toolSearchRegex_20251119OutputSchema = lazySchema12(
2087
+ () => zodSchema12(
2088
+ z13.array(
2089
+ z13.object({
2090
+ type: z13.literal("tool_reference"),
2091
+ toolName: z13.string()
1916
2092
  })
1917
2093
  )
1918
2094
  )
1919
2095
  );
1920
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
1921
- () => (0, import_provider_utils13.zodSchema)(
1922
- import_v412.z.object({
2096
+ var toolSearchRegex_20251119InputSchema = lazySchema12(
2097
+ () => zodSchema12(
2098
+ z13.object({
1923
2099
  /**
1924
2100
  * A regex pattern to search for tools.
1925
2101
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1930,15 +2106,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
1930
2106
  * - "database.*query|query.*database" - OR patterns for flexibility
1931
2107
  * - "(?i)slack" - case-insensitive search
1932
2108
  */
1933
- pattern: import_v412.z.string(),
2109
+ pattern: z13.string(),
1934
2110
  /**
1935
2111
  * Maximum number of tools to return. Optional.
1936
2112
  */
1937
- limit: import_v412.z.number().optional()
2113
+ limit: z13.number().optional()
1938
2114
  })
1939
2115
  )
1940
2116
  );
1941
- var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2117
+ var factory9 = createProviderToolFactoryWithOutputSchema8({
1942
2118
  id: "anthropic.tool_search_regex_20251119",
1943
2119
  inputSchema: toolSearchRegex_20251119InputSchema,
1944
2120
  outputSchema: toolSearchRegex_20251119OutputSchema,
@@ -1951,17 +2127,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
1951
2127
  // src/convert-to-anthropic-messages-prompt.ts
1952
2128
  function convertToString(data) {
1953
2129
  if (typeof data === "string") {
1954
- return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
2130
+ return new TextDecoder().decode(convertBase64ToUint8Array2(data));
1955
2131
  }
1956
2132
  if (data instanceof Uint8Array) {
1957
2133
  return new TextDecoder().decode(data);
1958
2134
  }
1959
2135
  if (data instanceof URL) {
1960
- throw new import_provider2.UnsupportedFunctionalityError({
2136
+ throw new UnsupportedFunctionalityError2({
1961
2137
  functionality: "URL-based text documents are not supported for citations"
1962
2138
  });
1963
2139
  }
1964
- throw new import_provider2.UnsupportedFunctionalityError({
2140
+ throw new UnsupportedFunctionalityError2({
1965
2141
  functionality: `unsupported data type for text documents: ${typeof data}`
1966
2142
  });
1967
2143
  }
@@ -1989,7 +2165,7 @@ async function convertToAnthropicMessagesPrompt({
1989
2165
  const messages = [];
1990
2166
  async function shouldEnableCitations(providerMetadata) {
1991
2167
  var _a2, _b2;
1992
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2168
+ const anthropicOptions = await parseProviderOptions({
1993
2169
  provider: "anthropic",
1994
2170
  providerOptions: providerMetadata,
1995
2171
  schema: anthropicFilePartProviderOptions
@@ -1997,7 +2173,7 @@ async function convertToAnthropicMessagesPrompt({
1997
2173
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1998
2174
  }
1999
2175
  async function getDocumentMetadata(providerMetadata) {
2000
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2176
+ const anthropicOptions = await parseProviderOptions({
2001
2177
  provider: "anthropic",
2002
2178
  providerOptions: providerMetadata,
2003
2179
  schema: anthropicFilePartProviderOptions
@@ -2014,7 +2190,7 @@ async function convertToAnthropicMessagesPrompt({
2014
2190
  switch (type) {
2015
2191
  case "system": {
2016
2192
  if (system != null) {
2017
- throw new import_provider2.UnsupportedFunctionalityError({
2193
+ throw new UnsupportedFunctionalityError2({
2018
2194
  functionality: "Multiple system messages that are separated by user/assistant messages"
2019
2195
  });
2020
2196
  }
@@ -2054,7 +2230,26 @@ async function convertToAnthropicMessagesPrompt({
2054
2230
  break;
2055
2231
  }
2056
2232
  case "file": {
2057
- if (part.mediaType.startsWith("image/")) {
2233
+ if (isProviderReference(part.data)) {
2234
+ const fileId = resolveProviderReference({
2235
+ reference: part.data,
2236
+ provider: "anthropic"
2237
+ });
2238
+ betas.add("files-api-2025-04-14");
2239
+ if (part.mediaType.startsWith("image/")) {
2240
+ anthropicContent.push({
2241
+ type: "image",
2242
+ source: { type: "file", file_id: fileId },
2243
+ cache_control: cacheControl
2244
+ });
2245
+ } else {
2246
+ anthropicContent.push({
2247
+ type: "document",
2248
+ source: { type: "file", file_id: fileId },
2249
+ cache_control: cacheControl
2250
+ });
2251
+ }
2252
+ } else if (part.mediaType.startsWith("image/")) {
2058
2253
  anthropicContent.push({
2059
2254
  type: "image",
2060
2255
  source: isUrlData(part.data) ? {
@@ -2063,7 +2258,7 @@ async function convertToAnthropicMessagesPrompt({
2063
2258
  } : {
2064
2259
  type: "base64",
2065
2260
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2066
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2261
+ data: convertToBase64(part.data)
2067
2262
  },
2068
2263
  cache_control: cacheControl
2069
2264
  });
@@ -2083,7 +2278,7 @@ async function convertToAnthropicMessagesPrompt({
2083
2278
  } : {
2084
2279
  type: "base64",
2085
2280
  media_type: "application/pdf",
2086
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2281
+ data: convertToBase64(part.data)
2087
2282
  },
2088
2283
  title: (_b = metadata.title) != null ? _b : part.filename,
2089
2284
  ...metadata.context && { context: metadata.context },
@@ -2117,7 +2312,7 @@ async function convertToAnthropicMessagesPrompt({
2117
2312
  cache_control: cacheControl
2118
2313
  });
2119
2314
  } else {
2120
- throw new import_provider2.UnsupportedFunctionalityError({
2315
+ throw new UnsupportedFunctionalityError2({
2121
2316
  functionality: `media type: ${part.mediaType}`
2122
2317
  });
2123
2318
  }
@@ -2153,26 +2348,16 @@ async function convertToAnthropicMessagesPrompt({
2153
2348
  type: "text",
2154
2349
  text: contentPart.text
2155
2350
  };
2156
- case "image-data": {
2157
- return {
2158
- type: "image",
2159
- source: {
2160
- type: "base64",
2161
- media_type: contentPart.mediaType,
2162
- data: contentPart.data
2163
- }
2164
- };
2165
- }
2166
- case "image-url": {
2167
- return {
2168
- type: "image",
2169
- source: {
2170
- type: "url",
2171
- url: contentPart.url
2172
- }
2173
- };
2174
- }
2175
2351
  case "file-url": {
2352
+ if (contentPart.mediaType.startsWith("image/")) {
2353
+ return {
2354
+ type: "image",
2355
+ source: {
2356
+ type: "url",
2357
+ url: contentPart.url
2358
+ }
2359
+ };
2360
+ }
2176
2361
  return {
2177
2362
  type: "document",
2178
2363
  source: {
@@ -2182,6 +2367,16 @@ async function convertToAnthropicMessagesPrompt({
2182
2367
  };
2183
2368
  }
2184
2369
  case "file-data": {
2370
+ if (contentPart.mediaType.startsWith("image/")) {
2371
+ return {
2372
+ type: "image",
2373
+ source: {
2374
+ type: "base64",
2375
+ media_type: contentPart.mediaType,
2376
+ data: contentPart.data
2377
+ }
2378
+ };
2379
+ }
2185
2380
  if (contentPart.mediaType === "application/pdf") {
2186
2381
  betas.add("pdfs-2024-09-25");
2187
2382
  return {
@@ -2221,7 +2416,7 @@ async function convertToAnthropicMessagesPrompt({
2221
2416
  return void 0;
2222
2417
  }
2223
2418
  }
2224
- }).filter(import_provider_utils14.isNonNullable);
2419
+ }).filter(isNonNullable);
2225
2420
  break;
2226
2421
  case "text":
2227
2422
  case "error-text":
@@ -2297,7 +2492,7 @@ async function convertToAnthropicMessagesPrompt({
2297
2492
  }
2298
2493
  case "reasoning": {
2299
2494
  if (sendReasoning) {
2300
- const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
2495
+ const reasoningMetadata = await parseProviderOptions({
2301
2496
  provider: "anthropic",
2302
2497
  providerOptions: part.providerOptions,
2303
2498
  schema: anthropicReasoningMetadataSchema
@@ -2503,7 +2698,7 @@ async function convertToAnthropicMessagesPrompt({
2503
2698
  break;
2504
2699
  }
2505
2700
  if (output.value.type === "code_execution_result") {
2506
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2701
+ const codeExecutionOutput = await validateTypes2({
2507
2702
  value: output.value,
2508
2703
  schema: codeExecution_20250522OutputSchema
2509
2704
  });
@@ -2520,7 +2715,7 @@ async function convertToAnthropicMessagesPrompt({
2520
2715
  cache_control: cacheControl
2521
2716
  });
2522
2717
  } else if (output.value.type === "encrypted_code_execution_result") {
2523
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2718
+ const codeExecutionOutput = await validateTypes2({
2524
2719
  value: output.value,
2525
2720
  schema: codeExecution_20260120OutputSchema
2526
2721
  });
@@ -2539,7 +2734,7 @@ async function convertToAnthropicMessagesPrompt({
2539
2734
  });
2540
2735
  }
2541
2736
  } else {
2542
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2737
+ const codeExecutionOutput = await validateTypes2({
2543
2738
  value: output.value,
2544
2739
  schema: codeExecution_20250825OutputSchema
2545
2740
  });
@@ -2608,7 +2803,7 @@ async function convertToAnthropicMessagesPrompt({
2608
2803
  });
2609
2804
  break;
2610
2805
  }
2611
- const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
2806
+ const webFetchOutput = await validateTypes2({
2612
2807
  value: output.value,
2613
2808
  schema: webFetch_20250910OutputSchema
2614
2809
  });
@@ -2643,7 +2838,7 @@ async function convertToAnthropicMessagesPrompt({
2643
2838
  });
2644
2839
  break;
2645
2840
  }
2646
- const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
2841
+ const webSearchOutput = await validateTypes2({
2647
2842
  value: output.value,
2648
2843
  schema: webSearch_20250305OutputSchema
2649
2844
  });
@@ -2670,7 +2865,7 @@ async function convertToAnthropicMessagesPrompt({
2670
2865
  });
2671
2866
  break;
2672
2867
  }
2673
- const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
2868
+ const toolSearchOutput = await validateTypes2({
2674
2869
  value: output.value,
2675
2870
  schema: toolSearchRegex_20251119OutputSchema
2676
2871
  });
@@ -2828,13 +3023,22 @@ function createCitationSource(citation, citationDocuments, generateId3) {
2828
3023
  }
2829
3024
  };
2830
3025
  }
2831
- var AnthropicMessagesLanguageModel = class {
3026
+ var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
2832
3027
  constructor(modelId, config) {
2833
3028
  this.specificationVersion = "v4";
2834
3029
  var _a;
2835
3030
  this.modelId = modelId;
2836
3031
  this.config = config;
2837
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
3032
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
3033
+ }
3034
+ static [WORKFLOW_SERIALIZE](model) {
3035
+ return serializeModelOptions({
3036
+ modelId: model.modelId,
3037
+ config: model.config
3038
+ });
3039
+ }
3040
+ static [WORKFLOW_DESERIALIZE](options) {
3041
+ return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
2838
3042
  }
2839
3043
  supportsUrl(url) {
2840
3044
  return url.protocol === "https:";
@@ -2869,10 +3073,11 @@ var AnthropicMessagesLanguageModel = class {
2869
3073
  seed,
2870
3074
  tools,
2871
3075
  toolChoice,
3076
+ reasoning,
2872
3077
  providerOptions,
2873
3078
  stream
2874
3079
  }) {
2875
- var _a, _b, _c, _d, _e, _f, _g;
3080
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2876
3081
  const warnings = [];
2877
3082
  if (frequencyPenalty != null) {
2878
3083
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2908,12 +3113,12 @@ var AnthropicMessagesLanguageModel = class {
2908
3113
  }
2909
3114
  }
2910
3115
  const providerOptionsName = this.providerOptionsName;
2911
- const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
3116
+ const canonicalOptions = await parseProviderOptions2({
2912
3117
  provider: "anthropic",
2913
3118
  providerOptions,
2914
3119
  schema: anthropicLanguageModelOptions
2915
3120
  });
2916
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
3121
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
2917
3122
  provider: providerOptionsName,
2918
3123
  providerOptions,
2919
3124
  schema: anthropicLanguageModelOptions
@@ -2927,10 +3132,41 @@ var AnthropicMessagesLanguageModel = class {
2927
3132
  const {
2928
3133
  maxOutputTokens: maxOutputTokensForModel,
2929
3134
  supportsStructuredOutput: modelSupportsStructuredOutput,
3135
+ supportsAdaptiveThinking,
3136
+ rejectsSamplingParameters,
3137
+ supportsXhighEffort,
2930
3138
  isKnownModel
2931
3139
  } = getModelCapabilities(this.modelId);
3140
+ if (rejectsSamplingParameters) {
3141
+ if (temperature != null) {
3142
+ warnings.push({
3143
+ type: "unsupported",
3144
+ feature: "temperature",
3145
+ details: `temperature is not supported by ${this.modelId} and will be ignored`
3146
+ });
3147
+ temperature = void 0;
3148
+ }
3149
+ if (topK != null) {
3150
+ warnings.push({
3151
+ type: "unsupported",
3152
+ feature: "topK",
3153
+ details: `topK is not supported by ${this.modelId} and will be ignored`
3154
+ });
3155
+ topK = void 0;
3156
+ }
3157
+ if (topP != null) {
3158
+ warnings.push({
3159
+ type: "unsupported",
3160
+ feature: "topP",
3161
+ details: `topP is not supported by ${this.modelId} and will be ignored`
3162
+ });
3163
+ topP = void 0;
3164
+ }
3165
+ }
3166
+ const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2932
3167
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2933
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3168
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3169
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
2934
3170
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2935
3171
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2936
3172
  type: "function",
@@ -2940,7 +3176,7 @@ var AnthropicMessagesLanguageModel = class {
2940
3176
  } : void 0;
2941
3177
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
2942
3178
  const cacheControlValidator = new CacheControlValidator();
2943
- const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
3179
+ const toolNameMapping = createToolNameMapping({
2944
3180
  tools,
2945
3181
  providerToolNames: {
2946
3182
  "anthropic.code_execution_20250522": "code_execution",
@@ -2965,14 +3201,32 @@ var AnthropicMessagesLanguageModel = class {
2965
3201
  });
2966
3202
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2967
3203
  prompt,
2968
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3204
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
2969
3205
  warnings,
2970
3206
  cacheControlValidator,
2971
3207
  toolNameMapping
2972
3208
  });
2973
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3209
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3210
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3211
+ reasoning,
3212
+ supportsAdaptiveThinking,
3213
+ supportsXhighEffort,
3214
+ maxOutputTokensForModel,
3215
+ warnings
3216
+ });
3217
+ if (reasoningConfig != null) {
3218
+ if (anthropicOptions.thinking == null) {
3219
+ anthropicOptions.thinking = reasoningConfig.thinking;
3220
+ }
3221
+ if (reasoningConfig.effort != null && ((_e = anthropicOptions.thinking) == null ? void 0 : _e.type) !== "disabled") {
3222
+ anthropicOptions.effort = reasoningConfig.effort;
3223
+ }
3224
+ }
3225
+ }
3226
+ const thinkingType = (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type;
2974
3227
  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;
3228
+ let thinkingBudget = thinkingType === "enabled" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.budgetTokens : void 0;
3229
+ const thinkingDisplay = thinkingType === "adaptive" ? (_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display : void 0;
2976
3230
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2977
3231
  const baseArgs = {
2978
3232
  // model id:
@@ -2987,14 +3241,24 @@ var AnthropicMessagesLanguageModel = class {
2987
3241
  ...isThinking && {
2988
3242
  thinking: {
2989
3243
  type: thinkingType,
2990
- ...thinkingBudget != null && { budget_tokens: thinkingBudget }
3244
+ ...thinkingBudget != null && { budget_tokens: thinkingBudget },
3245
+ ...thinkingDisplay != null && { display: thinkingDisplay }
2991
3246
  }
2992
3247
  },
2993
- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
3248
+ ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
2994
3249
  output_config: {
2995
3250
  ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
2996
3251
  effort: anthropicOptions.effort
2997
3252
  },
3253
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) && {
3254
+ task_budget: {
3255
+ type: anthropicOptions.taskBudget.type,
3256
+ total: anthropicOptions.taskBudget.total,
3257
+ ...anthropicOptions.taskBudget.remaining != null && {
3258
+ remaining: anthropicOptions.taskBudget.remaining
3259
+ }
3260
+ }
3261
+ },
2998
3262
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2999
3263
  format: {
3000
3264
  type: "json_schema",
@@ -3006,9 +3270,15 @@ var AnthropicMessagesLanguageModel = class {
3006
3270
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
3007
3271
  speed: anthropicOptions.speed
3008
3272
  },
3273
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
3274
+ inference_geo: anthropicOptions.inferenceGeo
3275
+ },
3009
3276
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3010
3277
  cache_control: anthropicOptions.cacheControl
3011
3278
  },
3279
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3280
+ metadata: { user_id: anthropicOptions.metadata.userId }
3281
+ },
3012
3282
  // mcp servers:
3013
3283
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3014
3284
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3030,7 +3300,10 @@ var AnthropicMessagesLanguageModel = class {
3030
3300
  id: anthropicOptions.container.id,
3031
3301
  skills: anthropicOptions.container.skills.map((skill) => ({
3032
3302
  type: skill.type,
3033
- skill_id: skill.skillId,
3303
+ skill_id: skill.type === "custom" ? resolveProviderReference2({
3304
+ reference: skill.providerReference,
3305
+ provider: "anthropic"
3306
+ }) : skill.skillId,
3034
3307
  version: skill.version
3035
3308
  }))
3036
3309
  }
@@ -3132,7 +3405,7 @@ var AnthropicMessagesLanguageModel = class {
3132
3405
  }
3133
3406
  baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
3134
3407
  } else {
3135
- if (topP != null && temperature != null) {
3408
+ if (isAnthropicModel && topP != null && temperature != null) {
3136
3409
  warnings.push({
3137
3410
  type: "unsupported",
3138
3411
  feature: "topP",
@@ -3176,12 +3449,13 @@ var AnthropicMessagesLanguageModel = class {
3176
3449
  if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
3177
3450
  betas.add("effort-2025-11-24");
3178
3451
  }
3452
+ if (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) {
3453
+ betas.add("task-budgets-2026-03-13");
3454
+ }
3179
3455
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3180
3456
  betas.add("fast-mode-2026-02-01");
3181
3457
  }
3182
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
3183
- betas.add("fine-grained-tool-streaming-2025-05-14");
3184
- }
3458
+ const defaultEagerInputStreaming = stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true);
3185
3459
  const {
3186
3460
  tools: anthropicTools2,
3187
3461
  toolChoice: anthropicToolChoice,
@@ -3193,13 +3467,17 @@ var AnthropicMessagesLanguageModel = class {
3193
3467
  toolChoice: { type: "required" },
3194
3468
  disableParallelToolUse: true,
3195
3469
  cacheControlValidator,
3196
- supportsStructuredOutput: false
3470
+ supportsStructuredOutput: false,
3471
+ supportsStrictTools,
3472
+ defaultEagerInputStreaming
3197
3473
  } : {
3198
3474
  tools: tools != null ? tools : [],
3199
3475
  toolChoice,
3200
3476
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3201
3477
  cacheControlValidator,
3202
- supportsStructuredOutput
3478
+ supportsStructuredOutput,
3479
+ supportsStrictTools,
3480
+ defaultEagerInputStreaming
3203
3481
  }
3204
3482
  );
3205
3483
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3216,7 +3494,7 @@ var AnthropicMessagesLanguageModel = class {
3216
3494
  ...betas,
3217
3495
  ...toolsBetas,
3218
3496
  ...userSuppliedBetas,
3219
- ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
3497
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3220
3498
  ]),
3221
3499
  usesJsonResponseTool: jsonResponseTool != null,
3222
3500
  toolNameMapping,
@@ -3228,16 +3506,16 @@ var AnthropicMessagesLanguageModel = class {
3228
3506
  betas,
3229
3507
  headers
3230
3508
  }) {
3231
- return (0, import_provider_utils15.combineHeaders)(
3232
- await (0, import_provider_utils15.resolve)(this.config.headers),
3509
+ return combineHeaders2(
3510
+ this.config.headers ? await resolve(this.config.headers) : void 0,
3233
3511
  headers,
3234
3512
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3235
3513
  );
3236
3514
  }
3237
3515
  async getBetasFromHeaders(requestHeaders) {
3238
3516
  var _a, _b;
3239
- const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3240
- const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3517
+ const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
3518
+ const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
3241
3519
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3242
3520
  return new Set(
3243
3521
  [
@@ -3302,12 +3580,12 @@ var AnthropicMessagesLanguageModel = class {
3302
3580
  responseHeaders,
3303
3581
  value: response,
3304
3582
  rawValue: rawResponse
3305
- } = await (0, import_provider_utils15.postJsonToApi)({
3583
+ } = await postJsonToApi({
3306
3584
  url: this.buildRequestUrl(false),
3307
3585
  headers: await this.getHeaders({ betas, headers: options.headers }),
3308
3586
  body: this.transformRequestBody(args, betas),
3309
3587
  failedResponseHandler: anthropicFailedResponseHandler,
3310
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3588
+ successfulResponseHandler: createJsonResponseHandler2(
3311
3589
  anthropicMessagesResponseSchema
3312
3590
  ),
3313
3591
  abortSignal: options.abortSignal,
@@ -3701,6 +3979,7 @@ var AnthropicMessagesLanguageModel = class {
3701
3979
  };
3702
3980
  }
3703
3981
  async doStream(options) {
3982
+ "use step";
3704
3983
  var _a, _b;
3705
3984
  const {
3706
3985
  args: body,
@@ -3722,12 +4001,12 @@ var AnthropicMessagesLanguageModel = class {
3722
4001
  body.tools
3723
4002
  );
3724
4003
  const url = this.buildRequestUrl(true);
3725
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
4004
+ const { responseHeaders, value: response } = await postJsonToApi({
3726
4005
  url,
3727
4006
  headers: await this.getHeaders({ betas, headers: options.headers }),
3728
4007
  body: this.transformRequestBody(body, betas),
3729
4008
  failedResponseHandler: anthropicFailedResponseHandler,
3730
- successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
4009
+ successfulResponseHandler: createEventSourceResponseHandler(
3731
4010
  anthropicMessagesChunkSchema
3732
4011
  ),
3733
4012
  abortSignal: options.abortSignal,
@@ -4452,7 +4731,7 @@ var AnthropicMessagesLanguageModel = class {
4452
4731
  }
4453
4732
  if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
4454
4733
  const error = result.value.error;
4455
- throw new import_provider3.APICallError({
4734
+ throw new APICallError({
4456
4735
  message: error.message,
4457
4736
  url,
4458
4737
  requestBodyValues: body,
@@ -4475,46 +4754,76 @@ var AnthropicMessagesLanguageModel = class {
4475
4754
  }
4476
4755
  };
4477
4756
  function getModelCapabilities(modelId) {
4478
- if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
4757
+ if (modelId.includes("claude-opus-4-7")) {
4758
+ return {
4759
+ maxOutputTokens: 128e3,
4760
+ supportsStructuredOutput: true,
4761
+ supportsAdaptiveThinking: true,
4762
+ rejectsSamplingParameters: true,
4763
+ supportsXhighEffort: true,
4764
+ isKnownModel: true
4765
+ };
4766
+ } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
4479
4767
  return {
4480
4768
  maxOutputTokens: 128e3,
4481
4769
  supportsStructuredOutput: true,
4770
+ supportsAdaptiveThinking: true,
4771
+ rejectsSamplingParameters: false,
4772
+ supportsXhighEffort: false,
4482
4773
  isKnownModel: true
4483
4774
  };
4484
4775
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4485
4776
  return {
4486
4777
  maxOutputTokens: 64e3,
4487
4778
  supportsStructuredOutput: true,
4779
+ supportsAdaptiveThinking: false,
4780
+ rejectsSamplingParameters: false,
4781
+ supportsXhighEffort: false,
4488
4782
  isKnownModel: true
4489
4783
  };
4490
4784
  } else if (modelId.includes("claude-opus-4-1")) {
4491
4785
  return {
4492
4786
  maxOutputTokens: 32e3,
4493
4787
  supportsStructuredOutput: true,
4788
+ supportsAdaptiveThinking: false,
4789
+ rejectsSamplingParameters: false,
4790
+ supportsXhighEffort: false,
4494
4791
  isKnownModel: true
4495
4792
  };
4496
4793
  } else if (modelId.includes("claude-sonnet-4-")) {
4497
4794
  return {
4498
4795
  maxOutputTokens: 64e3,
4499
4796
  supportsStructuredOutput: false,
4797
+ supportsAdaptiveThinking: false,
4798
+ rejectsSamplingParameters: false,
4799
+ supportsXhighEffort: false,
4500
4800
  isKnownModel: true
4501
4801
  };
4502
4802
  } else if (modelId.includes("claude-opus-4-")) {
4503
4803
  return {
4504
4804
  maxOutputTokens: 32e3,
4505
4805
  supportsStructuredOutput: false,
4806
+ supportsAdaptiveThinking: false,
4807
+ rejectsSamplingParameters: false,
4808
+ supportsXhighEffort: false,
4506
4809
  isKnownModel: true
4507
4810
  };
4508
4811
  } else if (modelId.includes("claude-3-haiku")) {
4509
4812
  return {
4510
4813
  maxOutputTokens: 4096,
4511
4814
  supportsStructuredOutput: false,
4815
+ supportsAdaptiveThinking: false,
4816
+ rejectsSamplingParameters: false,
4817
+ supportsXhighEffort: false,
4512
4818
  isKnownModel: true
4513
4819
  };
4514
4820
  } else {
4515
4821
  return {
4516
4822
  maxOutputTokens: 4096,
4517
4823
  supportsStructuredOutput: false,
4824
+ supportsAdaptiveThinking: false,
4825
+ rejectsSamplingParameters: false,
4826
+ supportsXhighEffort: false,
4518
4827
  isKnownModel: false
4519
4828
  };
4520
4829
  }
@@ -4537,6 +4846,44 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4537
4846
  }
4538
4847
  return hasWebTool20260209 && !hasCodeExecutionTool;
4539
4848
  }
4849
+ function resolveAnthropicReasoningConfig({
4850
+ reasoning,
4851
+ supportsAdaptiveThinking,
4852
+ supportsXhighEffort,
4853
+ maxOutputTokensForModel,
4854
+ warnings
4855
+ }) {
4856
+ if (!isCustomReasoning(reasoning)) {
4857
+ return void 0;
4858
+ }
4859
+ if (reasoning === "none") {
4860
+ return { thinking: { type: "disabled" } };
4861
+ }
4862
+ if (supportsAdaptiveThinking) {
4863
+ const effort = mapReasoningToProviderEffort({
4864
+ reasoning,
4865
+ effortMap: {
4866
+ minimal: "low",
4867
+ low: "low",
4868
+ medium: "medium",
4869
+ high: "high",
4870
+ xhigh: supportsXhighEffort ? "xhigh" : "max"
4871
+ },
4872
+ warnings
4873
+ });
4874
+ return { thinking: { type: "adaptive" }, effort };
4875
+ }
4876
+ const budgetTokens = mapReasoningToProviderBudget({
4877
+ reasoning,
4878
+ maxOutputTokens: maxOutputTokensForModel,
4879
+ maxReasoningBudget: maxOutputTokensForModel,
4880
+ warnings
4881
+ });
4882
+ if (budgetTokens == null) {
4883
+ return void 0;
4884
+ }
4885
+ return { thinking: { type: "enabled", budgetTokens } };
4886
+ }
4540
4887
  function mapAnthropicResponseContextManagement(contextManagement) {
4541
4888
  return contextManagement ? {
4542
4889
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4564,44 +4911,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4564
4911
  }
4565
4912
 
4566
4913
  // 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()
4914
+ import {
4915
+ createProviderToolFactory as createProviderToolFactory2,
4916
+ lazySchema as lazySchema13,
4917
+ zodSchema as zodSchema13
4918
+ } from "@ai-sdk/provider-utils";
4919
+ import { z as z14 } from "zod/v4";
4920
+ var bash_20241022InputSchema = lazySchema13(
4921
+ () => zodSchema13(
4922
+ z14.object({
4923
+ command: z14.string(),
4924
+ restart: z14.boolean().optional()
4574
4925
  })
4575
4926
  )
4576
4927
  );
4577
- var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
4928
+ var bash_20241022 = createProviderToolFactory2({
4578
4929
  id: "anthropic.bash_20241022",
4579
4930
  inputSchema: bash_20241022InputSchema
4580
4931
  });
4581
4932
 
4582
4933
  // 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()
4934
+ import {
4935
+ createProviderToolFactory as createProviderToolFactory3,
4936
+ lazySchema as lazySchema14,
4937
+ zodSchema as zodSchema14
4938
+ } from "@ai-sdk/provider-utils";
4939
+ import { z as z15 } from "zod/v4";
4940
+ var bash_20250124InputSchema = lazySchema14(
4941
+ () => zodSchema14(
4942
+ z15.object({
4943
+ command: z15.string(),
4944
+ restart: z15.boolean().optional()
4590
4945
  })
4591
4946
  )
4592
4947
  );
4593
- var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
4948
+ var bash_20250124 = createProviderToolFactory3({
4594
4949
  id: "anthropic.bash_20250124",
4595
4950
  inputSchema: bash_20250124InputSchema
4596
4951
  });
4597
4952
 
4598
4953
  // 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([
4954
+ import {
4955
+ createProviderToolFactory as createProviderToolFactory4,
4956
+ lazySchema as lazySchema15,
4957
+ zodSchema as zodSchema15
4958
+ } from "@ai-sdk/provider-utils";
4959
+ import { z as z16 } from "zod/v4";
4960
+ var computer_20241022InputSchema = lazySchema15(
4961
+ () => zodSchema15(
4962
+ z16.object({
4963
+ action: z16.enum([
4605
4964
  "key",
4606
4965
  "type",
4607
4966
  "mouse_move",
@@ -4613,23 +4972,27 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4613
4972
  "screenshot",
4614
4973
  "cursor_position"
4615
4974
  ]),
4616
- coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
4617
- text: import_v415.z.string().optional()
4975
+ coordinate: z16.array(z16.number().int()).optional(),
4976
+ text: z16.string().optional()
4618
4977
  })
4619
4978
  )
4620
4979
  );
4621
- var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
4980
+ var computer_20241022 = createProviderToolFactory4({
4622
4981
  id: "anthropic.computer_20241022",
4623
4982
  inputSchema: computer_20241022InputSchema
4624
4983
  });
4625
4984
 
4626
4985
  // 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([
4986
+ import {
4987
+ createProviderToolFactory as createProviderToolFactory5,
4988
+ lazySchema as lazySchema16,
4989
+ zodSchema as zodSchema16
4990
+ } from "@ai-sdk/provider-utils";
4991
+ import { z as z17 } from "zod/v4";
4992
+ var computer_20250124InputSchema = lazySchema16(
4993
+ () => zodSchema16(
4994
+ z17.object({
4995
+ action: z17.enum([
4633
4996
  "key",
4634
4997
  "hold_key",
4635
4998
  "type",
@@ -4647,27 +5010,31 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4647
5010
  "wait",
4648
5011
  "screenshot"
4649
5012
  ]),
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()
5013
+ coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
5014
+ duration: z17.number().optional(),
5015
+ scroll_amount: z17.number().optional(),
5016
+ scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
5017
+ start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
5018
+ text: z17.string().optional()
4656
5019
  })
4657
5020
  )
4658
5021
  );
4659
- var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
5022
+ var computer_20250124 = createProviderToolFactory5({
4660
5023
  id: "anthropic.computer_20250124",
4661
5024
  inputSchema: computer_20250124InputSchema
4662
5025
  });
4663
5026
 
4664
5027
  // 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([
5028
+ import {
5029
+ createProviderToolFactory as createProviderToolFactory6,
5030
+ lazySchema as lazySchema17,
5031
+ zodSchema as zodSchema17
5032
+ } from "@ai-sdk/provider-utils";
5033
+ import { z as z18 } from "zod/v4";
5034
+ var computer_20251124InputSchema = lazySchema17(
5035
+ () => zodSchema17(
5036
+ z18.object({
5037
+ action: z18.enum([
4671
5038
  "key",
4672
5039
  "hold_key",
4673
5040
  "type",
@@ -4686,166 +5053,186 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4686
5053
  "screenshot",
4687
5054
  "zoom"
4688
5055
  ]),
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()
5056
+ coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5057
+ duration: z18.number().optional(),
5058
+ region: z18.tuple([
5059
+ z18.number().int(),
5060
+ z18.number().int(),
5061
+ z18.number().int(),
5062
+ z18.number().int()
4696
5063
  ]).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()
5064
+ scroll_amount: z18.number().optional(),
5065
+ scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
5066
+ start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5067
+ text: z18.string().optional()
4701
5068
  })
4702
5069
  )
4703
5070
  );
4704
- var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
5071
+ var computer_20251124 = createProviderToolFactory6({
4705
5072
  id: "anthropic.computer_20251124",
4706
5073
  inputSchema: computer_20251124InputSchema
4707
5074
  });
4708
5075
 
4709
5076
  // 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()
5077
+ import {
5078
+ createProviderToolFactory as createProviderToolFactory7,
5079
+ lazySchema as lazySchema18,
5080
+ zodSchema as zodSchema18
5081
+ } from "@ai-sdk/provider-utils";
5082
+ import { z as z19 } from "zod/v4";
5083
+ var memory_20250818InputSchema = lazySchema18(
5084
+ () => zodSchema18(
5085
+ z19.discriminatedUnion("command", [
5086
+ z19.object({
5087
+ command: z19.literal("view"),
5088
+ path: z19.string(),
5089
+ view_range: z19.tuple([z19.number(), z19.number()]).optional()
4719
5090
  }),
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()
5091
+ z19.object({
5092
+ command: z19.literal("create"),
5093
+ path: z19.string(),
5094
+ file_text: z19.string()
4724
5095
  }),
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()
5096
+ z19.object({
5097
+ command: z19.literal("str_replace"),
5098
+ path: z19.string(),
5099
+ old_str: z19.string(),
5100
+ new_str: z19.string()
4730
5101
  }),
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()
5102
+ z19.object({
5103
+ command: z19.literal("insert"),
5104
+ path: z19.string(),
5105
+ insert_line: z19.number(),
5106
+ insert_text: z19.string()
4736
5107
  }),
4737
- import_v418.z.object({
4738
- command: import_v418.z.literal("delete"),
4739
- path: import_v418.z.string()
5108
+ z19.object({
5109
+ command: z19.literal("delete"),
5110
+ path: z19.string()
4740
5111
  }),
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()
5112
+ z19.object({
5113
+ command: z19.literal("rename"),
5114
+ old_path: z19.string(),
5115
+ new_path: z19.string()
4745
5116
  })
4746
5117
  ])
4747
5118
  )
4748
5119
  );
4749
- var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
5120
+ var memory_20250818 = createProviderToolFactory7({
4750
5121
  id: "anthropic.memory_20250818",
4751
5122
  inputSchema: memory_20250818InputSchema
4752
5123
  });
4753
5124
 
4754
5125
  // 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()
5126
+ import {
5127
+ createProviderToolFactory as createProviderToolFactory8,
5128
+ lazySchema as lazySchema19,
5129
+ zodSchema as zodSchema19
5130
+ } from "@ai-sdk/provider-utils";
5131
+ import { z as z20 } from "zod/v4";
5132
+ var textEditor_20241022InputSchema = lazySchema19(
5133
+ () => zodSchema19(
5134
+ z20.object({
5135
+ command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5136
+ path: z20.string(),
5137
+ file_text: z20.string().optional(),
5138
+ insert_line: z20.number().int().optional(),
5139
+ new_str: z20.string().optional(),
5140
+ insert_text: z20.string().optional(),
5141
+ old_str: z20.string().optional(),
5142
+ view_range: z20.array(z20.number().int()).optional()
4768
5143
  })
4769
5144
  )
4770
5145
  );
4771
- var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
5146
+ var textEditor_20241022 = createProviderToolFactory8({
4772
5147
  id: "anthropic.text_editor_20241022",
4773
5148
  inputSchema: textEditor_20241022InputSchema
4774
5149
  });
4775
5150
 
4776
5151
  // src/tool/text-editor_20250124.ts
4777
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
4778
- var import_v420 = require("zod/v4");
4779
- var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
4780
- () => (0, import_provider_utils23.zodSchema)(
4781
- import_v420.z.object({
4782
- command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4783
- path: import_v420.z.string(),
4784
- file_text: import_v420.z.string().optional(),
4785
- insert_line: import_v420.z.number().int().optional(),
4786
- new_str: import_v420.z.string().optional(),
4787
- insert_text: import_v420.z.string().optional(),
4788
- old_str: import_v420.z.string().optional(),
4789
- view_range: import_v420.z.array(import_v420.z.number().int()).optional()
5152
+ import {
5153
+ createProviderToolFactory as createProviderToolFactory9,
5154
+ lazySchema as lazySchema20,
5155
+ zodSchema as zodSchema20
5156
+ } from "@ai-sdk/provider-utils";
5157
+ import { z as z21 } from "zod/v4";
5158
+ var textEditor_20250124InputSchema = lazySchema20(
5159
+ () => zodSchema20(
5160
+ z21.object({
5161
+ command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5162
+ path: z21.string(),
5163
+ file_text: z21.string().optional(),
5164
+ insert_line: z21.number().int().optional(),
5165
+ new_str: z21.string().optional(),
5166
+ insert_text: z21.string().optional(),
5167
+ old_str: z21.string().optional(),
5168
+ view_range: z21.array(z21.number().int()).optional()
4790
5169
  })
4791
5170
  )
4792
5171
  );
4793
- var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
5172
+ var textEditor_20250124 = createProviderToolFactory9({
4794
5173
  id: "anthropic.text_editor_20250124",
4795
5174
  inputSchema: textEditor_20250124InputSchema
4796
5175
  });
4797
5176
 
4798
5177
  // src/tool/text-editor_20250429.ts
4799
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
4800
- var import_v421 = require("zod/v4");
4801
- var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
4802
- () => (0, import_provider_utils24.zodSchema)(
4803
- import_v421.z.object({
4804
- command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
4805
- path: import_v421.z.string(),
4806
- file_text: import_v421.z.string().optional(),
4807
- insert_line: import_v421.z.number().int().optional(),
4808
- new_str: import_v421.z.string().optional(),
4809
- insert_text: import_v421.z.string().optional(),
4810
- old_str: import_v421.z.string().optional(),
4811
- view_range: import_v421.z.array(import_v421.z.number().int()).optional()
5178
+ import {
5179
+ createProviderToolFactory as createProviderToolFactory10,
5180
+ lazySchema as lazySchema21,
5181
+ zodSchema as zodSchema21
5182
+ } from "@ai-sdk/provider-utils";
5183
+ import { z as z22 } from "zod/v4";
5184
+ var textEditor_20250429InputSchema = lazySchema21(
5185
+ () => zodSchema21(
5186
+ z22.object({
5187
+ command: z22.enum(["view", "create", "str_replace", "insert"]),
5188
+ path: z22.string(),
5189
+ file_text: z22.string().optional(),
5190
+ insert_line: z22.number().int().optional(),
5191
+ new_str: z22.string().optional(),
5192
+ insert_text: z22.string().optional(),
5193
+ old_str: z22.string().optional(),
5194
+ view_range: z22.array(z22.number().int()).optional()
4812
5195
  })
4813
5196
  )
4814
5197
  );
4815
- var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
5198
+ var textEditor_20250429 = createProviderToolFactory10({
4816
5199
  id: "anthropic.text_editor_20250429",
4817
5200
  inputSchema: textEditor_20250429InputSchema
4818
5201
  });
4819
5202
 
4820
5203
  // src/tool/tool-search-bm25_20251119.ts
4821
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4822
- var import_v422 = require("zod/v4");
4823
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
4824
- () => (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()
5204
+ import {
5205
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5206
+ lazySchema as lazySchema22,
5207
+ zodSchema as zodSchema22
5208
+ } from "@ai-sdk/provider-utils";
5209
+ import { z as z23 } from "zod/v4";
5210
+ var toolSearchBm25_20251119OutputSchema = lazySchema22(
5211
+ () => zodSchema22(
5212
+ z23.array(
5213
+ z23.object({
5214
+ type: z23.literal("tool_reference"),
5215
+ toolName: z23.string()
4829
5216
  })
4830
5217
  )
4831
5218
  )
4832
5219
  );
4833
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
4834
- () => (0, import_provider_utils25.zodSchema)(
4835
- import_v422.z.object({
5220
+ var toolSearchBm25_20251119InputSchema = lazySchema22(
5221
+ () => zodSchema22(
5222
+ z23.object({
4836
5223
  /**
4837
5224
  * A natural language query to search for tools.
4838
5225
  * Claude will use BM25 text search to find relevant tools.
4839
5226
  */
4840
- query: import_v422.z.string(),
5227
+ query: z23.string(),
4841
5228
  /**
4842
5229
  * Maximum number of tools to return. Optional.
4843
5230
  */
4844
- limit: import_v422.z.number().optional()
5231
+ limit: z23.number().optional()
4845
5232
  })
4846
5233
  )
4847
5234
  );
4848
- var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
5235
+ var factory10 = createProviderToolFactoryWithOutputSchema9({
4849
5236
  id: "anthropic.tool_search_bm25_20251119",
4850
5237
  inputSchema: toolSearchBm25_20251119InputSchema,
4851
5238
  outputSchema: toolSearchBm25_20251119OutputSchema,
@@ -5057,31 +5444,163 @@ var anthropicTools = {
5057
5444
  toolSearchBm25_20251119
5058
5445
  };
5059
5446
 
5447
+ // src/skills/anthropic-skills.ts
5448
+ import {
5449
+ combineHeaders as combineHeaders3,
5450
+ convertBase64ToUint8Array as convertBase64ToUint8Array3,
5451
+ createJsonResponseHandler as createJsonResponseHandler3,
5452
+ getFromApi,
5453
+ postFormDataToApi as postFormDataToApi2,
5454
+ resolve as resolve2
5455
+ } from "@ai-sdk/provider-utils";
5456
+
5457
+ // src/skills/anthropic-skills-api.ts
5458
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
5459
+ import { z as z24 } from "zod/v4";
5460
+ var anthropicSkillResponseSchema = lazySchema23(
5461
+ () => zodSchema23(
5462
+ z24.object({
5463
+ id: z24.string(),
5464
+ display_title: z24.string().nullish(),
5465
+ name: z24.string().nullish(),
5466
+ description: z24.string().nullish(),
5467
+ latest_version: z24.string().nullish(),
5468
+ source: z24.string(),
5469
+ created_at: z24.string(),
5470
+ updated_at: z24.string()
5471
+ })
5472
+ )
5473
+ );
5474
+ var anthropicSkillVersionListResponseSchema = lazySchema23(
5475
+ () => zodSchema23(
5476
+ z24.object({
5477
+ data: z24.array(
5478
+ z24.object({
5479
+ version: z24.string()
5480
+ })
5481
+ )
5482
+ })
5483
+ )
5484
+ );
5485
+ var anthropicSkillVersionResponseSchema = lazySchema23(
5486
+ () => zodSchema23(
5487
+ z24.object({
5488
+ type: z24.string(),
5489
+ skill_id: z24.string(),
5490
+ name: z24.string().nullish(),
5491
+ description: z24.string().nullish()
5492
+ })
5493
+ )
5494
+ );
5495
+
5496
+ // src/skills/anthropic-skills.ts
5497
+ var AnthropicSkills = class {
5498
+ constructor(config) {
5499
+ this.config = config;
5500
+ this.specificationVersion = "v4";
5501
+ }
5502
+ get provider() {
5503
+ return this.config.provider;
5504
+ }
5505
+ async getHeaders() {
5506
+ return combineHeaders3(await resolve2(this.config.headers), {
5507
+ "anthropic-beta": "skills-2025-10-02"
5508
+ });
5509
+ }
5510
+ async fetchVersionMetadata({
5511
+ skillId,
5512
+ version,
5513
+ headers
5514
+ }) {
5515
+ const { value: versionResponse } = await getFromApi({
5516
+ url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
5517
+ headers,
5518
+ failedResponseHandler: anthropicFailedResponseHandler,
5519
+ successfulResponseHandler: createJsonResponseHandler3(
5520
+ anthropicSkillVersionResponseSchema
5521
+ ),
5522
+ fetch: this.config.fetch
5523
+ });
5524
+ return {
5525
+ ...versionResponse.name != null ? { name: versionResponse.name } : {},
5526
+ ...versionResponse.description != null ? { description: versionResponse.description } : {}
5527
+ };
5528
+ }
5529
+ async uploadSkill(params) {
5530
+ var _a, _b;
5531
+ const warnings = [];
5532
+ const formData = new FormData();
5533
+ if (params.displayTitle != null) {
5534
+ formData.append("display_title", params.displayTitle);
5535
+ }
5536
+ for (const file of params.files) {
5537
+ const content = typeof file.content === "string" ? convertBase64ToUint8Array3(file.content) : file.content;
5538
+ formData.append("files[]", new Blob([content]), file.path);
5539
+ }
5540
+ const headers = await this.getHeaders();
5541
+ const { value: response } = await postFormDataToApi2({
5542
+ url: `${this.config.baseURL}/skills`,
5543
+ headers,
5544
+ formData,
5545
+ failedResponseHandler: anthropicFailedResponseHandler,
5546
+ successfulResponseHandler: createJsonResponseHandler3(
5547
+ anthropicSkillResponseSchema
5548
+ ),
5549
+ fetch: this.config.fetch
5550
+ });
5551
+ const versionMetadata = response.latest_version != null ? await this.fetchVersionMetadata({
5552
+ skillId: response.id,
5553
+ version: response.latest_version,
5554
+ headers
5555
+ }) : {};
5556
+ const name = (_a = versionMetadata.name) != null ? _a : response.name;
5557
+ const description = (_b = versionMetadata.description) != null ? _b : response.description;
5558
+ return {
5559
+ providerReference: { anthropic: response.id },
5560
+ ...response.display_title != null ? { displayTitle: response.display_title } : {},
5561
+ ...name != null ? { name } : {},
5562
+ ...description != null ? { description } : {},
5563
+ ...response.latest_version != null ? { latestVersion: response.latest_version } : {},
5564
+ providerMetadata: {
5565
+ anthropic: {
5566
+ ...response.source != null ? { source: response.source } : {},
5567
+ ...response.created_at != null ? { createdAt: response.created_at } : {},
5568
+ ...response.updated_at != null ? { updatedAt: response.updated_at } : {}
5569
+ }
5570
+ },
5571
+ warnings
5572
+ };
5573
+ }
5574
+ };
5575
+
5576
+ // src/version.ts
5577
+ var VERSION = true ? "4.0.0-beta.32" : "0.0.0-test";
5578
+
5060
5579
  // src/anthropic-provider.ts
5061
5580
  function createAnthropic(options = {}) {
5062
5581
  var _a, _b;
5063
- const baseURL = (_a = (0, import_provider_utils26.withoutTrailingSlash)(
5064
- (0, import_provider_utils26.loadOptionalSetting)({
5582
+ const baseURL = (_a = withoutTrailingSlash(
5583
+ loadOptionalSetting({
5065
5584
  settingValue: options.baseURL,
5066
5585
  environmentVariableName: "ANTHROPIC_BASE_URL"
5067
5586
  })
5068
5587
  )) != null ? _a : "https://api.anthropic.com/v1";
5069
5588
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
5070
5589
  if (options.apiKey && options.authToken) {
5071
- throw new import_provider4.InvalidArgumentError({
5590
+ throw new InvalidArgumentError({
5072
5591
  argument: "apiKey/authToken",
5073
5592
  message: "Both apiKey and authToken were provided. Please use only one authentication method."
5074
5593
  });
5075
5594
  }
5076
5595
  const getHeaders = () => {
5077
5596
  const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
5078
- "x-api-key": (0, import_provider_utils26.loadApiKey)({
5597
+ "x-api-key": loadApiKey({
5079
5598
  apiKey: options.apiKey,
5080
5599
  environmentVariableName: "ANTHROPIC_API_KEY",
5081
5600
  description: "Anthropic"
5082
5601
  })
5083
5602
  };
5084
- return (0, import_provider_utils26.withUserAgentSuffix)(
5603
+ return withUserAgentSuffix(
5085
5604
  {
5086
5605
  "anthropic-version": "2023-06-01",
5087
5606
  ...authHeaders,
@@ -5097,13 +5616,19 @@ function createAnthropic(options = {}) {
5097
5616
  baseURL,
5098
5617
  headers: getHeaders,
5099
5618
  fetch: options.fetch,
5100
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils26.generateId,
5619
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
5101
5620
  supportedUrls: () => ({
5102
5621
  "image/*": [/^https?:\/\/.*$/],
5103
5622
  "application/pdf": [/^https?:\/\/.*$/]
5104
5623
  })
5105
5624
  });
5106
5625
  };
5626
+ const createSkills = () => new AnthropicSkills({
5627
+ provider: `${providerName.replace(".messages", "")}.skills`,
5628
+ baseURL,
5629
+ headers: getHeaders,
5630
+ fetch: options.fetch
5631
+ });
5107
5632
  const provider = function(modelId) {
5108
5633
  if (new.target) {
5109
5634
  throw new Error(
@@ -5117,12 +5642,19 @@ function createAnthropic(options = {}) {
5117
5642
  provider.chat = createChatModel;
5118
5643
  provider.messages = createChatModel;
5119
5644
  provider.embeddingModel = (modelId) => {
5120
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "embeddingModel" });
5645
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
5121
5646
  };
5122
5647
  provider.textEmbeddingModel = provider.embeddingModel;
5123
5648
  provider.imageModel = (modelId) => {
5124
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
5649
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
5125
5650
  };
5651
+ provider.files = () => new AnthropicFiles({
5652
+ provider: providerName,
5653
+ baseURL,
5654
+ headers: getHeaders,
5655
+ fetch: options.fetch
5656
+ });
5657
+ provider.skills = createSkills;
5126
5658
  provider.tools = anthropicTools;
5127
5659
  return provider;
5128
5660
  }
@@ -5147,11 +5679,10 @@ function forwardAnthropicContainerIdFromLastStep({
5147
5679
  }
5148
5680
  return void 0;
5149
5681
  }
5150
- // Annotate the CommonJS export names for ESM import in node:
5151
- 0 && (module.exports = {
5682
+ export {
5152
5683
  VERSION,
5153
5684
  anthropic,
5154
5685
  createAnthropic,
5155
5686
  forwardAnthropicContainerIdFromLastStep
5156
- });
5687
+ };
5157
5688
  //# sourceMappingURL=index.js.map