@ai-sdk/anthropic 4.0.0-beta.26 → 4.0.0-beta.28

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,70 +1,61 @@
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 index_exports = {};
22
- __export(index_exports, {
23
- VERSION: () => VERSION,
24
- anthropic: () => anthropic,
25
- createAnthropic: () => createAnthropic,
26
- forwardAnthropicContainerIdFromLastStep: () => forwardAnthropicContainerIdFromLastStep
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
-
30
1
  // src/anthropic-provider.ts
31
- var import_provider4 = require("@ai-sdk/provider");
32
- var import_provider_utils29 = 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
14
  // src/anthropic-files.ts
35
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
36
- var import_v42 = require("zod/v4");
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";
37
24
 
38
25
  // src/anthropic-error.ts
39
- var import_provider_utils = require("@ai-sdk/provider-utils");
40
- var import_v4 = require("zod/v4");
41
- var anthropicErrorDataSchema = (0, import_provider_utils.lazySchema)(
42
- () => (0, import_provider_utils.zodSchema)(
43
- import_v4.z.object({
44
- type: import_v4.z.literal("error"),
45
- error: import_v4.z.object({
46
- type: import_v4.z.string(),
47
- 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()
48
39
  })
49
40
  })
50
41
  )
51
42
  );
52
- var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
43
+ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
53
44
  errorSchema: anthropicErrorDataSchema,
54
45
  errorToMessage: (data) => data.error.message
55
46
  });
56
47
 
57
48
  // src/anthropic-files.ts
58
- var anthropicUploadFileResponseSchema = (0, import_provider_utils2.lazySchema)(
59
- () => (0, import_provider_utils2.zodSchema)(
60
- import_v42.z.object({
61
- id: import_v42.z.string(),
62
- type: import_v42.z.literal("file"),
63
- filename: import_v42.z.string(),
64
- mime_type: import_v42.z.string(),
65
- size_bytes: import_v42.z.number(),
66
- created_at: import_v42.z.string(),
67
- downloadable: import_v42.z.boolean().nullish()
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()
68
59
  })
69
60
  )
70
61
  );
