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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,367 +1,361 @@
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/internal/index.ts
21
- var internal_exports = {};
22
- __export(internal_exports, {
23
- AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
24
- anthropicTools: () => anthropicTools,
25
- prepareTools: () => prepareTools
26
- });
27
- module.exports = __toCommonJS(internal_exports);
28
-
29
1
  // src/anthropic-messages-language-model.ts
30
- var import_provider3 = require("@ai-sdk/provider");
31
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ APICallError
4
+ } from "@ai-sdk/provider";
5
+ import {
6
+ combineHeaders,
7
+ createEventSourceResponseHandler,
8
+ createJsonResponseHandler,
9
+ createToolNameMapping,
10
+ generateId,
11
+ isCustomReasoning,
12
+ mapReasoningToProviderBudget,
13
+ mapReasoningToProviderEffort,
14
+ parseProviderOptions as parseProviderOptions2,
15
+ postJsonToApi,
16
+ resolve,
17
+ resolveProviderReference as resolveProviderReference2,
18
+ serializeModelOptions,
19
+ WORKFLOW_SERIALIZE,
20
+ WORKFLOW_DESERIALIZE
21
+ } from "@ai-sdk/provider-utils";
32
22
 
33
23
  // src/anthropic-error.ts
34
- var import_provider_utils = require("@ai-sdk/provider-utils");
35
- var import_v4 = require("zod/v4");
36
- var anthropicErrorDataSchema = (0, import_provider_utils.lazySchema)(
37
- () => (0, import_provider_utils.zodSchema)(
38
- import_v4.z.object({
39
- type: import_v4.z.literal("error"),
40
- error: import_v4.z.object({
41
- type: import_v4.z.string(),
42
- message: import_v4.z.string()
24
+ import {
25
+ createJsonErrorResponseHandler,
26
+ lazySchema,
27
+ zodSchema
28
+ } from "@ai-sdk/provider-utils";
29
+ import { z } from "zod/v4";
30
+ var anthropicErrorDataSchema = lazySchema(
31
+ () => zodSchema(
32
+ z.object({
33
+ type: z.literal("error"),
34
+ error: z.object({
35
+ type: z.string(),
36
+ message: z.string()
43
37
  })
44
38
  })
45
39
  )
46
40
  );
47
- var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
41
+ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
48
42
  errorSchema: anthropicErrorDataSchema,
49
43
  errorToMessage: (data) => data.error.message
50
44
  });
51
45
 
52
46
  // src/anthropic-messages-api.ts
53
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
54
- var import_v42 = require("zod/v4");
55
- var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
56
- () => (0, import_provider_utils2.zodSchema)(
57
- import_v42.z.object({
58
- type: import_v42.z.literal("message"),
59
- id: import_v42.z.string().nullish(),
60
- model: import_v42.z.string().nullish(),
61
- content: import_v42.z.array(
62
- import_v42.z.discriminatedUnion("type", [
63
- import_v42.z.object({
64
- type: import_v42.z.literal("text"),
65
- text: import_v42.z.string(),
66
- citations: import_v42.z.array(
67
- import_v42.z.discriminatedUnion("type", [
68
- import_v42.z.object({
69
- type: import_v42.z.literal("web_search_result_location"),
70
- cited_text: import_v42.z.string(),
71
- url: import_v42.z.string(),
72
- title: import_v42.z.string(),
73
- encrypted_index: import_v42.z.string()
47
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
48
+ import { z as z2 } from "zod/v4";
49
+ var anthropicMessagesResponseSchema = lazySchema2(
50
+ () => zodSchema2(
51
+ z2.object({
52
+ type: z2.literal("message"),
53
+ id: z2.string().nullish(),
54
+ model: z2.string().nullish(),
55
+ content: z2.array(
56
+ z2.discriminatedUnion("type", [
57
+ z2.object({
58
+ type: z2.literal("text"),
59
+ text: z2.string(),
60
+ citations: z2.array(
61
+ z2.discriminatedUnion("type", [
62
+ z2.object({
63
+ type: z2.literal("web_search_result_location"),
64
+ cited_text: z2.string(),
65
+ url: z2.string(),
66
+ title: z2.string(),
67
+ encrypted_index: z2.string()
74
68
  }),
75
- import_v42.z.object({
76
- type: import_v42.z.literal("page_location"),
77
- cited_text: import_v42.z.string(),
78
- document_index: import_v42.z.number(),
79
- document_title: import_v42.z.string().nullable(),
80
- start_page_number: import_v42.z.number(),
81
- end_page_number: import_v42.z.number()
69
+ z2.object({
70
+ type: z2.literal("page_location"),
71
+ cited_text: z2.string(),
72
+ document_index: z2.number(),
73
+ document_title: z2.string().nullable(),
74
+ start_page_number: z2.number(),
75
+ end_page_number: z2.number()
82
76
  }),
83
- import_v42.z.object({
84
- type: import_v42.z.literal("char_location"),
85
- cited_text: import_v42.z.string(),
86
- document_index: import_v42.z.number(),
87
- document_title: import_v42.z.string().nullable(),
88
- start_char_index: import_v42.z.number(),
89
- end_char_index: import_v42.z.number()
77
+ z2.object({
78
+ type: z2.literal("char_location"),
79
+ cited_text: z2.string(),
80
+ document_index: z2.number(),
81
+ document_title: z2.string().nullable(),
82
+ start_char_index: z2.number(),
83
+ end_char_index: z2.number()
90
84
  })
91
85
  ])
92
86
  ).optional()
93
87
  }),
94
- import_v42.z.object({
95
- type: import_v42.z.literal("thinking"),
96
- thinking: import_v42.z.string(),
97
- signature: import_v42.z.string()
88
+ z2.object({
89
+ type: z2.literal("thinking"),
90
+ thinking: z2.string(),
91
+ signature: z2.string()
98
92
  }),
99
- import_v42.z.object({
100
- type: import_v42.z.literal("redacted_thinking"),
101
- data: import_v42.z.string()
93
+ z2.object({
94
+ type: z2.literal("redacted_thinking"),
95
+ data: z2.string()
102
96
  }),
103
- import_v42.z.object({
104
- type: import_v42.z.literal("compaction"),
105
- content: import_v42.z.string()
97
+ z2.object({
98
+ type: z2.literal("compaction"),
99
+ content: z2.string()
106
100
  }),
107
- import_v42.z.object({
108
- type: import_v42.z.literal("tool_use"),
109
- id: import_v42.z.string(),
110
- name: import_v42.z.string(),
111
- input: import_v42.z.unknown(),
101
+ z2.object({
102
+ type: z2.literal("tool_use"),
103
+ id: z2.string(),
104
+ name: z2.string(),
105
+ input: z2.unknown(),
112
106
  // Programmatic tool calling: caller info when triggered from code execution
113
- caller: import_v42.z.union([
114
- import_v42.z.object({
115
- type: import_v42.z.literal("code_execution_20250825"),
116
- tool_id: import_v42.z.string()
107
+ caller: z2.union([
108
+ z2.object({
109
+ type: z2.literal("code_execution_20250825"),
110
+ tool_id: z2.string()
117
111
  }),
118
- import_v42.z.object({
119
- type: import_v42.z.literal("code_execution_20260120"),
120
- tool_id: import_v42.z.string()
112
+ z2.object({
113
+ type: z2.literal("code_execution_20260120"),
114
+ tool_id: z2.string()
121
115
  }),
122
- import_v42.z.object({
123
- type: import_v42.z.literal("direct")
116
+ z2.object({
117
+ type: z2.literal("direct")
124
118
  })
125
119
  ]).optional()
126
120
  }),
127
- import_v42.z.object({
128
- type: import_v42.z.literal("server_tool_use"),
129
- id: import_v42.z.string(),
130
- name: import_v42.z.string(),
131
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
132
- caller: import_v42.z.union([
133
- import_v42.z.object({
134
- type: import_v42.z.literal("code_execution_20260120"),
135
- tool_id: import_v42.z.string()
121
+ z2.object({
122
+ type: z2.literal("server_tool_use"),
123
+ id: z2.string(),
124
+ name: z2.string(),
125
+ input: z2.record(z2.string(), z2.unknown()).nullish(),
126
+ caller: z2.union([
127
+ z2.object({
128
+ type: z2.literal("code_execution_20260120"),
129
+ tool_id: z2.string()
136
130
  }),
137
- import_v42.z.object({
138
- type: import_v42.z.literal("direct")
131
+ z2.object({
132
+ type: z2.literal("direct")
139
133
  })
140
134
  ]).optional()
141
135
  }),
142
- import_v42.z.object({
143
- type: import_v42.z.literal("mcp_tool_use"),
144
- id: import_v42.z.string(),
145
- name: import_v42.z.string(),
146
- input: import_v42.z.unknown(),
147
- server_name: import_v42.z.string()
136
+ z2.object({
137
+ type: z2.literal("mcp_tool_use"),
138
+ id: z2.string(),
139
+ name: z2.string(),
140
+ input: z2.unknown(),
141
+ server_name: z2.string()
148
142
  }),
149
- import_v42.z.object({
150
- type: import_v42.z.literal("mcp_tool_result"),
151
- tool_use_id: import_v42.z.string(),
152
- is_error: import_v42.z.boolean(),
153
- content: import_v42.z.array(
154
- import_v42.z.union([
155
- import_v42.z.string(),
156
- import_v42.z.object({ type: import_v42.z.literal("text"), text: import_v42.z.string() })
143
+ z2.object({
144
+ type: z2.literal("mcp_tool_result"),
145
+ tool_use_id: z2.string(),
146
+ is_error: z2.boolean(),
147
+ content: z2.array(
148
+ z2.union([
149
+ z2.string(),
150
+ z2.object({ type: z2.literal("text"), text: z2.string() })
157
151
  ])
158
152
  )
159
153
  }),
160
- import_v42.z.object({
161
- type: import_v42.z.literal("web_fetch_tool_result"),
162
- tool_use_id: import_v42.z.string(),
163
- content: import_v42.z.union([
164
- import_v42.z.object({
165
- type: import_v42.z.literal("web_fetch_result"),
166
- url: import_v42.z.string(),
167
- retrieved_at: import_v42.z.string(),
168
- content: import_v42.z.object({
169
- type: import_v42.z.literal("document"),
170
- title: import_v42.z.string().nullable(),
171
- citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
172
- source: import_v42.z.union([
173
- import_v42.z.object({
174
- type: import_v42.z.literal("base64"),
175
- media_type: import_v42.z.literal("application/pdf"),
176
- data: import_v42.z.string()
154
+ z2.object({
155
+ type: z2.literal("web_fetch_tool_result"),
156
+ tool_use_id: z2.string(),
157
+ content: z2.union([
158
+ z2.object({
159
+ type: z2.literal("web_fetch_result"),
160
+ url: z2.string(),
161
+ retrieved_at: z2.string(),
162
+ content: z2.object({
163
+ type: z2.literal("document"),
164
+ title: z2.string().nullable(),
165
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
166
+ source: z2.union([
167
+ z2.object({
168
+ type: z2.literal("base64"),
169
+ media_type: z2.literal("application/pdf"),
170
+ data: z2.string()
177
171
  }),
178
- import_v42.z.object({
179
- type: import_v42.z.literal("text"),
180
- media_type: import_v42.z.literal("text/plain"),
181
- data: import_v42.z.string()
172
+ z2.object({
173
+ type: z2.literal("text"),
174
+ media_type: z2.literal("text/plain"),
175
+ data: z2.string()
182
176
  })
183
177
  ])
184
178
  })
185
179
  }),
186
- import_v42.z.object({
187
- type: import_v42.z.literal("web_fetch_tool_result_error"),
188
- error_code: import_v42.z.string()
180
+ z2.object({
181
+ type: z2.literal("web_fetch_tool_result_error"),
182
+ error_code: z2.string()
189
183
  })
190
184
  ])
191
185
  }),
192
- import_v42.z.object({
193
- type: import_v42.z.literal("web_search_tool_result"),
194
- tool_use_id: import_v42.z.string(),
195
- content: import_v42.z.union([
196
- import_v42.z.array(
197
- import_v42.z.object({
198
- type: import_v42.z.literal("web_search_result"),
199
- url: import_v42.z.string(),
200
- title: import_v42.z.string(),
201
- encrypted_content: import_v42.z.string(),
202
- page_age: import_v42.z.string().nullish()
186
+ z2.object({
187
+ type: z2.literal("web_search_tool_result"),
188
+ tool_use_id: z2.string(),
189
+ content: z2.union([
190
+ z2.array(
191
+ z2.object({
192
+ type: z2.literal("web_search_result"),
193
+ url: z2.string(),
194
+ title: z2.string(),
195
+ encrypted_content: z2.string(),
196
+ page_age: z2.string().nullish()
203
197
  })
204
198
  ),
205
- import_v42.z.object({
206
- type: import_v42.z.literal("web_search_tool_result_error"),
207
- error_code: import_v42.z.string()
199
+ z2.object({
200
+ type: z2.literal("web_search_tool_result_error"),
201
+ error_code: z2.string()
208
202
  })
209
203
  ])
210
204
  }),
211
205
  // code execution results for code_execution_20250522 tool:
212
- import_v42.z.object({
213
- type: import_v42.z.literal("code_execution_tool_result"),
214
- tool_use_id: import_v42.z.string(),
215
- content: import_v42.z.union([
216
- import_v42.z.object({
217
- type: import_v42.z.literal("code_execution_result"),
218
- stdout: import_v42.z.string(),
219
- stderr: import_v42.z.string(),
220
- return_code: import_v42.z.number(),
221
- content: import_v42.z.array(
222
- import_v42.z.object({
223
- type: import_v42.z.literal("code_execution_output"),
224
- file_id: import_v42.z.string()
206
+ z2.object({
207
+ type: z2.literal("code_execution_tool_result"),
208
+ tool_use_id: z2.string(),
209
+ content: z2.union([
210
+ z2.object({
211
+ type: z2.literal("code_execution_result"),
212
+ stdout: z2.string(),
213
+ stderr: z2.string(),
214
+ return_code: z2.number(),
215
+ content: z2.array(
216
+ z2.object({
217
+ type: z2.literal("code_execution_output"),
218
+ file_id: z2.string()
225
219
  })
226
220
  ).optional().default([])
227
221
  }),
228
- import_v42.z.object({
229
- type: import_v42.z.literal("encrypted_code_execution_result"),
230
- encrypted_stdout: import_v42.z.string(),
231
- stderr: import_v42.z.string(),
232
- return_code: import_v42.z.number(),
233
- content: import_v42.z.array(
234
- import_v42.z.object({
235
- type: import_v42.z.literal("code_execution_output"),
236
- file_id: import_v42.z.string()
222
+ z2.object({
223
+ type: z2.literal("encrypted_code_execution_result"),
224
+ encrypted_stdout: z2.string(),
225
+ stderr: z2.string(),
226
+ return_code: z2.number(),
227
+ content: z2.array(
228
+ z2.object({
229
+ type: z2.literal("code_execution_output"),
230
+ file_id: z2.string()
237
231
  })
238
232
  ).optional().default([])
239
233
  }),
240
- import_v42.z.object({
241
- type: import_v42.z.literal("code_execution_tool_result_error"),
242
- error_code: import_v42.z.string()
234
+ z2.object({
235
+ type: z2.literal("code_execution_tool_result_error"),
236
+ error_code: z2.string()
243
237
  })
244
238
  ])
245
239
  }),
246
240
  // bash code execution results for code_execution_20250825 tool:
247
- import_v42.z.object({
248
- type: import_v42.z.literal("bash_code_execution_tool_result"),
249
- tool_use_id: import_v42.z.string(),
250
- content: import_v42.z.discriminatedUnion("type", [
251
- import_v42.z.object({
252
- type: import_v42.z.literal("bash_code_execution_result"),
253
- content: import_v42.z.array(
254
- import_v42.z.object({
255
- type: import_v42.z.literal("bash_code_execution_output"),
256
- file_id: import_v42.z.string()
241
+ z2.object({
242
+ type: z2.literal("bash_code_execution_tool_result"),
243
+ tool_use_id: z2.string(),
244
+ content: z2.discriminatedUnion("type", [
245
+ z2.object({
246
+ type: z2.literal("bash_code_execution_result"),
247
+ content: z2.array(
248
+ z2.object({
249
+ type: z2.literal("bash_code_execution_output"),
250
+ file_id: z2.string()
257
251
  })
258
252
  ),
259
- stdout: import_v42.z.string(),
260
- stderr: import_v42.z.string(),
261
- return_code: import_v42.z.number()
253
+ stdout: z2.string(),
254
+ stderr: z2.string(),
255
+ return_code: z2.number()
262
256
  }),
263
- import_v42.z.object({
264
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
265
- error_code: import_v42.z.string()
257
+ z2.object({
258
+ type: z2.literal("bash_code_execution_tool_result_error"),
259
+ error_code: z2.string()
266
260
  })
267
261
  ])
268
262
  }),
269
263
  // text editor code execution results for code_execution_20250825 tool:
270
- import_v42.z.object({
271
- type: import_v42.z.literal("text_editor_code_execution_tool_result"),
272
- tool_use_id: import_v42.z.string(),
273
- content: import_v42.z.discriminatedUnion("type", [
274
- import_v42.z.object({
275
- type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
276
- error_code: import_v42.z.string()
264
+ z2.object({
265
+ type: z2.literal("text_editor_code_execution_tool_result"),
266
+ tool_use_id: z2.string(),
267
+ content: z2.discriminatedUnion("type", [
268
+ z2.object({
269
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
270
+ error_code: z2.string()
277
271
  }),
278
- import_v42.z.object({
279
- type: import_v42.z.literal("text_editor_code_execution_view_result"),
280
- content: import_v42.z.string(),
281
- file_type: import_v42.z.string(),
282
- num_lines: import_v42.z.number().nullable(),
283
- start_line: import_v42.z.number().nullable(),
284
- total_lines: import_v42.z.number().nullable()
272
+ z2.object({
273
+ type: z2.literal("text_editor_code_execution_view_result"),
274
+ content: z2.string(),
275
+ file_type: z2.string(),
276
+ num_lines: z2.number().nullable(),
277
+ start_line: z2.number().nullable(),
278
+ total_lines: z2.number().nullable()
285
279
  }),
286
- import_v42.z.object({
287
- type: import_v42.z.literal("text_editor_code_execution_create_result"),
288
- is_file_update: import_v42.z.boolean()
280
+ z2.object({
281
+ type: z2.literal("text_editor_code_execution_create_result"),
282
+ is_file_update: z2.boolean()
289
283
  }),
290
- import_v42.z.object({
291
- type: import_v42.z.literal(
284
+ z2.object({
285
+ type: z2.literal(
292
286
  "text_editor_code_execution_str_replace_result"
293
287
  ),
294
- lines: import_v42.z.array(import_v42.z.string()).nullable(),
295
- new_lines: import_v42.z.number().nullable(),
296
- new_start: import_v42.z.number().nullable(),
297
- old_lines: import_v42.z.number().nullable(),
298
- old_start: import_v42.z.number().nullable()
288
+ lines: z2.array(z2.string()).nullable(),
289
+ new_lines: z2.number().nullable(),
290
+ new_start: z2.number().nullable(),
291
+ old_lines: z2.number().nullable(),
292
+ old_start: z2.number().nullable()
299
293
  })
300
294
  ])
301
295
  }),
302
296
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
303
- import_v42.z.object({
304
- type: import_v42.z.literal("tool_search_tool_result"),
305
- tool_use_id: import_v42.z.string(),
306
- content: import_v42.z.union([
307
- import_v42.z.object({
308
- type: import_v42.z.literal("tool_search_tool_search_result"),
309
- tool_references: import_v42.z.array(
310
- import_v42.z.object({
311
- type: import_v42.z.literal("tool_reference"),
312
- tool_name: import_v42.z.string()
297
+ z2.object({
298
+ type: z2.literal("tool_search_tool_result"),
299
+ tool_use_id: z2.string(),
300
+ content: z2.union([
301
+ z2.object({
302
+ type: z2.literal("tool_search_tool_search_result"),
303
+ tool_references: z2.array(
304
+ z2.object({
305
+ type: z2.literal("tool_reference"),
306
+ tool_name: z2.string()
313
307
  })
314
308
  )
315
309
  }),
316
- import_v42.z.object({
317
- type: import_v42.z.literal("tool_search_tool_result_error"),
318
- error_code: import_v42.z.string()
310
+ z2.object({
311
+ type: z2.literal("tool_search_tool_result_error"),
312
+ error_code: z2.string()
319
313
  })
320
314
  ])
321
315
  })
322
316
  ])
323
317
  ),
324
- stop_reason: import_v42.z.string().nullish(),
325
- stop_sequence: import_v42.z.string().nullish(),
326
- usage: import_v42.z.looseObject({
327
- input_tokens: import_v42.z.number(),
328
- output_tokens: import_v42.z.number(),
329
- cache_creation_input_tokens: import_v42.z.number().nullish(),
330
- cache_read_input_tokens: import_v42.z.number().nullish(),
331
- iterations: import_v42.z.array(
332
- import_v42.z.object({
333
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
334
- input_tokens: import_v42.z.number(),
335
- output_tokens: import_v42.z.number()
318
+ stop_reason: z2.string().nullish(),
319
+ stop_sequence: z2.string().nullish(),
320
+ usage: z2.looseObject({
321
+ input_tokens: z2.number(),
322
+ output_tokens: z2.number(),
323
+ cache_creation_input_tokens: z2.number().nullish(),
324
+ cache_read_input_tokens: z2.number().nullish(),
325
+ iterations: z2.array(
326
+ z2.object({
327
+ type: z2.union([z2.literal("compaction"), z2.literal("message")]),
328
+ input_tokens: z2.number(),
329
+ output_tokens: z2.number()
336
330
  })
337
331
  ).nullish()
338
332
  }),
339
- container: import_v42.z.object({
340
- expires_at: import_v42.z.string(),
341
- id: import_v42.z.string(),
342
- skills: import_v42.z.array(
343
- import_v42.z.object({
344
- type: import_v42.z.union([import_v42.z.literal("anthropic"), import_v42.z.literal("custom")]),
345
- skill_id: import_v42.z.string(),
346
- version: import_v42.z.string()
333
+ container: z2.object({
334
+ expires_at: z2.string(),
335
+ id: z2.string(),
336
+ skills: z2.array(
337
+ z2.object({
338
+ type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
339
+ skill_id: z2.string(),
340
+ version: z2.string()
347
341
  })
348
342
  ).nullish()
349
343
  }).nullish(),
350
- context_management: import_v42.z.object({
351
- applied_edits: import_v42.z.array(
352
- import_v42.z.union([
353
- import_v42.z.object({
354
- type: import_v42.z.literal("clear_tool_uses_20250919"),
355
- cleared_tool_uses: import_v42.z.number(),
356
- cleared_input_tokens: import_v42.z.number()
344
+ context_management: z2.object({
345
+ applied_edits: z2.array(
346
+ z2.union([
347
+ z2.object({
348
+ type: z2.literal("clear_tool_uses_20250919"),
349
+ cleared_tool_uses: z2.number(),
350
+ cleared_input_tokens: z2.number()
357
351
  }),
358
- import_v42.z.object({
359
- type: import_v42.z.literal("clear_thinking_20251015"),
360
- cleared_thinking_turns: import_v42.z.number(),
361
- cleared_input_tokens: import_v42.z.number()
352
+ z2.object({
353
+ type: z2.literal("clear_thinking_20251015"),
354
+ cleared_thinking_turns: z2.number(),
355
+ cleared_input_tokens: z2.number()
362
356
  }),
363
- import_v42.z.object({
364
- type: import_v42.z.literal("compact_20260112")
357
+ z2.object({
358
+ type: z2.literal("compact_20260112")
365
359
  })
366
360
  ])
367
361
  )
@@ -369,457 +363,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
369
363
  })
370
364
  )
371
365
  );
372
- var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
373
- () => (0, import_provider_utils2.zodSchema)(
374
- import_v42.z.discriminatedUnion("type", [
375
- import_v42.z.object({
376
- type: import_v42.z.literal("message_start"),
377
- message: import_v42.z.object({
378
- id: import_v42.z.string().nullish(),
379
- model: import_v42.z.string().nullish(),
380
- role: import_v42.z.string().nullish(),
381
- usage: import_v42.z.looseObject({
382
- input_tokens: import_v42.z.number(),
383
- cache_creation_input_tokens: import_v42.z.number().nullish(),
384
- cache_read_input_tokens: import_v42.z.number().nullish()
366
+ var anthropicMessagesChunkSchema = lazySchema2(
367
+ () => zodSchema2(
368
+ z2.discriminatedUnion("type", [
369
+ z2.object({
370
+ type: z2.literal("message_start"),
371
+ message: z2.object({
372
+ id: z2.string().nullish(),
373
+ model: z2.string().nullish(),
374
+ role: z2.string().nullish(),
375
+ usage: z2.looseObject({
376
+ input_tokens: z2.number(),
377
+ cache_creation_input_tokens: z2.number().nullish(),
378
+ cache_read_input_tokens: z2.number().nullish()
385
379
  }),
386
380
  // Programmatic tool calling: content may be pre-populated for deferred tool calls
387
- content: import_v42.z.array(
388
- import_v42.z.discriminatedUnion("type", [
389
- import_v42.z.object({
390
- type: import_v42.z.literal("tool_use"),
391
- id: import_v42.z.string(),
392
- name: import_v42.z.string(),
393
- input: import_v42.z.unknown(),
394
- caller: import_v42.z.union([
395
- import_v42.z.object({
396
- type: import_v42.z.literal("code_execution_20250825"),
397
- tool_id: import_v42.z.string()
381
+ content: z2.array(
382
+ z2.discriminatedUnion("type", [
383
+ z2.object({
384
+ type: z2.literal("tool_use"),
385
+ id: z2.string(),
386
+ name: z2.string(),
387
+ input: z2.unknown(),
388
+ caller: z2.union([
389
+ z2.object({
390
+ type: z2.literal("code_execution_20250825"),
391
+ tool_id: z2.string()
398
392
  }),
399
- import_v42.z.object({
400
- type: import_v42.z.literal("code_execution_20260120"),
401
- tool_id: import_v42.z.string()
393
+ z2.object({
394
+ type: z2.literal("code_execution_20260120"),
395
+ tool_id: z2.string()
402
396
  }),
403
- import_v42.z.object({
404
- type: import_v42.z.literal("direct")
397
+ z2.object({
398
+ type: z2.literal("direct")
405
399
  })
406
400
  ]).optional()
407
401
  })
408
402
  ])
409
403
  ).nullish(),
410
- stop_reason: import_v42.z.string().nullish(),
411
- container: import_v42.z.object({
412
- expires_at: import_v42.z.string(),
413
- id: import_v42.z.string()
404
+ stop_reason: z2.string().nullish(),
405
+ container: z2.object({
406
+ expires_at: z2.string(),
407
+ id: z2.string()
414
408
  }).nullish()
415
409
  })
416
410
  }),
417
- import_v42.z.object({
418
- type: import_v42.z.literal("content_block_start"),
419
- index: import_v42.z.number(),
420
- content_block: import_v42.z.discriminatedUnion("type", [
421
- import_v42.z.object({
422
- type: import_v42.z.literal("text"),
423
- text: import_v42.z.string()
411
+ z2.object({
412
+ type: z2.literal("content_block_start"),
413
+ index: z2.number(),
414
+ content_block: z2.discriminatedUnion("type", [
415
+ z2.object({
416
+ type: z2.literal("text"),
417
+ text: z2.string()
424
418
  }),
425
- import_v42.z.object({
426
- type: import_v42.z.literal("thinking"),
427
- thinking: import_v42.z.string()
419
+ z2.object({
420
+ type: z2.literal("thinking"),
421
+ thinking: z2.string()
428
422
  }),
429
- import_v42.z.object({
430
- type: import_v42.z.literal("tool_use"),
431
- id: import_v42.z.string(),
432
- name: import_v42.z.string(),
423
+ z2.object({
424
+ type: z2.literal("tool_use"),
425
+ id: z2.string(),
426
+ name: z2.string(),
433
427
  // Programmatic tool calling: input may be present directly for deferred tool calls
434
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).optional(),
428
+ input: z2.record(z2.string(), z2.unknown()).optional(),
435
429
  // Programmatic tool calling: caller info when triggered from code execution
436
- caller: import_v42.z.union([
437
- import_v42.z.object({
438
- type: import_v42.z.literal("code_execution_20250825"),
439
- tool_id: import_v42.z.string()
430
+ caller: z2.union([
431
+ z2.object({
432
+ type: z2.literal("code_execution_20250825"),
433
+ tool_id: z2.string()
440
434
  }),
441
- import_v42.z.object({
442
- type: import_v42.z.literal("code_execution_20260120"),
443
- tool_id: import_v42.z.string()
435
+ z2.object({
436
+ type: z2.literal("code_execution_20260120"),
437
+ tool_id: z2.string()
444
438
  }),
445
- import_v42.z.object({
446
- type: import_v42.z.literal("direct")
439
+ z2.object({
440
+ type: z2.literal("direct")
447
441
  })
448
442
  ]).optional()
449
443
  }),
450
- import_v42.z.object({
451
- type: import_v42.z.literal("redacted_thinking"),
452
- data: import_v42.z.string()
444
+ z2.object({
445
+ type: z2.literal("redacted_thinking"),
446
+ data: z2.string()
453
447
  }),
454
- import_v42.z.object({
455
- type: import_v42.z.literal("compaction"),
456
- content: import_v42.z.string().nullish()
448
+ z2.object({
449
+ type: z2.literal("compaction"),
450
+ content: z2.string().nullish()
457
451
  }),
458
- import_v42.z.object({
459
- type: import_v42.z.literal("server_tool_use"),
460
- id: import_v42.z.string(),
461
- name: import_v42.z.string(),
462
- input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
463
- caller: import_v42.z.union([
464
- import_v42.z.object({
465
- type: import_v42.z.literal("code_execution_20260120"),
466
- tool_id: import_v42.z.string()
452
+ z2.object({
453
+ type: z2.literal("server_tool_use"),
454
+ id: z2.string(),
455
+ name: z2.string(),
456
+ input: z2.record(z2.string(), z2.unknown()).nullish(),
457
+ caller: z2.union([
458
+ z2.object({
459
+ type: z2.literal("code_execution_20260120"),
460
+ tool_id: z2.string()
467
461
  }),
468
- import_v42.z.object({
469
- type: import_v42.z.literal("direct")
462
+ z2.object({
463
+ type: z2.literal("direct")
470
464
  })
471
465
  ]).optional()
472
466
  }),
473
- import_v42.z.object({
474
- type: import_v42.z.literal("mcp_tool_use"),
475
- id: import_v42.z.string(),
476
- name: import_v42.z.string(),
477
- input: import_v42.z.unknown(),
478
- server_name: import_v42.z.string()
467
+ z2.object({
468
+ type: z2.literal("mcp_tool_use"),
469
+ id: z2.string(),
470
+ name: z2.string(),
471
+ input: z2.unknown(),
472
+ server_name: z2.string()
479
473
  }),
480
- import_v42.z.object({
481
- type: import_v42.z.literal("mcp_tool_result"),
482
- tool_use_id: import_v42.z.string(),
483
- is_error: import_v42.z.boolean(),
484
- content: import_v42.z.array(
485
- import_v42.z.union([
486
- import_v42.z.string(),
487
- import_v42.z.object({ type: import_v42.z.literal("text"), text: import_v42.z.string() })
474
+ z2.object({
475
+ type: z2.literal("mcp_tool_result"),
476
+ tool_use_id: z2.string(),
477
+ is_error: z2.boolean(),
478
+ content: z2.array(
479
+ z2.union([
480
+ z2.string(),
481
+ z2.object({ type: z2.literal("text"), text: z2.string() })
488
482
  ])
489
483
  )
490
484
  }),
491
- import_v42.z.object({
492
- type: import_v42.z.literal("web_fetch_tool_result"),
493
- tool_use_id: import_v42.z.string(),
494
- content: import_v42.z.union([
495
- import_v42.z.object({
496
- type: import_v42.z.literal("web_fetch_result"),
497
- url: import_v42.z.string(),
498
- retrieved_at: import_v42.z.string(),
499
- content: import_v42.z.object({
500
- type: import_v42.z.literal("document"),
501
- title: import_v42.z.string().nullable(),
502
- citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
503
- source: import_v42.z.union([
504
- import_v42.z.object({
505
- type: import_v42.z.literal("base64"),
506
- media_type: import_v42.z.literal("application/pdf"),
507
- data: import_v42.z.string()
485
+ z2.object({
486
+ type: z2.literal("web_fetch_tool_result"),
487
+ tool_use_id: z2.string(),
488
+ content: z2.union([
489
+ z2.object({
490
+ type: z2.literal("web_fetch_result"),
491
+ url: z2.string(),
492
+ retrieved_at: z2.string(),
493
+ content: z2.object({
494
+ type: z2.literal("document"),
495
+ title: z2.string().nullable(),
496
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
497
+ source: z2.union([
498
+ z2.object({
499
+ type: z2.literal("base64"),
500
+ media_type: z2.literal("application/pdf"),
501
+ data: z2.string()
508
502
  }),
509
- import_v42.z.object({
510
- type: import_v42.z.literal("text"),
511
- media_type: import_v42.z.literal("text/plain"),
512
- data: import_v42.z.string()
503
+ z2.object({
504
+ type: z2.literal("text"),
505
+ media_type: z2.literal("text/plain"),
506
+ data: z2.string()
513
507
  })
514
508
  ])
515
509
  })
516
510
  }),
517
- import_v42.z.object({
518
- type: import_v42.z.literal("web_fetch_tool_result_error"),
519
- error_code: import_v42.z.string()
511
+ z2.object({
512
+ type: z2.literal("web_fetch_tool_result_error"),
513
+ error_code: z2.string()
520
514
  })
521
515
  ])
522
516
  }),
523
- import_v42.z.object({
524
- type: import_v42.z.literal("web_search_tool_result"),
525
- tool_use_id: import_v42.z.string(),
526
- content: import_v42.z.union([
527
- import_v42.z.array(
528
- import_v42.z.object({
529
- type: import_v42.z.literal("web_search_result"),
530
- url: import_v42.z.string(),
531
- title: import_v42.z.string(),
532
- encrypted_content: import_v42.z.string(),
533
- page_age: import_v42.z.string().nullish()
517
+ z2.object({
518
+ type: z2.literal("web_search_tool_result"),
519
+ tool_use_id: z2.string(),
520
+ content: z2.union([
521
+ z2.array(
522
+ z2.object({
523
+ type: z2.literal("web_search_result"),
524
+ url: z2.string(),
525
+ title: z2.string(),
526
+ encrypted_content: z2.string(),
527
+ page_age: z2.string().nullish()
534
528
  })
535
529
  ),
536
- import_v42.z.object({
537
- type: import_v42.z.literal("web_search_tool_result_error"),
538
- error_code: import_v42.z.string()
530
+ z2.object({
531
+ type: z2.literal("web_search_tool_result_error"),
532
+ error_code: z2.string()
539
533
  })
540
534
  ])
541
535
  }),
542
536
  // code execution results for code_execution_20250522 tool:
543
- import_v42.z.object({
544
- type: import_v42.z.literal("code_execution_tool_result"),
545
- tool_use_id: import_v42.z.string(),
546
- content: import_v42.z.union([
547
- import_v42.z.object({
548
- type: import_v42.z.literal("code_execution_result"),
549
- stdout: import_v42.z.string(),
550
- stderr: import_v42.z.string(),
551
- return_code: import_v42.z.number(),
552
- content: import_v42.z.array(
553
- import_v42.z.object({
554
- type: import_v42.z.literal("code_execution_output"),
555
- file_id: import_v42.z.string()
537
+ z2.object({
538
+ type: z2.literal("code_execution_tool_result"),
539
+ tool_use_id: z2.string(),
540
+ content: z2.union([
541
+ z2.object({
542
+ type: z2.literal("code_execution_result"),
543
+ stdout: z2.string(),
544
+ stderr: z2.string(),
545
+ return_code: z2.number(),
546
+ content: z2.array(
547
+ z2.object({
548
+ type: z2.literal("code_execution_output"),
549
+ file_id: z2.string()
556
550
  })
557
551
  ).optional().default([])
558
552
  }),
559
- import_v42.z.object({
560
- type: import_v42.z.literal("encrypted_code_execution_result"),
561
- encrypted_stdout: import_v42.z.string(),
562
- stderr: import_v42.z.string(),
563
- return_code: import_v42.z.number(),
564
- content: import_v42.z.array(
565
- import_v42.z.object({
566
- type: import_v42.z.literal("code_execution_output"),
567
- file_id: import_v42.z.string()
553
+ z2.object({
554
+ type: z2.literal("encrypted_code_execution_result"),
555
+ encrypted_stdout: z2.string(),
556
+ stderr: z2.string(),
557
+ return_code: z2.number(),
558
+ content: z2.array(
559
+ z2.object({
560
+ type: z2.literal("code_execution_output"),
561
+ file_id: z2.string()
568
562
  })
569
563
  ).optional().default([])
570
564
  }),
571
- import_v42.z.object({
572
- type: import_v42.z.literal("code_execution_tool_result_error"),
573
- error_code: import_v42.z.string()
565
+ z2.object({
566
+ type: z2.literal("code_execution_tool_result_error"),
567
+ error_code: z2.string()
574
568
  })
575
569
  ])
576
570
  }),
577
571
  // bash code execution results for code_execution_20250825 tool:
578
- import_v42.z.object({
579
- type: import_v42.z.literal("bash_code_execution_tool_result"),
580
- tool_use_id: import_v42.z.string(),
581
- content: import_v42.z.discriminatedUnion("type", [
582
- import_v42.z.object({
583
- type: import_v42.z.literal("bash_code_execution_result"),
584
- content: import_v42.z.array(
585
- import_v42.z.object({
586
- type: import_v42.z.literal("bash_code_execution_output"),
587
- file_id: import_v42.z.string()
572
+ z2.object({
573
+ type: z2.literal("bash_code_execution_tool_result"),
574
+ tool_use_id: z2.string(),
575
+ content: z2.discriminatedUnion("type", [
576
+ z2.object({
577
+ type: z2.literal("bash_code_execution_result"),
578
+ content: z2.array(
579
+ z2.object({
580
+ type: z2.literal("bash_code_execution_output"),
581
+ file_id: z2.string()
588
582
  })
589
583
  ),
590
- stdout: import_v42.z.string(),
591
- stderr: import_v42.z.string(),
592
- return_code: import_v42.z.number()
584
+ stdout: z2.string(),
585
+ stderr: z2.string(),
586
+ return_code: z2.number()
593
587
  }),
594
- import_v42.z.object({
595
- type: import_v42.z.literal("bash_code_execution_tool_result_error"),
596
- error_code: import_v42.z.string()
588
+ z2.object({
589
+ type: z2.literal("bash_code_execution_tool_result_error"),
590
+ error_code: z2.string()
597
591
  })
598
592
  ])
599
593
  }),
600
594
  // text editor code execution results for code_execution_20250825 tool:
601
- import_v42.z.object({
602
- type: import_v42.z.literal("text_editor_code_execution_tool_result"),
603
- tool_use_id: import_v42.z.string(),
604
- content: import_v42.z.discriminatedUnion("type", [
605
- import_v42.z.object({
606
- type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
607
- error_code: import_v42.z.string()
595
+ z2.object({
596
+ type: z2.literal("text_editor_code_execution_tool_result"),
597
+ tool_use_id: z2.string(),
598
+ content: z2.discriminatedUnion("type", [
599
+ z2.object({
600
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
601
+ error_code: z2.string()
608
602
  }),
609
- import_v42.z.object({
610
- type: import_v42.z.literal("text_editor_code_execution_view_result"),
611
- content: import_v42.z.string(),
612
- file_type: import_v42.z.string(),
613
- num_lines: import_v42.z.number().nullable(),
614
- start_line: import_v42.z.number().nullable(),
615
- total_lines: import_v42.z.number().nullable()
603
+ z2.object({
604
+ type: z2.literal("text_editor_code_execution_view_result"),
605
+ content: z2.string(),
606
+ file_type: z2.string(),
607
+ num_lines: z2.number().nullable(),
608
+ start_line: z2.number().nullable(),
609
+ total_lines: z2.number().nullable()
616
610
  }),
617
- import_v42.z.object({
618
- type: import_v42.z.literal("text_editor_code_execution_create_result"),
619
- is_file_update: import_v42.z.boolean()
611
+ z2.object({
612
+ type: z2.literal("text_editor_code_execution_create_result"),
613
+ is_file_update: z2.boolean()
620
614
  }),
621
- import_v42.z.object({
622
- type: import_v42.z.literal(
615
+ z2.object({
616
+ type: z2.literal(
623
617
  "text_editor_code_execution_str_replace_result"
624
618
  ),
625
- lines: import_v42.z.array(import_v42.z.string()).nullable(),
626
- new_lines: import_v42.z.number().nullable(),
627
- new_start: import_v42.z.number().nullable(),
628
- old_lines: import_v42.z.number().nullable(),
629
- old_start: import_v42.z.number().nullable()
619
+ lines: z2.array(z2.string()).nullable(),
620
+ new_lines: z2.number().nullable(),
621
+ new_start: z2.number().nullable(),
622
+ old_lines: z2.number().nullable(),
623
+ old_start: z2.number().nullable()
630
624
  })
631
625
  ])
632
626
  }),
633
627
  // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
634
- import_v42.z.object({
635
- type: import_v42.z.literal("tool_search_tool_result"),
636
- tool_use_id: import_v42.z.string(),
637
- content: import_v42.z.union([
638
- import_v42.z.object({
639
- type: import_v42.z.literal("tool_search_tool_search_result"),
640
- tool_references: import_v42.z.array(
641
- import_v42.z.object({
642
- type: import_v42.z.literal("tool_reference"),
643
- tool_name: import_v42.z.string()
628
+ z2.object({
629
+ type: z2.literal("tool_search_tool_result"),
630
+ tool_use_id: z2.string(),
631
+ content: z2.union([
632
+ z2.object({
633
+ type: z2.literal("tool_search_tool_search_result"),
634
+ tool_references: z2.array(
635
+ z2.object({
636
+ type: z2.literal("tool_reference"),
637
+ tool_name: z2.string()
644
638
  })
645
639
  )
646
640
  }),
647
- import_v42.z.object({
648
- type: import_v42.z.literal("tool_search_tool_result_error"),
649
- error_code: import_v42.z.string()
641
+ z2.object({
642
+ type: z2.literal("tool_search_tool_result_error"),
643
+ error_code: z2.string()
650
644
  })
651
645
  ])
652
646
  })
653
647
  ])
654
648
  }),
655
- import_v42.z.object({
656
- type: import_v42.z.literal("content_block_delta"),
657
- index: import_v42.z.number(),
658
- delta: import_v42.z.discriminatedUnion("type", [
659
- import_v42.z.object({
660
- type: import_v42.z.literal("input_json_delta"),
661
- partial_json: import_v42.z.string()
649
+ z2.object({
650
+ type: z2.literal("content_block_delta"),
651
+ index: z2.number(),
652
+ delta: z2.discriminatedUnion("type", [
653
+ z2.object({
654
+ type: z2.literal("input_json_delta"),
655
+ partial_json: z2.string()
662
656
  }),
663
- import_v42.z.object({
664
- type: import_v42.z.literal("text_delta"),
665
- text: import_v42.z.string()
657
+ z2.object({
658
+ type: z2.literal("text_delta"),
659
+ text: z2.string()
666
660
  }),
667
- import_v42.z.object({
668
- type: import_v42.z.literal("thinking_delta"),
669
- thinking: import_v42.z.string()
661
+ z2.object({
662
+ type: z2.literal("thinking_delta"),
663
+ thinking: z2.string()
670
664
  }),
671
- import_v42.z.object({
672
- type: import_v42.z.literal("signature_delta"),
673
- signature: import_v42.z.string()
665
+ z2.object({
666
+ type: z2.literal("signature_delta"),
667
+ signature: z2.string()
674
668
  }),
675
- import_v42.z.object({
676
- type: import_v42.z.literal("compaction_delta"),
677
- content: import_v42.z.string().nullish()
669
+ z2.object({
670
+ type: z2.literal("compaction_delta"),
671
+ content: z2.string().nullish()
678
672
  }),
679
- import_v42.z.object({
680
- type: import_v42.z.literal("citations_delta"),
681
- citation: import_v42.z.discriminatedUnion("type", [
682
- import_v42.z.object({
683
- type: import_v42.z.literal("web_search_result_location"),
684
- cited_text: import_v42.z.string(),
685
- url: import_v42.z.string(),
686
- title: import_v42.z.string(),
687
- encrypted_index: import_v42.z.string()
673
+ z2.object({
674
+ type: z2.literal("citations_delta"),
675
+ citation: z2.discriminatedUnion("type", [
676
+ z2.object({
677
+ type: z2.literal("web_search_result_location"),
678
+ cited_text: z2.string(),
679
+ url: z2.string(),
680
+ title: z2.string(),
681
+ encrypted_index: z2.string()
688
682
  }),
689
- import_v42.z.object({
690
- type: import_v42.z.literal("page_location"),
691
- cited_text: import_v42.z.string(),
692
- document_index: import_v42.z.number(),
693
- document_title: import_v42.z.string().nullable(),
694
- start_page_number: import_v42.z.number(),
695
- end_page_number: import_v42.z.number()
683
+ z2.object({
684
+ type: z2.literal("page_location"),
685
+ cited_text: z2.string(),
686
+ document_index: z2.number(),
687
+ document_title: z2.string().nullable(),
688
+ start_page_number: z2.number(),
689
+ end_page_number: z2.number()
696
690
  }),
697
- import_v42.z.object({
698
- type: import_v42.z.literal("char_location"),
699
- cited_text: import_v42.z.string(),
700
- document_index: import_v42.z.number(),
701
- document_title: import_v42.z.string().nullable(),
702
- start_char_index: import_v42.z.number(),
703
- end_char_index: import_v42.z.number()
691
+ z2.object({
692
+ type: z2.literal("char_location"),
693
+ cited_text: z2.string(),
694
+ document_index: z2.number(),
695
+ document_title: z2.string().nullable(),
696
+ start_char_index: z2.number(),
697
+ end_char_index: z2.number()
704
698
  })
705
699
  ])
706
700
  })
707
701
  ])
708
702
  }),
709
- import_v42.z.object({
710
- type: import_v42.z.literal("content_block_stop"),
711
- index: import_v42.z.number()
703
+ z2.object({
704
+ type: z2.literal("content_block_stop"),
705
+ index: z2.number()
712
706
  }),
713
- import_v42.z.object({
714
- type: import_v42.z.literal("error"),
715
- error: import_v42.z.object({
716
- type: import_v42.z.string(),
717
- message: import_v42.z.string()
707
+ z2.object({
708
+ type: z2.literal("error"),
709
+ error: z2.object({
710
+ type: z2.string(),
711
+ message: z2.string()
718
712
  })
719
713
  }),
720
- import_v42.z.object({
721
- type: import_v42.z.literal("message_delta"),
722
- delta: import_v42.z.object({
723
- stop_reason: import_v42.z.string().nullish(),
724
- stop_sequence: import_v42.z.string().nullish(),
725
- container: import_v42.z.object({
726
- expires_at: import_v42.z.string(),
727
- id: import_v42.z.string(),
728
- skills: import_v42.z.array(
729
- import_v42.z.object({
730
- type: import_v42.z.union([
731
- import_v42.z.literal("anthropic"),
732
- import_v42.z.literal("custom")
714
+ z2.object({
715
+ type: z2.literal("message_delta"),
716
+ delta: z2.object({
717
+ stop_reason: z2.string().nullish(),
718
+ stop_sequence: z2.string().nullish(),
719
+ container: z2.object({
720
+ expires_at: z2.string(),
721
+ id: z2.string(),
722
+ skills: z2.array(
723
+ z2.object({
724
+ type: z2.union([
725
+ z2.literal("anthropic"),
726
+ z2.literal("custom")
733
727
  ]),
734
- skill_id: import_v42.z.string(),
735
- version: import_v42.z.string()
728
+ skill_id: z2.string(),
729
+ version: z2.string()
736
730
  })
737
731
  ).nullish()
738
732
  }).nullish()
739
733
  }),
740
- usage: import_v42.z.looseObject({
741
- input_tokens: import_v42.z.number().nullish(),
742
- output_tokens: import_v42.z.number(),
743
- cache_creation_input_tokens: import_v42.z.number().nullish(),
744
- cache_read_input_tokens: import_v42.z.number().nullish(),
745
- iterations: import_v42.z.array(
746
- import_v42.z.object({
747
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
748
- input_tokens: import_v42.z.number(),
749
- output_tokens: import_v42.z.number()
734
+ usage: z2.looseObject({
735
+ input_tokens: z2.number().nullish(),
736
+ output_tokens: z2.number(),
737
+ cache_creation_input_tokens: z2.number().nullish(),
738
+ cache_read_input_tokens: z2.number().nullish(),
739
+ iterations: z2.array(
740
+ z2.object({
741
+ type: z2.union([z2.literal("compaction"), z2.literal("message")]),
742
+ input_tokens: z2.number(),
743
+ output_tokens: z2.number()
750
744
  })
751
745
  ).nullish()
752
746
  }),
753
- context_management: import_v42.z.object({
754
- applied_edits: import_v42.z.array(
755
- import_v42.z.union([
756
- import_v42.z.object({
757
- type: import_v42.z.literal("clear_tool_uses_20250919"),
758
- cleared_tool_uses: import_v42.z.number(),
759
- cleared_input_tokens: import_v42.z.number()
747
+ context_management: z2.object({
748
+ applied_edits: z2.array(
749
+ z2.union([
750
+ z2.object({
751
+ type: z2.literal("clear_tool_uses_20250919"),
752
+ cleared_tool_uses: z2.number(),
753
+ cleared_input_tokens: z2.number()
760
754
  }),
761
- import_v42.z.object({
762
- type: import_v42.z.literal("clear_thinking_20251015"),
763
- cleared_thinking_turns: import_v42.z.number(),
764
- cleared_input_tokens: import_v42.z.number()
755
+ z2.object({
756
+ type: z2.literal("clear_thinking_20251015"),
757
+ cleared_thinking_turns: z2.number(),
758
+ cleared_input_tokens: z2.number()
765
759
  }),
766
- import_v42.z.object({
767
- type: import_v42.z.literal("compact_20260112")
760
+ z2.object({
761
+ type: z2.literal("compact_20260112")
768
762
  })
769
763
  ])
770
764
  )
771
765
  }).nullish()
772
766
  }),
773
- import_v42.z.object({
774
- type: import_v42.z.literal("message_stop")
767
+ z2.object({
768
+ type: z2.literal("message_stop")
775
769
  }),
776
- import_v42.z.object({
777
- type: import_v42.z.literal("ping")
770
+ z2.object({
771
+ type: z2.literal("ping")
778
772
  })
779
773
  ])
780
774
  )
781
775
  );
782
- var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
783
- () => (0, import_provider_utils2.zodSchema)(
784
- import_v42.z.object({
785
- signature: import_v42.z.string().optional(),
786
- redactedData: import_v42.z.string().optional()
776
+ var anthropicReasoningMetadataSchema = lazySchema2(
777
+ () => zodSchema2(
778
+ z2.object({
779
+ signature: z2.string().optional(),
780
+ redactedData: z2.string().optional()
787
781
  })
788
782
  )
789
783
  );
790
784
 
791
785
  // src/anthropic-messages-options.ts
792
- var import_v43 = require("zod/v4");
793
- var anthropicFilePartProviderOptions = import_v43.z.object({
786
+ import { z as z3 } from "zod/v4";
787
+ var anthropicFilePartProviderOptions = z3.object({
794
788
  /**
795
789
  * Citation configuration for this document.
796
790
  * When enabled, this document will generate citations in the response.
797
791
  */
798
- citations: import_v43.z.object({
792
+ citations: z3.object({
799
793
  /**
800
794
  * Enable citations for this document
801
795
  */
802
- enabled: import_v43.z.boolean()
796
+ enabled: z3.boolean()
803
797
  }).optional(),
804
798
  /**
805
799
  * Custom title for the document.
806
800
  * If not provided, the filename will be used.
807
801
  */
808
- title: import_v43.z.string().optional(),
802
+ title: z3.string().optional(),
809
803
  /**
810
804
  * Context about the document that will be passed to the model
811
805
  * but not used towards cited content.
812
806
  * Useful for storing document metadata as text or stringified JSON.
813
807
  */
814
- context: import_v43.z.string().optional()
808
+ context: z3.string().optional()
815
809
  });
816
- var anthropicLanguageModelOptions = import_v43.z.object({
810
+ var anthropicLanguageModelOptions = z3.object({
817
811
  /**
818
812
  * Whether to send reasoning to the model.
819
813
  *
820
814
  * This allows you to deactivate reasoning inputs for models that do not support them.
821
815
  */
822
- sendReasoning: import_v43.z.boolean().optional(),
816
+ sendReasoning: z3.boolean().optional(),
823
817
  /**
824
818
  * Determines how structured outputs are generated.
825
819
  *
@@ -827,52 +821,72 @@ var anthropicLanguageModelOptions = import_v43.z.object({
827
821
  * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
828
822
  * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
829
823
  */
830
- structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
824
+ structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
831
825
  /**
832
826
  * Configuration for enabling Claude's extended thinking.
833
827
  *
834
828
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
835
829
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
836
830
  */
837
- thinking: import_v43.z.discriminatedUnion("type", [
838
- import_v43.z.object({
831
+ thinking: z3.discriminatedUnion("type", [
832
+ z3.object({
839
833
  /** for Sonnet 4.6, Opus 4.6, and newer models */
840
- type: import_v43.z.literal("adaptive")
834
+ type: z3.literal("adaptive"),
835
+ /**
836
+ * Controls whether thinking content is included in the response.
837
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
838
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
839
+ */
840
+ display: z3.enum(["omitted", "summarized"]).optional()
841
841
  }),
842
- import_v43.z.object({
842
+ z3.object({
843
843
  /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
844
- type: import_v43.z.literal("enabled"),
845
- budgetTokens: import_v43.z.number().optional()
844
+ type: z3.literal("enabled"),
845
+ budgetTokens: z3.number().optional()
846
846
  }),
847
- import_v43.z.object({
848
- type: import_v43.z.literal("disabled")
847
+ z3.object({
848
+ type: z3.literal("disabled")
849
849
  })
850
850
  ]).optional(),
851
851
  /**
852
852
  * Whether to disable parallel function calling during tool use. Default is false.
853
853
  * When set to true, Claude will use at most one tool per response.
854
854
  */
855
- disableParallelToolUse: import_v43.z.boolean().optional(),
855
+ disableParallelToolUse: z3.boolean().optional(),
856
856
  /**
857
857
  * Cache control settings for this message.
858
858
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
859
859
  */
860
- cacheControl: import_v43.z.object({
861
- type: import_v43.z.literal("ephemeral"),
862
- ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
860
+ cacheControl: z3.object({
861
+ type: z3.literal("ephemeral"),
862
+ ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
863
+ }).optional(),
864
+ /**
865
+ * Metadata to include with the request.
866
+ *
867
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
868
+ */
869
+ metadata: z3.object({
870
+ /**
871
+ * An external identifier for the user associated with the request.
872
+ *
873
+ * Should be a UUID, hash value, or other opaque identifier.
874
+ * Must not contain PII (name, email, phone number, etc.).
875
+ */
876
+ userId: z3.string().optional()
863
877
  }).optional(),
864
878
  /**
865
879
  * MCP servers to be utilized in this request.
866
880
  */
867
- mcpServers: import_v43.z.array(
868
- import_v43.z.object({
869
- type: import_v43.z.literal("url"),
870
- name: import_v43.z.string(),
871
- url: import_v43.z.string(),
872
- authorizationToken: import_v43.z.string().nullish(),
873
- toolConfiguration: import_v43.z.object({
874
- enabled: import_v43.z.boolean().nullish(),
875
- allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
881
+ mcpServers: z3.array(
882
+ z3.object({
883
+ type: z3.literal("url"),
884
+ name: z3.string(),
885
+ url: z3.string(),
886
+ authorizationToken: z3.string().nullish(),
887
+ toolConfiguration: z3.object({
888
+ enabled: z3.boolean().nullish(),
889
+ allowedTools: z3.array(z3.string()).nullish()
876
890
  }).nullish()
877
891
  })
878
892
  ).optional(),
@@ -881,83 +895,112 @@ var anthropicLanguageModelOptions = import_v43.z.object({
881
895
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
882
896
  * Requires code execution tool to be enabled.
883
897
  */
884
- container: import_v43.z.object({
885
- id: import_v43.z.string().optional(),
886
- skills: import_v43.z.array(
887
- import_v43.z.object({
888
- type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
889
- skillId: import_v43.z.string(),
890
- version: import_v43.z.string().optional()
891
- })
898
+ container: z3.object({
899
+ id: z3.string().optional(),
900
+ skills: z3.array(
901
+ z3.discriminatedUnion("type", [
902
+ z3.object({
903
+ type: z3.literal("anthropic"),
904
+ skillId: z3.string(),
905
+ version: z3.string().optional()
906
+ }),
907
+ z3.object({
908
+ type: z3.literal("custom"),
909
+ providerReference: z3.record(z3.string(), z3.string()),
910
+ version: z3.string().optional()
911
+ })
912
+ ])
892
913
  ).optional()
893
914
  }).optional(),
894
915
  /**
895
- * Whether to enable tool streaming (and structured output streaming).
896
- *
897
- * When set to false, the model will return all tool calls and results
898
- * at once after a delay.
916
+ * Whether to enable fine-grained (eager) streaming of tool call inputs
917
+ * and structured outputs for every function tool in the request. When
918
+ * true (the default), each function tool receives a default of
919
+ * `eager_input_streaming: true` unless it explicitly sets
920
+ * `providerOptions.anthropic.eagerInputStreaming`.
899
921
  *
900
922
  * @default true
901
923
  */
902
- toolStreaming: import_v43.z.boolean().optional(),
924
+ toolStreaming: z3.boolean().optional(),
903
925
  /**
904
926
  * @default 'high'
905
927
  */
906
- effort: import_v43.z.enum(["low", "medium", "high", "max"]).optional(),
928
+ effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
929
+ /**
930
+ * Task budget for agentic turns. Informs the model of the total token budget
931
+ * available for the current task, allowing it to prioritize work and wind down
932
+ * gracefully as the budget is consumed.
933
+ *
934
+ * Advisory only — does not enforce a hard token limit.
935
+ */
936
+ taskBudget: z3.object({
937
+ type: z3.literal("tokens"),
938
+ total: z3.number().int().min(2e4),
939
+ remaining: z3.number().int().min(0).optional()
940
+ }).optional(),
907
941
  /**
908
942
  * Enable fast mode for faster inference (2.5x faster output token speeds).
909
943
  * Only supported with claude-opus-4-6.
910
944
  */
911
- speed: import_v43.z.enum(["fast", "standard"]).optional(),
945
+ speed: z3.enum(["fast", "standard"]).optional(),
946
+ /**
947
+ * Controls where model inference runs for this request.
948
+ *
949
+ * - `"global"`: Inference may run in any available geography (default).
950
+ * - `"us"`: Inference runs only in US-based infrastructure.
951
+ *
952
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
953
+ */
954
+ inferenceGeo: z3.enum(["us", "global"]).optional(),
912
955
  /**
913
956
  * A set of beta features to enable.
914
957
  * Allow a provider to receive the full `betas` set if it needs it.
915
958
  */
916
- anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
917
- contextManagement: import_v43.z.object({
918
- edits: import_v43.z.array(
919
- import_v43.z.discriminatedUnion("type", [
920
- import_v43.z.object({
921
- type: import_v43.z.literal("clear_tool_uses_20250919"),
922
- trigger: import_v43.z.discriminatedUnion("type", [
923
- import_v43.z.object({
924
- type: import_v43.z.literal("input_tokens"),
925
- value: import_v43.z.number()
959
+ anthropicBeta: z3.array(z3.string()).optional(),
960
+ contextManagement: z3.object({
961
+ edits: z3.array(
962
+ z3.discriminatedUnion("type", [
963
+ z3.object({
964
+ type: z3.literal("clear_tool_uses_20250919"),
965
+ trigger: z3.discriminatedUnion("type", [
966
+ z3.object({
967
+ type: z3.literal("input_tokens"),
968
+ value: z3.number()
926
969
  }),
927
- import_v43.z.object({
928
- type: import_v43.z.literal("tool_uses"),
929
- value: import_v43.z.number()
970
+ z3.object({
971
+ type: z3.literal("tool_uses"),
972
+ value: z3.number()
930
973
  })
931
974
  ]).optional(),
932
- keep: import_v43.z.object({
933
- type: import_v43.z.literal("tool_uses"),
934
- value: import_v43.z.number()
975
+ keep: z3.object({
976
+ type: z3.literal("tool_uses"),
977
+ value: z3.number()
935
978
  }).optional(),
936
- clearAtLeast: import_v43.z.object({
937
- type: import_v43.z.literal("input_tokens"),
938
- value: import_v43.z.number()
979
+ clearAtLeast: z3.object({
980
+ type: z3.literal("input_tokens"),
981
+ value: z3.number()
939
982
  }).optional(),
940
- clearToolInputs: import_v43.z.boolean().optional(),
941
- excludeTools: import_v43.z.array(import_v43.z.string()).optional()
983
+ clearToolInputs: z3.boolean().optional(),
984
+ excludeTools: z3.array(z3.string()).optional()
942
985
  }),
943
- import_v43.z.object({
944
- type: import_v43.z.literal("clear_thinking_20251015"),
945
- keep: import_v43.z.union([
946
- import_v43.z.literal("all"),
947
- import_v43.z.object({
948
- type: import_v43.z.literal("thinking_turns"),
949
- value: import_v43.z.number()
986
+ z3.object({
987
+ type: z3.literal("clear_thinking_20251015"),
988
+ keep: z3.union([
989
+ z3.literal("all"),
990
+ z3.object({
991
+ type: z3.literal("thinking_turns"),
992
+ value: z3.number()
950
993
  })
951
994
  ]).optional()
952
995
  }),
953
- import_v43.z.object({
954
- type: import_v43.z.literal("compact_20260112"),
955
- trigger: import_v43.z.object({
956
- type: import_v43.z.literal("input_tokens"),
957
- value: import_v43.z.number()
996
+ z3.object({
997
+ type: z3.literal("compact_20260112"),
998
+ trigger: z3.object({
999
+ type: z3.literal("input_tokens"),
1000
+ value: z3.number()
958
1001
  }).optional(),
959
- pauseAfterCompaction: import_v43.z.boolean().optional(),
960
- instructions: import_v43.z.string().optional()
1002
+ pauseAfterCompaction: z3.boolean().optional(),
1003
+ instructions: z3.string().optional()
961
1004
  })
962
1005
  ])
963
1006
  )
@@ -965,7 +1008,9 @@ var anthropicLanguageModelOptions = import_v43.z.object({
965
1008
  });
966
1009
 
967
1010
  // src/anthropic-prepare-tools.ts
968
- var import_provider = require("@ai-sdk/provider");
1011
+ import {
1012
+ UnsupportedFunctionalityError
1013
+ } from "@ai-sdk/provider";
969
1014
 
970
1015
  // src/get-cache-control.ts
971
1016
  var MAX_CACHE_BREAKPOINTS = 4;
@@ -1010,31 +1055,31 @@ var CacheControlValidator = class {
1010
1055
  };
1011
1056
 
1012
1057
  // src/tool/text-editor_20250728.ts
1013
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
1014
- var import_v44 = require("zod/v4");
1015
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1016
- var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1017
- () => (0, import_provider_utils4.zodSchema)(
1018
- import_v44.z.object({
1019
- maxCharacters: import_v44.z.number().optional()
1058
+ import { createProviderToolFactory } from "@ai-sdk/provider-utils";
1059
+ import { z as z4 } from "zod/v4";
1060
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
1061
+ var textEditor_20250728ArgsSchema = lazySchema3(
1062
+ () => zodSchema3(
1063
+ z4.object({
1064
+ maxCharacters: z4.number().optional()
1020
1065
  })
1021
1066
  )
1022
1067
  );
1023
- var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1024
- () => (0, import_provider_utils4.zodSchema)(
1025
- import_v44.z.object({
1026
- command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
1027
- path: import_v44.z.string(),
1028
- file_text: import_v44.z.string().optional(),
1029
- insert_line: import_v44.z.number().int().optional(),
1030
- new_str: import_v44.z.string().optional(),
1031
- insert_text: import_v44.z.string().optional(),
1032
- old_str: import_v44.z.string().optional(),
1033
- view_range: import_v44.z.array(import_v44.z.number().int()).optional()
1068
+ var textEditor_20250728InputSchema = lazySchema3(
1069
+ () => zodSchema3(
1070
+ z4.object({
1071
+ command: z4.enum(["view", "create", "str_replace", "insert"]),
1072
+ path: z4.string(),
1073
+ file_text: z4.string().optional(),
1074
+ insert_line: z4.number().int().optional(),
1075
+ new_str: z4.string().optional(),
1076
+ insert_text: z4.string().optional(),
1077
+ old_str: z4.string().optional(),
1078
+ view_range: z4.array(z4.number().int()).optional()
1034
1079
  })
1035
1080
  )
1036
1081
  );
1037
- var factory = (0, import_provider_utils3.createProviderToolFactory)({
1082
+ var factory = createProviderToolFactory({
1038
1083
  id: "anthropic.text_editor_20250728",
1039
1084
  inputSchema: textEditor_20250728InputSchema
1040
1085
  });
@@ -1043,45 +1088,49 @@ var textEditor_20250728 = (args = {}) => {
1043
1088
  };
1044
1089
 
1045
1090
  // src/tool/web-search_20260209.ts
1046
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1047
- var import_v45 = require("zod/v4");
1048
- var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
1049
- () => (0, import_provider_utils5.zodSchema)(
1050
- import_v45.z.object({
1051
- maxUses: import_v45.z.number().optional(),
1052
- allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1053
- blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1054
- userLocation: import_v45.z.object({
1055
- type: import_v45.z.literal("approximate"),
1056
- city: import_v45.z.string().optional(),
1057
- region: import_v45.z.string().optional(),
1058
- country: import_v45.z.string().optional(),
1059
- timezone: import_v45.z.string().optional()
1091
+ import {
1092
+ createProviderToolFactoryWithOutputSchema,
1093
+ lazySchema as lazySchema4,
1094
+ zodSchema as zodSchema4
1095
+ } from "@ai-sdk/provider-utils";
1096
+ import { z as z5 } from "zod/v4";
1097
+ var webSearch_20260209ArgsSchema = lazySchema4(
1098
+ () => zodSchema4(
1099
+ z5.object({
1100
+ maxUses: z5.number().optional(),
1101
+ allowedDomains: z5.array(z5.string()).optional(),
1102
+ blockedDomains: z5.array(z5.string()).optional(),
1103
+ userLocation: z5.object({
1104
+ type: z5.literal("approximate"),
1105
+ city: z5.string().optional(),
1106
+ region: z5.string().optional(),
1107
+ country: z5.string().optional(),
1108
+ timezone: z5.string().optional()
1060
1109
  }).optional()
1061
1110
  })
1062
1111
  )
1063
1112
  );
1064
- var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
1065
- () => (0, import_provider_utils5.zodSchema)(
1066
- import_v45.z.array(
1067
- import_v45.z.object({
1068
- url: import_v45.z.string(),
1069
- title: import_v45.z.string().nullable(),
1070
- pageAge: import_v45.z.string().nullable(),
1071
- encryptedContent: import_v45.z.string(),
1072
- type: import_v45.z.literal("web_search_result")
1113
+ var webSearch_20260209OutputSchema = lazySchema4(
1114
+ () => zodSchema4(
1115
+ z5.array(
1116
+ z5.object({
1117
+ url: z5.string(),
1118
+ title: z5.string().nullable(),
1119
+ pageAge: z5.string().nullable(),
1120
+ encryptedContent: z5.string(),
1121
+ type: z5.literal("web_search_result")
1073
1122
  })
1074
1123
  )
1075
1124
  )
1076
1125
  );
1077
- var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
1078
- () => (0, import_provider_utils5.zodSchema)(
1079
- import_v45.z.object({
1080
- query: import_v45.z.string()
1126
+ var webSearch_20260209InputSchema = lazySchema4(
1127
+ () => zodSchema4(
1128
+ z5.object({
1129
+ query: z5.string()
1081
1130
  })
1082
1131
  )
1083
1132
  );
1084
- var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
1133
+ var factory2 = createProviderToolFactoryWithOutputSchema({
1085
1134
  id: "anthropic.web_search_20260209",
1086
1135
  inputSchema: webSearch_20260209InputSchema,
1087
1136
  outputSchema: webSearch_20260209OutputSchema,
@@ -1092,45 +1141,49 @@ var webSearch_20260209 = (args = {}) => {
1092
1141
  };
1093
1142
 
1094
1143
  // src/tool/web-search_20250305.ts
1095
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1096
- var import_v46 = require("zod/v4");
1097
- var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1098
- () => (0, import_provider_utils6.zodSchema)(
1099
- import_v46.z.object({
1100
- maxUses: import_v46.z.number().optional(),
1101
- allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1102
- blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1103
- userLocation: import_v46.z.object({
1104
- type: import_v46.z.literal("approximate"),
1105
- city: import_v46.z.string().optional(),
1106
- region: import_v46.z.string().optional(),
1107
- country: import_v46.z.string().optional(),
1108
- timezone: import_v46.z.string().optional()
1144
+ import {
1145
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1146
+ lazySchema as lazySchema5,
1147
+ zodSchema as zodSchema5
1148
+ } from "@ai-sdk/provider-utils";
1149
+ import { z as z6 } from "zod/v4";
1150
+ var webSearch_20250305ArgsSchema = lazySchema5(
1151
+ () => zodSchema5(
1152
+ z6.object({
1153
+ maxUses: z6.number().optional(),
1154
+ allowedDomains: z6.array(z6.string()).optional(),
1155
+ blockedDomains: z6.array(z6.string()).optional(),
1156
+ userLocation: z6.object({
1157
+ type: z6.literal("approximate"),
1158
+ city: z6.string().optional(),
1159
+ region: z6.string().optional(),
1160
+ country: z6.string().optional(),
1161
+ timezone: z6.string().optional()
1109
1162
  }).optional()
1110
1163
  })
1111
1164
  )
1112
1165
  );
1113
- var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1114
- () => (0, import_provider_utils6.zodSchema)(
1115
- import_v46.z.array(
1116
- import_v46.z.object({
1117
- url: import_v46.z.string(),
1118
- title: import_v46.z.string().nullable(),
1119
- pageAge: import_v46.z.string().nullable(),
1120
- encryptedContent: import_v46.z.string(),
1121
- type: import_v46.z.literal("web_search_result")
1166
+ var webSearch_20250305OutputSchema = lazySchema5(
1167
+ () => zodSchema5(
1168
+ z6.array(
1169
+ z6.object({
1170
+ url: z6.string(),
1171
+ title: z6.string().nullable(),
1172
+ pageAge: z6.string().nullable(),
1173
+ encryptedContent: z6.string(),
1174
+ type: z6.literal("web_search_result")
1122
1175
  })
1123
1176
  )
1124
1177
  )
1125
1178
  );
1126
- var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1127
- () => (0, import_provider_utils6.zodSchema)(
1128
- import_v46.z.object({
1129
- query: import_v46.z.string()
1179
+ var webSearch_20250305InputSchema = lazySchema5(
1180
+ () => zodSchema5(
1181
+ z6.object({
1182
+ query: z6.string()
1130
1183
  })
1131
1184
  )
1132
1185
  );
1133
- var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1186
+ var factory3 = createProviderToolFactoryWithOutputSchema2({
1134
1187
  id: "anthropic.web_search_20250305",
1135
1188
  inputSchema: webSearch_20250305InputSchema,
1136
1189
  outputSchema: webSearch_20250305OutputSchema,
@@ -1141,53 +1194,57 @@ var webSearch_20250305 = (args = {}) => {
1141
1194
  };
1142
1195
 
1143
1196
  // src/tool/web-fetch-20260209.ts
1144
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1145
- var import_v47 = require("zod/v4");
1146
- var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
1147
- () => (0, import_provider_utils7.zodSchema)(
1148
- import_v47.z.object({
1149
- maxUses: import_v47.z.number().optional(),
1150
- allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1151
- blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1152
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1153
- maxContentTokens: import_v47.z.number().optional()
1197
+ import {
1198
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1199
+ lazySchema as lazySchema6,
1200
+ zodSchema as zodSchema6
1201
+ } from "@ai-sdk/provider-utils";
1202
+ import { z as z7 } from "zod/v4";
1203
+ var webFetch_20260209ArgsSchema = lazySchema6(
1204
+ () => zodSchema6(
1205
+ z7.object({
1206
+ maxUses: z7.number().optional(),
1207
+ allowedDomains: z7.array(z7.string()).optional(),
1208
+ blockedDomains: z7.array(z7.string()).optional(),
1209
+ citations: z7.object({ enabled: z7.boolean() }).optional(),
1210
+ maxContentTokens: z7.number().optional()
1154
1211
  })
1155
1212
  )
1156
1213
  );
1157
- var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1158
- () => (0, import_provider_utils7.zodSchema)(
1159
- import_v47.z.object({
1160
- type: import_v47.z.literal("web_fetch_result"),
1161
- url: import_v47.z.string(),
1162
- content: import_v47.z.object({
1163
- type: import_v47.z.literal("document"),
1164
- title: import_v47.z.string().nullable(),
1165
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1166
- source: import_v47.z.union([
1167
- import_v47.z.object({
1168
- type: import_v47.z.literal("base64"),
1169
- mediaType: import_v47.z.literal("application/pdf"),
1170
- data: import_v47.z.string()
1214
+ var webFetch_20260209OutputSchema = lazySchema6(
1215
+ () => zodSchema6(
1216
+ z7.object({
1217
+ type: z7.literal("web_fetch_result"),
1218
+ url: z7.string(),
1219
+ content: z7.object({
1220
+ type: z7.literal("document"),
1221
+ title: z7.string().nullable(),
1222
+ citations: z7.object({ enabled: z7.boolean() }).optional(),
1223
+ source: z7.union([
1224
+ z7.object({
1225
+ type: z7.literal("base64"),
1226
+ mediaType: z7.literal("application/pdf"),
1227
+ data: z7.string()
1171
1228
  }),
1172
- import_v47.z.object({
1173
- type: import_v47.z.literal("text"),
1174
- mediaType: import_v47.z.literal("text/plain"),
1175
- data: import_v47.z.string()
1229
+ z7.object({
1230
+ type: z7.literal("text"),
1231
+ mediaType: z7.literal("text/plain"),
1232
+ data: z7.string()
1176
1233
  })
1177
1234
  ])
1178
1235
  }),
1179
- retrievedAt: import_v47.z.string().nullable()
1236
+ retrievedAt: z7.string().nullable()
1180
1237
  })
1181
1238
  )
1182
1239
  );
1183
- var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1184
- () => (0, import_provider_utils7.zodSchema)(
1185
- import_v47.z.object({
1186
- url: import_v47.z.string()
1240
+ var webFetch_20260209InputSchema = lazySchema6(
1241
+ () => zodSchema6(
1242
+ z7.object({
1243
+ url: z7.string()
1187
1244
  })
1188
1245
  )
1189
1246
  );
1190
- var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1247
+ var factory4 = createProviderToolFactoryWithOutputSchema3({
1191
1248
  id: "anthropic.web_fetch_20260209",
1192
1249
  inputSchema: webFetch_20260209InputSchema,
1193
1250
  outputSchema: webFetch_20260209OutputSchema,
@@ -1198,53 +1255,57 @@ var webFetch_20260209 = (args = {}) => {
1198
1255
  };
1199
1256
 
1200
1257
  // src/tool/web-fetch-20250910.ts
1201
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1202
- var import_v48 = require("zod/v4");
1203
- var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1204
- () => (0, import_provider_utils8.zodSchema)(
1205
- import_v48.z.object({
1206
- maxUses: import_v48.z.number().optional(),
1207
- allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1208
- blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
1209
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1210
- maxContentTokens: import_v48.z.number().optional()
1258
+ import {
1259
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1260
+ lazySchema as lazySchema7,
1261
+ zodSchema as zodSchema7
1262
+ } from "@ai-sdk/provider-utils";
1263
+ import { z as z8 } from "zod/v4";
1264
+ var webFetch_20250910ArgsSchema = lazySchema7(
1265
+ () => zodSchema7(
1266
+ z8.object({
1267
+ maxUses: z8.number().optional(),
1268
+ allowedDomains: z8.array(z8.string()).optional(),
1269
+ blockedDomains: z8.array(z8.string()).optional(),
1270
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1271
+ maxContentTokens: z8.number().optional()
1211
1272
  })
1212
1273
  )
1213
1274
  );
1214
- var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1215
- () => (0, import_provider_utils8.zodSchema)(
1216
- import_v48.z.object({
1217
- type: import_v48.z.literal("web_fetch_result"),
1218
- url: import_v48.z.string(),
1219
- content: import_v48.z.object({
1220
- type: import_v48.z.literal("document"),
1221
- title: import_v48.z.string().nullable(),
1222
- citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
1223
- source: import_v48.z.union([
1224
- import_v48.z.object({
1225
- type: import_v48.z.literal("base64"),
1226
- mediaType: import_v48.z.literal("application/pdf"),
1227
- data: import_v48.z.string()
1275
+ var webFetch_20250910OutputSchema = lazySchema7(
1276
+ () => zodSchema7(
1277
+ z8.object({
1278
+ type: z8.literal("web_fetch_result"),
1279
+ url: z8.string(),
1280
+ content: z8.object({
1281
+ type: z8.literal("document"),
1282
+ title: z8.string().nullable(),
1283
+ citations: z8.object({ enabled: z8.boolean() }).optional(),
1284
+ source: z8.union([
1285
+ z8.object({
1286
+ type: z8.literal("base64"),
1287
+ mediaType: z8.literal("application/pdf"),
1288
+ data: z8.string()
1228
1289
  }),
1229
- import_v48.z.object({
1230
- type: import_v48.z.literal("text"),
1231
- mediaType: import_v48.z.literal("text/plain"),
1232
- data: import_v48.z.string()
1290
+ z8.object({
1291
+ type: z8.literal("text"),
1292
+ mediaType: z8.literal("text/plain"),
1293
+ data: z8.string()
1233
1294
  })
1234
1295
  ])
1235
1296
  }),
1236
- retrievedAt: import_v48.z.string().nullable()
1297
+ retrievedAt: z8.string().nullable()
1237
1298
  })
1238
1299
  )
1239
1300
  );
1240
- var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1241
- () => (0, import_provider_utils8.zodSchema)(
1242
- import_v48.z.object({
1243
- url: import_v48.z.string()
1301
+ var webFetch_20250910InputSchema = lazySchema7(
1302
+ () => zodSchema7(
1303
+ z8.object({
1304
+ url: z8.string()
1244
1305
  })
1245
1306
  )
1246
1307
  );
1247
- var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1308
+ var factory5 = createProviderToolFactoryWithOutputSchema4({
1248
1309
  id: "anthropic.web_fetch_20250910",
1249
1310
  inputSchema: webFetch_20250910InputSchema,
1250
1311
  outputSchema: webFetch_20250910OutputSchema,
@@ -1255,15 +1316,17 @@ var webFetch_20250910 = (args = {}) => {
1255
1316
  };
1256
1317
 
1257
1318
  // src/anthropic-prepare-tools.ts
1258
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1319
+ import { validateTypes } from "@ai-sdk/provider-utils";
1259
1320
  async function prepareTools({
1260
1321
  tools,
1261
1322
  toolChoice,
1262
1323
  disableParallelToolUse,
1263
1324
  cacheControlValidator,
1264
- supportsStructuredOutput
1325
+ supportsStructuredOutput,
1326
+ supportsStrictTools,
1327
+ defaultEagerInputStreaming = false
1265
1328
  }) {
1266
- var _a;
1329
+ var _a, _b;
1267
1330
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
1268
1331
  const toolWarnings = [];
1269
1332
  const betas = /* @__PURE__ */ new Set();
@@ -1280,16 +1343,23 @@ async function prepareTools({
1280
1343
  canCache: true
1281
1344
  });
1282
1345
  const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
1283
- const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1346
+ const eagerInputStreaming = (_b = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming) != null ? _b : defaultEagerInputStreaming;
1284
1347
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1285
1348
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1349
+ if (!supportsStrictTools && tool.strict != null) {
1350
+ toolWarnings.push({
1351
+ type: "unsupported",
1352
+ feature: "strict",
1353
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1354
+ });
1355
+ }
1286
1356
  anthropicTools2.push({
1287
1357
  name: tool.name,
1288
1358
  description: tool.description,
1289
1359
  input_schema: tool.inputSchema,
1290
1360
  cache_control: cacheControl,
1291
1361
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1292
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1362
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1293
1363
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1294
1364
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1295
1365
  ...tool.inputExamples != null ? {
@@ -1397,7 +1467,7 @@ async function prepareTools({
1397
1467
  break;
1398
1468
  }
1399
1469
  case "anthropic.text_editor_20250728": {
1400
- const args = await (0, import_provider_utils9.validateTypes)({
1470
+ const args = await validateTypes({
1401
1471
  value: tool.args,
1402
1472
  schema: textEditor_20250728ArgsSchema
1403
1473
  });
@@ -1437,7 +1507,7 @@ async function prepareTools({
1437
1507
  }
1438
1508
  case "anthropic.web_fetch_20250910": {
1439
1509
  betas.add("web-fetch-2025-09-10");
1440
- const args = await (0, import_provider_utils9.validateTypes)({
1510
+ const args = await validateTypes({
1441
1511
  value: tool.args,
1442
1512
  schema: webFetch_20250910ArgsSchema
1443
1513
  });
@@ -1455,7 +1525,7 @@ async function prepareTools({
1455
1525
  }
1456
1526
  case "anthropic.web_fetch_20260209": {
1457
1527
  betas.add("code-execution-web-tools-2026-02-09");
1458
- const args = await (0, import_provider_utils9.validateTypes)({
1528
+ const args = await validateTypes({
1459
1529
  value: tool.args,
1460
1530
  schema: webFetch_20260209ArgsSchema
1461
1531
  });
@@ -1472,7 +1542,7 @@ async function prepareTools({
1472
1542
  break;
1473
1543
  }
1474
1544
  case "anthropic.web_search_20250305": {
1475
- const args = await (0, import_provider_utils9.validateTypes)({
1545
+ const args = await validateTypes({
1476
1546
  value: tool.args,
1477
1547
  schema: webSearch_20250305ArgsSchema
1478
1548
  });
@@ -1489,7 +1559,7 @@ async function prepareTools({
1489
1559
  }
1490
1560
  case "anthropic.web_search_20260209": {
1491
1561
  betas.add("code-execution-web-tools-2026-02-09");
1492
- const args = await (0, import_provider_utils9.validateTypes)({
1562
+ const args = await validateTypes({
1493
1563
  value: tool.args,
1494
1564
  schema: webSearch_20260209ArgsSchema
1495
1565
  });
@@ -1505,7 +1575,6 @@ async function prepareTools({
1505
1575
  break;
1506
1576
  }
1507
1577
  case "anthropic.tool_search_regex_20251119": {
1508
- betas.add("advanced-tool-use-2025-11-20");
1509
1578
  anthropicTools2.push({
1510
1579
  type: "tool_search_tool_regex_20251119",
1511
1580
  name: "tool_search_tool_regex"
@@ -1513,7 +1582,6 @@ async function prepareTools({
1513
1582
  break;
1514
1583
  }
1515
1584
  case "anthropic.tool_search_bm25_20251119": {
1516
- betas.add("advanced-tool-use-2025-11-20");
1517
1585
  anthropicTools2.push({
1518
1586
  type: "tool_search_tool_bm25_20251119",
1519
1587
  name: "tool_search_tool_bm25"
@@ -1584,7 +1652,7 @@ async function prepareTools({
1584
1652
  };
1585
1653
  default: {
1586
1654
  const _exhaustiveCheck = type;
1587
- throw new import_provider.UnsupportedFunctionalityError({
1655
+ throw new UnsupportedFunctionalityError({
1588
1656
  functionality: `tool choice type: ${_exhaustiveCheck}`
1589
1657
  });
1590
1658
  }
@@ -1632,36 +1700,50 @@ function convertAnthropicMessagesUsage({
1632
1700
  }
1633
1701
 
1634
1702
  // src/convert-to-anthropic-messages-prompt.ts
1635
- var import_provider2 = require("@ai-sdk/provider");
1636
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
1703
+ import {
1704
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1705
+ } from "@ai-sdk/provider";
1706
+ import {
1707
+ convertBase64ToUint8Array,
1708
+ convertToBase64,
1709
+ isProviderReference,
1710
+ parseProviderOptions,
1711
+ resolveProviderReference,
1712
+ validateTypes as validateTypes2,
1713
+ isNonNullable
1714
+ } from "@ai-sdk/provider-utils";
1637
1715
 
1638
1716
  // src/tool/code-execution_20250522.ts
1639
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1640
- var import_v49 = require("zod/v4");
1641
- var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
1642
- () => (0, import_provider_utils10.zodSchema)(
1643
- import_v49.z.object({
1644
- type: import_v49.z.literal("code_execution_result"),
1645
- stdout: import_v49.z.string(),
1646
- stderr: import_v49.z.string(),
1647
- return_code: import_v49.z.number(),
1648
- content: import_v49.z.array(
1649
- import_v49.z.object({
1650
- type: import_v49.z.literal("code_execution_output"),
1651
- file_id: import_v49.z.string()
1717
+ import {
1718
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1719
+ lazySchema as lazySchema8,
1720
+ zodSchema as zodSchema8
1721
+ } from "@ai-sdk/provider-utils";
1722
+ import { z as z9 } from "zod/v4";
1723
+ var codeExecution_20250522OutputSchema = lazySchema8(
1724
+ () => zodSchema8(
1725
+ z9.object({
1726
+ type: z9.literal("code_execution_result"),
1727
+ stdout: z9.string(),
1728
+ stderr: z9.string(),
1729
+ return_code: z9.number(),
1730
+ content: z9.array(
1731
+ z9.object({
1732
+ type: z9.literal("code_execution_output"),
1733
+ file_id: z9.string()
1652
1734
  })
1653
1735
  ).optional().default([])
1654
1736
  })
1655
1737
  )
1656
1738
  );
1657
- var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
1658
- () => (0, import_provider_utils10.zodSchema)(
1659
- import_v49.z.object({
1660
- code: import_v49.z.string()
1739
+ var codeExecution_20250522InputSchema = lazySchema8(
1740
+ () => zodSchema8(
1741
+ z9.object({
1742
+ code: z9.string()
1661
1743
  })
1662
1744
  )
1663
1745
  );
1664
- var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1746
+ var factory6 = createProviderToolFactoryWithOutputSchema5({
1665
1747
  id: "anthropic.code_execution_20250522",
1666
1748
  inputSchema: codeExecution_20250522InputSchema,
1667
1749
  outputSchema: codeExecution_20250522OutputSchema
@@ -1671,102 +1753,106 @@ var codeExecution_20250522 = (args = {}) => {
1671
1753
  };
1672
1754
 
1673
1755
  // src/tool/code-execution_20250825.ts
1674
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1675
- var import_v410 = require("zod/v4");
1676
- var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
1677
- () => (0, import_provider_utils11.zodSchema)(
1678
- import_v410.z.discriminatedUnion("type", [
1679
- import_v410.z.object({
1680
- type: import_v410.z.literal("code_execution_result"),
1681
- stdout: import_v410.z.string(),
1682
- stderr: import_v410.z.string(),
1683
- return_code: import_v410.z.number(),
1684
- content: import_v410.z.array(
1685
- import_v410.z.object({
1686
- type: import_v410.z.literal("code_execution_output"),
1687
- file_id: import_v410.z.string()
1756
+ import {
1757
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1758
+ lazySchema as lazySchema9,
1759
+ zodSchema as zodSchema9
1760
+ } from "@ai-sdk/provider-utils";
1761
+ import { z as z10 } from "zod/v4";
1762
+ var codeExecution_20250825OutputSchema = lazySchema9(
1763
+ () => zodSchema9(
1764
+ z10.discriminatedUnion("type", [
1765
+ z10.object({
1766
+ type: z10.literal("code_execution_result"),
1767
+ stdout: z10.string(),
1768
+ stderr: z10.string(),
1769
+ return_code: z10.number(),
1770
+ content: z10.array(
1771
+ z10.object({
1772
+ type: z10.literal("code_execution_output"),
1773
+ file_id: z10.string()
1688
1774
  })
1689
1775
  ).optional().default([])
1690
1776
  }),
1691
- import_v410.z.object({
1692
- type: import_v410.z.literal("bash_code_execution_result"),
1693
- content: import_v410.z.array(
1694
- import_v410.z.object({
1695
- type: import_v410.z.literal("bash_code_execution_output"),
1696
- file_id: import_v410.z.string()
1777
+ z10.object({
1778
+ type: z10.literal("bash_code_execution_result"),
1779
+ content: z10.array(
1780
+ z10.object({
1781
+ type: z10.literal("bash_code_execution_output"),
1782
+ file_id: z10.string()
1697
1783
  })
1698
1784
  ),
1699
- stdout: import_v410.z.string(),
1700
- stderr: import_v410.z.string(),
1701
- return_code: import_v410.z.number()
1785
+ stdout: z10.string(),
1786
+ stderr: z10.string(),
1787
+ return_code: z10.number()
1702
1788
  }),
1703
- import_v410.z.object({
1704
- type: import_v410.z.literal("bash_code_execution_tool_result_error"),
1705
- error_code: import_v410.z.string()
1789
+ z10.object({
1790
+ type: z10.literal("bash_code_execution_tool_result_error"),
1791
+ error_code: z10.string()
1706
1792
  }),
1707
- import_v410.z.object({
1708
- type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
1709
- error_code: import_v410.z.string()
1793
+ z10.object({
1794
+ type: z10.literal("text_editor_code_execution_tool_result_error"),
1795
+ error_code: z10.string()
1710
1796
  }),
1711
- import_v410.z.object({
1712
- type: import_v410.z.literal("text_editor_code_execution_view_result"),
1713
- content: import_v410.z.string(),
1714
- file_type: import_v410.z.string(),
1715
- num_lines: import_v410.z.number().nullable(),
1716
- start_line: import_v410.z.number().nullable(),
1717
- total_lines: import_v410.z.number().nullable()
1797
+ z10.object({
1798
+ type: z10.literal("text_editor_code_execution_view_result"),
1799
+ content: z10.string(),
1800
+ file_type: z10.string(),
1801
+ num_lines: z10.number().nullable(),
1802
+ start_line: z10.number().nullable(),
1803
+ total_lines: z10.number().nullable()
1718
1804
  }),
1719
- import_v410.z.object({
1720
- type: import_v410.z.literal("text_editor_code_execution_create_result"),
1721
- is_file_update: import_v410.z.boolean()
1805
+ z10.object({
1806
+ type: z10.literal("text_editor_code_execution_create_result"),
1807
+ is_file_update: z10.boolean()
1722
1808
  }),
1723
- import_v410.z.object({
1724
- type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
1725
- lines: import_v410.z.array(import_v410.z.string()).nullable(),
1726
- new_lines: import_v410.z.number().nullable(),
1727
- new_start: import_v410.z.number().nullable(),
1728
- old_lines: import_v410.z.number().nullable(),
1729
- old_start: import_v410.z.number().nullable()
1809
+ z10.object({
1810
+ type: z10.literal("text_editor_code_execution_str_replace_result"),
1811
+ lines: z10.array(z10.string()).nullable(),
1812
+ new_lines: z10.number().nullable(),
1813
+ new_start: z10.number().nullable(),
1814
+ old_lines: z10.number().nullable(),
1815
+ old_start: z10.number().nullable()
1730
1816
  })
1731
1817
  ])
1732
1818
  )
1733
1819
  );
1734
- var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
1735
- () => (0, import_provider_utils11.zodSchema)(
1736
- import_v410.z.discriminatedUnion("type", [
1820
+ var codeExecution_20250825InputSchema = lazySchema9(
1821
+ () => zodSchema9(
1822
+ z10.discriminatedUnion("type", [
1737
1823
  // Programmatic tool calling format (mapped from { code } by AI SDK)
1738
- import_v410.z.object({
1739
- type: import_v410.z.literal("programmatic-tool-call"),
1740
- code: import_v410.z.string()
1824
+ z10.object({
1825
+ type: z10.literal("programmatic-tool-call"),
1826
+ code: z10.string()
1741
1827
  }),
1742
- import_v410.z.object({
1743
- type: import_v410.z.literal("bash_code_execution"),
1744
- command: import_v410.z.string()
1828
+ z10.object({
1829
+ type: z10.literal("bash_code_execution"),
1830
+ command: z10.string()
1745
1831
  }),
1746
- import_v410.z.discriminatedUnion("command", [
1747
- import_v410.z.object({
1748
- type: import_v410.z.literal("text_editor_code_execution"),
1749
- command: import_v410.z.literal("view"),
1750
- path: import_v410.z.string()
1832
+ z10.discriminatedUnion("command", [
1833
+ z10.object({
1834
+ type: z10.literal("text_editor_code_execution"),
1835
+ command: z10.literal("view"),
1836
+ path: z10.string()
1751
1837
  }),
1752
- import_v410.z.object({
1753
- type: import_v410.z.literal("text_editor_code_execution"),
1754
- command: import_v410.z.literal("create"),
1755
- path: import_v410.z.string(),
1756
- file_text: import_v410.z.string().nullish()
1838
+ z10.object({
1839
+ type: z10.literal("text_editor_code_execution"),
1840
+ command: z10.literal("create"),
1841
+ path: z10.string(),
1842
+ file_text: z10.string().nullish()
1757
1843
  }),
1758
- import_v410.z.object({
1759
- type: import_v410.z.literal("text_editor_code_execution"),
1760
- command: import_v410.z.literal("str_replace"),
1761
- path: import_v410.z.string(),
1762
- old_str: import_v410.z.string(),
1763
- new_str: import_v410.z.string()
1844
+ z10.object({
1845
+ type: z10.literal("text_editor_code_execution"),
1846
+ command: z10.literal("str_replace"),
1847
+ path: z10.string(),
1848
+ old_str: z10.string(),
1849
+ new_str: z10.string()
1764
1850
  })
1765
1851
  ])
1766
1852
  ])
1767
1853
  )
1768
1854
  );
1769
- var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1855
+ var factory7 = createProviderToolFactoryWithOutputSchema6({
1770
1856
  id: "anthropic.code_execution_20250825",
1771
1857
  inputSchema: codeExecution_20250825InputSchema,
1772
1858
  outputSchema: codeExecution_20250825OutputSchema,
@@ -1780,113 +1866,117 @@ var codeExecution_20250825 = (args = {}) => {
1780
1866
  };
1781
1867
 
1782
1868
  // src/tool/code-execution_20260120.ts
1783
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1784
- var import_v411 = require("zod/v4");
1785
- var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
1786
- () => (0, import_provider_utils12.zodSchema)(
1787
- import_v411.z.discriminatedUnion("type", [
1788
- import_v411.z.object({
1789
- type: import_v411.z.literal("code_execution_result"),
1790
- stdout: import_v411.z.string(),
1791
- stderr: import_v411.z.string(),
1792
- return_code: import_v411.z.number(),
1793
- content: import_v411.z.array(
1794
- import_v411.z.object({
1795
- type: import_v411.z.literal("code_execution_output"),
1796
- file_id: import_v411.z.string()
1869
+ import {
1870
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
1871
+ lazySchema as lazySchema10,
1872
+ zodSchema as zodSchema10
1873
+ } from "@ai-sdk/provider-utils";
1874
+ import { z as z11 } from "zod/v4";
1875
+ var codeExecution_20260120OutputSchema = lazySchema10(
1876
+ () => zodSchema10(
1877
+ z11.discriminatedUnion("type", [
1878
+ z11.object({
1879
+ type: z11.literal("code_execution_result"),
1880
+ stdout: z11.string(),
1881
+ stderr: z11.string(),
1882
+ return_code: z11.number(),
1883
+ content: z11.array(
1884
+ z11.object({
1885
+ type: z11.literal("code_execution_output"),
1886
+ file_id: z11.string()
1797
1887
  })
1798
1888
  ).optional().default([])
1799
1889
  }),
1800
- import_v411.z.object({
1801
- type: import_v411.z.literal("encrypted_code_execution_result"),
1802
- encrypted_stdout: import_v411.z.string(),
1803
- stderr: import_v411.z.string(),
1804
- return_code: import_v411.z.number(),
1805
- content: import_v411.z.array(
1806
- import_v411.z.object({
1807
- type: import_v411.z.literal("code_execution_output"),
1808
- file_id: import_v411.z.string()
1890
+ z11.object({
1891
+ type: z11.literal("encrypted_code_execution_result"),
1892
+ encrypted_stdout: z11.string(),
1893
+ stderr: z11.string(),
1894
+ return_code: z11.number(),
1895
+ content: z11.array(
1896
+ z11.object({
1897
+ type: z11.literal("code_execution_output"),
1898
+ file_id: z11.string()
1809
1899
  })
1810
1900
  ).optional().default([])
1811
1901
  }),
1812
- import_v411.z.object({
1813
- type: import_v411.z.literal("bash_code_execution_result"),
1814
- content: import_v411.z.array(
1815
- import_v411.z.object({
1816
- type: import_v411.z.literal("bash_code_execution_output"),
1817
- file_id: import_v411.z.string()
1902
+ z11.object({
1903
+ type: z11.literal("bash_code_execution_result"),
1904
+ content: z11.array(
1905
+ z11.object({
1906
+ type: z11.literal("bash_code_execution_output"),
1907
+ file_id: z11.string()
1818
1908
  })
1819
1909
  ),
1820
- stdout: import_v411.z.string(),
1821
- stderr: import_v411.z.string(),
1822
- return_code: import_v411.z.number()
1910
+ stdout: z11.string(),
1911
+ stderr: z11.string(),
1912
+ return_code: z11.number()
1823
1913
  }),
1824
- import_v411.z.object({
1825
- type: import_v411.z.literal("bash_code_execution_tool_result_error"),
1826
- error_code: import_v411.z.string()
1914
+ z11.object({
1915
+ type: z11.literal("bash_code_execution_tool_result_error"),
1916
+ error_code: z11.string()
1827
1917
  }),
1828
- import_v411.z.object({
1829
- type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
1830
- error_code: import_v411.z.string()
1918
+ z11.object({
1919
+ type: z11.literal("text_editor_code_execution_tool_result_error"),
1920
+ error_code: z11.string()
1831
1921
  }),
1832
- import_v411.z.object({
1833
- type: import_v411.z.literal("text_editor_code_execution_view_result"),
1834
- content: import_v411.z.string(),
1835
- file_type: import_v411.z.string(),
1836
- num_lines: import_v411.z.number().nullable(),
1837
- start_line: import_v411.z.number().nullable(),
1838
- total_lines: import_v411.z.number().nullable()
1922
+ z11.object({
1923
+ type: z11.literal("text_editor_code_execution_view_result"),
1924
+ content: z11.string(),
1925
+ file_type: z11.string(),
1926
+ num_lines: z11.number().nullable(),
1927
+ start_line: z11.number().nullable(),
1928
+ total_lines: z11.number().nullable()
1839
1929
  }),
1840
- import_v411.z.object({
1841
- type: import_v411.z.literal("text_editor_code_execution_create_result"),
1842
- is_file_update: import_v411.z.boolean()
1930
+ z11.object({
1931
+ type: z11.literal("text_editor_code_execution_create_result"),
1932
+ is_file_update: z11.boolean()
1843
1933
  }),
1844
- import_v411.z.object({
1845
- type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
1846
- lines: import_v411.z.array(import_v411.z.string()).nullable(),
1847
- new_lines: import_v411.z.number().nullable(),
1848
- new_start: import_v411.z.number().nullable(),
1849
- old_lines: import_v411.z.number().nullable(),
1850
- old_start: import_v411.z.number().nullable()
1934
+ z11.object({
1935
+ type: z11.literal("text_editor_code_execution_str_replace_result"),
1936
+ lines: z11.array(z11.string()).nullable(),
1937
+ new_lines: z11.number().nullable(),
1938
+ new_start: z11.number().nullable(),
1939
+ old_lines: z11.number().nullable(),
1940
+ old_start: z11.number().nullable()
1851
1941
  })
1852
1942
  ])
1853
1943
  )
1854
1944
  );
1855
- var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1856
- () => (0, import_provider_utils12.zodSchema)(
1857
- import_v411.z.discriminatedUnion("type", [
1858
- import_v411.z.object({
1859
- type: import_v411.z.literal("programmatic-tool-call"),
1860
- code: import_v411.z.string()
1945
+ var codeExecution_20260120InputSchema = lazySchema10(
1946
+ () => zodSchema10(
1947
+ z11.discriminatedUnion("type", [
1948
+ z11.object({
1949
+ type: z11.literal("programmatic-tool-call"),
1950
+ code: z11.string()
1861
1951
  }),
1862
- import_v411.z.object({
1863
- type: import_v411.z.literal("bash_code_execution"),
1864
- command: import_v411.z.string()
1952
+ z11.object({
1953
+ type: z11.literal("bash_code_execution"),
1954
+ command: z11.string()
1865
1955
  }),
1866
- import_v411.z.discriminatedUnion("command", [
1867
- import_v411.z.object({
1868
- type: import_v411.z.literal("text_editor_code_execution"),
1869
- command: import_v411.z.literal("view"),
1870
- path: import_v411.z.string()
1956
+ z11.discriminatedUnion("command", [
1957
+ z11.object({
1958
+ type: z11.literal("text_editor_code_execution"),
1959
+ command: z11.literal("view"),
1960
+ path: z11.string()
1871
1961
  }),
1872
- import_v411.z.object({
1873
- type: import_v411.z.literal("text_editor_code_execution"),
1874
- command: import_v411.z.literal("create"),
1875
- path: import_v411.z.string(),
1876
- file_text: import_v411.z.string().nullish()
1962
+ z11.object({
1963
+ type: z11.literal("text_editor_code_execution"),
1964
+ command: z11.literal("create"),
1965
+ path: z11.string(),
1966
+ file_text: z11.string().nullish()
1877
1967
  }),
1878
- import_v411.z.object({
1879
- type: import_v411.z.literal("text_editor_code_execution"),
1880
- command: import_v411.z.literal("str_replace"),
1881
- path: import_v411.z.string(),
1882
- old_str: import_v411.z.string(),
1883
- new_str: import_v411.z.string()
1968
+ z11.object({
1969
+ type: z11.literal("text_editor_code_execution"),
1970
+ command: z11.literal("str_replace"),
1971
+ path: z11.string(),
1972
+ old_str: z11.string(),
1973
+ new_str: z11.string()
1884
1974
  })
1885
1975
  ])
1886
1976
  ])
1887
1977
  )
1888
1978
  );
1889
- var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1979
+ var factory8 = createProviderToolFactoryWithOutputSchema7({
1890
1980
  id: "anthropic.code_execution_20260120",
1891
1981
  inputSchema: codeExecution_20260120InputSchema,
1892
1982
  outputSchema: codeExecution_20260120OutputSchema,
@@ -1897,21 +1987,25 @@ var codeExecution_20260120 = (args = {}) => {
1897
1987
  };
1898
1988
 
1899
1989
  // src/tool/tool-search-regex_20251119.ts
1900
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1901
- var import_v412 = require("zod/v4");
1902
- var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
1903
- () => (0, import_provider_utils13.zodSchema)(
1904
- import_v412.z.array(
1905
- import_v412.z.object({
1906
- type: import_v412.z.literal("tool_reference"),
1907
- toolName: import_v412.z.string()
1990
+ import {
1991
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
1992
+ lazySchema as lazySchema11,
1993
+ zodSchema as zodSchema11
1994
+ } from "@ai-sdk/provider-utils";
1995
+ import { z as z12 } from "zod/v4";
1996
+ var toolSearchRegex_20251119OutputSchema = lazySchema11(
1997
+ () => zodSchema11(
1998
+ z12.array(
1999
+ z12.object({
2000
+ type: z12.literal("tool_reference"),
2001
+ toolName: z12.string()
1908
2002
  })
1909
2003
  )
1910
2004
  )
1911
2005
  );
1912
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
1913
- () => (0, import_provider_utils13.zodSchema)(
1914
- import_v412.z.object({
2006
+ var toolSearchRegex_20251119InputSchema = lazySchema11(
2007
+ () => zodSchema11(
2008
+ z12.object({
1915
2009
  /**
1916
2010
  * A regex pattern to search for tools.
1917
2011
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1922,15 +2016,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
1922
2016
  * - "database.*query|query.*database" - OR patterns for flexibility
1923
2017
  * - "(?i)slack" - case-insensitive search
1924
2018
  */
1925
- pattern: import_v412.z.string(),
2019
+ pattern: z12.string(),
1926
2020
  /**
1927
2021
  * Maximum number of tools to return. Optional.
1928
2022
  */
1929
- limit: import_v412.z.number().optional()
2023
+ limit: z12.number().optional()
1930
2024
  })
1931
2025
  )
1932
2026
  );
1933
- var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2027
+ var factory9 = createProviderToolFactoryWithOutputSchema8({
1934
2028
  id: "anthropic.tool_search_regex_20251119",
1935
2029
  inputSchema: toolSearchRegex_20251119InputSchema,
1936
2030
  outputSchema: toolSearchRegex_20251119OutputSchema,
@@ -1943,17 +2037,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
1943
2037
  // src/convert-to-anthropic-messages-prompt.ts
1944
2038
  function convertToString(data) {
1945
2039
  if (typeof data === "string") {
1946
- return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
2040
+ return new TextDecoder().decode(convertBase64ToUint8Array(data));
1947
2041
  }
1948
2042
  if (data instanceof Uint8Array) {
1949
2043
  return new TextDecoder().decode(data);
1950
2044
  }
1951
2045
  if (data instanceof URL) {
1952
- throw new import_provider2.UnsupportedFunctionalityError({
2046
+ throw new UnsupportedFunctionalityError2({
1953
2047
  functionality: "URL-based text documents are not supported for citations"
1954
2048
  });
1955
2049
  }
1956
- throw new import_provider2.UnsupportedFunctionalityError({
2050
+ throw new UnsupportedFunctionalityError2({
1957
2051
  functionality: `unsupported data type for text documents: ${typeof data}`
1958
2052
  });
1959
2053
  }
@@ -1981,7 +2075,7 @@ async function convertToAnthropicMessagesPrompt({
1981
2075
  const messages = [];
1982
2076
  async function shouldEnableCitations(providerMetadata) {
1983
2077
  var _a2, _b2;
1984
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2078
+ const anthropicOptions = await parseProviderOptions({
1985
2079
  provider: "anthropic",
1986
2080
  providerOptions: providerMetadata,
1987
2081
  schema: anthropicFilePartProviderOptions
@@ -1989,7 +2083,7 @@ async function convertToAnthropicMessagesPrompt({
1989
2083
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1990
2084
  }
1991
2085
  async function getDocumentMetadata(providerMetadata) {
1992
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2086
+ const anthropicOptions = await parseProviderOptions({
1993
2087
  provider: "anthropic",
1994
2088
  providerOptions: providerMetadata,
1995
2089
  schema: anthropicFilePartProviderOptions
@@ -2006,7 +2100,7 @@ async function convertToAnthropicMessagesPrompt({
2006
2100
  switch (type) {
2007
2101
  case "system": {
2008
2102
  if (system != null) {
2009
- throw new import_provider2.UnsupportedFunctionalityError({
2103
+ throw new UnsupportedFunctionalityError2({
2010
2104
  functionality: "Multiple system messages that are separated by user/assistant messages"
2011
2105
  });
2012
2106
  }
@@ -2046,7 +2140,26 @@ async function convertToAnthropicMessagesPrompt({
2046
2140
  break;
2047
2141
  }
2048
2142
  case "file": {
2049
- if (part.mediaType.startsWith("image/")) {
2143
+ if (isProviderReference(part.data)) {
2144
+ const fileId = resolveProviderReference({
2145
+ reference: part.data,
2146
+ provider: "anthropic"
2147
+ });
2148
+ betas.add("files-api-2025-04-14");
2149
+ if (part.mediaType.startsWith("image/")) {
2150
+ anthropicContent.push({
2151
+ type: "image",
2152
+ source: { type: "file", file_id: fileId },
2153
+ cache_control: cacheControl
2154
+ });
2155
+ } else {
2156
+ anthropicContent.push({
2157
+ type: "document",
2158
+ source: { type: "file", file_id: fileId },
2159
+ cache_control: cacheControl
2160
+ });
2161
+ }
2162
+ } else if (part.mediaType.startsWith("image/")) {
2050
2163
  anthropicContent.push({
2051
2164
  type: "image",
2052
2165
  source: isUrlData(part.data) ? {
@@ -2055,7 +2168,7 @@ async function convertToAnthropicMessagesPrompt({
2055
2168
  } : {
2056
2169
  type: "base64",
2057
2170
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2058
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2171
+ data: convertToBase64(part.data)
2059
2172
  },
2060
2173
  cache_control: cacheControl
2061
2174
  });
@@ -2075,7 +2188,7 @@ async function convertToAnthropicMessagesPrompt({
2075
2188
  } : {
2076
2189
  type: "base64",
2077
2190
  media_type: "application/pdf",
2078
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2191
+ data: convertToBase64(part.data)
2079
2192
  },
2080
2193
  title: (_b = metadata.title) != null ? _b : part.filename,
2081
2194
  ...metadata.context && { context: metadata.context },
@@ -2109,7 +2222,7 @@ async function convertToAnthropicMessagesPrompt({
2109
2222
  cache_control: cacheControl
2110
2223
  });
2111
2224
  } else {
2112
- throw new import_provider2.UnsupportedFunctionalityError({
2225
+ throw new UnsupportedFunctionalityError2({
2113
2226
  functionality: `media type: ${part.mediaType}`
2114
2227
  });
2115
2228
  }
@@ -2145,26 +2258,16 @@ async function convertToAnthropicMessagesPrompt({
2145
2258
  type: "text",
2146
2259
  text: contentPart.text
2147
2260
  };
2148
- case "image-data": {
2149
- return {
2150
- type: "image",
2151
- source: {
2152
- type: "base64",
2153
- media_type: contentPart.mediaType,
2154
- data: contentPart.data
2155
- }
2156
- };
2157
- }
2158
- case "image-url": {
2159
- return {
2160
- type: "image",
2161
- source: {
2162
- type: "url",
2163
- url: contentPart.url
2164
- }
2165
- };
2166
- }
2167
2261
  case "file-url": {
2262
+ if (contentPart.mediaType.startsWith("image/")) {
2263
+ return {
2264
+ type: "image",
2265
+ source: {
2266
+ type: "url",
2267
+ url: contentPart.url
2268
+ }
2269
+ };
2270
+ }
2168
2271
  return {
2169
2272
  type: "document",
2170
2273
  source: {
@@ -2174,6 +2277,16 @@ async function convertToAnthropicMessagesPrompt({
2174
2277
  };
2175
2278
  }
2176
2279
  case "file-data": {
2280
+ if (contentPart.mediaType.startsWith("image/")) {
2281
+ return {
2282
+ type: "image",
2283
+ source: {
2284
+ type: "base64",
2285
+ media_type: contentPart.mediaType,
2286
+ data: contentPart.data
2287
+ }
2288
+ };
2289
+ }
2177
2290
  if (contentPart.mediaType === "application/pdf") {
2178
2291
  betas.add("pdfs-2024-09-25");
2179
2292
  return {
@@ -2213,7 +2326,7 @@ async function convertToAnthropicMessagesPrompt({
2213
2326
  return void 0;
2214
2327
  }
2215
2328
  }
2216
- }).filter(import_provider_utils14.isNonNullable);
2329
+ }).filter(isNonNullable);
2217
2330
  break;
2218
2331
  case "text":
2219
2332
  case "error-text":
@@ -2289,7 +2402,7 @@ async function convertToAnthropicMessagesPrompt({
2289
2402
  }
2290
2403
  case "reasoning": {
2291
2404
  if (sendReasoning) {
2292
- const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
2405
+ const reasoningMetadata = await parseProviderOptions({
2293
2406
  provider: "anthropic",
2294
2407
  providerOptions: part.providerOptions,
2295
2408
  schema: anthropicReasoningMetadataSchema
@@ -2495,7 +2608,7 @@ async function convertToAnthropicMessagesPrompt({
2495
2608
  break;
2496
2609
  }
2497
2610
  if (output.value.type === "code_execution_result") {
2498
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2611
+ const codeExecutionOutput = await validateTypes2({
2499
2612
  value: output.value,
2500
2613
  schema: codeExecution_20250522OutputSchema
2501
2614
  });
@@ -2512,7 +2625,7 @@ async function convertToAnthropicMessagesPrompt({
2512
2625
  cache_control: cacheControl
2513
2626
  });
2514
2627
  } else if (output.value.type === "encrypted_code_execution_result") {
2515
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2628
+ const codeExecutionOutput = await validateTypes2({
2516
2629
  value: output.value,
2517
2630
  schema: codeExecution_20260120OutputSchema
2518
2631
  });
@@ -2531,7 +2644,7 @@ async function convertToAnthropicMessagesPrompt({
2531
2644
  });
2532
2645
  }
2533
2646
  } else {
2534
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2647
+ const codeExecutionOutput = await validateTypes2({
2535
2648
  value: output.value,
2536
2649
  schema: codeExecution_20250825OutputSchema
2537
2650
  });
@@ -2600,7 +2713,7 @@ async function convertToAnthropicMessagesPrompt({
2600
2713
  });
2601
2714
  break;
2602
2715
  }
2603
- const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
2716
+ const webFetchOutput = await validateTypes2({
2604
2717
  value: output.value,
2605
2718
  schema: webFetch_20250910OutputSchema
2606
2719
  });
@@ -2635,7 +2748,7 @@ async function convertToAnthropicMessagesPrompt({
2635
2748
  });
2636
2749
  break;
2637
2750
  }
2638
- const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
2751
+ const webSearchOutput = await validateTypes2({
2639
2752
  value: output.value,
2640
2753
  schema: webSearch_20250305OutputSchema
2641
2754
  });
@@ -2662,7 +2775,7 @@ async function convertToAnthropicMessagesPrompt({
2662
2775
  });
2663
2776
  break;
2664
2777
  }
2665
- const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
2778
+ const toolSearchOutput = await validateTypes2({
2666
2779
  value: output.value,
2667
2780
  schema: toolSearchRegex_20251119OutputSchema
2668
2781
  });
@@ -2820,13 +2933,22 @@ function createCitationSource(citation, citationDocuments, generateId2) {
2820
2933
  }
2821
2934
  };
2822
2935
  }
2823
- var AnthropicMessagesLanguageModel = class {
2936
+ var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
2824
2937
  constructor(modelId, config) {
2825
2938
  this.specificationVersion = "v4";
2826
2939
  var _a;
2827
2940
  this.modelId = modelId;
2828
2941
  this.config = config;
2829
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
2942
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
2943
+ }
2944
+ static [WORKFLOW_SERIALIZE](model) {
2945
+ return serializeModelOptions({
2946
+ modelId: model.modelId,
2947
+ config: model.config
2948
+ });
2949
+ }
2950
+ static [WORKFLOW_DESERIALIZE](options) {
2951
+ return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
2830
2952
  }
2831
2953
  supportsUrl(url) {
2832
2954
  return url.protocol === "https:";
@@ -2861,10 +2983,11 @@ var AnthropicMessagesLanguageModel = class {
2861
2983
  seed,
2862
2984
  tools,
2863
2985
  toolChoice,
2986
+ reasoning,
2864
2987
  providerOptions,
2865
2988
  stream
2866
2989
  }) {
2867
- var _a, _b, _c, _d, _e, _f, _g;
2990
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2868
2991
  const warnings = [];
2869
2992
  if (frequencyPenalty != null) {
2870
2993
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2900,12 +3023,12 @@ var AnthropicMessagesLanguageModel = class {
2900
3023
  }
2901
3024
  }
2902
3025
  const providerOptionsName = this.providerOptionsName;
2903
- const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
3026
+ const canonicalOptions = await parseProviderOptions2({
2904
3027
  provider: "anthropic",
2905
3028
  providerOptions,
2906
3029
  schema: anthropicLanguageModelOptions
2907
3030
  });
2908
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
3031
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
2909
3032
  provider: providerOptionsName,
2910
3033
  providerOptions,
2911
3034
  schema: anthropicLanguageModelOptions
@@ -2919,10 +3042,41 @@ var AnthropicMessagesLanguageModel = class {
2919
3042
  const {
2920
3043
  maxOutputTokens: maxOutputTokensForModel,
2921
3044
  supportsStructuredOutput: modelSupportsStructuredOutput,
3045
+ supportsAdaptiveThinking,
3046
+ rejectsSamplingParameters,
3047
+ supportsXhighEffort,
2922
3048
  isKnownModel
2923
3049
  } = getModelCapabilities(this.modelId);
3050
+ if (rejectsSamplingParameters) {
3051
+ if (temperature != null) {
3052
+ warnings.push({
3053
+ type: "unsupported",
3054
+ feature: "temperature",
3055
+ details: `temperature is not supported by ${this.modelId} and will be ignored`
3056
+ });
3057
+ temperature = void 0;
3058
+ }
3059
+ if (topK != null) {
3060
+ warnings.push({
3061
+ type: "unsupported",
3062
+ feature: "topK",
3063
+ details: `topK is not supported by ${this.modelId} and will be ignored`
3064
+ });
3065
+ topK = void 0;
3066
+ }
3067
+ if (topP != null) {
3068
+ warnings.push({
3069
+ type: "unsupported",
3070
+ feature: "topP",
3071
+ details: `topP is not supported by ${this.modelId} and will be ignored`
3072
+ });
3073
+ topP = void 0;
3074
+ }
3075
+ }
3076
+ const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2924
3077
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2925
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3078
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3079
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
2926
3080
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2927
3081
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2928
3082
  type: "function",
@@ -2932,7 +3086,7 @@ var AnthropicMessagesLanguageModel = class {
2932
3086
  } : void 0;
2933
3087
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
2934
3088
  const cacheControlValidator = new CacheControlValidator();
2935
- const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
3089
+ const toolNameMapping = createToolNameMapping({
2936
3090
  tools,
2937
3091
  providerToolNames: {
2938
3092
  "anthropic.code_execution_20250522": "code_execution",
@@ -2957,14 +3111,32 @@ var AnthropicMessagesLanguageModel = class {
2957
3111
  });
2958
3112
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2959
3113
  prompt,
2960
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3114
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
2961
3115
  warnings,
2962
3116
  cacheControlValidator,
2963
3117
  toolNameMapping
2964
3118
  });
2965
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3119
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3120
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3121
+ reasoning,
3122
+ supportsAdaptiveThinking,
3123
+ supportsXhighEffort,
3124
+ maxOutputTokensForModel,
3125
+ warnings
3126
+ });
3127
+ if (reasoningConfig != null) {
3128
+ if (anthropicOptions.thinking == null) {
3129
+ anthropicOptions.thinking = reasoningConfig.thinking;
3130
+ }
3131
+ if (reasoningConfig.effort != null && ((_e = anthropicOptions.thinking) == null ? void 0 : _e.type) !== "disabled") {
3132
+ anthropicOptions.effort = reasoningConfig.effort;
3133
+ }
3134
+ }
3135
+ }
3136
+ const thinkingType = (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type;
2966
3137
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
2967
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
3138
+ let thinkingBudget = thinkingType === "enabled" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.budgetTokens : void 0;
3139
+ const thinkingDisplay = thinkingType === "adaptive" ? (_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display : void 0;
2968
3140
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2969
3141
  const baseArgs = {
2970
3142
  // model id:
@@ -2979,14 +3151,24 @@ var AnthropicMessagesLanguageModel = class {
2979
3151
  ...isThinking && {
2980
3152
  thinking: {
2981
3153
  type: thinkingType,
2982
- ...thinkingBudget != null && { budget_tokens: thinkingBudget }
3154
+ ...thinkingBudget != null && { budget_tokens: thinkingBudget },
3155
+ ...thinkingDisplay != null && { display: thinkingDisplay }
2983
3156
  }
2984
3157
  },
2985
- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
3158
+ ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
2986
3159
  output_config: {
2987
3160
  ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
2988
3161
  effort: anthropicOptions.effort
2989
3162
  },
3163
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) && {
3164
+ task_budget: {
3165
+ type: anthropicOptions.taskBudget.type,
3166
+ total: anthropicOptions.taskBudget.total,
3167
+ ...anthropicOptions.taskBudget.remaining != null && {
3168
+ remaining: anthropicOptions.taskBudget.remaining
3169
+ }
3170
+ }
3171
+ },
2990
3172
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2991
3173
  format: {
2992
3174
  type: "json_schema",
@@ -2998,9 +3180,15 @@ var AnthropicMessagesLanguageModel = class {
2998
3180
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
2999
3181
  speed: anthropicOptions.speed
3000
3182
  },
3183
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
3184
+ inference_geo: anthropicOptions.inferenceGeo
3185
+ },
3001
3186
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3002
3187
  cache_control: anthropicOptions.cacheControl
3003
3188
  },
3189
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3190
+ metadata: { user_id: anthropicOptions.metadata.userId }
3191
+ },
3004
3192
  // mcp servers:
3005
3193
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3006
3194
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3022,7 +3210,10 @@ var AnthropicMessagesLanguageModel = class {
3022
3210
  id: anthropicOptions.container.id,
3023
3211
  skills: anthropicOptions.container.skills.map((skill) => ({
3024
3212
  type: skill.type,
3025
- skill_id: skill.skillId,
3213
+ skill_id: skill.type === "custom" ? resolveProviderReference2({
3214
+ reference: skill.providerReference,
3215
+ provider: "anthropic"
3216
+ }) : skill.skillId,
3026
3217
  version: skill.version
3027
3218
  }))
3028
3219
  }
@@ -3124,7 +3315,7 @@ var AnthropicMessagesLanguageModel = class {
3124
3315
  }
3125
3316
  baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
3126
3317
  } else {
3127
- if (topP != null && temperature != null) {
3318
+ if (isAnthropicModel && topP != null && temperature != null) {
3128
3319
  warnings.push({
3129
3320
  type: "unsupported",
3130
3321
  feature: "topP",
@@ -3168,12 +3359,13 @@ var AnthropicMessagesLanguageModel = class {
3168
3359
  if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
3169
3360
  betas.add("effort-2025-11-24");
3170
3361
  }
3362
+ if (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) {
3363
+ betas.add("task-budgets-2026-03-13");
3364
+ }
3171
3365
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3172
3366
  betas.add("fast-mode-2026-02-01");
3173
3367
  }
3174
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
3175
- betas.add("fine-grained-tool-streaming-2025-05-14");
3176
- }
3368
+ const defaultEagerInputStreaming = stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true);
3177
3369
  const {
3178
3370
  tools: anthropicTools2,
3179
3371
  toolChoice: anthropicToolChoice,
@@ -3185,13 +3377,17 @@ var AnthropicMessagesLanguageModel = class {
3185
3377
  toolChoice: { type: "required" },
3186
3378
  disableParallelToolUse: true,
3187
3379
  cacheControlValidator,
3188
- supportsStructuredOutput: false
3380
+ supportsStructuredOutput: false,
3381
+ supportsStrictTools,
3382
+ defaultEagerInputStreaming
3189
3383
  } : {
3190
3384
  tools: tools != null ? tools : [],
3191
3385
  toolChoice,
3192
3386
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3193
3387
  cacheControlValidator,
3194
- supportsStructuredOutput
3388
+ supportsStructuredOutput,
3389
+ supportsStrictTools,
3390
+ defaultEagerInputStreaming
3195
3391
  }
3196
3392
  );
3197
3393
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3208,7 +3404,7 @@ var AnthropicMessagesLanguageModel = class {
3208
3404
  ...betas,
3209
3405
  ...toolsBetas,
3210
3406
  ...userSuppliedBetas,
3211
- ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
3407
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3212
3408
  ]),
3213
3409
  usesJsonResponseTool: jsonResponseTool != null,
3214
3410
  toolNameMapping,
@@ -3220,16 +3416,16 @@ var AnthropicMessagesLanguageModel = class {
3220
3416
  betas,
3221
3417
  headers
3222
3418
  }) {
3223
- return (0, import_provider_utils15.combineHeaders)(
3224
- await (0, import_provider_utils15.resolve)(this.config.headers),
3419
+ return combineHeaders(
3420
+ this.config.headers ? await resolve(this.config.headers) : void 0,
3225
3421
  headers,
3226
3422
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3227
3423
  );
3228
3424
  }
3229
3425
  async getBetasFromHeaders(requestHeaders) {
3230
3426
  var _a, _b;
3231
- const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3232
- const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3427
+ const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
3428
+ const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
3233
3429
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3234
3430
  return new Set(
3235
3431
  [
@@ -3294,12 +3490,12 @@ var AnthropicMessagesLanguageModel = class {
3294
3490
  responseHeaders,
3295
3491
  value: response,
3296
3492
  rawValue: rawResponse
3297
- } = await (0, import_provider_utils15.postJsonToApi)({
3493
+ } = await postJsonToApi({
3298
3494
  url: this.buildRequestUrl(false),
3299
3495
  headers: await this.getHeaders({ betas, headers: options.headers }),
3300
3496
  body: this.transformRequestBody(args, betas),
3301
3497
  failedResponseHandler: anthropicFailedResponseHandler,
3302
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3498
+ successfulResponseHandler: createJsonResponseHandler(
3303
3499
  anthropicMessagesResponseSchema
3304
3500
  ),
3305
3501
  abortSignal: options.abortSignal,
@@ -3693,6 +3889,7 @@ var AnthropicMessagesLanguageModel = class {
3693
3889
  };
3694
3890
  }
3695
3891
  async doStream(options) {
3892
+ "use step";
3696
3893
  var _a, _b;
3697
3894
  const {
3698
3895
  args: body,
@@ -3714,12 +3911,12 @@ var AnthropicMessagesLanguageModel = class {
3714
3911
  body.tools
3715
3912
  );
3716
3913
  const url = this.buildRequestUrl(true);
3717
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
3914
+ const { responseHeaders, value: response } = await postJsonToApi({
3718
3915
  url,
3719
3916
  headers: await this.getHeaders({ betas, headers: options.headers }),
3720
3917
  body: this.transformRequestBody(body, betas),
3721
3918
  failedResponseHandler: anthropicFailedResponseHandler,
3722
- successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
3919
+ successfulResponseHandler: createEventSourceResponseHandler(
3723
3920
  anthropicMessagesChunkSchema
3724
3921
  ),
3725
3922
  abortSignal: options.abortSignal,
@@ -4444,7 +4641,7 @@ var AnthropicMessagesLanguageModel = class {
4444
4641
  }
4445
4642
  if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
4446
4643
  const error = result.value.error;
4447
- throw new import_provider3.APICallError({
4644
+ throw new APICallError({
4448
4645
  message: error.message,
4449
4646
  url,
4450
4647
  requestBodyValues: body,
@@ -4467,46 +4664,76 @@ var AnthropicMessagesLanguageModel = class {
4467
4664
  }
4468
4665
  };
4469
4666
  function getModelCapabilities(modelId) {
4470
- if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
4667
+ if (modelId.includes("claude-opus-4-7")) {
4471
4668
  return {
4472
4669
  maxOutputTokens: 128e3,
4473
4670
  supportsStructuredOutput: true,
4671
+ supportsAdaptiveThinking: true,
4672
+ rejectsSamplingParameters: true,
4673
+ supportsXhighEffort: true,
4674
+ isKnownModel: true
4675
+ };
4676
+ } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
4677
+ return {
4678
+ maxOutputTokens: 128e3,
4679
+ supportsStructuredOutput: true,
4680
+ supportsAdaptiveThinking: true,
4681
+ rejectsSamplingParameters: false,
4682
+ supportsXhighEffort: false,
4474
4683
  isKnownModel: true
4475
4684
  };
4476
4685
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4477
4686
  return {
4478
4687
  maxOutputTokens: 64e3,
4479
4688
  supportsStructuredOutput: true,
4689
+ supportsAdaptiveThinking: false,
4690
+ rejectsSamplingParameters: false,
4691
+ supportsXhighEffort: false,
4480
4692
  isKnownModel: true
4481
4693
  };
4482
4694
  } else if (modelId.includes("claude-opus-4-1")) {
4483
4695
  return {
4484
4696
  maxOutputTokens: 32e3,
4485
4697
  supportsStructuredOutput: true,
4698
+ supportsAdaptiveThinking: false,
4699
+ rejectsSamplingParameters: false,
4700
+ supportsXhighEffort: false,
4486
4701
  isKnownModel: true
4487
4702
  };
4488
4703
  } else if (modelId.includes("claude-sonnet-4-")) {
4489
4704
  return {
4490
4705
  maxOutputTokens: 64e3,
4491
4706
  supportsStructuredOutput: false,
4707
+ supportsAdaptiveThinking: false,
4708
+ rejectsSamplingParameters: false,
4709
+ supportsXhighEffort: false,
4492
4710
  isKnownModel: true
4493
4711
  };
4494
4712
  } else if (modelId.includes("claude-opus-4-")) {
4495
4713
  return {
4496
4714
  maxOutputTokens: 32e3,
4497
4715
  supportsStructuredOutput: false,
4716
+ supportsAdaptiveThinking: false,
4717
+ rejectsSamplingParameters: false,
4718
+ supportsXhighEffort: false,
4498
4719
  isKnownModel: true
4499
4720
  };
4500
4721
  } else if (modelId.includes("claude-3-haiku")) {
4501
4722
  return {
4502
4723
  maxOutputTokens: 4096,
4503
4724
  supportsStructuredOutput: false,
4725
+ supportsAdaptiveThinking: false,
4726
+ rejectsSamplingParameters: false,
4727
+ supportsXhighEffort: false,
4504
4728
  isKnownModel: true
4505
4729
  };
4506
4730
  } else {
4507
4731
  return {
4508
4732
  maxOutputTokens: 4096,
4509
4733
  supportsStructuredOutput: false,
4734
+ supportsAdaptiveThinking: false,
4735
+ rejectsSamplingParameters: false,
4736
+ supportsXhighEffort: false,
4510
4737
  isKnownModel: false
4511
4738
  };
4512
4739
  }
@@ -4529,6 +4756,44 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4529
4756
  }
4530
4757
  return hasWebTool20260209 && !hasCodeExecutionTool;
4531
4758
  }
4759
+ function resolveAnthropicReasoningConfig({
4760
+ reasoning,
4761
+ supportsAdaptiveThinking,
4762
+ supportsXhighEffort,
4763
+ maxOutputTokensForModel,
4764
+ warnings
4765
+ }) {
4766
+ if (!isCustomReasoning(reasoning)) {
4767
+ return void 0;
4768
+ }
4769
+ if (reasoning === "none") {
4770
+ return { thinking: { type: "disabled" } };
4771
+ }
4772
+ if (supportsAdaptiveThinking) {
4773
+ const effort = mapReasoningToProviderEffort({
4774
+ reasoning,
4775
+ effortMap: {
4776
+ minimal: "low",
4777
+ low: "low",
4778
+ medium: "medium",
4779
+ high: "high",
4780
+ xhigh: supportsXhighEffort ? "xhigh" : "max"
4781
+ },
4782
+ warnings
4783
+ });
4784
+ return { thinking: { type: "adaptive" }, effort };
4785
+ }
4786
+ const budgetTokens = mapReasoningToProviderBudget({
4787
+ reasoning,
4788
+ maxOutputTokens: maxOutputTokensForModel,
4789
+ maxReasoningBudget: maxOutputTokensForModel,
4790
+ warnings
4791
+ });
4792
+ if (budgetTokens == null) {
4793
+ return void 0;
4794
+ }
4795
+ return { thinking: { type: "enabled", budgetTokens } };
4796
+ }
4532
4797
  function mapAnthropicResponseContextManagement(contextManagement) {
4533
4798
  return contextManagement ? {
4534
4799
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4556,44 +4821,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4556
4821
  }
4557
4822
 
4558
4823
  // src/tool/bash_20241022.ts
4559
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4560
- var import_v413 = require("zod/v4");
4561
- var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
4562
- () => (0, import_provider_utils16.zodSchema)(
4563
- import_v413.z.object({
4564
- command: import_v413.z.string(),
4565
- restart: import_v413.z.boolean().optional()
4824
+ import {
4825
+ createProviderToolFactory as createProviderToolFactory2,
4826
+ lazySchema as lazySchema12,
4827
+ zodSchema as zodSchema12
4828
+ } from "@ai-sdk/provider-utils";
4829
+ import { z as z13 } from "zod/v4";
4830
+ var bash_20241022InputSchema = lazySchema12(
4831
+ () => zodSchema12(
4832
+ z13.object({
4833
+ command: z13.string(),
4834
+ restart: z13.boolean().optional()
4566
4835
  })
4567
4836
  )
4568
4837
  );
4569
- var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
4838
+ var bash_20241022 = createProviderToolFactory2({
4570
4839
  id: "anthropic.bash_20241022",
4571
4840
  inputSchema: bash_20241022InputSchema
4572
4841
  });
4573
4842
 
4574
4843
  // src/tool/bash_20250124.ts
4575
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4576
- var import_v414 = require("zod/v4");
4577
- var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
4578
- () => (0, import_provider_utils17.zodSchema)(
4579
- import_v414.z.object({
4580
- command: import_v414.z.string(),
4581
- restart: import_v414.z.boolean().optional()
4844
+ import {
4845
+ createProviderToolFactory as createProviderToolFactory3,
4846
+ lazySchema as lazySchema13,
4847
+ zodSchema as zodSchema13
4848
+ } from "@ai-sdk/provider-utils";
4849
+ import { z as z14 } from "zod/v4";
4850
+ var bash_20250124InputSchema = lazySchema13(
4851
+ () => zodSchema13(
4852
+ z14.object({
4853
+ command: z14.string(),
4854
+ restart: z14.boolean().optional()
4582
4855
  })
4583
4856
  )
4584
4857
  );
4585
- var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
4858
+ var bash_20250124 = createProviderToolFactory3({
4586
4859
  id: "anthropic.bash_20250124",
4587
4860
  inputSchema: bash_20250124InputSchema
4588
4861
  });
4589
4862
 
4590
4863
  // src/tool/computer_20241022.ts
4591
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4592
- var import_v415 = require("zod/v4");
4593
- var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4594
- () => (0, import_provider_utils18.zodSchema)(
4595
- import_v415.z.object({
4596
- action: import_v415.z.enum([
4864
+ import {
4865
+ createProviderToolFactory as createProviderToolFactory4,
4866
+ lazySchema as lazySchema14,
4867
+ zodSchema as zodSchema14
4868
+ } from "@ai-sdk/provider-utils";
4869
+ import { z as z15 } from "zod/v4";
4870
+ var computer_20241022InputSchema = lazySchema14(
4871
+ () => zodSchema14(
4872
+ z15.object({
4873
+ action: z15.enum([
4597
4874
  "key",
4598
4875
  "type",
4599
4876
  "mouse_move",
@@ -4605,23 +4882,27 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4605
4882
  "screenshot",
4606
4883
  "cursor_position"
4607
4884
  ]),
4608
- coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
4609
- text: import_v415.z.string().optional()
4885
+ coordinate: z15.array(z15.number().int()).optional(),
4886
+ text: z15.string().optional()
4610
4887
  })
4611
4888
  )
4612
4889
  );
4613
- var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
4890
+ var computer_20241022 = createProviderToolFactory4({
4614
4891
  id: "anthropic.computer_20241022",
4615
4892
  inputSchema: computer_20241022InputSchema
4616
4893
  });
4617
4894
 
4618
4895
  // src/tool/computer_20250124.ts
4619
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4620
- var import_v416 = require("zod/v4");
4621
- var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4622
- () => (0, import_provider_utils19.zodSchema)(
4623
- import_v416.z.object({
4624
- action: import_v416.z.enum([
4896
+ import {
4897
+ createProviderToolFactory as createProviderToolFactory5,
4898
+ lazySchema as lazySchema15,
4899
+ zodSchema as zodSchema15
4900
+ } from "@ai-sdk/provider-utils";
4901
+ import { z as z16 } from "zod/v4";
4902
+ var computer_20250124InputSchema = lazySchema15(
4903
+ () => zodSchema15(
4904
+ z16.object({
4905
+ action: z16.enum([
4625
4906
  "key",
4626
4907
  "hold_key",
4627
4908
  "type",
@@ -4639,27 +4920,31 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4639
4920
  "wait",
4640
4921
  "screenshot"
4641
4922
  ]),
4642
- coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4643
- duration: import_v416.z.number().optional(),
4644
- scroll_amount: import_v416.z.number().optional(),
4645
- scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
4646
- start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4647
- text: import_v416.z.string().optional()
4923
+ coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4924
+ duration: z16.number().optional(),
4925
+ scroll_amount: z16.number().optional(),
4926
+ scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
4927
+ start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4928
+ text: z16.string().optional()
4648
4929
  })
4649
4930
  )
4650
4931
  );
4651
- var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
4932
+ var computer_20250124 = createProviderToolFactory5({
4652
4933
  id: "anthropic.computer_20250124",
4653
4934
  inputSchema: computer_20250124InputSchema
4654
4935
  });
4655
4936
 
4656
4937
  // src/tool/computer_20251124.ts
4657
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4658
- var import_v417 = require("zod/v4");
4659
- var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4660
- () => (0, import_provider_utils20.zodSchema)(
4661
- import_v417.z.object({
4662
- action: import_v417.z.enum([
4938
+ import {
4939
+ createProviderToolFactory as createProviderToolFactory6,
4940
+ lazySchema as lazySchema16,
4941
+ zodSchema as zodSchema16
4942
+ } from "@ai-sdk/provider-utils";
4943
+ import { z as z17 } from "zod/v4";
4944
+ var computer_20251124InputSchema = lazySchema16(
4945
+ () => zodSchema16(
4946
+ z17.object({
4947
+ action: z17.enum([
4663
4948
  "key",
4664
4949
  "hold_key",
4665
4950
  "type",
@@ -4678,166 +4963,186 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4678
4963
  "screenshot",
4679
4964
  "zoom"
4680
4965
  ]),
4681
- coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4682
- duration: import_v417.z.number().optional(),
4683
- region: import_v417.z.tuple([
4684
- import_v417.z.number().int(),
4685
- import_v417.z.number().int(),
4686
- import_v417.z.number().int(),
4687
- import_v417.z.number().int()
4966
+ coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4967
+ duration: z17.number().optional(),
4968
+ region: z17.tuple([
4969
+ z17.number().int(),
4970
+ z17.number().int(),
4971
+ z17.number().int(),
4972
+ z17.number().int()
4688
4973
  ]).optional(),
4689
- scroll_amount: import_v417.z.number().optional(),
4690
- scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4691
- start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4692
- text: import_v417.z.string().optional()
4974
+ scroll_amount: z17.number().optional(),
4975
+ scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
4976
+ start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4977
+ text: z17.string().optional()
4693
4978
  })
4694
4979
  )
4695
4980
  );
4696
- var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
4981
+ var computer_20251124 = createProviderToolFactory6({
4697
4982
  id: "anthropic.computer_20251124",
4698
4983
  inputSchema: computer_20251124InputSchema
4699
4984
  });
4700
4985
 
4701
4986
  // src/tool/memory_20250818.ts
4702
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
4703
- var import_v418 = require("zod/v4");
4704
- var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
4705
- () => (0, import_provider_utils21.zodSchema)(
4706
- import_v418.z.discriminatedUnion("command", [
4707
- import_v418.z.object({
4708
- command: import_v418.z.literal("view"),
4709
- path: import_v418.z.string(),
4710
- view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
4987
+ import {
4988
+ createProviderToolFactory as createProviderToolFactory7,
4989
+ lazySchema as lazySchema17,
4990
+ zodSchema as zodSchema17
4991
+ } from "@ai-sdk/provider-utils";
4992
+ import { z as z18 } from "zod/v4";
4993
+ var memory_20250818InputSchema = lazySchema17(
4994
+ () => zodSchema17(
4995
+ z18.discriminatedUnion("command", [
4996
+ z18.object({
4997
+ command: z18.literal("view"),
4998
+ path: z18.string(),
4999
+ view_range: z18.tuple([z18.number(), z18.number()]).optional()
4711
5000
  }),
4712
- import_v418.z.object({
4713
- command: import_v418.z.literal("create"),
4714
- path: import_v418.z.string(),
4715
- file_text: import_v418.z.string()
5001
+ z18.object({
5002
+ command: z18.literal("create"),
5003
+ path: z18.string(),
5004
+ file_text: z18.string()
4716
5005
  }),
4717
- import_v418.z.object({
4718
- command: import_v418.z.literal("str_replace"),
4719
- path: import_v418.z.string(),
4720
- old_str: import_v418.z.string(),
4721
- new_str: import_v418.z.string()
5006
+ z18.object({
5007
+ command: z18.literal("str_replace"),
5008
+ path: z18.string(),
5009
+ old_str: z18.string(),
5010
+ new_str: z18.string()
4722
5011
  }),
4723
- import_v418.z.object({
4724
- command: import_v418.z.literal("insert"),
4725
- path: import_v418.z.string(),
4726
- insert_line: import_v418.z.number(),
4727
- insert_text: import_v418.z.string()
5012
+ z18.object({
5013
+ command: z18.literal("insert"),
5014
+ path: z18.string(),
5015
+ insert_line: z18.number(),
5016
+ insert_text: z18.string()
4728
5017
  }),
4729
- import_v418.z.object({
4730
- command: import_v418.z.literal("delete"),
4731
- path: import_v418.z.string()
5018
+ z18.object({
5019
+ command: z18.literal("delete"),
5020
+ path: z18.string()
4732
5021
  }),
4733
- import_v418.z.object({
4734
- command: import_v418.z.literal("rename"),
4735
- old_path: import_v418.z.string(),
4736
- new_path: import_v418.z.string()
5022
+ z18.object({
5023
+ command: z18.literal("rename"),
5024
+ old_path: z18.string(),
5025
+ new_path: z18.string()
4737
5026
  })
4738
5027
  ])
4739
5028
  )
4740
5029
  );
4741
- var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
5030
+ var memory_20250818 = createProviderToolFactory7({
4742
5031
  id: "anthropic.memory_20250818",
4743
5032
  inputSchema: memory_20250818InputSchema
4744
5033
  });
4745
5034
 
4746
5035
  // src/tool/text-editor_20241022.ts
4747
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
4748
- var import_v419 = require("zod/v4");
4749
- var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
4750
- () => (0, import_provider_utils22.zodSchema)(
4751
- import_v419.z.object({
4752
- command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4753
- path: import_v419.z.string(),
4754
- file_text: import_v419.z.string().optional(),
4755
- insert_line: import_v419.z.number().int().optional(),
4756
- new_str: import_v419.z.string().optional(),
4757
- insert_text: import_v419.z.string().optional(),
4758
- old_str: import_v419.z.string().optional(),
4759
- view_range: import_v419.z.array(import_v419.z.number().int()).optional()
5036
+ import {
5037
+ createProviderToolFactory as createProviderToolFactory8,
5038
+ lazySchema as lazySchema18,
5039
+ zodSchema as zodSchema18
5040
+ } from "@ai-sdk/provider-utils";
5041
+ import { z as z19 } from "zod/v4";
5042
+ var textEditor_20241022InputSchema = lazySchema18(
5043
+ () => zodSchema18(
5044
+ z19.object({
5045
+ command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5046
+ path: z19.string(),
5047
+ file_text: z19.string().optional(),
5048
+ insert_line: z19.number().int().optional(),
5049
+ new_str: z19.string().optional(),
5050
+ insert_text: z19.string().optional(),
5051
+ old_str: z19.string().optional(),
5052
+ view_range: z19.array(z19.number().int()).optional()
4760
5053
  })
4761
5054
  )
4762
5055
  );
4763
- var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
5056
+ var textEditor_20241022 = createProviderToolFactory8({
4764
5057
  id: "anthropic.text_editor_20241022",
4765
5058
  inputSchema: textEditor_20241022InputSchema
4766
5059
  });
4767
5060
 
4768
5061
  // src/tool/text-editor_20250124.ts
4769
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
4770
- var import_v420 = require("zod/v4");
4771
- var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
4772
- () => (0, import_provider_utils23.zodSchema)(
4773
- import_v420.z.object({
4774
- command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4775
- path: import_v420.z.string(),
4776
- file_text: import_v420.z.string().optional(),
4777
- insert_line: import_v420.z.number().int().optional(),
4778
- new_str: import_v420.z.string().optional(),
4779
- insert_text: import_v420.z.string().optional(),
4780
- old_str: import_v420.z.string().optional(),
4781
- view_range: import_v420.z.array(import_v420.z.number().int()).optional()
5062
+ import {
5063
+ createProviderToolFactory as createProviderToolFactory9,
5064
+ lazySchema as lazySchema19,
5065
+ zodSchema as zodSchema19
5066
+ } from "@ai-sdk/provider-utils";
5067
+ import { z as z20 } from "zod/v4";
5068
+ var textEditor_20250124InputSchema = lazySchema19(
5069
+ () => zodSchema19(
5070
+ z20.object({
5071
+ command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5072
+ path: z20.string(),
5073
+ file_text: z20.string().optional(),
5074
+ insert_line: z20.number().int().optional(),
5075
+ new_str: z20.string().optional(),
5076
+ insert_text: z20.string().optional(),
5077
+ old_str: z20.string().optional(),
5078
+ view_range: z20.array(z20.number().int()).optional()
4782
5079
  })
4783
5080
  )
4784
5081
  );
4785
- var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
5082
+ var textEditor_20250124 = createProviderToolFactory9({
4786
5083
  id: "anthropic.text_editor_20250124",
4787
5084
  inputSchema: textEditor_20250124InputSchema
4788
5085
  });
4789
5086
 
4790
5087
  // src/tool/text-editor_20250429.ts
4791
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
4792
- var import_v421 = require("zod/v4");
4793
- var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
4794
- () => (0, import_provider_utils24.zodSchema)(
4795
- import_v421.z.object({
4796
- command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
4797
- path: import_v421.z.string(),
4798
- file_text: import_v421.z.string().optional(),
4799
- insert_line: import_v421.z.number().int().optional(),
4800
- new_str: import_v421.z.string().optional(),
4801
- insert_text: import_v421.z.string().optional(),
4802
- old_str: import_v421.z.string().optional(),
4803
- view_range: import_v421.z.array(import_v421.z.number().int()).optional()
5088
+ import {
5089
+ createProviderToolFactory as createProviderToolFactory10,
5090
+ lazySchema as lazySchema20,
5091
+ zodSchema as zodSchema20
5092
+ } from "@ai-sdk/provider-utils";
5093
+ import { z as z21 } from "zod/v4";
5094
+ var textEditor_20250429InputSchema = lazySchema20(
5095
+ () => zodSchema20(
5096
+ z21.object({
5097
+ command: z21.enum(["view", "create", "str_replace", "insert"]),
5098
+ path: z21.string(),
5099
+ file_text: z21.string().optional(),
5100
+ insert_line: z21.number().int().optional(),
5101
+ new_str: z21.string().optional(),
5102
+ insert_text: z21.string().optional(),
5103
+ old_str: z21.string().optional(),
5104
+ view_range: z21.array(z21.number().int()).optional()
4804
5105
  })
4805
5106
  )
4806
5107
  );
4807
- var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
5108
+ var textEditor_20250429 = createProviderToolFactory10({
4808
5109
  id: "anthropic.text_editor_20250429",
4809
5110
  inputSchema: textEditor_20250429InputSchema
4810
5111
  });
4811
5112
 
4812
5113
  // src/tool/tool-search-bm25_20251119.ts
4813
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4814
- var import_v422 = require("zod/v4");
4815
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
4816
- () => (0, import_provider_utils25.zodSchema)(
4817
- import_v422.z.array(
4818
- import_v422.z.object({
4819
- type: import_v422.z.literal("tool_reference"),
4820
- toolName: import_v422.z.string()
5114
+ import {
5115
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5116
+ lazySchema as lazySchema21,
5117
+ zodSchema as zodSchema21
5118
+ } from "@ai-sdk/provider-utils";
5119
+ import { z as z22 } from "zod/v4";
5120
+ var toolSearchBm25_20251119OutputSchema = lazySchema21(
5121
+ () => zodSchema21(
5122
+ z22.array(
5123
+ z22.object({
5124
+ type: z22.literal("tool_reference"),
5125
+ toolName: z22.string()
4821
5126
  })
4822
5127
  )
4823
5128
  )
4824
5129
  );
4825
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
4826
- () => (0, import_provider_utils25.zodSchema)(
4827
- import_v422.z.object({
5130
+ var toolSearchBm25_20251119InputSchema = lazySchema21(
5131
+ () => zodSchema21(
5132
+ z22.object({
4828
5133
  /**
4829
5134
  * A natural language query to search for tools.
4830
5135
  * Claude will use BM25 text search to find relevant tools.
4831
5136
  */
4832
- query: import_v422.z.string(),
5137
+ query: z22.string(),
4833
5138
  /**
4834
5139
  * Maximum number of tools to return. Optional.
4835
5140
  */
4836
- limit: import_v422.z.number().optional()
5141
+ limit: z22.number().optional()
4837
5142
  })
4838
5143
  )
4839
5144
  );
4840
- var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
5145
+ var factory10 = createProviderToolFactoryWithOutputSchema9({
4841
5146
  id: "anthropic.tool_search_bm25_20251119",
4842
5147
  inputSchema: toolSearchBm25_20251119InputSchema,
4843
5148
  outputSchema: toolSearchBm25_20251119OutputSchema,
@@ -5048,10 +5353,10 @@ var anthropicTools = {
5048
5353
  */
5049
5354
  toolSearchBm25_20251119
5050
5355
  };
5051
- // Annotate the CommonJS export names for ESM import in node:
5052
- 0 && (module.exports = {
5356
+ export {
5053
5357
  AnthropicMessagesLanguageModel,
5054
5358
  anthropicTools,
5359
+ getModelCapabilities,
5055
5360
  prepareTools
5056
- });
5361
+ };
5057
5362
  //# sourceMappingURL=index.js.map