@@ -82,7 +73,7 @@ var AnthropicFiles = class {
82
73
  filename
83
74
  }) {
84
75
  var _a, _b;
85
- const fileBytes = data instanceof Uint8Array ? data : (0, import_provider_utils2.convertBase64ToUint8Array)(data);
76
+ const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
86
77
  const blob = new Blob([fileBytes], { type: mediaType });
87
78
  const formData = new FormData();
88
79
  if (filename != null) {
@@ -90,14 +81,14 @@ var AnthropicFiles = class {
90
81
  } else {
91
82
  formData.append("file", blob);
92
83
  }
93
- const { value: response } = await (0, import_provider_utils2.postFormDataToApi)({
84
+ const { value: response } = await postFormDataToApi({
94
85
  url: `${this.config.baseURL}/files`,
95
- headers: (0, import_provider_utils2.combineHeaders)(this.config.headers(), {
86
+ headers: combineHeaders(this.config.headers(), {
96
87
  "anthropic-beta": "files-api-2025-04-14"
97
88
  }),
98
89
  formData,
99
90
  failedResponseHandler: anthropicFailedResponseHandler,
100
- successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
91
+ successfulResponseHandler: createJsonResponseHandler(
101
92
  anthropicUploadFileResponseSchema
102
93
  ),
103
94
  fetch: this.config.fetch
@@ -121,322 +112,340 @@ var AnthropicFiles = class {
121
112
  };
122
113
 
123
114
  // src/anthropic-messages-language-model.ts
124
- var import_provider3 = require("@ai-sdk/provider");
125
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
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";
126
135
 
127
136
  // src/anthropic-messages-api.ts
128
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
129
- var import_v43 = require("zod/v4");
130
- var anthropicMessagesResponseSchema = (0, import_provider_utils3.lazySchema)(
131
- () => (0, import_provider_utils3.zodSchema)(
132
- import_v43.z.object({
133
- type: import_v43.z.literal("message"),
134
- id: import_v43.z.string().nullish(),
135
- model: import_v43.z.string().nullish(),
136
- content: import_v43.z.array(
137
- import_v43.z.discriminatedUnion("type", [
138
- import_v43.z.object({
139
- type: import_v43.z.literal("text"),
140
- text: import_v43.z.string(),
141
- citations: import_v43.z.array(
142
- import_v43.z.discriminatedUnion("type", [
143
- import_v43.z.object({
144
- type: import_v43.z.literal("web_search_result_location"),
145
- cited_text: import_v43.z.string(),
146
- url: import_v43.z.string(),
147
- title: import_v43.z.string(),
148
- encrypted_index: import_v43.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()
149
158
  }),
150
- import_v43.z.object({
151
- type: import_v43.z.literal("page_location"),
152
- cited_text: import_v43.z.string(),
153
- document_index: import_v43.z.number(),
154
- document_title: import_v43.z.string().nullable(),
155
- start_page_number: import_v43.z.number(),
156
- end_page_number: import_v43.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()
157
166
  }),
158
- import_v43.z.object({
159
- type: import_v43.z.literal("char_location"),
160
- cited_text: import_v43.z.string(),
161
- document_index: import_v43.z.number(),
162
- document_title: import_v43.z.string().nullable(),
163
- start_char_index: import_v43.z.number(),
164
- end_char_index: import_v43.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()
165
174
  })
166
175
  ])
167
176
  ).optional()
168
177
  }),
169
- import_v43.z.object({
170
- type: import_v43.z.literal("thinking"),
171
- thinking: import_v43.z.string(),
172
- signature: import_v43.z.string()
178
+ z3.object({
179
+ type: z3.literal("thinking"),
180
+ thinking: z3.string(),
181
+ signature: z3.string()
173
182
  }),
174
- import_v43.z.object({
175
- type: import_v43.z.literal("redacted_thinking"),
176
- data: import_v43.z.string()
183
+ z3.object({
184
+ type: z3.literal("redacted_thinking"),
185
+ data: z3.string()
177
186
  }),
178
- import_v43.z.object({
179
- type: import_v43.z.literal("compaction"),
180
- content: import_v43.z.string()
187
+ z3.object({
188
+ type: z3.literal("compaction"),
189
+ content: z3.string()
181
190
  }),
182
- import_v43.z.object({
183
- type: import_v43.z.literal("tool_use"),
184
- id: import_v43.z.string(),
185
- name: import_v43.z.string(),
186
- input: import_v43.z.unknown(),
191
+ z3.object({
192
+ type: z3.literal("tool_use"),
193
+ id: z3.string(),
194
+ name: z3.string(),
195
+ input: z3.unknown(),
187
196
  // Programmatic tool calling: caller info when triggered from code execution
188
- caller: import_v43.z.union([
189
- import_v43.z.object({
190
- type: import_v43.z.literal("code_execution_20250825"),
191
- tool_id: import_v43.z.string()
197
+ caller: z3.union([
198
+ z3.object({
199
+ type: z3.literal("code_execution_20250825"),
200
+ tool_id: z3.string()
192
201
  }),
193
- import_v43.z.object({
194
- type: import_v43.z.literal("code_execution_20260120"),
195
- tool_id: import_v43.z.string()
202
+ z3.object({
203
+ type: z3.literal("code_execution_20260120"),
204
+ tool_id: z3.string()
196
205
  }),
197
- import_v43.z.object({
198
- type: import_v43.z.literal("direct")
206
+ z3.object({
207
+ type: z3.literal("direct")
199
208
  })
200
209
  ]).optional()
201
210
  }),
202
- import_v43.z.object({
203
- type: import_v43.z.literal("server_tool_use"),
204
- id: import_v43.z.string(),
205
- name: import_v43.z.string(),
206
- input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
207
- caller: import_v43.z.union([
208
- import_v43.z.object({
209
- type: import_v43.z.literal("code_execution_20260120"),
210
- tool_id: import_v43.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()
211
220
  }),
212
- import_v43.z.object({
213
- type: import_v43.z.literal("direct")
221
+ z3.object({
222
+ type: z3.literal("direct")
214
223
  })
215
224
  ]).optional()
216
225
  }),
217
- import_v43.z.object({
218
- type: import_v43.z.literal("mcp_tool_use"),
219
- id: import_v43.z.string(),
220
- name: import_v43.z.string(),
221
- input: import_v43.z.unknown(),
222
- server_name: import_v43.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()
223
232
  }),
224
- import_v43.z.object({
225
- type: import_v43.z.literal("mcp_tool_result"),
226
- tool_use_id: import_v43.z.string(),
227
- is_error: import_v43.z.boolean(),
228
- content: import_v43.z.array(
229
- import_v43.z.union([
230
- import_v43.z.string(),
231
- import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.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() })
232
241
  ])
233
242
  )
234
243
  }),
235
- import_v43.z.object({
236
- type: import_v43.z.literal("web_fetch_tool_result"),
237
- tool_use_id: import_v43.z.string(),
238
- content: import_v43.z.union([
239
- import_v43.z.object({
240
- type: import_v43.z.literal("web_fetch_result"),
241
- url: import_v43.z.string(),
242
- retrieved_at: import_v43.z.string(),
243
- content: import_v43.z.object({
244
- type: import_v43.z.literal("document"),
245
- title: import_v43.z.string().nullable(),
246
- citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
247
- source: import_v43.z.union([
248
- import_v43.z.object({
249
- type: import_v43.z.literal("base64"),
250
- media_type: import_v43.z.literal("application/pdf"),
251
- data: import_v43.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()
252
261
  }),
253
- import_v43.z.object({
254
- type: import_v43.z.literal("text"),
255
- media_type: import_v43.z.literal("text/plain"),
256
- data: import_v43.z.string()
262
+ z3.object({
263
+ type: z3.literal("text"),
264
+ media_type: z3.literal("text/plain"),
265
+ data: z3.string()
257
266
  })
258
267
  ])
259
268
  })
260
269
  }),
261
- import_v43.z.object({
262
- type: import_v43.z.literal("web_fetch_tool_result_error"),
263
- error_code: import_v43.z.string()
270
+ z3.object({
271
+ type: z3.literal("web_fetch_tool_result_error"),
272
+ error_code: z3.string()
264
273
  })
265
274
  ])
266
275
  }),
267
- import_v43.z.object({
268
- type: import_v43.z.literal("web_search_tool_result"),
269
- tool_use_id: import_v43.z.string(),
270
- content: import_v43.z.union([
271
- import_v43.z.array(
272
- import_v43.z.object({
273
- type: import_v43.z.literal("web_search_result"),
274
- url: import_v43.z.string(),
275
- title: import_v43.z.string(),
276
- encrypted_content: import_v43.z.string(),
277
- page_age: import_v43.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()
278
287
  })
279
288
  ),
280
- import_v43.z.object({
281
- type: import_v43.z.literal("web_search_tool_result_error"),
282
- error_code: import_v43.z.string()
289
+ z3.object({
290
+ type: z3.literal("web_search_tool_result_error"),
291
+ error_code: z3.string()
283
292
  })
284
293
  ])
285
294
  }),
286
295
  // code execution results for code_execution_20250522 tool:
287
- import_v43.z.object({
288
- type: import_v43.z.literal("code_execution_tool_result"),
289
- tool_use_id: import_v43.z.string(),
290
- content: import_v43.z.union([
291
- import_v43.z.object({
292
- type: import_v43.z.literal("code_execution_result"),
293
- stdout: import_v43.z.string(),
294
- stderr: import_v43.z.string(),
295
- return_code: import_v43.z.number(),
296
- content: import_v43.z.array(
297
- import_v43.z.object({
298
- type: import_v43.z.literal("code_execution_output"),
299
- file_id: import_v43.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()
300
309
  })
301
310
  ).optional().default([])
302
311
  }),
303
- import_v43.z.object({
304
- type: import_v43.z.literal("encrypted_code_execution_result"),
305
- encrypted_stdout: import_v43.z.string(),
306
- stderr: import_v43.z.string(),
307
- return_code: import_v43.z.number(),
308
- content: import_v43.z.array(
309
- import_v43.z.object({
310
- type: import_v43.z.literal("code_execution_output"),
311
- file_id: import_v43.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()
312
321
  })
313
322
  ).optional().default([])
314
323
  }),
315
- import_v43.z.object({
316
- type: import_v43.z.literal("code_execution_tool_result_error"),
317
- error_code: import_v43.z.string()
324
+ z3.object({
325
+ type: z3.literal("code_execution_tool_result_error"),
326
+ error_code: z3.string()
318
327
  })
319
328
  ])
320
329
  }),
321
330
  // bash code execution results for code_execution_20250825 tool:
322
- import_v43.z.object({
323
- type: import_v43.z.literal("bash_code_execution_tool_result"),
324
- tool_use_id: import_v43.z.string(),
325
- content: import_v43.z.discriminatedUnion("type", [
326
- import_v43.z.object({
327
- type: import_v43.z.literal("bash_code_execution_result"),
328
- content: import_v43.z.array(
329
- import_v43.z.object({
330
- type: import_v43.z.literal("bash_code_execution_output"),
331
- file_id: import_v43.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()
332
341
  })
333
342
  ),
334
- stdout: import_v43.z.string(),
335
- stderr: import_v43.z.string(),
336
- return_code: import_v43.z.number()
343
+ stdout: z3.string(),
344
+ stderr: z3.string(),
345
+ return_code: z3.number()
337
346
  }),
338
- import_v43.z.object({
339
- type: import_v43.z.literal("bash_code_execution_tool_result_error"),
340
- error_code: import_v43.z.string()
347
+ z3.object({
348
+ type: z3.literal("bash_code_execution_tool_result_error"),
349
+ error_code: z3.string()
341
350
  })
342
351
  ])
343
352
  }),
344
353
  // text editor code execution results for code_execution_20250825 tool:
345
- import_v43.z.object({
346
- type: import_v43.z.literal("text_editor_code_execution_tool_result"),
347
- tool_use_id: import_v43.z.string(),
348
- content: import_v43.z.discriminatedUnion("type", [
349
- import_v43.z.object({
350
- type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
351
- error_code: import_v43.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()
352
361
  }),
353
- import_v43.z.object({
354
- type: import_v43.z.literal("text_editor_code_execution_view_result"),
355
- content: import_v43.z.string(),
356
- file_type: import_v43.z.string(),
357
- num_lines: import_v43.z.number().nullable(),
358
- start_line: import_v43.z.number().nullable(),
359
- total_lines: import_v43.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()
360
369
  }),
361
- import_v43.z.object({
362
- type: import_v43.z.literal("text_editor_code_execution_create_result"),
363
- is_file_update: import_v43.z.boolean()
370
+ z3.object({
371
+ type: z3.literal("text_editor_code_execution_create_result"),
372
+ is_file_update: z3.boolean()
364
373
  }),
365
- import_v43.z.object({
366
- type: import_v43.z.literal(
374
+ z3.object({
375
+ type: z3.literal(
367
376
  "text_editor_code_execution_str_replace_result"
368
377
  ),
369
- lines: import_v43.z.array(import_v43.z.string()).nullable(),
370
- new_lines: import_v43.z.number().nullable(),
371
- new_start: import_v43.z.number().nullable(),
372
- old_lines: import_v43.z.number().nullable(),
373
- old_start: import_v43.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()
374
383
  })
375
384
  ])
376
385
  }),
377
386
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
378
- import_v43.z.object({
379
- type: import_v43.z.literal("tool_search_tool_result"),
380
- tool_use_id: import_v43.z.string(),
381
- content: import_v43.z.union([
382
- import_v43.z.object({
383
- type: import_v43.z.literal("tool_search_tool_search_result"),
384
- tool_references: import_v43.z.array(
385
- import_v43.z.object({
386
- type: import_v43.z.literal("tool_reference"),
387
- tool_name: import_v43.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()
388
397
  })
389
398
  )
390
399
  }),
391
- import_v43.z.object({
392
- type: import_v43.z.literal("tool_search_tool_result_error"),
393
- error_code: import_v43.z.string()
400
+ z3.object({
401
+ type: z3.literal("tool_search_tool_result_error"),
402
+ error_code: z3.string()
394
403
  })
395
404
  ])
396
405
  })
397
406
  ])
398
407
  ),
399
- stop_reason: import_v43.z.string().nullish(),
400
- stop_sequence: import_v43.z.string().nullish(),
401
- usage: import_v43.z.looseObject({
402
- input_tokens: import_v43.z.number(),
403
- output_tokens: import_v43.z.number(),
404
- cache_creation_input_tokens: import_v43.z.number().nullish(),
405
- cache_read_input_tokens: import_v43.z.number().nullish(),
406
- iterations: import_v43.z.array(
407
- import_v43.z.object({
408
- type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
409
- input_tokens: import_v43.z.number(),
410
- output_tokens: import_v43.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()
411
420
  })
412
421
  ).nullish()
413
422
  }),
414
- container: import_v43.z.object({
415
- expires_at: import_v43.z.string(),
416
- id: import_v43.z.string(),
417
- skills: import_v43.z.array(
418
- import_v43.z.object({
419
- type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
420
- skill_id: import_v43.z.string(),
421
- version: import_v43.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()
422
431
  })
423
432
  ).nullish()
424
433
  }).nullish(),
425
- context_management: import_v43.z.object({
426
- applied_edits: import_v43.z.array(
427
- import_v43.z.union([
428
- import_v43.z.object({
429
- type: import_v43.z.literal("clear_tool_uses_20250919"),
430
- cleared_tool_uses: import_v43.z.number(),
431
- cleared_input_tokens: import_v43.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()
432
441
  }),
433
- import_v43.z.object({
434
- type: import_v43.z.literal("clear_thinking_20251015"),
435
- cleared_thinking_turns: import_v43.z.number(),
436
- cleared_input_tokens: import_v43.z.number()
442
+ z3.object({
443
+ type: z3.literal("clear_thinking_20251015"),
444
+ cleared_thinking_turns: z3.number(),
445
+ cleared_input_tokens: z3.number()
437
446
  }),
438
- import_v43.z.object({
439
- type: import_v43.z.literal("compact_20260112")
447
+ z3.object({
448
+ type: z3.literal("compact_20260112")
440
449
  })
441
450
  ])
442
451
  )
@@ -444,457 +453,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils3.lazySchema)(
444
453
  })
445
454
  )
446
455
  );
447
- var anthropicMessagesChunkSchema = (0, import_provider_utils3.lazySchema)(
448
- () => (0, import_provider_utils3.zodSchema)(
449
- import_v43.z.discriminatedUnion("type", [
450
- import_v43.z.object({
451
- type: import_v43.z.literal("message_start"),
452
- message: import_v43.z.object({
453
- id: import_v43.z.string().nullish(),
454
- model: import_v43.z.string().nullish(),
455
- role: import_v43.z.string().nullish(),
456
- usage: import_v43.z.looseObject({
457
- input_tokens: import_v43.z.number(),
458
- cache_creation_input_tokens: import_v43.z.number().nullish(),
459
- cache_read_input_tokens: import_v43.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()
460
469
  }),
461
470
  // Programmatic tool calling: content may be pre-populated for deferred tool calls
462
- content: import_v43.z.array(
463
- import_v43.z.discriminatedUnion("type", [
464
- import_v43.z.object({
465
- type: import_v43.z.literal("tool_use"),
466
- id: import_v43.z.string(),
467
- name: import_v43.z.string(),
468
- input: import_v43.z.unknown(),
469
- caller: import_v43.z.union([
470
- import_v43.z.object({
471
- type: import_v43.z.literal("code_execution_20250825"),
472
- tool_id: import_v43.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()
473
482
  }),
474
- import_v43.z.object({
475
- type: import_v43.z.literal("code_execution_20260120"),
476
- tool_id: import_v43.z.string()
483
+ z3.object({
484
+ type: z3.literal("code_execution_20260120"),
485
+ tool_id: z3.string()
477
486
  }),
478
- import_v43.z.object({
479
- type: import_v43.z.literal("direct")
487
+ z3.object({
488
+ type: z3.literal("direct")
480
489
  })
481
490
  ]).optional()
482
491
  })
483
492
  ])
484
493
  ).nullish(),
485
- stop_reason: import_v43.z.string().nullish(),
486
- container: import_v43.z.object({
487
- expires_at: import_v43.z.string(),
488
- id: import_v43.z.string()
494
+ stop_reason: z3.string().nullish(),
495
+ container: z3.object({
496
+ expires_at: z3.string(),
497
+ id: z3.string()
489
498
  }).nullish()
490
499
  })
491
500
  }),
492
- import_v43.z.object({
493
- type: import_v43.z.literal("content_block_start"),
494
- index: import_v43.z.number(),
495
- content_block: import_v43.z.discriminatedUnion("type", [
496
- import_v43.z.object({
497
- type: import_v43.z.literal("text"),
498
- text: import_v43.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()
499
508
  }),
500
- import_v43.z.object({
501
- type: import_v43.z.literal("thinking"),
502
- thinking: import_v43.z.string()
509
+ z3.object({
510
+ type: z3.literal("thinking"),
511
+ thinking: z3.string()
503
512
  }),
504
- import_v43.z.object({
505
- type: import_v43.z.literal("tool_use"),
506
- id: import_v43.z.string(),
507
- name: import_v43.z.string(),
513
+ z3.object({
514
+ type: z3.literal("tool_use"),
515
+ id: z3.string(),
516
+ name: z3.string(),
508
517
  // Programmatic tool calling: input may be present directly for deferred tool calls
509
- input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
518
+ input: z3.record(z3.string(), z3.unknown()).optional(),
510
519
  // Programmatic tool calling: caller info when triggered from code execution
511
- caller: import_v43.z.union([
512
- import_v43.z.object({
513
- type: import_v43.z.literal("code_execution_20250825"),
514
- tool_id: import_v43.z.string()
520
+ caller: z3.union([
521
+ z3.object({
522
+ type: z3.literal("code_execution_20250825"),
523
+ tool_id: z3.string()
515
524
  }),
516
- import_v43.z.object({
517
- type: import_v43.z.literal("code_execution_20260120"),
518
- tool_id: import_v43.z.string()
525
+ z3.object({
526
+ type: z3.literal("code_execution_20260120"),
527
+ tool_id: z3.string()
519
528
  }),
520
- import_v43.z.object({
521
- type: import_v43.z.literal("direct")
529
+ z3.object({
530
+ type: z3.literal("direct")
522
531
  })
523
532
  ]).optional()
524
533
  }),
525
- import_v43.z.object({
526
- type: import_v43.z.literal("redacted_thinking"),
527
- data: import_v43.z.string()
534
+ z3.object({
535
+ type: z3.literal("redacted_thinking"),
536
+ data: z3.string()
528
537
  }),
529
- import_v43.z.object({
530
- type: import_v43.z.literal("compaction"),
531
- content: import_v43.z.string().nullish()
538
+ z3.object({
539
+ type: z3.literal("compaction"),
540
+ content: z3.string().nullish()
532
541
  }),
533
- import_v43.z.object({
534
- type: import_v43.z.literal("server_tool_use"),
535
- id: import_v43.z.string(),
536
- name: import_v43.z.string(),
537
- input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
538
- caller: import_v43.z.union([
539
- import_v43.z.object({
540
- type: import_v43.z.literal("code_execution_20260120"),
541
- tool_id: import_v43.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()
542
551
  }),
543
- import_v43.z.object({
544
- type: import_v43.z.literal("direct")
552
+ z3.object({
553
+ type: z3.literal("direct")
545
554
  })
546
555
  ]).optional()
547
556
  }),
548
- import_v43.z.object({
549
- type: import_v43.z.literal("mcp_tool_use"),
550
- id: import_v43.z.string(),
551
- name: import_v43.z.string(),
552
- input: import_v43.z.unknown(),
553
- server_name: import_v43.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()
554
563
  }),
555
- import_v43.z.object({
556
- type: import_v43.z.literal("mcp_tool_result"),
557
- tool_use_id: import_v43.z.string(),
558
- is_error: import_v43.z.boolean(),
559
- content: import_v43.z.array(
560
- import_v43.z.union([
561
- import_v43.z.string(),
562
- import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.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() })
563
572
  ])
564
573
  )
565
574
  }),
566
- import_v43.z.object({
567
- type: import_v43.z.literal("web_fetch_tool_result"),
568
- tool_use_id: import_v43.z.string(),
569
- content: import_v43.z.union([
570
- import_v43.z.object({
571
- type: import_v43.z.literal("web_fetch_result"),
572
- url: import_v43.z.string(),
573
- retrieved_at: import_v43.z.string(),
574
- content: import_v43.z.object({
575
- type: import_v43.z.literal("document"),
576
- title: import_v43.z.string().nullable(),
577
- citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
578
- source: import_v43.z.union([
579
- import_v43.z.object({
580
- type: import_v43.z.literal("base64"),
581
- media_type: import_v43.z.literal("application/pdf"),
582
- data: import_v43.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()
583
592
  }),
584
- import_v43.z.object({
585
- type: import_v43.z.literal("text"),
586
- media_type: import_v43.z.literal("text/plain"),
587
- data: import_v43.z.string()
593
+ z3.object({
594
+ type: z3.literal("text"),
595
+ media_type: z3.literal("text/plain"),
596
+ data: z3.string()
588
597
  })
589
598
  ])
590
599
  })
591
600
  }),
592
- import_v43.z.object({
593
- type: import_v43.z.literal("web_fetch_tool_result_error"),
594
- error_code: import_v43.z.string()
601
+ z3.object({
602
+ type: z3.literal("web_fetch_tool_result_error"),
603
+ error_code: z3.string()
595
604
  })
596
605
  ])
597
606
  }),
598
- import_v43.z.object({
599
- type: import_v43.z.literal("web_search_tool_result"),
600
- tool_use_id: import_v43.z.string(),
601
- content: import_v43.z.union([
602
- import_v43.z.array(
603
- import_v43.z.object({
604
- type: import_v43.z.literal("web_search_result"),
605
- url: import_v43.z.string(),
606
- title: import_v43.z.string(),
607
- encrypted_content: import_v43.z.string(),
608
- page_age: import_v43.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()
609
618
  })
610
619
  ),
611
- import_v43.z.object({
612
- type: import_v43.z.literal("web_search_tool_result_error"),
613
- error_code: import_v43.z.string()
620
+ z3.object({
621
+ type: z3.literal("web_search_tool_result_error"),
622
+ error_code: z3.string()
614
623
  })
615
624
  ])
616
625
  }),
617
626
  // code execution results for code_execution_20250522 tool:
618
- import_v43.z.object({
619
- type: import_v43.z.literal("code_execution_tool_result"),
620
- tool_use_id: import_v43.z.string(),
621
- content: import_v43.z.union([
622
- import_v43.z.object({
623
- type: import_v43.z.literal("code_execution_result"),
624
- stdout: import_v43.z.string(),
625
- stderr: import_v43.z.string(),
626
- return_code: import_v43.z.number(),
627
- content: import_v43.z.array(
628
- import_v43.z.object({
629
- type: import_v43.z.literal("code_execution_output"),
630
- file_id: import_v43.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()
631
640
  })
632
641
  ).optional().default([])
633
642
  }),
634
- import_v43.z.object({
635
- type: import_v43.z.literal("encrypted_code_execution_result"),
636
- encrypted_stdout: import_v43.z.string(),
637
- stderr: import_v43.z.string(),
638
- return_code: import_v43.z.number(),
639
- content: import_v43.z.array(
640
- import_v43.z.object({
641
- type: import_v43.z.literal("code_execution_output"),
642
- file_id: import_v43.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()
643
652
  })
644
653
  ).optional().default([])
645
654
  }),
646
- import_v43.z.object({
647
- type: import_v43.z.literal("code_execution_tool_result_error"),
648
- error_code: import_v43.z.string()
655
+ z3.object({
656
+ type: z3.literal("code_execution_tool_result_error"),
657
+ error_code: z3.string()
649
658
  })
650
659
  ])
651
660
  }),
652
661
  // bash code execution results for code_execution_20250825 tool:
653
- import_v43.z.object({
654
- type: import_v43.z.literal("bash_code_execution_tool_result"),
655
- tool_use_id: import_v43.z.string(),
656
- content: import_v43.z.discriminatedUnion("type", [
657
- import_v43.z.object({
658
- type: import_v43.z.literal("bash_code_execution_result"),
659
- content: import_v43.z.array(
660
- import_v43.z.object({
661
- type: import_v43.z.literal("bash_code_execution_output"),
662
- file_id: import_v43.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()
663
672
  })
664
673
  ),
665
- stdout: import_v43.z.string(),
666
- stderr: import_v43.z.string(),
667
- return_code: import_v43.z.number()
674
+ stdout: z3.string(),
675
+ stderr: z3.string(),
676
+ return_code: z3.number()
668
677
  }),
669
- import_v43.z.object({
670
- type: import_v43.z.literal("bash_code_execution_tool_result_error"),
671
- error_code: import_v43.z.string()
678
+ z3.object({
679
+ type: z3.literal("bash_code_execution_tool_result_error"),
680
+ error_code: z3.string()
672
681
  })
673
682
  ])
674
683
  }),
675
684
  // text editor code execution results for code_execution_20250825 tool:
676
- import_v43.z.object({
677
- type: import_v43.z.literal("text_editor_code_execution_tool_result"),
678
- tool_use_id: import_v43.z.string(),
679
- content: import_v43.z.discriminatedUnion("type", [
680
- import_v43.z.object({
681
- type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
682
- error_code: import_v43.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()
683
692
  }),
684
- import_v43.z.object({
685
- type: import_v43.z.literal("text_editor_code_execution_view_result"),
686
- content: import_v43.z.string(),
687
- file_type: import_v43.z.string(),
688
- num_lines: import_v43.z.number().nullable(),
689
- start_line: import_v43.z.number().nullable(),
690
- total_lines: import_v43.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()
691
700
  }),
692
- import_v43.z.object({
693
- type: import_v43.z.literal("text_editor_code_execution_create_result"),
694
- is_file_update: import_v43.z.boolean()
701
+ z3.object({
702
+ type: z3.literal("text_editor_code_execution_create_result"),
703
+ is_file_update: z3.boolean()
695
704
  }),
696
- import_v43.z.object({
697
- type: import_v43.z.literal(
705
+ z3.object({
706
+ type: z3.literal(
698
707
  "text_editor_code_execution_str_replace_result"
699
708
  ),
700
- lines: import_v43.z.array(import_v43.z.string()).nullable(),
701
- new_lines: import_v43.z.number().nullable(),
702
- new_start: import_v43.z.number().nullable(),
703
- old_lines: import_v43.z.number().nullable(),
704
- old_start: import_v43.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()
705
714
  })
706
715
  ])
707
716
  }),
708
717
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
709
- import_v43.z.object({
710
- type: import_v43.z.literal("tool_search_tool_result"),
711
- tool_use_id: import_v43.z.string(),
712
- content: import_v43.z.union([
713
- import_v43.z.object({
714
- type: import_v43.z.literal("tool_search_tool_search_result"),
715
- tool_references: import_v43.z.array(
716
- import_v43.z.object({
717
- type: import_v43.z.literal("tool_reference"),
718
- tool_name: import_v43.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()
719
728
  })
720
729
  )
721
730
  }),
722
- import_v43.z.object({
723
- type: import_v43.z.literal("tool_search_tool_result_error"),
724
- error_code: import_v43.z.string()
731
+ z3.object({
732
+ type: z3.literal("tool_search_tool_result_error"),
733
+ error_code: z3.string()
725
734
  })
726
735
  ])
727
736
  })
728
737
  ])
729
738
  }),
730
- import_v43.z.object({
731
- type: import_v43.z.literal("content_block_delta"),
732
- index: import_v43.z.number(),
733
- delta: import_v43.z.discriminatedUnion("type", [
734
- import_v43.z.object({
735
- type: import_v43.z.literal("input_json_delta"),
736
- partial_json: import_v43.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()
737
746
  }),
738
- import_v43.z.object({
739
- type: import_v43.z.literal("text_delta"),
740
- text: import_v43.z.string()
747
+ z3.object({
748
+ type: z3.literal("text_delta"),
749
+ text: z3.string()
741
750
  }),
742
- import_v43.z.object({
743
- type: import_v43.z.literal("thinking_delta"),
744
- thinking: import_v43.z.string()
751
+ z3.object({
752
+ type: z3.literal("thinking_delta"),
753
+ thinking: z3.string()
745
754
  }),
746
- import_v43.z.object({
747
- type: import_v43.z.literal("signature_delta"),
748
- signature: import_v43.z.string()
755
+ z3.object({
756
+ type: z3.literal("signature_delta"),
757
+ signature: z3.string()
749
758
  }),
750
- import_v43.z.object({
751
- type: import_v43.z.literal("compaction_delta"),
752
- content: import_v43.z.string().nullish()
759
+ z3.object({
760
+ type: z3.literal("compaction_delta"),
761
+ content: z3.string().nullish()
753
762
  }),
754
- import_v43.z.object({
755
- type: import_v43.z.literal("citations_delta"),
756
- citation: import_v43.z.discriminatedUnion("type", [
757
- import_v43.z.object({
758
- type: import_v43.z.literal("web_search_result_location"),
759
- cited_text: import_v43.z.string(),
760
- url: import_v43.z.string(),
761
- title: import_v43.z.string(),
762
- encrypted_index: import_v43.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()
763
772
  }),
764
- import_v43.z.object({
765
- type: import_v43.z.literal("page_location"),
766
- cited_text: import_v43.z.string(),
767
- document_index: import_v43.z.number(),
768
- document_title: import_v43.z.string().nullable(),
769
- start_page_number: import_v43.z.number(),
770
- end_page_number: import_v43.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()
771
780
  }),
772
- import_v43.z.object({
773
- type: import_v43.z.literal("char_location"),
774
- cited_text: import_v43.z.string(),
775
- document_index: import_v43.z.number(),
776
- document_title: import_v43.z.string().nullable(),
777
- start_char_index: import_v43.z.number(),
778
- end_char_index: import_v43.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()
779
788
  })
780
789
  ])
781
790
  })
782
791
  ])
783
792
  }),
784
- import_v43.z.object({
785
- type: import_v43.z.literal("content_block_stop"),
786
- index: import_v43.z.number()
793
+ z3.object({
794
+ type: z3.literal("content_block_stop"),
795
+ index: z3.number()
787
796
  }),
788
- import_v43.z.object({
789
- type: import_v43.z.literal("error"),
790
- error: import_v43.z.object({
791
- type: import_v43.z.string(),
792
- message: import_v43.z.string()
797
+ z3.object({
798
+ type: z3.literal("error"),
799
+ error: z3.object({
800
+ type: z3.string(),
801
+ message: z3.string()
793
802
  })
794
803
  }),
795
- import_v43.z.object({
796
- type: import_v43.z.literal("message_delta"),
797
- delta: import_v43.z.object({
798
- stop_reason: import_v43.z.string().nullish(),
799
- stop_sequence: import_v43.z.string().nullish(),
800
- container: import_v43.z.object({
801
- expires_at: import_v43.z.string(),
802
- id: import_v43.z.string(),
803
- skills: import_v43.z.array(
804
- import_v43.z.object({
805
- type: import_v43.z.union([
806
- import_v43.z.literal("anthropic"),
807
- import_v43.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")
808
817
  ]),
809
- skill_id: import_v43.z.string(),
810
- version: import_v43.z.string()
818
+ skill_id: z3.string(),
819
+ version: z3.string()
811
820
  })
812
821
  ).nullish()
813
822
  }).nullish()
814
823
  }),
815
- usage: import_v43.z.looseObject({
816
- input_tokens: import_v43.z.number().nullish(),
817
- output_tokens: import_v43.z.number(),
818
- cache_creation_input_tokens: import_v43.z.number().nullish(),
819
- cache_read_input_tokens: import_v43.z.number().nullish(),
820
- iterations: import_v43.z.array(
821
- import_v43.z.object({
822
- type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
823
- input_tokens: import_v43.z.number(),
824
- output_tokens: import_v43.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()
825
834
  })
826
835
  ).nullish()
827
836
  }),
828
- context_management: import_v43.z.object({
829
- applied_edits: import_v43.z.array(
830
- import_v43.z.union([
831
- import_v43.z.object({
832
- type: import_v43.z.literal("clear_tool_uses_20250919"),
833
- cleared_tool_uses: import_v43.z.number(),
834
- cleared_input_tokens: import_v43.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()
835
844
  }),
836
- import_v43.z.object({
837
- type: import_v43.z.literal("clear_thinking_20251015"),
838
- cleared_thinking_turns: import_v43.z.number(),
839
- cleared_input_tokens: import_v43.z.number()
845
+ z3.object({
846
+ type: z3.literal("clear_thinking_20251015"),
847
+ cleared_thinking_turns: z3.number(),
848
+ cleared_input_tokens: z3.number()
840
849
  }),
841
- import_v43.z.object({
842
- type: import_v43.z.literal("compact_20260112")
850
+ z3.object({
851
+ type: z3.literal("compact_20260112")
843
852
  })
844
853
  ])
845
854
  )
846
855
  }).nullish()
847
856
  }),
848
- import_v43.z.object({
849
- type: import_v43.z.literal("message_stop")
857
+ z3.object({
858
+ type: z3.literal("message_stop")
850
859
  }),
851
- import_v43.z.object({
852
- type: import_v43.z.literal("ping")
860
+ z3.object({
861
+ type: z3.literal("ping")
853
862
  })
854
863
  ])
855
864
  )
856
865
  );
857
- var anthropicReasoningMetadataSchema = (0, import_provider_utils3.lazySchema)(
858
- () => (0, import_provider_utils3.zodSchema)(
859
- import_v43.z.object({
860
- signature: import_v43.z.string().optional(),
861
- redactedData: import_v43.z.string().optional()
866
+ var anthropicReasoningMetadataSchema = lazySchema3(
867
+ () => zodSchema3(
868
+ z3.object({
869
+ signature: z3.string().optional(),
870
+ redactedData: z3.string().optional()
862
871
  })
863
872
  )
864
873
  );
865
874
 
866
875
  // src/anthropic-messages-options.ts
867
- var import_v44 = require("zod/v4");
868
- var anthropicFilePartProviderOptions = import_v44.z.object({
876
+ import { z as z4 } from "zod/v4";
877
+ var anthropicFilePartProviderOptions = z4.object({
869
878
  /**
870
879
  * Citation configuration for this document.
871
880
  * When enabled, this document will generate citations in the response.
872
881
  */
873
- citations: import_v44.z.object({
882
+ citations: z4.object({
874
883
  /**
875
884
  * Enable citations for this document
876
885
  */
877
- enabled: import_v44.z.boolean()
886
+ enabled: z4.boolean()
878
887
  }).optional(),
879
888
  /**
880
889
  * Custom title for the document.
881
890
  * If not provided, the filename will be used.
882
891
  */
883
- title: import_v44.z.string().optional(),
892
+ title: z4.string().optional(),
884
893
  /**
885
894
  * Context about the document that will be passed to the model
886
895
  * but not used towards cited content.
887
896
  * Useful for storing document metadata as text or stringified JSON.
888
897
  */
889
- context: import_v44.z.string().optional()
898
+ context: z4.string().optional()
890
899
  });
891
- var anthropicLanguageModelOptions = import_v44.z.object({
900
+ var anthropicLanguageModelOptions = z4.object({
892
901
  /**
893
902
  * Whether to send reasoning to the model.
894
903
  *
895
904
  * This allows you to deactivate reasoning inputs for models that do not support them.
896
905
  */
897
- sendReasoning: import_v44.z.boolean().optional(),
906
+ sendReasoning: z4.boolean().optional(),
898
907
  /**
899
908
  * Determines how structured outputs are generated.
900
909
  *
@@ -902,66 +911,66 @@ var anthropicLanguageModelOptions = import_v44.z.object({
902
911
  * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
903
912
  * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
904
913
  */
905
- structuredOutputMode: import_v44.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
914
+ structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional(),
906
915
  /**
907
916
  * Configuration for enabling Claude's extended thinking.
908
917
  *
909
918
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
910
919
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
911
920
  */
912
- thinking: import_v44.z.discriminatedUnion("type", [
913
- import_v44.z.object({
921
+ thinking: z4.discriminatedUnion("type", [
922
+ z4.object({
914
923
  /** for Sonnet 4.6, Opus 4.6, and newer models */
915
- type: import_v44.z.literal("adaptive")
924
+ type: z4.literal("adaptive")
916
925
  }),
917
- import_v44.z.object({
926
+ z4.object({
918
927
  /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
919
- type: import_v44.z.literal("enabled"),
920
- budgetTokens: import_v44.z.number().optional()
928
+ type: z4.literal("enabled"),
929
+ budgetTokens: z4.number().optional()
921
930
  }),
922
- import_v44.z.object({
923
- type: import_v44.z.literal("disabled")
931
+ z4.object({
932
+ type: z4.literal("disabled")
924
933
  })
925
934
  ]).optional(),
926
935
  /**
927
936
  * Whether to disable parallel function calling during tool use. Default is false.
928
937
  * When set to true, Claude will use at most one tool per response.
929
938
  */
930
- disableParallelToolUse: import_v44.z.boolean().optional(),
939
+ disableParallelToolUse: z4.boolean().optional(),
931
940
  /**
932
941
  * Cache control settings for this message.
933
942
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
934
943
  */
935
- cacheControl: import_v44.z.object({
936
- type: import_v44.z.literal("ephemeral"),
937
- ttl: import_v44.z.union([import_v44.z.literal("5m"), import_v44.z.literal("1h")]).optional()
944
+ cacheControl: z4.object({
945
+ type: z4.literal("ephemeral"),
946
+ ttl: z4.union([z4.literal("5m"), z4.literal("1h")]).optional()
938
947
  }).optional(),
939
948
  /**
940
949
  * Metadata to include with the request.
941
950
  *
942
951
  * See https://platform.claude.com/docs/en/api/messages/create for details.
943
952
  */
944
- metadata: import_v44.z.object({
953
+ metadata: z4.object({
945
954
  /**
946
955
  * An external identifier for the user associated with the request.
947
956
  *
948
957
  * Should be a UUID, hash value, or other opaque identifier.
949
958
  * Must not contain PII (name, email, phone number, etc.).
950
959
  */
951
- userId: import_v44.z.string().optional()
960
+ userId: z4.string().optional()
952
961
  }).optional(),
953
962
  /**
954
963
  * MCP servers to be utilized in this request.
955
964
  */
956
- mcpServers: import_v44.z.array(
957
- import_v44.z.object({
958
- type: import_v44.z.literal("url"),
959
- name: import_v44.z.string(),
960
- url: import_v44.z.string(),
961
- authorizationToken: import_v44.z.string().nullish(),
962
- toolConfiguration: import_v44.z.object({
963
- enabled: import_v44.z.boolean().nullish(),
964
- allowedTools: import_v44.z.array(import_v44.z.string()).nullish()
965
+ mcpServers: z4.array(
966
+ z4.object({
967
+ type: z4.literal("url"),
968
+ name: z4.string(),
969
+ url: z4.string(),
970
+ authorizationToken: z4.string().nullish(),
971
+ toolConfiguration: z4.object({
972
+ enabled: z4.boolean().nullish(),
973
+ allowedTools: z4.array(z4.string()).nullish()
965
974
  }).nullish()
966
975
  })
967
976
  ).optional(),
@@ -970,19 +979,19 @@ var anthropicLanguageModelOptions = import_v44.z.object({
970
979
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
971
980
  * Requires code execution tool to be enabled.
972
981
  */
973
- container: import_v44.z.object({
974
- id: import_v44.z.string().optional(),
975
- skills: import_v44.z.array(
976
- import_v44.z.discriminatedUnion("type", [
977
- import_v44.z.object({
978
- type: import_v44.z.literal("anthropic"),
979
- skillId: import_v44.z.string(),
980
- version: import_v44.z.string().optional()
982
+ container: z4.object({
983
+ id: z4.string().optional(),
984
+ skills: z4.array(
985
+ z4.discriminatedUnion("type", [
986
+ z4.object({
987
+ type: z4.literal("anthropic"),
988
+ skillId: z4.string(),
989
+ version: z4.string().optional()
981
990
  }),
982
- import_v44.z.object({
983
- type: import_v44.z.literal("custom"),
984
- providerReference: import_v44.z.record(import_v44.z.string(), import_v44.z.string()),
985
- version: import_v44.z.string().optional()
991
+ z4.object({
992
+ type: z4.literal("custom"),
993
+ providerReference: z4.record(z4.string(), z4.string()),
994
+ version: z4.string().optional()
986
995
  })
987
996
  ])
988
997
  ).optional()
@@ -995,16 +1004,16 @@ var anthropicLanguageModelOptions = import_v44.z.object({
995
1004
  *
996
1005
  * @default true
997
1006
  */
998
- toolStreaming: import_v44.z.boolean().optional(),
1007
+ toolStreaming: z4.boolean().optional(),
999
1008
  /**
1000
1009
  * @default 'high'
1001
1010
  */
1002
- effort: import_v44.z.enum(["low", "medium", "high", "max"]).optional(),
1011
+ effort: z4.enum(["low", "medium", "high", "max"]).optional(),
1003
1012
  /**
1004
1013
  * Enable fast mode for faster inference (2.5x faster output token speeds).
1005
1014
  * Only supported with claude-opus-4-6.
1006
1015
  */
1007
- speed: import_v44.z.enum(["fast", "standard"]).optional(),
1016
+ speed: z4.enum(["fast", "standard"]).optional(),
1008
1017
  /**
1009
1018
  * Controls where model inference runs for this request.
1010
1019
  *
@@ -1013,56 +1022,56 @@ var anthropicLanguageModelOptions = import_v44.z.object({
1013
1022
  *
1014
1023
  * See https://platform.claude.com/docs/en/build-with-claude/data-residency
1015
1024
  */
1016
- inferenceGeo: import_v44.z.enum(["us", "global"]).optional(),
1025
+ inferenceGeo: z4.enum(["us", "global"]).optional(),
1017
1026
  /**
1018
1027
  * A set of beta features to enable.
1019
1028
  * Allow a provider to receive the full `betas` set if it needs it.
1020
1029
  */
1021
- anthropicBeta: import_v44.z.array(import_v44.z.string()).optional(),
1022
- contextManagement: import_v44.z.object({
1023
- edits: import_v44.z.array(
1024
- import_v44.z.discriminatedUnion("type", [
1025
- import_v44.z.object({
1026
- type: import_v44.z.literal("clear_tool_uses_20250919"),
1027
- trigger: import_v44.z.discriminatedUnion("type", [
1028
- import_v44.z.object({
1029
- type: import_v44.z.literal("input_tokens"),
1030
- value: import_v44.z.number()
1030
+ anthropicBeta: z4.array(z4.string()).optional(),
1031
+ contextManagement: z4.object({
1032
+ edits: z4.array(
1033
+ z4.discriminatedUnion("type", [
1034
+ z4.object({
1035
+ type: z4.literal("clear_tool_uses_20250919"),
1036
+ trigger: z4.discriminatedUnion("type", [
1037
+ z4.object({
1038
+ type: z4.literal("input_tokens"),
1039
+ value: z4.number()
1031
1040
  }),
1032
- import_v44.z.object({
1033
- type: import_v44.z.literal("tool_uses"),
1034
- value: import_v44.z.number()
1041
+ z4.object({
1042
+ type: z4.literal("tool_uses"),
1043
+ value: z4.number()
1035
1044
  })
1036
1045
  ]).optional(),
1037
- keep: import_v44.z.object({
1038
- type: import_v44.z.literal("tool_uses"),
1039
- value: import_v44.z.number()
1046
+ keep: z4.object({
1047
+ type: z4.literal("tool_uses"),
1048
+ value: z4.number()
1040
1049
  }).optional(),
1041
- clearAtLeast: import_v44.z.object({
1042
- type: import_v44.z.literal("input_tokens"),
1043
- value: import_v44.z.number()
1050
+ clearAtLeast: z4.object({
1051
+ type: z4.literal("input_tokens"),
1052
+ value: z4.number()
1044
1053
  }).optional(),
1045
- clearToolInputs: import_v44.z.boolean().optional(),
1046
- excludeTools: import_v44.z.array(import_v44.z.string()).optional()
1054
+ clearToolInputs: z4.boolean().optional(),
1055
+ excludeTools: z4.array(z4.string()).optional()
1047
1056
  }),
1048
- import_v44.z.object({
1049
- type: import_v44.z.literal("clear_thinking_20251015"),
1050
- keep: import_v44.z.union([
1051
- import_v44.z.literal("all"),
1052
- import_v44.z.object({
1053
- type: import_v44.z.literal("thinking_turns"),
1054
- value: import_v44.z.number()
1057
+ z4.object({
1058
+ type: z4.literal("clear_thinking_20251015"),
1059
+ keep: z4.union([
1060
+ z4.literal("all"),
1061
+ z4.object({
1062
+ type: z4.literal("thinking_turns"),
1063
+ value: z4.number()
1055
1064
  })
1056
1065
  ]).optional()
1057
1066
  }),
1058
- import_v44.z.object({
1059
- type: import_v44.z.literal("compact_20260112"),
1060
- trigger: import_v44.z.object({
1061
- type: import_v44.z.literal("input_tokens"),
1062
- value: import_v44.z.number()
1067
+ z4.object({
1068
+ type: z4.literal("compact_20260112"),
1069
+ trigger: z4.object({
1070
+ type: z4.literal("input_tokens"),
1071
+ value: z4.number()
1063
1072
  }).optional(),
1064
- pauseAfterCompaction: import_v44.z.boolean().optional(),
1065
- instructions: import_v44.z.string().optional()
1073
+ pauseAfterCompaction: z4.boolean().optional(),
1074
+ instructions: z4.string().optional()
1066
1075
  })
1067
1076
  ])
1068
1077
  )
@@ -1070,7 +1079,9 @@ var anthropicLanguageModelOptions = import_v44.z.object({
1070
1079
  });
1071
1080
 
1072
1081
  // src/anthropic-prepare-tools.ts
1073
- var import_provider = require("@ai-sdk/provider");
1082
+ import {
1083
+ UnsupportedFunctionalityError
1084
+ } from "@ai-sdk/provider";
1074
1085
 
1075
1086
  // src/get-cache-control.ts
1076
1087
  var MAX_CACHE_BREAKPOINTS = 4;
@@ -1115,31 +1126,31 @@ var CacheControlValidator = class {
1115
1126
  };
1116
1127
 
1117
1128
  // src/tool/text-editor_20250728.ts
1118
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1119
- var import_v45 = require("zod/v4");
1120
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1121
- var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
1122
- () => (0, import_provider_utils5.zodSchema)(
1123
- import_v45.z.object({
1124
- maxCharacters: import_v45.z.number().optional()
1129
+ import { createProviderToolFactory } from "@ai-sdk/provider-utils";
1130
+ import { z as z5 } from "zod/v4";
1131
+ import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
1132
+ var textEditor_20250728ArgsSchema = lazySchema4(
1133
+ () => zodSchema4(
1134
+ z5.object({
1135
+ maxCharacters: z5.number().optional()
1125
1136
  })
1126
1137
  )
1127
1138
  );
1128
- var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
1129
- () => (0, import_provider_utils5.zodSchema)(
1130
- import_v45.z.object({
1131
- command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1132
- path: import_v45.z.string(),
1133
- file_text: import_v45.z.string().optional(),
1134
- insert_line: import_v45.z.number().int().optional(),
1135
- new_str: import_v45.z.string().optional(),
1136
- insert_text: import_v45.z.string().optional(),
1137
- old_str: import_v45.z.string().optional(),
1138
- view_range: import_v45.z.array(import_v45.z.number().int()).optional()
1139
+ var textEditor_20250728InputSchema = lazySchema4(
1140
+ () => zodSchema4(
1141
+ z5.object({
1142
+ command: z5.enum(["view", "create", "str_replace", "insert"]),
1143
+ path: z5.string(),
1144
+ file_text: z5.string().optional(),
1145
+ insert_line: z5.number().int().optional(),
1146
+ new_str: z5.string().optional(),
1147
+ insert_text: z5.string().optional(),
1148
+ old_str: z5.string().optional(),
1149
+ view_range: z5.array(z5.number().int()).optional()
1139
1150
  })
1140
1151
  )
1141
1152
  );
1142
- var factory = (0, import_provider_utils4.createProviderToolFactory)({
1153
+ var factory = createProviderToolFactory({
1143
1154
  id: "anthropic.text_editor_20250728",
1144
1155
  inputSchema: textEditor_20250728InputSchema
1145
1156
  });
@@ -1148,45 +1159,49 @@ var textEditor_20250728 = (args = {}) => {
1148
1159
  };
1149
1160
 
1150
1161
  // src/tool/web-search_20260209.ts
1151
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1152
- var import_v46 = require("zod/v4");
1153
- var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
1154
- () => (0, import_provider_utils6.zodSchema)(
1155
- import_v46.z.object({
1156
- maxUses: import_v46.z.number().optional(),
1157
- allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1158
- blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1159
- userLocation: import_v46.z.object({
1160
- type: import_v46.z.literal("approximate"),
1161
- city: import_v46.z.string().optional(),
1162
- region: import_v46.z.string().optional(),
1163
- country: import_v46.z.string().optional(),
1164
- timezone: import_v46.z.string().optional()
1162
+ import {
1163
+ createProviderToolFactoryWithOutputSchema,
1164
+ lazySchema as lazySchema5,
1165
+ zodSchema as zodSchema5
1166
+ } from "@ai-sdk/provider-utils";
1167
+ import { z as z6 } from "zod/v4";
1168
+ var webSearch_20260209ArgsSchema = lazySchema5(
1169
+ () => zodSchema5(
1170
+ z6.object({
1171
+ maxUses: z6.number().optional(),
1172
+ allowedDomains: z6.array(z6.string()).optional(),
1173
+ blockedDomains: z6.array(z6.string()).optional(),
1174
+ userLocation: z6.object({
1175
+ type: z6.literal("approximate"),
1176
+ city: z6.string().optional(),
1177
+ region: z6.string().optional(),
1178
+ country: z6.string().optional(),
1179
+ timezone: z6.string().optional()
1165
1180
  }).optional()
1166
1181
  })
1167
1182
  )
1168
1183
  );
1169
- var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
1170
- () => (0, import_provider_utils6.zodSchema)(
1171
- import_v46.z.array(
1172
- import_v46.z.object({
1173
- url: import_v46.z.string(),
1174
- title: import_v46.z.string().nullable(),
1175
- pageAge: import_v46.z.string().nullable(),
1176
- encryptedContent: import_v46.z.string(),
1177
- type: import_v46.z.literal("web_search_result")
1184
+ var webSearch_20260209OutputSchema = lazySchema5(
1185
+ () => zodSchema5(
1186
+ z6.array(
1187
+ z6.object({
1188
+ url: z6.string(),
1189
+ title: z6.string().nullable(),
1190
+ pageAge: z6.string().nullable(),
1191
+ encryptedContent: z6.string(),
1192
+ type: z6.literal("web_search_result")
1178
1193
  })
1179
1194
  )
1180
1195
  )
1181
1196
  );
1182
- var webSearch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
1183
- () => (0, import_provider_utils6.zodSchema)(
1184
- import_v46.z.object({
1185
- query: import_v46.z.string()
1197
+ var webSearch_20260209InputSchema = lazySchema5(
1198
+ () => zodSchema5(
1199
+ z6.object({
1200
+ query: z6.string()
1186
1201
  })
1187
1202
  )
1188
1203
  );
1189
- var factory2 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1204
+ var factory2 = createProviderToolFactoryWithOutputSchema({
1190
1205
  id: "anthropic.web_search_20260209",
1191
1206
  inputSchema: webSearch_20260209InputSchema,
1192
1207
  outputSchema: webSearch_20260209OutputSchema,
@@ -1197,45 +1212,49 @@ var webSearch_20260209 = (args = {}) => {
1197
1212
  };
1198
1213
 
1199
1214
  // src/tool/web-search_20250305.ts
1200
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1201
- var import_v47 = require("zod/v4");
1202
- var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
1203
- () => (0, import_provider_utils7.zodSchema)(
1204
- import_v47.z.object({
1205
- maxUses: import_v47.z.number().optional(),
1206
- allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1207
- blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1208
- userLocation: import_v47.z.object({
1209
- type: import_v47.z.literal("approximate"),
1210
- city: import_v47.z.string().optional(),
1211
- region: import_v47.z.string().optional(),
1212
- country: import_v47.z.string().optional(),
1213
- timezone: import_v47.z.string().optional()
1215
+ import {
1216
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1217
+ lazySchema as lazySchema6,
1218
+ zodSchema as zodSchema6
1219
+ } from "@ai-sdk/provider-utils";
1220
+ import { z as z7 } from "zod/v4";
1221
+ var webSearch_20250305ArgsSchema = lazySchema6(
1222
+ () => zodSchema6(
1223
+ z7.object({
1224
+ maxUses: z7.number().optional(),
1225
+ allowedDomains: z7.array(z7.string()).optional(),
1226
+ blockedDomains: z7.array(z7.string()).optional(),
1227
+ userLocation: z7.object({
1228
+ type: z7.literal("approximate"),
1229
+ city: z7.string().optional(),
1230
+ region: z7.string().optional(),
1231
+ country: z7.string().optional(),
1232
+ timezone: z7.string().optional()
1214
1233
  }).optional()
1215
1234
  })
1216
1235
  )
1217
1236
  );
1218
- var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
1219
- () => (0, import_provider_utils7.zodSchema)(
1220
- import_v47.z.array(
1221
- import_v47.z.object({
1222
- url: import_v47.z.string(),
1223
- title: import_v47.z.string().nullable(),
1224
- pageAge: import_v47.z.string().nullable(),
1225
- encryptedContent: import_v47.z.string(),
1226
- type: import_v47.z.literal("web_search_result")
1237
+ var webSearch_20250305OutputSchema = lazySchema6(
1238
+ () => zodSchema6(
1239
+ z7.array(
1240
+ z7.object({
1241
+ url: z7.string(),
1242
+ title: z7.string().nullable(),
1243
+ pageAge: z7.string().nullable(),
1244
+ encryptedContent: z7.string(),
1245
+ type: z7.literal("web_search_result")
1227
1246
  })
1228
1247
  )
1229
1248
  )
1230
1249
  );
1231
- var webSearch_20250305InputSchema = (0, import_provider_utils7.lazySchema)(
1232
- () => (0, import_provider_utils7.zodSchema)(
1233
- import_v47.z.object({
1234
- query: import_v47.z.string()
1250
+ var webSearch_20250305InputSchema = lazySchema6(
1251
+ () => zodSchema6(
1252
+ z7.object({
1253
+ query: z7.string()
1235
1254
  })
1236
1255
  )
1237
1256
  );
1238
- var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1257
+ var factory3 = createProviderToolFactoryWithOutputSchema2({
1239
1258
  id: "anthropic.web_search_20250305",
1240
1259
  inputSchema: webSearch_20250305InputSchema,
1241
1260
  outputSchema: webSearch_20250305OutputSchema,
@@ -1246,53 +1265,57 @@ var webSearch_20250305 = (args = {}) => {
1246
1265
  };
1247
1266
 
1248
1267
  // src/tool/web-fetch-20260209.ts
1249
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1250
- var import_v48 = require("zod/v4");
1251
- var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
1252
- () => (0, import_provider_utils8.zodSchema)(
1253
- import_v48.z.object({
1254
- maxUses: import_v48.z.number().optional(),
1255
- allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1256
- blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1257
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1258
- maxContentTokens: import_v48.z.number().optional()
1268
+ import {
1269
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1270
+ lazySchema as lazySchema7,
1271
+ zodSchema as zodSchema7
1272
+ } from "@ai-sdk/provider-utils";
1273
+ import { z as z8 } from "zod/v4";
1274
+ var webFetch_20260209ArgsSchema = lazySchema7(
1275
+ () => zodSchema7(
1276
+ z8.object({
1277
+ maxUses: z8.number().optional(),
1278
+ allowedDomains: z8.array(z8.string()).optional(),
1279
+ blockedDomains: z8.array(z8.string()).optional(),
1280
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1281
+ maxContentTokens: z8.number().optional()
1259
1282
  })
1260
1283
  )
1261
1284
  );
1262
- var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
1263
- () => (0, import_provider_utils8.zodSchema)(
1264
- import_v48.z.object({
1265
- type: import_v48.z.literal("web_fetch_result"),
1266
- url: import_v48.z.string(),
1267
- content: import_v48.z.object({
1268
- type: import_v48.z.literal("document"),
1269
- title: import_v48.z.string().nullable(),
1270
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1271
- source: import_v48.z.union([
1272
- import_v48.z.object({
1273
- type: import_v48.z.literal("base64"),
1274
- mediaType: import_v48.z.literal("application/pdf"),
1275
- data: import_v48.z.string()
1285
+ var webFetch_20260209OutputSchema = lazySchema7(
1286
+ () => zodSchema7(
1287
+ z8.object({
1288
+ type: z8.literal("web_fetch_result"),
1289
+ url: z8.string(),
1290
+ content: z8.object({
1291
+ type: z8.literal("document"),
1292
+ title: z8.string().nullable(),
1293
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1294
+ source: z8.union([
1295
+ z8.object({
1296
+ type: z8.literal("base64"),
1297
+ mediaType: z8.literal("application/pdf"),
1298
+ data: z8.string()
1276
1299
  }),
1277
- import_v48.z.object({
1278
- type: import_v48.z.literal("text"),
1279
- mediaType: import_v48.z.literal("text/plain"),
1280
- data: import_v48.z.string()
1300
+ z8.object({
1301
+ type: z8.literal("text"),
1302
+ mediaType: z8.literal("text/plain"),
1303
+ data: z8.string()
1281
1304
  })
1282
1305
  ])
1283
1306
  }),
1284
- retrievedAt: import_v48.z.string().nullable()
1307
+ retrievedAt: z8.string().nullable()
1285
1308
  })
1286
1309
  )
1287
1310
  );
1288
- var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
1289
- () => (0, import_provider_utils8.zodSchema)(
1290
- import_v48.z.object({
1291
- url: import_v48.z.string()
1311
+ var webFetch_20260209InputSchema = lazySchema7(
1312
+ () => zodSchema7(
1313
+ z8.object({
1314
+ url: z8.string()
1292
1315
  })
1293
1316
  )
1294
1317
  );
1295
- var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1318
+ var factory4 = createProviderToolFactoryWithOutputSchema3({
1296
1319
  id: "anthropic.web_fetch_20260209",
1297
1320
  inputSchema: webFetch_20260209InputSchema,
1298
1321
  outputSchema: webFetch_20260209OutputSchema,
@@ -1303,53 +1326,57 @@ var webFetch_20260209 = (args = {}) => {
1303
1326
  };
1304
1327
 
1305
1328
  // src/tool/web-fetch-20250910.ts
1306
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1307
- var import_v49 = require("zod/v4");
1308
- var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
1309
- () => (0, import_provider_utils9.zodSchema)(
1310
- import_v49.z.object({
1311
- maxUses: import_v49.z.number().optional(),
1312
- allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1313
- blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1314
- citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1315
- maxContentTokens: import_v49.z.number().optional()
1329
+ import {
1330
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1331
+ lazySchema as lazySchema8,
1332
+ zodSchema as zodSchema8
1333
+ } from "@ai-sdk/provider-utils";
1334
+ import { z as z9 } from "zod/v4";
1335
+ var webFetch_20250910ArgsSchema = lazySchema8(
1336
+ () => zodSchema8(
1337
+ z9.object({
1338
+ maxUses: z9.number().optional(),
1339
+ allowedDomains: z9.array(z9.string()).optional(),
1340
+ blockedDomains: z9.array(z9.string()).optional(),
1341
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1342
+ maxContentTokens: z9.number().optional()
1316
1343
  })
1317
1344
  )
1318
1345
  );
1319
- var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
1320
- () => (0, import_provider_utils9.zodSchema)(
1321
- import_v49.z.object({
1322
- type: import_v49.z.literal("web_fetch_result"),
1323
- url: import_v49.z.string(),
1324
- content: import_v49.z.object({
1325
- type: import_v49.z.literal("document"),
1326
- title: import_v49.z.string().nullable(),
1327
- citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1328
- source: import_v49.z.union([
1329
- import_v49.z.object({
1330
- type: import_v49.z.literal("base64"),
1331
- mediaType: import_v49.z.literal("application/pdf"),
1332
- data: import_v49.z.string()
1346
+ var webFetch_20250910OutputSchema = lazySchema8(
1347
+ () => zodSchema8(
1348
+ z9.object({
1349
+ type: z9.literal("web_fetch_result"),
1350
+ url: z9.string(),
1351
+ content: z9.object({
1352
+ type: z9.literal("document"),
1353
+ title: z9.string().nullable(),
1354
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1355
+ source: z9.union([
1356
+ z9.object({
1357
+ type: z9.literal("base64"),
1358
+ mediaType: z9.literal("application/pdf"),
1359
+ data: z9.string()
1333
1360
  }),
1334
- import_v49.z.object({
1335
- type: import_v49.z.literal("text"),
1336
- mediaType: import_v49.z.literal("text/plain"),
1337
- data: import_v49.z.string()
1361
+ z9.object({
1362
+ type: z9.literal("text"),
1363
+ mediaType: z9.literal("text/plain"),
1364
+ data: z9.string()
1338
1365
  })
1339
1366
  ])
1340
1367
  }),
1341
- retrievedAt: import_v49.z.string().nullable()
1368
+ retrievedAt: z9.string().nullable()
1342
1369
  })
1343
1370
  )
1344
1371
  );
1345
- var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
1346
- () => (0, import_provider_utils9.zodSchema)(
1347
- import_v49.z.object({
1348
- url: import_v49.z.string()
1372
+ var webFetch_20250910InputSchema = lazySchema8(
1373
+ () => zodSchema8(
1374
+ z9.object({
1375
+ url: z9.string()
1349
1376
  })
1350
1377
  )
1351
1378
  );
1352
- var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1379
+ var factory5 = createProviderToolFactoryWithOutputSchema4({
1353
1380
  id: "anthropic.web_fetch_20250910",
1354
1381
  inputSchema: webFetch_20250910InputSchema,
1355
1382
  outputSchema: webFetch_20250910OutputSchema,
@@ -1360,7 +1387,7 @@ var webFetch_20250910 = (args = {}) => {
1360
1387
  };
1361
1388
 
1362
1389
  // src/anthropic-prepare-tools.ts
1363
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1390
+ import { validateTypes } from "@ai-sdk/provider-utils";
1364
1391
  async function prepareTools({
1365
1392
  tools,
1366
1393
  toolChoice,
@@ -1510,7 +1537,7 @@ async function prepareTools({
1510
1537
  break;
1511
1538
  }
1512
1539
  case "anthropic.text_editor_20250728": {
1513
- const args = await (0, import_provider_utils10.validateTypes)({
1540
+ const args = await validateTypes({
1514
1541
  value: tool.args,
1515
1542
  schema: textEditor_20250728ArgsSchema
1516
1543
  });
@@ -1550,7 +1577,7 @@ async function prepareTools({
1550
1577
  }
1551
1578
  case "anthropic.web_fetch_20250910": {
1552
1579
  betas.add("web-fetch-2025-09-10");
1553
- const args = await (0, import_provider_utils10.validateTypes)({
1580
+ const args = await validateTypes({
1554
1581
  value: tool.args,
1555
1582
  schema: webFetch_20250910ArgsSchema
1556
1583
  });
@@ -1568,7 +1595,7 @@ async function prepareTools({
1568
1595
  }
1569
1596
  case "anthropic.web_fetch_20260209": {
1570
1597
  betas.add("code-execution-web-tools-2026-02-09");
1571
- const args = await (0, import_provider_utils10.validateTypes)({
1598
+ const args = await validateTypes({
1572
1599
  value: tool.args,
1573
1600
  schema: webFetch_20260209ArgsSchema
1574
1601
  });
@@ -1585,7 +1612,7 @@ async function prepareTools({
1585
1612
  break;
1586
1613
  }
1587
1614
  case "anthropic.web_search_20250305": {
1588
- const args = await (0, import_provider_utils10.validateTypes)({
1615
+ const args = await validateTypes({
1589
1616
  value: tool.args,
1590
1617
  schema: webSearch_20250305ArgsSchema
1591
1618
  });
@@ -1602,7 +1629,7 @@ async function prepareTools({
1602
1629
  }
1603
1630
  case "anthropic.web_search_20260209": {
1604
1631
  betas.add("code-execution-web-tools-2026-02-09");
1605
- const args = await (0, import_provider_utils10.validateTypes)({
1632
+ const args = await validateTypes({
1606
1633
  value: tool.args,
1607
1634
  schema: webSearch_20260209ArgsSchema
1608
1635
  });
@@ -1695,7 +1722,7 @@ async function prepareTools({
1695
1722
  };
1696
1723
  default: {
1697
1724
  const _exhaustiveCheck = type;
1698
- throw new import_provider.UnsupportedFunctionalityError({
1725
+ throw new UnsupportedFunctionalityError({
1699
1726
  functionality: `tool choice type: ${_exhaustiveCheck}`
1700
1727
  });
1701
1728
  }
@@ -1743,36 +1770,50 @@ function convertAnthropicMessagesUsage({
1743
1770
  }
1744
1771
 
1745
1772
  // src/convert-to-anthropic-messages-prompt.ts
1746
- var import_provider2 = require("@ai-sdk/provider");
1747
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
1773
+ import {
1774
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1775
+ } from "@ai-sdk/provider";
1776
+ import {
1777
+ convertBase64ToUint8Array as convertBase64ToUint8Array2,
1778
+ convertToBase64,
1779
+ isProviderReference,
1780
+ parseProviderOptions,
1781
+ resolveProviderReference,
1782
+ validateTypes as validateTypes2,
1783
+ isNonNullable
1784
+ } from "@ai-sdk/provider-utils";
1748
1785
 
1749
1786
  // src/tool/code-execution_20250522.ts
1750
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1751
- var import_v410 = require("zod/v4");
1752
- var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
1753
- () => (0, import_provider_utils11.zodSchema)(
1754
- import_v410.z.object({
1755
- type: import_v410.z.literal("code_execution_result"),
1756
- stdout: import_v410.z.string(),
1757
- stderr: import_v410.z.string(),
1758
- return_code: import_v410.z.number(),
1759
- content: import_v410.z.array(
1760
- import_v410.z.object({
1761
- type: import_v410.z.literal("code_execution_output"),
1762
- file_id: import_v410.z.string()
1787
+ import {
1788
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1789
+ lazySchema as lazySchema9,
1790
+ zodSchema as zodSchema9
1791
+ } from "@ai-sdk/provider-utils";
1792
+ import { z as z10 } from "zod/v4";
1793
+ var codeExecution_20250522OutputSchema = lazySchema9(
1794
+ () => zodSchema9(
1795
+ z10.object({
1796
+ type: z10.literal("code_execution_result"),
1797
+ stdout: z10.string(),
1798
+ stderr: z10.string(),
1799
+ return_code: z10.number(),
1800
+ content: z10.array(
1801
+ z10.object({
1802
+ type: z10.literal("code_execution_output"),
1803
+ file_id: z10.string()
1763
1804
  })
1764
1805
  ).optional().default([])
1765
1806
  })
1766
1807
  )
1767
1808
  );
1768
- var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
1769
- () => (0, import_provider_utils11.zodSchema)(
1770
- import_v410.z.object({
1771
- code: import_v410.z.string()
1809
+ var codeExecution_20250522InputSchema = lazySchema9(
1810
+ () => zodSchema9(
1811
+ z10.object({
1812
+ code: z10.string()
1772
1813
  })
1773
1814
  )
1774
1815
  );
1775
- var factory6 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1816
+ var factory6 = createProviderToolFactoryWithOutputSchema5({
1776
1817
  id: "anthropic.code_execution_20250522",
1777
1818
  inputSchema: codeExecution_20250522InputSchema,
1778
1819
  outputSchema: codeExecution_20250522OutputSchema
@@ -1782,102 +1823,106 @@ var codeExecution_20250522 = (args = {}) => {
1782
1823
  };
1783
1824
 
1784
1825
  // src/tool/code-execution_20250825.ts
1785
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1786
- var import_v411 = require("zod/v4");
1787
- var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
1788
- () => (0, import_provider_utils12.zodSchema)(
1789
- import_v411.z.discriminatedUnion("type", [
1790
- import_v411.z.object({
1791
- type: import_v411.z.literal("code_execution_result"),
1792
- stdout: import_v411.z.string(),
1793
- stderr: import_v411.z.string(),
1794
- return_code: import_v411.z.number(),
1795
- content: import_v411.z.array(
1796
- import_v411.z.object({
1797
- type: import_v411.z.literal("code_execution_output"),
1798
- file_id: import_v411.z.string()
1826
+ import {
1827
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1828
+ lazySchema as lazySchema10,
1829
+ zodSchema as zodSchema10
1830
+ } from "@ai-sdk/provider-utils";
1831
+ import { z as z11 } from "zod/v4";
1832
+ var codeExecution_20250825OutputSchema = lazySchema10(
1833
+ () => zodSchema10(
1834
+ z11.discriminatedUnion("type", [
1835
+ z11.object({
1836
+ type: z11.literal("code_execution_result"),
1837
+ stdout: z11.string(),
1838
+ stderr: z11.string(),
1839
+ return_code: z11.number(),
1840
+ content: z11.array(
1841
+ z11.object({
1842
+ type: z11.literal("code_execution_output"),
1843
+ file_id: z11.string()
1799
1844
  })
1800
1845
  ).optional().default([])
1801
1846
  }),
1802
- import_v411.z.object({
1803
- type: import_v411.z.literal("bash_code_execution_result"),
1804
- content: import_v411.z.array(
1805
- import_v411.z.object({
1806
- type: import_v411.z.literal("bash_code_execution_output"),
1807
- file_id: import_v411.z.string()
1847
+ z11.object({
1848
+ type: z11.literal("bash_code_execution_result"),
1849
+ content: z11.array(
1850
+ z11.object({
1851
+ type: z11.literal("bash_code_execution_output"),
1852
+ file_id: z11.string()
1808
1853
  })
1809
1854
  ),
1810
- stdout: import_v411.z.string(),
1811
- stderr: import_v411.z.string(),
1812
- return_code: import_v411.z.number()
1855
+ stdout: z11.string(),
1856
+ stderr: z11.string(),
1857
+ return_code: z11.number()
1813
1858
  }),
1814
- import_v411.z.object({
1815
- type: import_v411.z.literal("bash_code_execution_tool_result_error"),
1816
- error_code: import_v411.z.string()
1859
+ z11.object({
1860
+ type: z11.literal("bash_code_execution_tool_result_error"),
1861
+ error_code: z11.string()
1817
1862
  }),
1818
- import_v411.z.object({
1819
- type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
1820
- error_code: import_v411.z.string()
1863
+ z11.object({
1864
+ type: z11.literal("text_editor_code_execution_tool_result_error"),
1865
+ error_code: z11.string()
1821
1866
  }),
1822
- import_v411.z.object({
1823
- type: import_v411.z.literal("text_editor_code_execution_view_result"),
1824
- content: import_v411.z.string(),
1825
- file_type: import_v411.z.string(),
1826
- num_lines: import_v411.z.number().nullable(),
1827
- start_line: import_v411.z.number().nullable(),
1828
- total_lines: import_v411.z.number().nullable()
1867
+ z11.object({
1868
+ type: z11.literal("text_editor_code_execution_view_result"),
1869
+ content: z11.string(),
1870
+ file_type: z11.string(),
1871
+ num_lines: z11.number().nullable(),
1872
+ start_line: z11.number().nullable(),
1873
+ total_lines: z11.number().nullable()
1829
1874
  }),
1830
- import_v411.z.object({
1831
- type: import_v411.z.literal("text_editor_code_execution_create_result"),
1832
- is_file_update: import_v411.z.boolean()
1875
+ z11.object({
1876
+ type: z11.literal("text_editor_code_execution_create_result"),
1877
+ is_file_update: z11.boolean()
1833
1878
  }),
1834
- import_v411.z.object({
1835
- type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
1836
- lines: import_v411.z.array(import_v411.z.string()).nullable(),
1837
- new_lines: import_v411.z.number().nullable(),
1838
- new_start: import_v411.z.number().nullable(),
1839
- old_lines: import_v411.z.number().nullable(),
1840
- old_start: import_v411.z.number().nullable()
1879
+ z11.object({
1880
+ type: z11.literal("text_editor_code_execution_str_replace_result"),
1881
+ lines: z11.array(z11.string()).nullable(),
1882
+ new_lines: z11.number().nullable(),
1883
+ new_start: z11.number().nullable(),
1884
+ old_lines: z11.number().nullable(),
1885
+ old_start: z11.number().nullable()
1841
1886
  })
1842
1887
  ])
1843
1888
  )
1844
1889
  );
1845
- var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
1846
- () => (0, import_provider_utils12.zodSchema)(
1847
- import_v411.z.discriminatedUnion("type", [
1890
+ var codeExecution_20250825InputSchema = lazySchema10(
1891
+ () => zodSchema10(
1892
+ z11.discriminatedUnion("type", [
1848
1893
  // Programmatic tool calling format (mapped from { code } by AI SDK)
1849
- import_v411.z.object({
1850
- type: import_v411.z.literal("programmatic-tool-call"),
1851
- code: import_v411.z.string()
1894
+ z11.object({
1895
+ type: z11.literal("programmatic-tool-call"),
1896
+ code: z11.string()
1852
1897
  }),
1853
- import_v411.z.object({
1854
- type: import_v411.z.literal("bash_code_execution"),
1855
- command: import_v411.z.string()
1898
+ z11.object({
1899
+ type: z11.literal("bash_code_execution"),
1900
+ command: z11.string()
1856
1901
  }),
1857
- import_v411.z.discriminatedUnion("command", [
1858
- import_v411.z.object({
1859
- type: import_v411.z.literal("text_editor_code_execution"),
1860
- command: import_v411.z.literal("view"),
1861
- path: import_v411.z.string()
1902
+ z11.discriminatedUnion("command", [
1903
+ z11.object({
1904
+ type: z11.literal("text_editor_code_execution"),
1905
+ command: z11.literal("view"),
1906
+ path: z11.string()
1862
1907
  }),
1863
- import_v411.z.object({
1864
- type: import_v411.z.literal("text_editor_code_execution"),
1865
- command: import_v411.z.literal("create"),
1866
- path: import_v411.z.string(),
1867
- file_text: import_v411.z.string().nullish()
1908
+ z11.object({
1909
+ type: z11.literal("text_editor_code_execution"),
1910
+ command: z11.literal("create"),
1911
+ path: z11.string(),
1912
+ file_text: z11.string().nullish()
1868
1913
  }),
1869
- import_v411.z.object({
1870
- type: import_v411.z.literal("text_editor_code_execution"),
1871
- command: import_v411.z.literal("str_replace"),
1872
- path: import_v411.z.string(),
1873
- old_str: import_v411.z.string(),
1874
- new_str: import_v411.z.string()
1914
+ z11.object({
1915
+ type: z11.literal("text_editor_code_execution"),
1916
+ command: z11.literal("str_replace"),
1917
+ path: z11.string(),
1918
+ old_str: z11.string(),
1919
+ new_str: z11.string()
1875
1920
  })
1876
1921
  ])
1877
1922
  ])
1878
1923
  )
1879
1924
  );
1880
- var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1925
+ var factory7 = createProviderToolFactoryWithOutputSchema6({
1881
1926
  id: "anthropic.code_execution_20250825",
1882
1927
  inputSchema: codeExecution_20250825InputSchema,
1883
1928
  outputSchema: codeExecution_20250825OutputSchema,
@@ -1891,113 +1936,117 @@ var codeExecution_20250825 = (args = {}) => {
1891
1936
  };
1892
1937
 
1893
1938
  // src/tool/code-execution_20260120.ts
1894
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1895
- var import_v412 = require("zod/v4");
1896
- var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
1897
- () => (0, import_provider_utils13.zodSchema)(
1898
- import_v412.z.discriminatedUnion("type", [
1899
- import_v412.z.object({
1900
- type: import_v412.z.literal("code_execution_result"),
1901
- stdout: import_v412.z.string(),
1902
- stderr: import_v412.z.string(),
1903
- return_code: import_v412.z.number(),
1904
- content: import_v412.z.array(
1905
- import_v412.z.object({
1906
- type: import_v412.z.literal("code_execution_output"),
1907
- file_id: import_v412.z.string()
1939
+ import {
1940
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
1941
+ lazySchema as lazySchema11,
1942
+ zodSchema as zodSchema11
1943
+ } from "@ai-sdk/provider-utils";
1944
+ import { z as z12 } from "zod/v4";
1945
+ var codeExecution_20260120OutputSchema = lazySchema11(
1946
+ () => zodSchema11(
1947
+ z12.discriminatedUnion("type", [
1948
+ z12.object({
1949
+ type: z12.literal("code_execution_result"),
1950
+ stdout: z12.string(),
1951
+ stderr: z12.string(),
1952
+ return_code: z12.number(),
1953
+ content: z12.array(
1954
+ z12.object({
1955
+ type: z12.literal("code_execution_output"),
1956
+ file_id: z12.string()
1908
1957
  })
1909
1958
  ).optional().default([])
1910
1959
  }),
1911
- import_v412.z.object({
1912
- type: import_v412.z.literal("encrypted_code_execution_result"),
1913
- encrypted_stdout: import_v412.z.string(),
1914
- stderr: import_v412.z.string(),
1915
- return_code: import_v412.z.number(),
1916
- content: import_v412.z.array(
1917
- import_v412.z.object({
1918
- type: import_v412.z.literal("code_execution_output"),
1919
- file_id: import_v412.z.string()
1960
+ z12.object({
1961
+ type: z12.literal("encrypted_code_execution_result"),
1962
+ encrypted_stdout: z12.string(),
1963
+ stderr: z12.string(),
1964
+ return_code: z12.number(),
1965
+ content: z12.array(
1966
+ z12.object({
1967
+ type: z12.literal("code_execution_output"),
1968
+ file_id: z12.string()
1920
1969
  })
1921
1970
  ).optional().default([])
1922
1971
  }),
1923
- import_v412.z.object({
1924
- type: import_v412.z.literal("bash_code_execution_result"),
1925
- content: import_v412.z.array(
1926
- import_v412.z.object({
1927
- type: import_v412.z.literal("bash_code_execution_output"),
1928
- file_id: import_v412.z.string()
1972
+ z12.object({
1973
+ type: z12.literal("bash_code_execution_result"),
1974
+ content: z12.array(
1975
+ z12.object({
1976
+ type: z12.literal("bash_code_execution_output"),
1977
+ file_id: z12.string()
1929
1978
  })
1930
1979
  ),
1931
- stdout: import_v412.z.string(),
1932
- stderr: import_v412.z.string(),
1933
- return_code: import_v412.z.number()
1980
+ stdout: z12.string(),
1981
+ stderr: z12.string(),
1982
+ return_code: z12.number()
1934
1983
  }),
1935
- import_v412.z.object({
1936
- type: import_v412.z.literal("bash_code_execution_tool_result_error"),
1937
- error_code: import_v412.z.string()
1984
+ z12.object({
1985
+ type: z12.literal("bash_code_execution_tool_result_error"),
1986
+ error_code: z12.string()
1938
1987
  }),
1939
- import_v412.z.object({
1940
- type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
1941
- error_code: import_v412.z.string()
1988
+ z12.object({
1989
+ type: z12.literal("text_editor_code_execution_tool_result_error"),
1990
+ error_code: z12.string()
1942
1991
  }),
1943
- import_v412.z.object({
1944
- type: import_v412.z.literal("text_editor_code_execution_view_result"),
1945
- content: import_v412.z.string(),
1946
- file_type: import_v412.z.string(),
1947
- num_lines: import_v412.z.number().nullable(),
1948
- start_line: import_v412.z.number().nullable(),
1949
- total_lines: import_v412.z.number().nullable()
1992
+ z12.object({
1993
+ type: z12.literal("text_editor_code_execution_view_result"),
1994
+ content: z12.string(),
1995
+ file_type: z12.string(),
1996
+ num_lines: z12.number().nullable(),
1997
+ start_line: z12.number().nullable(),
1998
+ total_lines: z12.number().nullable()
1950
1999
  }),
1951
- import_v412.z.object({
1952
- type: import_v412.z.literal("text_editor_code_execution_create_result"),
1953
- is_file_update: import_v412.z.boolean()
2000
+ z12.object({
2001
+ type: z12.literal("text_editor_code_execution_create_result"),
2002
+ is_file_update: z12.boolean()
1954
2003
  }),
1955
- import_v412.z.object({
1956
- type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
1957
- lines: import_v412.z.array(import_v412.z.string()).nullable(),
1958
- new_lines: import_v412.z.number().nullable(),
1959
- new_start: import_v412.z.number().nullable(),
1960
- old_lines: import_v412.z.number().nullable(),
1961
- old_start: import_v412.z.number().nullable()
2004
+ z12.object({
2005
+ type: z12.literal("text_editor_code_execution_str_replace_result"),
2006
+ lines: z12.array(z12.string()).nullable(),
2007
+ new_lines: z12.number().nullable(),
2008
+ new_start: z12.number().nullable(),
2009
+ old_lines: z12.number().nullable(),
2010
+ old_start: z12.number().nullable()
1962
2011
  })
1963
2012
  ])
1964
2013
  )
1965
2014
  );
1966
- var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
1967
- () => (0, import_provider_utils13.zodSchema)(
1968
- import_v412.z.discriminatedUnion("type", [
1969
- import_v412.z.object({
1970
- type: import_v412.z.literal("programmatic-tool-call"),
1971
- code: import_v412.z.string()
2015
+ var codeExecution_20260120InputSchema = lazySchema11(
2016
+ () => zodSchema11(
2017
+ z12.discriminatedUnion("type", [
2018
+ z12.object({
2019
+ type: z12.literal("programmatic-tool-call"),
2020
+ code: z12.string()
1972
2021
  }),
1973
- import_v412.z.object({
1974
- type: import_v412.z.literal("bash_code_execution"),
1975
- command: import_v412.z.string()
2022
+ z12.object({
2023
+ type: z12.literal("bash_code_execution"),
2024
+ command: z12.string()
1976
2025
  }),
1977
- import_v412.z.discriminatedUnion("command", [
1978
- import_v412.z.object({
1979
- type: import_v412.z.literal("text_editor_code_execution"),
1980
- command: import_v412.z.literal("view"),
1981
- path: import_v412.z.string()
2026
+ z12.discriminatedUnion("command", [
2027
+ z12.object({
2028
+ type: z12.literal("text_editor_code_execution"),
2029
+ command: z12.literal("view"),
2030
+ path: z12.string()
1982
2031
  }),
1983
- import_v412.z.object({
1984
- type: import_v412.z.literal("text_editor_code_execution"),
1985
- command: import_v412.z.literal("create"),
1986
- path: import_v412.z.string(),
1987
- file_text: import_v412.z.string().nullish()
2032
+ z12.object({
2033
+ type: z12.literal("text_editor_code_execution"),
2034
+ command: z12.literal("create"),
2035
+ path: z12.string(),
2036
+ file_text: z12.string().nullish()
1988
2037
  }),
1989
- import_v412.z.object({
1990
- type: import_v412.z.literal("text_editor_code_execution"),
1991
- command: import_v412.z.literal("str_replace"),
1992
- path: import_v412.z.string(),
1993
- old_str: import_v412.z.string(),
1994
- new_str: import_v412.z.string()
2038
+ z12.object({
2039
+ type: z12.literal("text_editor_code_execution"),
2040
+ command: z12.literal("str_replace"),
2041
+ path: z12.string(),
2042
+ old_str: z12.string(),
2043
+ new_str: z12.string()
1995
2044
  })
1996
2045
  ])
1997
2046
  ])
1998
2047
  )
1999
2048
  );
2000
- var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2049
+ var factory8 = createProviderToolFactoryWithOutputSchema7({
2001
2050
  id: "anthropic.code_execution_20260120",
2002
2051
  inputSchema: codeExecution_20260120InputSchema,
2003
2052
  outputSchema: codeExecution_20260120OutputSchema,
@@ -2008,21 +2057,25 @@ var codeExecution_20260120 = (args = {}) => {
2008
2057
  };
2009
2058
 
2010
2059
  // src/tool/tool-search-regex_20251119.ts
2011
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2012
- var import_v413 = require("zod/v4");
2013
- var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
2014
- () => (0, import_provider_utils14.zodSchema)(
2015
- import_v413.z.array(
2016
- import_v413.z.object({
2017
- type: import_v413.z.literal("tool_reference"),
2018
- toolName: import_v413.z.string()
2060
+ import {
2061
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2062
+ lazySchema as lazySchema12,
2063
+ zodSchema as zodSchema12
2064
+ } from "@ai-sdk/provider-utils";
2065
+ import { z as z13 } from "zod/v4";
2066
+ var toolSearchRegex_20251119OutputSchema = lazySchema12(
2067
+ () => zodSchema12(
2068
+ z13.array(
2069
+ z13.object({
2070
+ type: z13.literal("tool_reference"),
2071
+ toolName: z13.string()
2019
2072
  })
2020
2073
  )
2021
2074
  )
2022
2075
  );
2023
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
2024
- () => (0, import_provider_utils14.zodSchema)(
2025
- import_v413.z.object({
2076
+ var toolSearchRegex_20251119InputSchema = lazySchema12(
2077
+ () => zodSchema12(
2078
+ z13.object({
2026
2079
  /**
2027
2080
  * A regex pattern to search for tools.
2028
2081
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -2033,15 +2086,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
2033
2086
  * - "database.*query|query.*database" - OR patterns for flexibility
2034
2087
  * - "(?i)slack" - case-insensitive search
2035
2088
  */
2036
- pattern: import_v413.z.string(),
2089
+ pattern: z13.string(),
2037
2090
  /**
2038
2091
  * Maximum number of tools to return. Optional.
2039
2092
  */
2040
- limit: import_v413.z.number().optional()
2093
+ limit: z13.number().optional()
2041
2094
  })
2042
2095
  )
2043
2096
  );
2044
- var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
2097
+ var factory9 = createProviderToolFactoryWithOutputSchema8({
2045
2098
  id: "anthropic.tool_search_regex_20251119",
2046
2099
  inputSchema: toolSearchRegex_20251119InputSchema,
2047
2100
  outputSchema: toolSearchRegex_20251119OutputSchema,
@@ -2054,17 +2107,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
2054
2107
  // src/convert-to-anthropic-messages-prompt.ts
2055
2108
  function convertToString(data) {
2056
2109
  if (typeof data === "string") {
2057
- return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
2110
+ return new TextDecoder().decode(convertBase64ToUint8Array2(data));
2058
2111
  }
2059
2112
  if (data instanceof Uint8Array) {
2060
2113
  return new TextDecoder().decode(data);
2061
2114
  }
2062
2115
  if (data instanceof URL) {
2063
- throw new import_provider2.UnsupportedFunctionalityError({
2116
+ throw new UnsupportedFunctionalityError2({
2064
2117
  functionality: "URL-based text documents are not supported for citations"
2065
2118
  });
2066
2119
  }
2067
- throw new import_provider2.UnsupportedFunctionalityError({
2120
+ throw new UnsupportedFunctionalityError2({
2068
2121
  functionality: `unsupported data type for text documents: ${typeof data}`
2069
2122
  });
2070
2123
  }
@@ -2092,7 +2145,7 @@ async function convertToAnthropicMessagesPrompt({
2092
2145
  const messages = [];
2093
2146
  async function shouldEnableCitations(providerMetadata) {
2094
2147
  var _a2, _b2;
2095
- const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
2148
+ const anthropicOptions = await parseProviderOptions({
2096
2149
  provider: "anthropic",
2097
2150
  providerOptions: providerMetadata,
2098
2151
  schema: anthropicFilePartProviderOptions
@@ -2100,7 +2153,7 @@ async function convertToAnthropicMessagesPrompt({
2100
2153
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
2101
2154
  }
2102
2155
  async function getDocumentMetadata(providerMetadata) {
2103
- const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
2156
+ const anthropicOptions = await parseProviderOptions({
2104
2157
  provider: "anthropic",
2105
2158
  providerOptions: providerMetadata,
2106
2159
  schema: anthropicFilePartProviderOptions
@@ -2117,7 +2170,7 @@ async function convertToAnthropicMessagesPrompt({
2117
2170
  switch (type) {
2118
2171
  case "system": {
2119
2172
  if (system != null) {
2120
- throw new import_provider2.UnsupportedFunctionalityError({
2173
+ throw new UnsupportedFunctionalityError2({
2121
2174
  functionality: "Multiple system messages that are separated by user/assistant messages"
2122
2175
  });
2123
2176
  }
@@ -2157,8 +2210,8 @@ async function convertToAnthropicMessagesPrompt({
2157
2210
  break;
2158
2211
  }
2159
2212
  case "file": {
2160
- if ((0, import_provider_utils15.isProviderReference)(part.data)) {
2161
- const fileId = (0, import_provider_utils15.resolveProviderReference)({
2213
+ if (isProviderReference(part.data)) {
2214
+ const fileId = resolveProviderReference({
2162
2215
  reference: part.data,
2163
2216
  provider: "anthropic"
2164
2217
  });
@@ -2185,7 +2238,7 @@ async function convertToAnthropicMessagesPrompt({
2185
2238
  } : {
2186
2239
  type: "base64",
2187
2240
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2188
- data: (0, import_provider_utils15.convertToBase64)(part.data)
2241
+ data: convertToBase64(part.data)
2189
2242
  },
2190
2243
  cache_control: cacheControl
2191
2244
  });
@@ -2205,7 +2258,7 @@ async function convertToAnthropicMessagesPrompt({
2205
2258
  } : {
2206
2259
  type: "base64",
2207
2260
  media_type: "application/pdf",
2208
- data: (0, import_provider_utils15.convertToBase64)(part.data)
2261
+ data: convertToBase64(part.data)
2209
2262
  },
2210
2263
  title: (_b = metadata.title) != null ? _b : part.filename,
2211
2264
  ...metadata.context && { context: metadata.context },
@@ -2239,7 +2292,7 @@ async function convertToAnthropicMessagesPrompt({
2239
2292
  cache_control: cacheControl
2240
2293
  });
2241
2294
  } else {
2242
- throw new import_provider2.UnsupportedFunctionalityError({
2295
+ throw new UnsupportedFunctionalityError2({
2243
2296
  functionality: `media type: ${part.mediaType}`
2244
2297
  });
2245
2298
  }
@@ -2275,26 +2328,16 @@ async function convertToAnthropicMessagesPrompt({
2275
2328
  type: "text",
2276
2329
  text: contentPart.text
2277
2330
  };
2278
- case "image-data": {
2279
- return {
2280
- type: "image",
2281
- source: {
2282
- type: "base64",
2283
- media_type: contentPart.mediaType,
2284
- data: contentPart.data
2285
- }
2286
- };
2287
- }
2288
- case "image-url": {
2289
- return {
2290
- type: "image",
2291
- source: {
2292
- type: "url",
2293
- url: contentPart.url
2294
- }
2295
- };
2296
- }
2297
2331
  case "file-url": {
2332
+ if (contentPart.mediaType.startsWith("image/")) {
2333
+ return {
2334
+ type: "image",
2335
+ source: {
2336
+ type: "url",
2337
+ url: contentPart.url
2338
+ }
2339
+ };
2340
+ }
2298
2341
  return {
2299
2342
  type: "document",
2300
2343
  source: {
@@ -2304,6 +2347,16 @@ async function convertToAnthropicMessagesPrompt({
2304
2347
  };
2305
2348
  }
2306
2349
  case "file-data": {
2350
+ if (contentPart.mediaType.startsWith("image/")) {
2351
+ return {
2352
+ type: "image",
2353
+ source: {
2354
+ type: "base64",
2355
+ media_type: contentPart.mediaType,
2356
+ data: contentPart.data
2357
+ }
2358
+ };
2359
+ }
2307
2360
  if (contentPart.mediaType === "application/pdf") {
2308
2361
  betas.add("pdfs-2024-09-25");
2309
2362
  return {
@@ -2343,7 +2396,7 @@ async function convertToAnthropicMessagesPrompt({
2343
2396
  return void 0;
2344
2397
  }
2345
2398
  }
2346
- }).filter(import_provider_utils15.isNonNullable);
2399
+ }).filter(isNonNullable);
2347
2400
  break;
2348
2401
  case "text":
2349
2402
  case "error-text":
@@ -2419,7 +2472,7 @@ async function convertToAnthropicMessagesPrompt({
2419
2472
  }
2420
2473
  case "reasoning": {
2421
2474
  if (sendReasoning) {
2422
- const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
2475
+ const reasoningMetadata = await parseProviderOptions({
2423
2476
  provider: "anthropic",
2424
2477
  providerOptions: part.providerOptions,
2425
2478
  schema: anthropicReasoningMetadataSchema
@@ -2625,7 +2678,7 @@ async function convertToAnthropicMessagesPrompt({
2625
2678
  break;
2626
2679
  }
2627
2680
  if (output.value.type === "code_execution_result") {
2628
- const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2681
+ const codeExecutionOutput = await validateTypes2({
2629
2682
  value: output.value,
2630
2683
  schema: codeExecution_20250522OutputSchema
2631
2684
  });
@@ -2642,7 +2695,7 @@ async function convertToAnthropicMessagesPrompt({
2642
2695
  cache_control: cacheControl
2643
2696
  });
2644
2697
  } else if (output.value.type === "encrypted_code_execution_result") {
2645
- const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2698
+ const codeExecutionOutput = await validateTypes2({
2646
2699
  value: output.value,
2647
2700
  schema: codeExecution_20260120OutputSchema
2648
2701
  });
@@ -2661,7 +2714,7 @@ async function convertToAnthropicMessagesPrompt({
2661
2714
  });
2662
2715
  }
2663
2716
  } else {
2664
- const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2717
+ const codeExecutionOutput = await validateTypes2({
2665
2718
  value: output.value,
2666
2719
  schema: codeExecution_20250825OutputSchema
2667
2720
  });
@@ -2730,7 +2783,7 @@ async function convertToAnthropicMessagesPrompt({
2730
2783
  });
2731
2784
  break;
2732
2785
  }
2733
- const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
2786
+ const webFetchOutput = await validateTypes2({
2734
2787
  value: output.value,
2735
2788
  schema: webFetch_20250910OutputSchema
2736
2789
  });
@@ -2765,7 +2818,7 @@ async function convertToAnthropicMessagesPrompt({
2765
2818
  });
2766
2819
  break;
2767
2820
  }
2768
- const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
2821
+ const webSearchOutput = await validateTypes2({
2769
2822
  value: output.value,
2770
2823
  schema: webSearch_20250305OutputSchema
2771
2824
  });
@@ -2792,7 +2845,7 @@ async function convertToAnthropicMessagesPrompt({
2792
2845
  });
2793
2846
  break;
2794
2847
  }
2795
- const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
2848
+ const toolSearchOutput = await validateTypes2({
2796
2849
  value: output.value,
2797
2850
  schema: toolSearchRegex_20251119OutputSchema
2798
2851
  });
@@ -2950,13 +3003,22 @@ function createCitationSource(citation, citationDocuments, generateId3) {
2950
3003
  }
2951
3004
  };
2952
3005
  }
2953
- var AnthropicMessagesLanguageModel = class {
3006
+ var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
2954
3007
  constructor(modelId, config) {
2955
3008
  this.specificationVersion = "v4";
2956
3009
  var _a;
2957
3010
  this.modelId = modelId;
2958
3011
  this.config = config;
2959
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
3012
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
3013
+ }
3014
+ static [WORKFLOW_SERIALIZE](model) {
3015
+ return serializeModelOptions({
3016
+ modelId: model.modelId,
3017
+ config: model.config
3018
+ });
3019
+ }
3020
+ static [WORKFLOW_DESERIALIZE](options) {
3021
+ return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
2960
3022
  }
2961
3023
  supportsUrl(url) {
2962
3024
  return url.protocol === "https:";
@@ -3031,12 +3093,12 @@ var AnthropicMessagesLanguageModel = class {
3031
3093
  }
3032
3094
  }
3033
3095
  const providerOptionsName = this.providerOptionsName;
3034
- const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
3096
+ const canonicalOptions = await parseProviderOptions2({
3035
3097
  provider: "anthropic",
3036
3098
  providerOptions,
3037
3099
  schema: anthropicLanguageModelOptions
3038
3100
  });
3039
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
3101
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
3040
3102
  provider: providerOptionsName,
3041
3103
  providerOptions,
3042
3104
  schema: anthropicLanguageModelOptions
@@ -3066,7 +3128,7 @@ var AnthropicMessagesLanguageModel = class {
3066
3128
  } : void 0;
3067
3129
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
3068
3130
  const cacheControlValidator = new CacheControlValidator();
3069
- const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
3131
+ const toolNameMapping = createToolNameMapping({
3070
3132
  tools,
3071
3133
  providerToolNames: {
3072
3134
  "anthropic.code_execution_20250522": "code_execution",
@@ -3096,7 +3158,7 @@ var AnthropicMessagesLanguageModel = class {
3096
3158
  cacheControlValidator,
3097
3159
  toolNameMapping
3098
3160
  });
3099
- if ((0, import_provider_utils16.isCustomReasoning)(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3161
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3100
3162
  const reasoningConfig = resolveAnthropicReasoningConfig({
3101
3163
  reasoning,
3102
3164
  supportsAdaptiveThinking,
@@ -3176,7 +3238,7 @@ var AnthropicMessagesLanguageModel = class {
3176
3238
  id: anthropicOptions.container.id,
3177
3239
  skills: anthropicOptions.container.skills.map((skill) => ({
3178
3240
  type: skill.type,
3179
- skill_id: skill.type === "custom" ? (0, import_provider_utils16.resolveProviderReference)({
3241
+ skill_id: skill.type === "custom" ? resolveProviderReference2({
3180
3242
  reference: skill.providerReference,
3181
3243
  provider: "anthropic"
3182
3244
  }) : skill.skillId,
@@ -3379,16 +3441,16 @@ var AnthropicMessagesLanguageModel = class {
3379
3441
  betas,
3380
3442
  headers
3381
3443
  }) {
3382
- return (0, import_provider_utils16.combineHeaders)(
3383
- await (0, import_provider_utils16.resolve)(this.config.headers),
3444
+ return combineHeaders2(
3445
+ this.config.headers ? await resolve(this.config.headers) : void 0,
3384
3446
  headers,
3385
3447
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3386
3448
  );
3387
3449
  }
3388
3450
  async getBetasFromHeaders(requestHeaders) {
3389
3451
  var _a, _b;
3390
- const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3391
- const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3452
+ const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
3453
+ const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
3392
3454
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3393
3455
  return new Set(
3394
3456
  [
@@ -3453,12 +3515,12 @@ var AnthropicMessagesLanguageModel = class {
3453
3515
  responseHeaders,
3454
3516
  value: response,
3455
3517
  rawValue: rawResponse
3456
- } = await (0, import_provider_utils16.postJsonToApi)({
3518
+ } = await postJsonToApi({
3457
3519
  url: this.buildRequestUrl(false),
3458
3520
  headers: await this.getHeaders({ betas, headers: options.headers }),
3459
3521
  body: this.transformRequestBody(args, betas),
3460
3522
  failedResponseHandler: anthropicFailedResponseHandler,
3461
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3523
+ successfulResponseHandler: createJsonResponseHandler2(
3462
3524
  anthropicMessagesResponseSchema
3463
3525
  ),
3464
3526
  abortSignal: options.abortSignal,
@@ -3852,6 +3914,7 @@ var AnthropicMessagesLanguageModel = class {
3852
3914
  };
3853
3915
  }
3854
3916
  async doStream(options) {
3917
+ "use step";
3855
3918
  var _a, _b;
3856
3919
  const {
3857
3920
  args: body,
@@ -3873,12 +3936,12 @@ var AnthropicMessagesLanguageModel = class {
3873
3936
  body.tools
3874
3937
  );
3875
3938
  const url = this.buildRequestUrl(true);
3876
- const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
3939
+ const { responseHeaders, value: response } = await postJsonToApi({
3877
3940
  url,
3878
3941
  headers: await this.getHeaders({ betas, headers: options.headers }),
3879
3942
  body: this.transformRequestBody(body, betas),
3880
3943
  failedResponseHandler: anthropicFailedResponseHandler,
3881
- successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
3944
+ successfulResponseHandler: createEventSourceResponseHandler(
3882
3945
  anthropicMessagesChunkSchema
3883
3946
  ),
3884
3947
  abortSignal: options.abortSignal,
@@ -4603,7 +4666,7 @@ var AnthropicMessagesLanguageModel = class {
4603
4666
  }
4604
4667
  if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
4605
4668
  const error = result.value.error;
4606
- throw new import_provider3.APICallError({
4669
+ throw new APICallError({
4607
4670
  message: error.message,
4608
4671
  url,
4609
4672
  requestBodyValues: body,
@@ -4701,14 +4764,14 @@ function resolveAnthropicReasoningConfig({
4701
4764
  maxOutputTokensForModel,
4702
4765
  warnings
4703
4766
  }) {
4704
- if (!(0, import_provider_utils16.isCustomReasoning)(reasoning)) {
4767
+ if (!isCustomReasoning(reasoning)) {
4705
4768
  return void 0;
4706
4769
  }
4707
4770
  if (reasoning === "none") {
4708
4771
  return { thinking: { type: "disabled" } };
4709
4772
  }
4710
4773
  if (supportsAdaptiveThinking) {
4711
- const effort = (0, import_provider_utils16.mapReasoningToProviderEffort)({
4774
+ const effort = mapReasoningToProviderEffort({
4712
4775
  reasoning,
4713
4776
  effortMap: {
4714
4777
  minimal: "low",
@@ -4721,7 +4784,7 @@ function resolveAnthropicReasoningConfig({
4721
4784
  });
4722
4785
  return { thinking: { type: "adaptive" }, effort };
4723
4786
  }
4724
- const budgetTokens = (0, import_provider_utils16.mapReasoningToProviderBudget)({
4787
+ const budgetTokens = mapReasoningToProviderBudget({
4725
4788
  reasoning,
4726
4789
  maxOutputTokens: maxOutputTokensForModel,
4727
4790
  maxReasoningBudget: maxOutputTokensForModel,
@@ -4759,44 +4822,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4759
4822
  }
4760
4823
 
4761
4824
  // src/tool/bash_20241022.ts
4762
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4763
- var import_v414 = require("zod/v4");
4764
- var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4765
- () => (0, import_provider_utils17.zodSchema)(
4766
- import_v414.z.object({
4767
- command: import_v414.z.string(),
4768
- restart: import_v414.z.boolean().optional()
4825
+ import {
4826
+ createProviderToolFactory as createProviderToolFactory2,
4827
+ lazySchema as lazySchema13,
4828
+ zodSchema as zodSchema13
4829
+ } from "@ai-sdk/provider-utils";
4830
+ import { z as z14 } from "zod/v4";
4831
+ var bash_20241022InputSchema = lazySchema13(
4832
+ () => zodSchema13(
4833
+ z14.object({
4834
+ command: z14.string(),
4835
+ restart: z14.boolean().optional()
4769
4836
  })
4770
4837
  )
4771
4838
  );
4772
- var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
4839
+ var bash_20241022 = createProviderToolFactory2({
4773
4840
  id: "anthropic.bash_20241022",
4774
4841
  inputSchema: bash_20241022InputSchema
4775
4842
  });
4776
4843
 
4777
4844
  // src/tool/bash_20250124.ts
4778
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4779
- var import_v415 = require("zod/v4");
4780
- var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4781
- () => (0, import_provider_utils18.zodSchema)(
4782
- import_v415.z.object({
4783
- command: import_v415.z.string(),
4784
- restart: import_v415.z.boolean().optional()
4845
+ import {
4846
+ createProviderToolFactory as createProviderToolFactory3,
4847
+ lazySchema as lazySchema14,
4848
+ zodSchema as zodSchema14
4849
+ } from "@ai-sdk/provider-utils";
4850
+ import { z as z15 } from "zod/v4";
4851
+ var bash_20250124InputSchema = lazySchema14(
4852
+ () => zodSchema14(
4853
+ z15.object({
4854
+ command: z15.string(),
4855
+ restart: z15.boolean().optional()
4785
4856
  })
4786
4857
  )
4787
4858
  );
4788
- var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
4859
+ var bash_20250124 = createProviderToolFactory3({
4789
4860
  id: "anthropic.bash_20250124",
4790
4861
  inputSchema: bash_20250124InputSchema
4791
4862
  });
4792
4863
 
4793
4864
  // src/tool/computer_20241022.ts
4794
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4795
- var import_v416 = require("zod/v4");
4796
- var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4797
- () => (0, import_provider_utils19.zodSchema)(
4798
- import_v416.z.object({
4799
- action: import_v416.z.enum([
4865
+ import {
4866
+ createProviderToolFactory as createProviderToolFactory4,
4867
+ lazySchema as lazySchema15,
4868
+ zodSchema as zodSchema15
4869
+ } from "@ai-sdk/provider-utils";
4870
+ import { z as z16 } from "zod/v4";
4871
+ var computer_20241022InputSchema = lazySchema15(
4872
+ () => zodSchema15(
4873
+ z16.object({
4874
+ action: z16.enum([
4800
4875
  "key",
4801
4876
  "type",
4802
4877
  "mouse_move",
@@ -4808,23 +4883,27 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4808
4883
  "screenshot",
4809
4884
  "cursor_position"
4810
4885
  ]),
4811
- coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
4812
- text: import_v416.z.string().optional()
4886
+ coordinate: z16.array(z16.number().int()).optional(),
4887
+ text: z16.string().optional()
4813
4888
  })
4814
4889
  )
4815
4890
  );
4816
- var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
4891
+ var computer_20241022 = createProviderToolFactory4({
4817
4892
  id: "anthropic.computer_20241022",
4818
4893
  inputSchema: computer_20241022InputSchema
4819
4894
  });
4820
4895
 
4821
4896
  // src/tool/computer_20250124.ts
4822
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4823
- var import_v417 = require("zod/v4");
4824
- var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4825
- () => (0, import_provider_utils20.zodSchema)(
4826
- import_v417.z.object({
4827
- action: import_v417.z.enum([
4897
+ import {
4898
+ createProviderToolFactory as createProviderToolFactory5,
4899
+ lazySchema as lazySchema16,
4900
+ zodSchema as zodSchema16
4901
+ } from "@ai-sdk/provider-utils";
4902
+ import { z as z17 } from "zod/v4";
4903
+ var computer_20250124InputSchema = lazySchema16(
4904
+ () => zodSchema16(
4905
+ z17.object({
4906
+ action: z17.enum([
4828
4907
  "key",
4829
4908
  "hold_key",
4830
4909
  "type",
@@ -4842,27 +4921,31 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4842
4921
  "wait",
4843
4922
  "screenshot"
4844
4923
  ]),
4845
- coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4846
- duration: import_v417.z.number().optional(),
4847
- scroll_amount: import_v417.z.number().optional(),
4848
- scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4849
- start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4850
- text: import_v417.z.string().optional()
4924
+ coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4925
+ duration: z17.number().optional(),
4926
+ scroll_amount: z17.number().optional(),
4927
+ scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
4928
+ start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4929
+ text: z17.string().optional()
4851
4930
  })
4852
4931
  )
4853
4932
  );
4854
- var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
4933
+ var computer_20250124 = createProviderToolFactory5({
4855
4934
  id: "anthropic.computer_20250124",
4856
4935
  inputSchema: computer_20250124InputSchema
4857
4936
  });
4858
4937
 
4859
4938
  // src/tool/computer_20251124.ts
4860
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
4861
- var import_v418 = require("zod/v4");
4862
- var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
4863
- () => (0, import_provider_utils21.zodSchema)(
4864
- import_v418.z.object({
4865
- action: import_v418.z.enum([
4939
+ import {
4940
+ createProviderToolFactory as createProviderToolFactory6,
4941
+ lazySchema as lazySchema17,
4942
+ zodSchema as zodSchema17
4943
+ } from "@ai-sdk/provider-utils";
4944
+ import { z as z18 } from "zod/v4";
4945
+ var computer_20251124InputSchema = lazySchema17(
4946
+ () => zodSchema17(
4947
+ z18.object({
4948
+ action: z18.enum([
4866
4949
  "key",
4867
4950
  "hold_key",
4868
4951
  "type",
@@ -4881,166 +4964,186 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
4881
4964
  "screenshot",
4882
4965
  "zoom"
4883
4966
  ]),
4884
- coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
4885
- duration: import_v418.z.number().optional(),
4886
- region: import_v418.z.tuple([
4887
- import_v418.z.number().int(),
4888
- import_v418.z.number().int(),
4889
- import_v418.z.number().int(),
4890
- import_v418.z.number().int()
4967
+ coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
4968
+ duration: z18.number().optional(),
4969
+ region: z18.tuple([
4970
+ z18.number().int(),
4971
+ z18.number().int(),
4972
+ z18.number().int(),
4973
+ z18.number().int()
4891
4974
  ]).optional(),
4892
- scroll_amount: import_v418.z.number().optional(),
4893
- scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
4894
- start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
4895
- text: import_v418.z.string().optional()
4975
+ scroll_amount: z18.number().optional(),
4976
+ scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
4977
+ start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
4978
+ text: z18.string().optional()
4896
4979
  })
4897
4980
  )
4898
4981
  );
4899
- var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
4982
+ var computer_20251124 = createProviderToolFactory6({
4900
4983
  id: "anthropic.computer_20251124",
4901
4984
  inputSchema: computer_20251124InputSchema
4902
4985
  });
4903
4986
 
4904
4987
  // src/tool/memory_20250818.ts
4905
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
4906
- var import_v419 = require("zod/v4");
4907
- var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
4908
- () => (0, import_provider_utils22.zodSchema)(
4909
- import_v419.z.discriminatedUnion("command", [
4910
- import_v419.z.object({
4911
- command: import_v419.z.literal("view"),
4912
- path: import_v419.z.string(),
4913
- view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
4988
+ import {
4989
+ createProviderToolFactory as createProviderToolFactory7,
4990
+ lazySchema as lazySchema18,
4991
+ zodSchema as zodSchema18
4992
+ } from "@ai-sdk/provider-utils";
4993
+ import { z as z19 } from "zod/v4";
4994
+ var memory_20250818InputSchema = lazySchema18(
4995
+ () => zodSchema18(
4996
+ z19.discriminatedUnion("command", [
4997
+ z19.object({
4998
+ command: z19.literal("view"),
4999
+ path: z19.string(),
5000
+ view_range: z19.tuple([z19.number(), z19.number()]).optional()
4914
5001
  }),
4915
- import_v419.z.object({
4916
- command: import_v419.z.literal("create"),
4917
- path: import_v419.z.string(),
4918
- file_text: import_v419.z.string()
5002
+ z19.object({
5003
+ command: z19.literal("create"),
5004
+ path: z19.string(),
5005
+ file_text: z19.string()
4919
5006
  }),
4920
- import_v419.z.object({
4921
- command: import_v419.z.literal("str_replace"),
4922
- path: import_v419.z.string(),
4923
- old_str: import_v419.z.string(),
4924
- new_str: import_v419.z.string()
5007
+ z19.object({
5008
+ command: z19.literal("str_replace"),
5009
+ path: z19.string(),
5010
+ old_str: z19.string(),
5011
+ new_str: z19.string()
4925
5012
  }),
4926
- import_v419.z.object({
4927
- command: import_v419.z.literal("insert"),
4928
- path: import_v419.z.string(),
4929
- insert_line: import_v419.z.number(),
4930
- insert_text: import_v419.z.string()
5013
+ z19.object({
5014
+ command: z19.literal("insert"),
5015
+ path: z19.string(),
5016
+ insert_line: z19.number(),
5017
+ insert_text: z19.string()
4931
5018
  }),
4932
- import_v419.z.object({
4933
- command: import_v419.z.literal("delete"),
4934
- path: import_v419.z.string()
5019
+ z19.object({
5020
+ command: z19.literal("delete"),
5021
+ path: z19.string()
4935
5022
  }),
4936
- import_v419.z.object({
4937
- command: import_v419.z.literal("rename"),
4938
- old_path: import_v419.z.string(),
4939
- new_path: import_v419.z.string()
5023
+ z19.object({
5024
+ command: z19.literal("rename"),
5025
+ old_path: z19.string(),
5026
+ new_path: z19.string()
4940
5027
  })
4941
5028
  ])
4942
5029
  )
4943
5030
  );
4944
- var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
5031
+ var memory_20250818 = createProviderToolFactory7({
4945
5032
  id: "anthropic.memory_20250818",
4946
5033
  inputSchema: memory_20250818InputSchema
4947
5034
  });
4948
5035
 
4949
5036
  // src/tool/text-editor_20241022.ts
4950
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
4951
- var import_v420 = require("zod/v4");
4952
- var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
4953
- () => (0, import_provider_utils23.zodSchema)(
4954
- import_v420.z.object({
4955
- command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4956
- path: import_v420.z.string(),
4957
- file_text: import_v420.z.string().optional(),
4958
- insert_line: import_v420.z.number().int().optional(),
4959
- new_str: import_v420.z.string().optional(),
4960
- insert_text: import_v420.z.string().optional(),
4961
- old_str: import_v420.z.string().optional(),
4962
- view_range: import_v420.z.array(import_v420.z.number().int()).optional()
5037
+ import {
5038
+ createProviderToolFactory as createProviderToolFactory8,
5039
+ lazySchema as lazySchema19,
5040
+ zodSchema as zodSchema19
5041
+ } from "@ai-sdk/provider-utils";
5042
+ import { z as z20 } from "zod/v4";
5043
+ var textEditor_20241022InputSchema = lazySchema19(
5044
+ () => zodSchema19(
5045
+ z20.object({
5046
+ command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5047
+ path: z20.string(),
5048
+ file_text: z20.string().optional(),
5049
+ insert_line: z20.number().int().optional(),
5050
+ new_str: z20.string().optional(),
5051
+ insert_text: z20.string().optional(),
5052
+ old_str: z20.string().optional(),
5053
+ view_range: z20.array(z20.number().int()).optional()
4963
5054
  })
4964
5055
  )
4965
5056
  );
4966
- var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
5057
+ var textEditor_20241022 = createProviderToolFactory8({
4967
5058
  id: "anthropic.text_editor_20241022",
4968
5059
  inputSchema: textEditor_20241022InputSchema
4969
5060
  });
4970
5061
 
4971
5062
  // src/tool/text-editor_20250124.ts
4972
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
4973
- var import_v421 = require("zod/v4");
4974
- var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
4975
- () => (0, import_provider_utils24.zodSchema)(
4976
- import_v421.z.object({
4977
- command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4978
- path: import_v421.z.string(),
4979
- file_text: import_v421.z.string().optional(),
4980
- insert_line: import_v421.z.number().int().optional(),
4981
- new_str: import_v421.z.string().optional(),
4982
- insert_text: import_v421.z.string().optional(),
4983
- old_str: import_v421.z.string().optional(),
4984
- view_range: import_v421.z.array(import_v421.z.number().int()).optional()
5063
+ import {
5064
+ createProviderToolFactory as createProviderToolFactory9,
5065
+ lazySchema as lazySchema20,
5066
+ zodSchema as zodSchema20
5067
+ } from "@ai-sdk/provider-utils";
5068
+ import { z as z21 } from "zod/v4";
5069
+ var textEditor_20250124InputSchema = lazySchema20(
5070
+ () => zodSchema20(
5071
+ z21.object({
5072
+ command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5073
+ path: z21.string(),
5074
+ file_text: z21.string().optional(),
5075
+ insert_line: z21.number().int().optional(),
5076
+ new_str: z21.string().optional(),
5077
+ insert_text: z21.string().optional(),
5078
+ old_str: z21.string().optional(),
5079
+ view_range: z21.array(z21.number().int()).optional()
4985
5080
  })
4986
5081
  )
4987
5082
  );
4988
- var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
5083
+ var textEditor_20250124 = createProviderToolFactory9({
4989
5084
  id: "anthropic.text_editor_20250124",
4990
5085
  inputSchema: textEditor_20250124InputSchema
4991
5086
  });
4992
5087
 
4993
5088
  // src/tool/text-editor_20250429.ts
4994
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4995
- var import_v422 = require("zod/v4");
4996
- var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
4997
- () => (0, import_provider_utils25.zodSchema)(
4998
- import_v422.z.object({
4999
- command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
5000
- path: import_v422.z.string(),
5001
- file_text: import_v422.z.string().optional(),
5002
- insert_line: import_v422.z.number().int().optional(),
5003
- new_str: import_v422.z.string().optional(),
5004
- insert_text: import_v422.z.string().optional(),
5005
- old_str: import_v422.z.string().optional(),
5006
- view_range: import_v422.z.array(import_v422.z.number().int()).optional()
5089
+ import {
5090
+ createProviderToolFactory as createProviderToolFactory10,
5091
+ lazySchema as lazySchema21,
5092
+ zodSchema as zodSchema21
5093
+ } from "@ai-sdk/provider-utils";
5094
+ import { z as z22 } from "zod/v4";
5095
+ var textEditor_20250429InputSchema = lazySchema21(
5096
+ () => zodSchema21(
5097
+ z22.object({
5098
+ command: z22.enum(["view", "create", "str_replace", "insert"]),
5099
+ path: z22.string(),
5100
+ file_text: z22.string().optional(),
5101
+ insert_line: z22.number().int().optional(),
5102
+ new_str: z22.string().optional(),
5103
+ insert_text: z22.string().optional(),
5104
+ old_str: z22.string().optional(),
5105
+ view_range: z22.array(z22.number().int()).optional()
5007
5106
  })
5008
5107
  )
5009
5108
  );
5010
- var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
5109
+ var textEditor_20250429 = createProviderToolFactory10({
5011
5110
  id: "anthropic.text_editor_20250429",
5012
5111
  inputSchema: textEditor_20250429InputSchema
5013
5112
  });
5014
5113
 
5015
5114
  // src/tool/tool-search-bm25_20251119.ts
5016
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
5017
- var import_v423 = require("zod/v4");
5018
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
5019
- () => (0, import_provider_utils26.zodSchema)(
5020
- import_v423.z.array(
5021
- import_v423.z.object({
5022
- type: import_v423.z.literal("tool_reference"),
5023
- toolName: import_v423.z.string()
5115
+ import {
5116
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5117
+ lazySchema as lazySchema22,
5118
+ zodSchema as zodSchema22
5119
+ } from "@ai-sdk/provider-utils";
5120
+ import { z as z23 } from "zod/v4";
5121
+ var toolSearchBm25_20251119OutputSchema = lazySchema22(
5122
+ () => zodSchema22(
5123
+ z23.array(
5124
+ z23.object({
5125
+ type: z23.literal("tool_reference"),
5126
+ toolName: z23.string()
5024
5127
  })
5025
5128
  )
5026
5129
  )
5027
5130
  );
5028
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
5029
- () => (0, import_provider_utils26.zodSchema)(
5030
- import_v423.z.object({
5131
+ var toolSearchBm25_20251119InputSchema = lazySchema22(
5132
+ () => zodSchema22(
5133
+ z23.object({
5031
5134
  /**
5032
5135
  * A natural language query to search for tools.
5033
5136
  * Claude will use BM25 text search to find relevant tools.
5034
5137
  */
5035
- query: import_v423.z.string(),
5138
+ query: z23.string(),
5036
5139
  /**
5037
5140
  * Maximum number of tools to return. Optional.
5038
5141
  */
5039
- limit: import_v423.z.number().optional()
5142
+ limit: z23.number().optional()
5040
5143
  })
5041
5144
  )
5042
5145
  );
5043
- var factory10 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
5146
+ var factory10 = createProviderToolFactoryWithOutputSchema9({
5044
5147
  id: "anthropic.tool_search_bm25_20251119",
5045
5148
  inputSchema: toolSearchBm25_20251119InputSchema,
5046
5149
  outputSchema: toolSearchBm25_20251119OutputSchema,
@@ -5253,43 +5356,50 @@ var anthropicTools = {
5253
5356
  };
5254
5357
 
5255
5358
  // src/skills/anthropic-skills.ts
5256
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
5359
+ import {
5360
+ combineHeaders as combineHeaders3,
5361
+ convertBase64ToUint8Array as convertBase64ToUint8Array3,
5362
+ createJsonResponseHandler as createJsonResponseHandler3,
5363
+ getFromApi,
5364
+ postFormDataToApi as postFormDataToApi2,
5365
+ resolve as resolve2
5366
+ } from "@ai-sdk/provider-utils";
5257
5367
 
5258
5368
  // src/skills/anthropic-skills-api.ts
5259
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
5260
- var import_v424 = require("zod/v4");
5261
- var anthropicSkillResponseSchema = (0, import_provider_utils27.lazySchema)(
5262
- () => (0, import_provider_utils27.zodSchema)(
5263
- import_v424.z.object({
5264
- id: import_v424.z.string(),
5265
- display_title: import_v424.z.string().nullish(),
5266
- name: import_v424.z.string().nullish(),
5267
- description: import_v424.z.string().nullish(),
5268
- latest_version: import_v424.z.string().nullish(),
5269
- source: import_v424.z.string(),
5270
- created_at: import_v424.z.string(),
5271
- updated_at: import_v424.z.string()
5369
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
5370
+ import { z as z24 } from "zod/v4";
5371
+ var anthropicSkillResponseSchema = lazySchema23(
5372
+ () => zodSchema23(
5373
+ z24.object({
5374
+ id: z24.string(),
5375
+ display_title: z24.string().nullish(),
5376
+ name: z24.string().nullish(),
5377
+ description: z24.string().nullish(),
5378
+ latest_version: z24.string().nullish(),
5379
+ source: z24.string(),
5380
+ created_at: z24.string(),
5381
+ updated_at: z24.string()
5272
5382
  })
5273
5383
  )
5274
5384
  );
5275
- var anthropicSkillVersionListResponseSchema = (0, import_provider_utils27.lazySchema)(
5276
- () => (0, import_provider_utils27.zodSchema)(
5277
- import_v424.z.object({
5278
- data: import_v424.z.array(
5279
- import_v424.z.object({
5280
- version: import_v424.z.string()
5385
+ var anthropicSkillVersionListResponseSchema = lazySchema23(
5386
+ () => zodSchema23(
5387
+ z24.object({
5388
+ data: z24.array(
5389
+ z24.object({
5390
+ version: z24.string()
5281
5391
  })
5282
5392
  )
5283
5393
  })
5284
5394
  )
5285
5395
  );
5286
- var anthropicSkillVersionResponseSchema = (0, import_provider_utils27.lazySchema)(
5287
- () => (0, import_provider_utils27.zodSchema)(
5288
- import_v424.z.object({
5289
- type: import_v424.z.string(),
5290
- skill_id: import_v424.z.string(),
5291
- name: import_v424.z.string().nullish(),
5292
- description: import_v424.z.string().nullish()
5396
+ var anthropicSkillVersionResponseSchema = lazySchema23(
5397
+ () => zodSchema23(
5398
+ z24.object({
5399
+ type: z24.string(),
5400
+ skill_id: z24.string(),
5401
+ name: z24.string().nullish(),
5402
+ description: z24.string().nullish()
5293
5403
  })
5294
5404
  )
5295
5405
  );
@@ -5304,7 +5414,7 @@ var AnthropicSkills = class {
5304
5414
  return this.config.provider;
5305
5415
  }
5306
5416
  async getHeaders() {
5307
- return (0, import_provider_utils28.combineHeaders)(await (0, import_provider_utils28.resolve)(this.config.headers), {
5417
+ return combineHeaders3(await resolve2(this.config.headers), {
5308
5418
  "anthropic-beta": "skills-2025-10-02"
5309
5419
  });
5310
5420
  }
@@ -5313,11 +5423,11 @@ var AnthropicSkills = class {
5313
5423
  version,
5314
5424
  headers
5315
5425
  }) {
5316
- const { value: versionResponse } = await (0, import_provider_utils28.getFromApi)({
5426
+ const { value: versionResponse } = await getFromApi({
5317
5427
  url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
5318
5428
  headers,
5319
5429
  failedResponseHandler: anthropicFailedResponseHandler,
5320
- successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
5430
+ successfulResponseHandler: createJsonResponseHandler3(
5321
5431
  anthropicSkillVersionResponseSchema
5322
5432
  ),
5323
5433
  fetch: this.config.fetch
@@ -5335,16 +5445,16 @@ var AnthropicSkills = class {
5335
5445
  formData.append("display_title", params.displayTitle);
5336
5446
  }
5337
5447
  for (const file of params.files) {
5338
- const content = typeof file.content === "string" ? (0, import_provider_utils28.convertBase64ToUint8Array)(file.content) : file.content;
5448
+ const content = typeof file.content === "string" ? convertBase64ToUint8Array3(file.content) : file.content;
5339
5449
  formData.append("files[]", new Blob([content]), file.path);
5340
5450
  }
5341
5451
  const headers = await this.getHeaders();
5342
- const { value: response } = await (0, import_provider_utils28.postFormDataToApi)({
5452
+ const { value: response } = await postFormDataToApi2({
5343
5453
  url: `${this.config.baseURL}/skills`,
5344
5454
  headers,
5345
5455
  formData,
5346
5456
  failedResponseHandler: anthropicFailedResponseHandler,
5347
- successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
5457
+ successfulResponseHandler: createJsonResponseHandler3(
5348
5458
  anthropicSkillResponseSchema
5349
5459
  ),
5350
5460
  fetch: this.config.fetch
@@ -5375,33 +5485,33 @@ var AnthropicSkills = class {
5375
5485
  };
5376
5486
 
5377
5487
  // src/version.ts
5378
- var VERSION = true ? "4.0.0-beta.26" : "0.0.0-test";
5488
+ var VERSION = true ? "4.0.0-beta.28" : "0.0.0-test";
5379
5489
 
5380
5490
  // src/anthropic-provider.ts
5381
5491
  function createAnthropic(options = {}) {
5382
5492
  var _a, _b;
5383
- const baseURL = (_a = (0, import_provider_utils29.withoutTrailingSlash)(
5384
- (0, import_provider_utils29.loadOptionalSetting)({
5493
+ const baseURL = (_a = withoutTrailingSlash(
5494
+ loadOptionalSetting({
5385
5495
  settingValue: options.baseURL,
5386
5496
  environmentVariableName: "ANTHROPIC_BASE_URL"
5387
5497
  })
5388
5498
  )) != null ? _a : "https://api.anthropic.com/v1";
5389
5499
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
5390
5500
  if (options.apiKey && options.authToken) {
5391
- throw new import_provider4.InvalidArgumentError({
5501
+ throw new InvalidArgumentError({
5392
5502
  argument: "apiKey/authToken",
5393
5503
  message: "Both apiKey and authToken were provided. Please use only one authentication method."
5394
5504
  });
5395
5505
  }
5396
5506
  const getHeaders = () => {
5397
5507
  const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
5398
- "x-api-key": (0, import_provider_utils29.loadApiKey)({
5508
+ "x-api-key": loadApiKey({
5399
5509
  apiKey: options.apiKey,
5400
5510
  environmentVariableName: "ANTHROPIC_API_KEY",
5401
5511
  description: "Anthropic"
5402
5512
  })
5403
5513
  };
5404
- return (0, import_provider_utils29.withUserAgentSuffix)(
5514
+ return withUserAgentSuffix(
5405
5515
  {
5406
5516
  "anthropic-version": "2023-06-01",
5407
5517
  ...authHeaders,
@@ -5417,7 +5527,7 @@ function createAnthropic(options = {}) {
5417
5527
  baseURL,
5418
5528
  headers: getHeaders,
5419
5529
  fetch: options.fetch,
5420
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils29.generateId,
5530
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
5421
5531
  supportedUrls: () => ({
5422
5532
  "image/*": [/^https?:\/\/.*$/],
5423
5533
  "application/pdf": [/^https?:\/\/.*$/]
@@ -5443,11 +5553,11 @@ function createAnthropic(options = {}) {
5443
5553
  provider.chat = createChatModel;
5444
5554
  provider.messages = createChatModel;
5445
5555
  provider.embeddingModel = (modelId) => {
5446
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "embeddingModel" });
5556
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
5447
5557
  };
5448
5558
  provider.textEmbeddingModel = provider.embeddingModel;
5449
5559
  provider.imageModel = (modelId) => {
5450
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
5560
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
5451
5561
  };
5452
5562
  provider.files = () => new AnthropicFiles({
5453
5563
  provider: providerName,
@@ -5480,11 +5590,10 @@ function forwardAnthropicContainerIdFromLastStep({
5480
5590
  }
5481
5591
  return void 0;
5482
5592
  }
5483
- // Annotate the CommonJS export names for ESM import in node:
5484
- 0 && (module.exports = {
5593
+ export {
5485
5594
  VERSION,
5486
5595
  anthropic,
5487
5596
  createAnthropic,
5488
5597
  forwardAnthropicContainerIdFromLastStep
5489
- });
5598
+ };
5490
5599
  //# sourceMappingURL=index.js.map