@ai-sdk/anthropic 2.0.25 → 2.0.27

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,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/internal/index.ts
@@ -42,14 +32,14 @@ var import_provider_utils10 = require("@ai-sdk/provider-utils");
42
32
 
43
33
  // src/anthropic-error.ts
44
34
  var import_provider_utils = require("@ai-sdk/provider-utils");
45
- var z = __toESM(require("zod/v4"));
35
+ var import_v4 = require("zod/v4");
46
36
  var anthropicErrorDataSchema = (0, import_provider_utils.lazySchema)(
47
37
  () => (0, import_provider_utils.zodSchema)(
48
- z.object({
49
- type: z.literal("error"),
50
- error: z.object({
51
- type: z.string(),
52
- message: z.string()
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()
53
43
  })
54
44
  })
55
45
  )
@@ -61,377 +51,377 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
61
51
 
62
52
  // src/anthropic-messages-api.ts
63
53
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
64
- var z2 = __toESM(require("zod/v4"));
54
+ var import_v42 = require("zod/v4");
65
55
  var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
66
56
  () => (0, import_provider_utils2.zodSchema)(
67
- z2.object({
68
- type: z2.literal("message"),
69
- id: z2.string().nullish(),
70
- model: z2.string().nullish(),
71
- content: z2.array(
72
- z2.discriminatedUnion("type", [
73
- z2.object({
74
- type: z2.literal("text"),
75
- text: z2.string(),
76
- citations: z2.array(
77
- z2.discriminatedUnion("type", [
78
- z2.object({
79
- type: z2.literal("web_search_result_location"),
80
- cited_text: z2.string(),
81
- url: z2.string(),
82
- title: z2.string(),
83
- encrypted_index: z2.string()
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()
84
74
  }),
85
- z2.object({
86
- type: z2.literal("page_location"),
87
- cited_text: z2.string(),
88
- document_index: z2.number(),
89
- document_title: z2.string().nullable(),
90
- start_page_number: z2.number(),
91
- end_page_number: z2.number()
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()
92
82
  }),
93
- z2.object({
94
- type: z2.literal("char_location"),
95
- cited_text: z2.string(),
96
- document_index: z2.number(),
97
- document_title: z2.string().nullable(),
98
- start_char_index: z2.number(),
99
- end_char_index: z2.number()
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()
100
90
  })
101
91
  ])
102
92
  ).optional()
103
93
  }),
104
- z2.object({
105
- type: z2.literal("thinking"),
106
- thinking: z2.string(),
107
- signature: z2.string()
94
+ import_v42.z.object({
95
+ type: import_v42.z.literal("thinking"),
96
+ thinking: import_v42.z.string(),
97
+ signature: import_v42.z.string()
108
98
  }),
109
- z2.object({
110
- type: z2.literal("redacted_thinking"),
111
- data: z2.string()
99
+ import_v42.z.object({
100
+ type: import_v42.z.literal("redacted_thinking"),
101
+ data: import_v42.z.string()
112
102
  }),
113
- z2.object({
114
- type: z2.literal("tool_use"),
115
- id: z2.string(),
116
- name: z2.string(),
117
- input: z2.unknown()
103
+ import_v42.z.object({
104
+ type: import_v42.z.literal("tool_use"),
105
+ id: import_v42.z.string(),
106
+ name: import_v42.z.string(),
107
+ input: import_v42.z.unknown()
118
108
  }),
119
- z2.object({
120
- type: z2.literal("server_tool_use"),
121
- id: z2.string(),
122
- name: z2.string(),
123
- input: z2.record(z2.string(), z2.unknown()).nullish()
109
+ import_v42.z.object({
110
+ type: import_v42.z.literal("server_tool_use"),
111
+ id: import_v42.z.string(),
112
+ name: import_v42.z.string(),
113
+ input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
124
114
  }),
125
- z2.object({
126
- type: z2.literal("web_fetch_tool_result"),
127
- tool_use_id: z2.string(),
128
- content: z2.union([
129
- z2.object({
130
- type: z2.literal("web_fetch_result"),
131
- url: z2.string(),
132
- retrieved_at: z2.string(),
133
- content: z2.object({
134
- type: z2.literal("document"),
135
- title: z2.string().nullable(),
136
- citations: z2.object({ enabled: z2.boolean() }).optional(),
137
- source: z2.object({
138
- type: z2.literal("text"),
139
- media_type: z2.string(),
140
- data: z2.string()
115
+ import_v42.z.object({
116
+ type: import_v42.z.literal("web_fetch_tool_result"),
117
+ tool_use_id: import_v42.z.string(),
118
+ content: import_v42.z.union([
119
+ import_v42.z.object({
120
+ type: import_v42.z.literal("web_fetch_result"),
121
+ url: import_v42.z.string(),
122
+ retrieved_at: import_v42.z.string(),
123
+ content: import_v42.z.object({
124
+ type: import_v42.z.literal("document"),
125
+ title: import_v42.z.string().nullable(),
126
+ citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
127
+ source: import_v42.z.object({
128
+ type: import_v42.z.literal("text"),
129
+ media_type: import_v42.z.string(),
130
+ data: import_v42.z.string()
141
131
  })
142
132
  })
143
133
  }),
144
- z2.object({
145
- type: z2.literal("web_fetch_tool_result_error"),
146
- error_code: z2.string()
134
+ import_v42.z.object({
135
+ type: import_v42.z.literal("web_fetch_tool_result_error"),
136
+ error_code: import_v42.z.string()
147
137
  })
148
138
  ])
149
139
  }),
150
- z2.object({
151
- type: z2.literal("web_search_tool_result"),
152
- tool_use_id: z2.string(),
153
- content: z2.union([
154
- z2.array(
155
- z2.object({
156
- type: z2.literal("web_search_result"),
157
- url: z2.string(),
158
- title: z2.string(),
159
- encrypted_content: z2.string(),
160
- page_age: z2.string().nullish()
140
+ import_v42.z.object({
141
+ type: import_v42.z.literal("web_search_tool_result"),
142
+ tool_use_id: import_v42.z.string(),
143
+ content: import_v42.z.union([
144
+ import_v42.z.array(
145
+ import_v42.z.object({
146
+ type: import_v42.z.literal("web_search_result"),
147
+ url: import_v42.z.string(),
148
+ title: import_v42.z.string(),
149
+ encrypted_content: import_v42.z.string(),
150
+ page_age: import_v42.z.string().nullish()
161
151
  })
162
152
  ),
163
- z2.object({
164
- type: z2.literal("web_search_tool_result_error"),
165
- error_code: z2.string()
153
+ import_v42.z.object({
154
+ type: import_v42.z.literal("web_search_tool_result_error"),
155
+ error_code: import_v42.z.string()
166
156
  })
167
157
  ])
168
158
  }),
169
- z2.object({
170
- type: z2.literal("code_execution_tool_result"),
171
- tool_use_id: z2.string(),
172
- content: z2.union([
173
- z2.object({
174
- type: z2.literal("code_execution_result"),
175
- stdout: z2.string(),
176
- stderr: z2.string(),
177
- return_code: z2.number()
159
+ import_v42.z.object({
160
+ type: import_v42.z.literal("code_execution_tool_result"),
161
+ tool_use_id: import_v42.z.string(),
162
+ content: import_v42.z.union([
163
+ import_v42.z.object({
164
+ type: import_v42.z.literal("code_execution_result"),
165
+ stdout: import_v42.z.string(),
166
+ stderr: import_v42.z.string(),
167
+ return_code: import_v42.z.number()
178
168
  }),
179
- z2.object({
180
- type: z2.literal("code_execution_tool_result_error"),
181
- error_code: z2.string()
169
+ import_v42.z.object({
170
+ type: import_v42.z.literal("code_execution_tool_result_error"),
171
+ error_code: import_v42.z.string()
182
172
  })
183
173
  ])
184
174
  })
185
175
  ])
186
176
  ),
187
- stop_reason: z2.string().nullish(),
188
- stop_sequence: z2.string().nullish(),
189
- usage: z2.looseObject({
190
- input_tokens: z2.number(),
191
- output_tokens: z2.number(),
192
- cache_creation_input_tokens: z2.number().nullish(),
193
- cache_read_input_tokens: z2.number().nullish()
177
+ stop_reason: import_v42.z.string().nullish(),
178
+ stop_sequence: import_v42.z.string().nullish(),
179
+ usage: import_v42.z.looseObject({
180
+ input_tokens: import_v42.z.number(),
181
+ output_tokens: import_v42.z.number(),
182
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
183
+ cache_read_input_tokens: import_v42.z.number().nullish()
194
184
  })
195
185
  })
196
186
  )
197
187
  );
198
188
  var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
199
189
  () => (0, import_provider_utils2.zodSchema)(
200
- z2.discriminatedUnion("type", [
201
- z2.object({
202
- type: z2.literal("message_start"),
203
- message: z2.object({
204
- id: z2.string().nullish(),
205
- model: z2.string().nullish(),
206
- usage: z2.looseObject({
207
- input_tokens: z2.number(),
208
- cache_creation_input_tokens: z2.number().nullish(),
209
- cache_read_input_tokens: z2.number().nullish()
190
+ import_v42.z.discriminatedUnion("type", [
191
+ import_v42.z.object({
192
+ type: import_v42.z.literal("message_start"),
193
+ message: import_v42.z.object({
194
+ id: import_v42.z.string().nullish(),
195
+ model: import_v42.z.string().nullish(),
196
+ usage: import_v42.z.looseObject({
197
+ input_tokens: import_v42.z.number(),
198
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
199
+ cache_read_input_tokens: import_v42.z.number().nullish()
210
200
  })
211
201
  })
212
202
  }),
213
- z2.object({
214
- type: z2.literal("content_block_start"),
215
- index: z2.number(),
216
- content_block: z2.discriminatedUnion("type", [
217
- z2.object({
218
- type: z2.literal("text"),
219
- text: z2.string()
203
+ import_v42.z.object({
204
+ type: import_v42.z.literal("content_block_start"),
205
+ index: import_v42.z.number(),
206
+ content_block: import_v42.z.discriminatedUnion("type", [
207
+ import_v42.z.object({
208
+ type: import_v42.z.literal("text"),
209
+ text: import_v42.z.string()
220
210
  }),
221
- z2.object({
222
- type: z2.literal("thinking"),
223
- thinking: z2.string()
211
+ import_v42.z.object({
212
+ type: import_v42.z.literal("thinking"),
213
+ thinking: import_v42.z.string()
224
214
  }),
225
- z2.object({
226
- type: z2.literal("tool_use"),
227
- id: z2.string(),
228
- name: z2.string()
215
+ import_v42.z.object({
216
+ type: import_v42.z.literal("tool_use"),
217
+ id: import_v42.z.string(),
218
+ name: import_v42.z.string()
229
219
  }),
230
- z2.object({
231
- type: z2.literal("redacted_thinking"),
232
- data: z2.string()
220
+ import_v42.z.object({
221
+ type: import_v42.z.literal("redacted_thinking"),
222
+ data: import_v42.z.string()
233
223
  }),
234
- z2.object({
235
- type: z2.literal("server_tool_use"),
236
- id: z2.string(),
237
- name: z2.string(),
238
- input: z2.record(z2.string(), z2.unknown()).nullish()
224
+ import_v42.z.object({
225
+ type: import_v42.z.literal("server_tool_use"),
226
+ id: import_v42.z.string(),
227
+ name: import_v42.z.string(),
228
+ input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
239
229
  }),
240
- z2.object({
241
- type: z2.literal("web_fetch_tool_result"),
242
- tool_use_id: z2.string(),
243
- content: z2.union([
244
- z2.object({
245
- type: z2.literal("web_fetch_result"),
246
- url: z2.string(),
247
- retrieved_at: z2.string(),
248
- content: z2.object({
249
- type: z2.literal("document"),
250
- title: z2.string().nullable(),
251
- citations: z2.object({ enabled: z2.boolean() }).optional(),
252
- source: z2.object({
253
- type: z2.literal("text"),
254
- media_type: z2.string(),
255
- data: z2.string()
230
+ import_v42.z.object({
231
+ type: import_v42.z.literal("web_fetch_tool_result"),
232
+ tool_use_id: import_v42.z.string(),
233
+ content: import_v42.z.union([
234
+ import_v42.z.object({
235
+ type: import_v42.z.literal("web_fetch_result"),
236
+ url: import_v42.z.string(),
237
+ retrieved_at: import_v42.z.string(),
238
+ content: import_v42.z.object({
239
+ type: import_v42.z.literal("document"),
240
+ title: import_v42.z.string().nullable(),
241
+ citations: import_v42.z.object({ enabled: import_v42.z.boolean() }).optional(),
242
+ source: import_v42.z.object({
243
+ type: import_v42.z.literal("text"),
244
+ media_type: import_v42.z.string(),
245
+ data: import_v42.z.string()
256
246
  })
257
247
  })
258
248
  }),
259
- z2.object({
260
- type: z2.literal("web_fetch_tool_result_error"),
261
- error_code: z2.string()
249
+ import_v42.z.object({
250
+ type: import_v42.z.literal("web_fetch_tool_result_error"),
251
+ error_code: import_v42.z.string()
262
252
  })
263
253
  ])
264
254
  }),
265
- z2.object({
266
- type: z2.literal("web_search_tool_result"),
267
- tool_use_id: z2.string(),
268
- content: z2.union([
269
- z2.array(
270
- z2.object({
271
- type: z2.literal("web_search_result"),
272
- url: z2.string(),
273
- title: z2.string(),
274
- encrypted_content: z2.string(),
275
- page_age: z2.string().nullish()
255
+ import_v42.z.object({
256
+ type: import_v42.z.literal("web_search_tool_result"),
257
+ tool_use_id: import_v42.z.string(),
258
+ content: import_v42.z.union([
259
+ import_v42.z.array(
260
+ import_v42.z.object({
261
+ type: import_v42.z.literal("web_search_result"),
262
+ url: import_v42.z.string(),
263
+ title: import_v42.z.string(),
264
+ encrypted_content: import_v42.z.string(),
265
+ page_age: import_v42.z.string().nullish()
276
266
  })
277
267
  ),
278
- z2.object({
279
- type: z2.literal("web_search_tool_result_error"),
280
- error_code: z2.string()
268
+ import_v42.z.object({
269
+ type: import_v42.z.literal("web_search_tool_result_error"),
270
+ error_code: import_v42.z.string()
281
271
  })
282
272
  ])
283
273
  }),
284
- z2.object({
285
- type: z2.literal("code_execution_tool_result"),
286
- tool_use_id: z2.string(),
287
- content: z2.union([
288
- z2.object({
289
- type: z2.literal("code_execution_result"),
290
- stdout: z2.string(),
291
- stderr: z2.string(),
292
- return_code: z2.number()
274
+ import_v42.z.object({
275
+ type: import_v42.z.literal("code_execution_tool_result"),
276
+ tool_use_id: import_v42.z.string(),
277
+ content: import_v42.z.union([
278
+ import_v42.z.object({
279
+ type: import_v42.z.literal("code_execution_result"),
280
+ stdout: import_v42.z.string(),
281
+ stderr: import_v42.z.string(),
282
+ return_code: import_v42.z.number()
293
283
  }),
294
- z2.object({
295
- type: z2.literal("code_execution_tool_result_error"),
296
- error_code: z2.string()
284
+ import_v42.z.object({
285
+ type: import_v42.z.literal("code_execution_tool_result_error"),
286
+ error_code: import_v42.z.string()
297
287
  })
298
288
  ])
299
289
  })
300
290
  ])
301
291
  }),
302
- z2.object({
303
- type: z2.literal("content_block_delta"),
304
- index: z2.number(),
305
- delta: z2.discriminatedUnion("type", [
306
- z2.object({
307
- type: z2.literal("input_json_delta"),
308
- partial_json: z2.string()
292
+ import_v42.z.object({
293
+ type: import_v42.z.literal("content_block_delta"),
294
+ index: import_v42.z.number(),
295
+ delta: import_v42.z.discriminatedUnion("type", [
296
+ import_v42.z.object({
297
+ type: import_v42.z.literal("input_json_delta"),
298
+ partial_json: import_v42.z.string()
309
299
  }),
310
- z2.object({
311
- type: z2.literal("text_delta"),
312
- text: z2.string()
300
+ import_v42.z.object({
301
+ type: import_v42.z.literal("text_delta"),
302
+ text: import_v42.z.string()
313
303
  }),
314
- z2.object({
315
- type: z2.literal("thinking_delta"),
316
- thinking: z2.string()
304
+ import_v42.z.object({
305
+ type: import_v42.z.literal("thinking_delta"),
306
+ thinking: import_v42.z.string()
317
307
  }),
318
- z2.object({
319
- type: z2.literal("signature_delta"),
320
- signature: z2.string()
308
+ import_v42.z.object({
309
+ type: import_v42.z.literal("signature_delta"),
310
+ signature: import_v42.z.string()
321
311
  }),
322
- z2.object({
323
- type: z2.literal("citations_delta"),
324
- citation: z2.discriminatedUnion("type", [
325
- z2.object({
326
- type: z2.literal("web_search_result_location"),
327
- cited_text: z2.string(),
328
- url: z2.string(),
329
- title: z2.string(),
330
- encrypted_index: z2.string()
312
+ import_v42.z.object({
313
+ type: import_v42.z.literal("citations_delta"),
314
+ citation: import_v42.z.discriminatedUnion("type", [
315
+ import_v42.z.object({
316
+ type: import_v42.z.literal("web_search_result_location"),
317
+ cited_text: import_v42.z.string(),
318
+ url: import_v42.z.string(),
319
+ title: import_v42.z.string(),
320
+ encrypted_index: import_v42.z.string()
331
321
  }),
332
- z2.object({
333
- type: z2.literal("page_location"),
334
- cited_text: z2.string(),
335
- document_index: z2.number(),
336
- document_title: z2.string().nullable(),
337
- start_page_number: z2.number(),
338
- end_page_number: z2.number()
322
+ import_v42.z.object({
323
+ type: import_v42.z.literal("page_location"),
324
+ cited_text: import_v42.z.string(),
325
+ document_index: import_v42.z.number(),
326
+ document_title: import_v42.z.string().nullable(),
327
+ start_page_number: import_v42.z.number(),
328
+ end_page_number: import_v42.z.number()
339
329
  }),
340
- z2.object({
341
- type: z2.literal("char_location"),
342
- cited_text: z2.string(),
343
- document_index: z2.number(),
344
- document_title: z2.string().nullable(),
345
- start_char_index: z2.number(),
346
- end_char_index: z2.number()
330
+ import_v42.z.object({
331
+ type: import_v42.z.literal("char_location"),
332
+ cited_text: import_v42.z.string(),
333
+ document_index: import_v42.z.number(),
334
+ document_title: import_v42.z.string().nullable(),
335
+ start_char_index: import_v42.z.number(),
336
+ end_char_index: import_v42.z.number()
347
337
  })
348
338
  ])
349
339
  })
350
340
  ])
351
341
  }),
352
- z2.object({
353
- type: z2.literal("content_block_stop"),
354
- index: z2.number()
342
+ import_v42.z.object({
343
+ type: import_v42.z.literal("content_block_stop"),
344
+ index: import_v42.z.number()
355
345
  }),
356
- z2.object({
357
- type: z2.literal("error"),
358
- error: z2.object({
359
- type: z2.string(),
360
- message: z2.string()
346
+ import_v42.z.object({
347
+ type: import_v42.z.literal("error"),
348
+ error: import_v42.z.object({
349
+ type: import_v42.z.string(),
350
+ message: import_v42.z.string()
361
351
  })
362
352
  }),
363
- z2.object({
364
- type: z2.literal("message_delta"),
365
- delta: z2.object({
366
- stop_reason: z2.string().nullish(),
367
- stop_sequence: z2.string().nullish()
353
+ import_v42.z.object({
354
+ type: import_v42.z.literal("message_delta"),
355
+ delta: import_v42.z.object({
356
+ stop_reason: import_v42.z.string().nullish(),
357
+ stop_sequence: import_v42.z.string().nullish()
368
358
  }),
369
- usage: z2.looseObject({
370
- output_tokens: z2.number(),
371
- cache_creation_input_tokens: z2.number().nullish()
359
+ usage: import_v42.z.looseObject({
360
+ output_tokens: import_v42.z.number(),
361
+ cache_creation_input_tokens: import_v42.z.number().nullish()
372
362
  })
373
363
  }),
374
- z2.object({
375
- type: z2.literal("message_stop")
364
+ import_v42.z.object({
365
+ type: import_v42.z.literal("message_stop")
376
366
  }),
377
- z2.object({
378
- type: z2.literal("ping")
367
+ import_v42.z.object({
368
+ type: import_v42.z.literal("ping")
379
369
  })
380
370
  ])
381
371
  )
382
372
  );
383
373
  var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
384
374
  () => (0, import_provider_utils2.zodSchema)(
385
- z2.object({
386
- signature: z2.string().optional(),
387
- redactedData: z2.string().optional()
375
+ import_v42.z.object({
376
+ signature: import_v42.z.string().optional(),
377
+ redactedData: import_v42.z.string().optional()
388
378
  })
389
379
  )
390
380
  );
391
381
 
392
382
  // src/anthropic-messages-options.ts
393
- var z3 = __toESM(require("zod/v4"));
394
- var anthropicFilePartProviderOptions = z3.object({
383
+ var import_v43 = require("zod/v4");
384
+ var anthropicFilePartProviderOptions = import_v43.z.object({
395
385
  /**
396
386
  * Citation configuration for this document.
397
387
  * When enabled, this document will generate citations in the response.
398
388
  */
399
- citations: z3.object({
389
+ citations: import_v43.z.object({
400
390
  /**
401
391
  * Enable citations for this document
402
392
  */
403
- enabled: z3.boolean()
393
+ enabled: import_v43.z.boolean()
404
394
  }).optional(),
405
395
  /**
406
396
  * Custom title for the document.
407
397
  * If not provided, the filename will be used.
408
398
  */
409
- title: z3.string().optional(),
399
+ title: import_v43.z.string().optional(),
410
400
  /**
411
401
  * Context about the document that will be passed to the model
412
402
  * but not used towards cited content.
413
403
  * Useful for storing document metadata as text or stringified JSON.
414
404
  */
415
- context: z3.string().optional()
405
+ context: import_v43.z.string().optional()
416
406
  });
417
- var anthropicProviderOptions = z3.object({
418
- sendReasoning: z3.boolean().optional(),
419
- thinking: z3.object({
420
- type: z3.union([z3.literal("enabled"), z3.literal("disabled")]),
421
- budgetTokens: z3.number().optional()
407
+ var anthropicProviderOptions = import_v43.z.object({
408
+ sendReasoning: import_v43.z.boolean().optional(),
409
+ thinking: import_v43.z.object({
410
+ type: import_v43.z.union([import_v43.z.literal("enabled"), import_v43.z.literal("disabled")]),
411
+ budgetTokens: import_v43.z.number().optional()
422
412
  }).optional(),
423
413
  /**
424
414
  * Whether to disable parallel function calling during tool use. Default is false.
425
415
  * When set to true, Claude will use at most one tool per response.
426
416
  */
427
- disableParallelToolUse: z3.boolean().optional(),
417
+ disableParallelToolUse: import_v43.z.boolean().optional(),
428
418
  /**
429
419
  * Cache control settings for this message.
430
420
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
431
421
  */
432
- cacheControl: z3.object({
433
- type: z3.literal("ephemeral"),
434
- ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
422
+ cacheControl: import_v43.z.object({
423
+ type: import_v43.z.literal("ephemeral"),
424
+ ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
435
425
  }).optional()
436
426
  });
437
427
 
@@ -448,25 +438,25 @@ function getCacheControl(providerMetadata) {
448
438
 
449
439
  // src/tool/text-editor_20250728.ts
450
440
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
451
- var z4 = __toESM(require("zod/v4"));
441
+ var import_v44 = require("zod/v4");
452
442
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
453
443
  var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
454
444
  () => (0, import_provider_utils4.zodSchema)(
455
- z4.object({
456
- maxCharacters: z4.number().optional()
445
+ import_v44.z.object({
446
+ maxCharacters: import_v44.z.number().optional()
457
447
  })
458
448
  )
459
449
  );
460
450
  var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
461
451
  () => (0, import_provider_utils4.zodSchema)(
462
- z4.object({
463
- command: z4.enum(["view", "create", "str_replace", "insert"]),
464
- path: z4.string(),
465
- file_text: z4.string().optional(),
466
- insert_line: z4.number().int().optional(),
467
- new_str: z4.string().optional(),
468
- old_str: z4.string().optional(),
469
- view_range: z4.array(z4.number().int()).optional()
452
+ import_v44.z.object({
453
+ command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
454
+ path: import_v44.z.string(),
455
+ file_text: import_v44.z.string().optional(),
456
+ insert_line: import_v44.z.number().int().optional(),
457
+ new_str: import_v44.z.string().optional(),
458
+ old_str: import_v44.z.string().optional(),
459
+ view_range: import_v44.z.array(import_v44.z.number().int()).optional()
470
460
  })
471
461
  )
472
462
  );
@@ -481,40 +471,40 @@ var textEditor_20250728 = (args = {}) => {
481
471
 
482
472
  // src/tool/web-search_20250305.ts
483
473
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
484
- var z5 = __toESM(require("zod/v4"));
474
+ var import_v45 = require("zod/v4");
485
475
  var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
486
476
  () => (0, import_provider_utils5.zodSchema)(
487
- z5.object({
488
- maxUses: z5.number().optional(),
489
- allowedDomains: z5.array(z5.string()).optional(),
490
- blockedDomains: z5.array(z5.string()).optional(),
491
- userLocation: z5.object({
492
- type: z5.literal("approximate"),
493
- city: z5.string().optional(),
494
- region: z5.string().optional(),
495
- country: z5.string().optional(),
496
- timezone: z5.string().optional()
477
+ import_v45.z.object({
478
+ maxUses: import_v45.z.number().optional(),
479
+ allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
480
+ blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
481
+ userLocation: import_v45.z.object({
482
+ type: import_v45.z.literal("approximate"),
483
+ city: import_v45.z.string().optional(),
484
+ region: import_v45.z.string().optional(),
485
+ country: import_v45.z.string().optional(),
486
+ timezone: import_v45.z.string().optional()
497
487
  }).optional()
498
488
  })
499
489
  )
500
490
  );
501
491
  var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
502
492
  () => (0, import_provider_utils5.zodSchema)(
503
- z5.array(
504
- z5.object({
505
- url: z5.string(),
506
- title: z5.string(),
507
- pageAge: z5.string().nullable(),
508
- encryptedContent: z5.string(),
509
- type: z5.literal("web_search_result")
493
+ import_v45.z.array(
494
+ import_v45.z.object({
495
+ url: import_v45.z.string(),
496
+ title: import_v45.z.string(),
497
+ pageAge: import_v45.z.string().nullable(),
498
+ encryptedContent: import_v45.z.string(),
499
+ type: import_v45.z.literal("web_search_result")
510
500
  })
511
501
  )
512
502
  )
513
503
  );
514
504
  var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
515
505
  () => (0, import_provider_utils5.zodSchema)(
516
- z5.object({
517
- query: z5.string()
506
+ import_v45.z.object({
507
+ query: import_v45.z.string()
518
508
  })
519
509
  )
520
510
  );
@@ -530,48 +520,48 @@ var webSearch_20250305 = (args = {}) => {
530
520
 
531
521
  // src/tool/web-fetch-20250910.ts
532
522
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
533
- var z6 = __toESM(require("zod/v4"));
523
+ var import_v46 = require("zod/v4");
534
524
  var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
535
525
  () => (0, import_provider_utils6.zodSchema)(
536
- z6.object({
537
- maxUses: z6.number().optional(),
538
- allowedDomains: z6.array(z6.string()).optional(),
539
- blockedDomains: z6.array(z6.string()).optional(),
540
- citations: z6.object({ enabled: z6.boolean() }).optional(),
541
- maxContentTokens: z6.number().optional()
526
+ import_v46.z.object({
527
+ maxUses: import_v46.z.number().optional(),
528
+ allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
529
+ blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
530
+ citations: import_v46.z.object({ enabled: import_v46.z.boolean() }).optional(),
531
+ maxContentTokens: import_v46.z.number().optional()
542
532
  })
543
533
  )
544
534
  );
545
535
  var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
546
536
  () => (0, import_provider_utils6.zodSchema)(
547
- z6.object({
548
- type: z6.literal("web_fetch_result"),
549
- url: z6.string(),
550
- content: z6.object({
551
- type: z6.literal("document"),
552
- title: z6.string(),
553
- citations: z6.object({ enabled: z6.boolean() }).optional(),
554
- source: z6.union([
555
- z6.object({
556
- type: z6.literal("base64"),
557
- mediaType: z6.literal("application/pdf"),
558
- data: z6.string()
537
+ import_v46.z.object({
538
+ type: import_v46.z.literal("web_fetch_result"),
539
+ url: import_v46.z.string(),
540
+ content: import_v46.z.object({
541
+ type: import_v46.z.literal("document"),
542
+ title: import_v46.z.string(),
543
+ citations: import_v46.z.object({ enabled: import_v46.z.boolean() }).optional(),
544
+ source: import_v46.z.union([
545
+ import_v46.z.object({
546
+ type: import_v46.z.literal("base64"),
547
+ mediaType: import_v46.z.literal("application/pdf"),
548
+ data: import_v46.z.string()
559
549
  }),
560
- z6.object({
561
- type: z6.literal("text"),
562
- mediaType: z6.literal("text/plain"),
563
- data: z6.string()
550
+ import_v46.z.object({
551
+ type: import_v46.z.literal("text"),
552
+ mediaType: import_v46.z.literal("text/plain"),
553
+ data: import_v46.z.string()
564
554
  })
565
555
  ])
566
556
  }),
567
- retrievedAt: z6.string().nullable()
557
+ retrievedAt: import_v46.z.string().nullable()
568
558
  })
569
559
  )
570
560
  );
571
561
  var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
572
562
  () => (0, import_provider_utils6.zodSchema)(
573
- z6.object({
574
- url: z6.string()
563
+ import_v46.z.object({
564
+ url: import_v46.z.string()
575
565
  })
576
566
  )
577
567
  );
@@ -798,21 +788,21 @@ var import_provider_utils9 = require("@ai-sdk/provider-utils");
798
788
 
799
789
  // src/tool/code-execution_20250522.ts
800
790
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
801
- var z7 = __toESM(require("zod/v4"));
791
+ var import_v47 = require("zod/v4");
802
792
  var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
803
793
  () => (0, import_provider_utils8.zodSchema)(
804
- z7.object({
805
- type: z7.literal("code_execution_result"),
806
- stdout: z7.string(),
807
- stderr: z7.string(),
808
- return_code: z7.number()
794
+ import_v47.z.object({
795
+ type: import_v47.z.literal("code_execution_result"),
796
+ stdout: import_v47.z.string(),
797
+ stderr: import_v47.z.string(),
798
+ return_code: import_v47.z.number()
809
799
  })
810
800
  )
811
801
  );
812
802
  var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
813
803
  () => (0, import_provider_utils8.zodSchema)(
814
- z7.object({
815
- code: z7.string()
804
+ import_v47.z.object({
805
+ code: import_v47.z.string()
816
806
  })
817
807
  )
818
808
  );
@@ -1013,6 +1003,18 @@ async function convertToAnthropicMessagesPrompt({
1013
1003
  cache_control: void 0
1014
1004
  };
1015
1005
  }
1006
+ if (contentPart.mediaType === "application/pdf") {
1007
+ betas.add("pdfs-2024-09-25");
1008
+ return {
1009
+ type: "document",
1010
+ source: {
1011
+ type: "base64",
1012
+ media_type: contentPart.mediaType,
1013
+ data: contentPart.data
1014
+ },
1015
+ cache_control: void 0
1016
+ };
1017
+ }
1016
1018
  throw new import_provider2.UnsupportedFunctionalityError({
1017
1019
  functionality: `media type: ${contentPart.mediaType}`
1018
1020
  });
@@ -2207,12 +2209,12 @@ var AnthropicMessagesLanguageModel = class {
2207
2209
 
2208
2210
  // src/tool/bash_20241022.ts
2209
2211
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
2210
- var z8 = __toESM(require("zod/v4"));
2212
+ var import_v48 = require("zod/v4");
2211
2213
  var bash_20241022InputSchema = (0, import_provider_utils11.lazySchema)(
2212
2214
  () => (0, import_provider_utils11.zodSchema)(
2213
- z8.object({
2214
- command: z8.string(),
2215
- restart: z8.boolean().optional()
2215
+ import_v48.z.object({
2216
+ command: import_v48.z.string(),
2217
+ restart: import_v48.z.boolean().optional()
2216
2218
  })
2217
2219
  )
2218
2220
  );
@@ -2224,12 +2226,12 @@ var bash_20241022 = (0, import_provider_utils11.createProviderDefinedToolFactory
2224
2226
 
2225
2227
  // src/tool/bash_20250124.ts
2226
2228
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
2227
- var z9 = __toESM(require("zod/v4"));
2229
+ var import_v49 = require("zod/v4");
2228
2230
  var bash_20250124InputSchema = (0, import_provider_utils12.lazySchema)(
2229
2231
  () => (0, import_provider_utils12.zodSchema)(
2230
- z9.object({
2231
- command: z9.string(),
2232
- restart: z9.boolean().optional()
2232
+ import_v49.z.object({
2233
+ command: import_v49.z.string(),
2234
+ restart: import_v49.z.boolean().optional()
2233
2235
  })
2234
2236
  )
2235
2237
  );
@@ -2241,11 +2243,11 @@ var bash_20250124 = (0, import_provider_utils12.createProviderDefinedToolFactory
2241
2243
 
2242
2244
  // src/tool/computer_20241022.ts
2243
2245
  var import_provider_utils13 = require("@ai-sdk/provider-utils");
2244
- var z10 = __toESM(require("zod/v4"));
2246
+ var import_v410 = require("zod/v4");
2245
2247
  var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
2246
2248
  () => (0, import_provider_utils13.zodSchema)(
2247
- z10.object({
2248
- action: z10.enum([
2249
+ import_v410.z.object({
2250
+ action: import_v410.z.enum([
2249
2251
  "key",
2250
2252
  "type",
2251
2253
  "mouse_move",
@@ -2257,8 +2259,8 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
2257
2259
  "screenshot",
2258
2260
  "cursor_position"
2259
2261
  ]),
2260
- coordinate: z10.array(z10.number().int()).optional(),
2261
- text: z10.string().optional()
2262
+ coordinate: import_v410.z.array(import_v410.z.number().int()).optional(),
2263
+ text: import_v410.z.string().optional()
2262
2264
  })
2263
2265
  )
2264
2266
  );
@@ -2270,11 +2272,11 @@ var computer_20241022 = (0, import_provider_utils13.createProviderDefinedToolFac
2270
2272
 
2271
2273
  // src/tool/computer_20250124.ts
2272
2274
  var import_provider_utils14 = require("@ai-sdk/provider-utils");
2273
- var z11 = __toESM(require("zod/v4"));
2275
+ var import_v411 = require("zod/v4");
2274
2276
  var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
2275
2277
  () => (0, import_provider_utils14.zodSchema)(
2276
- z11.object({
2277
- action: z11.enum([
2278
+ import_v411.z.object({
2279
+ action: import_v411.z.enum([
2278
2280
  "key",
2279
2281
  "hold_key",
2280
2282
  "type",
@@ -2292,12 +2294,12 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
2292
2294
  "wait",
2293
2295
  "screenshot"
2294
2296
  ]),
2295
- coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2296
- duration: z11.number().optional(),
2297
- scroll_amount: z11.number().optional(),
2298
- scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2299
- start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2300
- text: z11.string().optional()
2297
+ coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2298
+ duration: import_v411.z.number().optional(),
2299
+ scroll_amount: import_v411.z.number().optional(),
2300
+ scroll_direction: import_v411.z.enum(["up", "down", "left", "right"]).optional(),
2301
+ start_coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2302
+ text: import_v411.z.string().optional()
2301
2303
  })
2302
2304
  )
2303
2305
  );
@@ -2309,17 +2311,17 @@ var computer_20250124 = (0, import_provider_utils14.createProviderDefinedToolFac
2309
2311
 
2310
2312
  // src/tool/text-editor_20241022.ts
2311
2313
  var import_provider_utils15 = require("@ai-sdk/provider-utils");
2312
- var z12 = __toESM(require("zod/v4"));
2314
+ var import_v412 = require("zod/v4");
2313
2315
  var textEditor_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
2314
2316
  () => (0, import_provider_utils15.zodSchema)(
2315
- z12.object({
2316
- command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2317
- path: z12.string(),
2318
- file_text: z12.string().optional(),
2319
- insert_line: z12.number().int().optional(),
2320
- new_str: z12.string().optional(),
2321
- old_str: z12.string().optional(),
2322
- view_range: z12.array(z12.number().int()).optional()
2317
+ import_v412.z.object({
2318
+ command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2319
+ path: import_v412.z.string(),
2320
+ file_text: import_v412.z.string().optional(),
2321
+ insert_line: import_v412.z.number().int().optional(),
2322
+ new_str: import_v412.z.string().optional(),
2323
+ old_str: import_v412.z.string().optional(),
2324
+ view_range: import_v412.z.array(import_v412.z.number().int()).optional()
2323
2325
  })
2324
2326
  )
2325
2327
  );
@@ -2331,17 +2333,17 @@ var textEditor_20241022 = (0, import_provider_utils15.createProviderDefinedToolF
2331
2333
 
2332
2334
  // src/tool/text-editor_20250124.ts
2333
2335
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
2334
- var z13 = __toESM(require("zod/v4"));
2336
+ var import_v413 = require("zod/v4");
2335
2337
  var textEditor_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
2336
2338
  () => (0, import_provider_utils16.zodSchema)(
2337
- z13.object({
2338
- command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2339
- path: z13.string(),
2340
- file_text: z13.string().optional(),
2341
- insert_line: z13.number().int().optional(),
2342
- new_str: z13.string().optional(),
2343
- old_str: z13.string().optional(),
2344
- view_range: z13.array(z13.number().int()).optional()
2339
+ import_v413.z.object({
2340
+ command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2341
+ path: import_v413.z.string(),
2342
+ file_text: import_v413.z.string().optional(),
2343
+ insert_line: import_v413.z.number().int().optional(),
2344
+ new_str: import_v413.z.string().optional(),
2345
+ old_str: import_v413.z.string().optional(),
2346
+ view_range: import_v413.z.array(import_v413.z.number().int()).optional()
2345
2347
  })
2346
2348
  )
2347
2349
  );
@@ -2353,17 +2355,17 @@ var textEditor_20250124 = (0, import_provider_utils16.createProviderDefinedToolF
2353
2355
 
2354
2356
  // src/tool/text-editor_20250429.ts
2355
2357
  var import_provider_utils17 = require("@ai-sdk/provider-utils");
2356
- var z14 = __toESM(require("zod/v4"));
2358
+ var import_v414 = require("zod/v4");
2357
2359
  var textEditor_20250429InputSchema = (0, import_provider_utils17.lazySchema)(
2358
2360
  () => (0, import_provider_utils17.zodSchema)(
2359
- z14.object({
2360
- command: z14.enum(["view", "create", "str_replace", "insert"]),
2361
- path: z14.string(),
2362
- file_text: z14.string().optional(),
2363
- insert_line: z14.number().int().optional(),
2364
- new_str: z14.string().optional(),
2365
- old_str: z14.string().optional(),
2366
- view_range: z14.array(z14.number().int()).optional()
2361
+ import_v414.z.object({
2362
+ command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
2363
+ path: import_v414.z.string(),
2364
+ file_text: import_v414.z.string().optional(),
2365
+ insert_line: import_v414.z.number().int().optional(),
2366
+ new_str: import_v414.z.string().optional(),
2367
+ old_str: import_v414.z.string().optional(),
2368
+ view_range: import_v414.z.array(import_v414.z.number().int()).optional()
2367
2369
  })
2368
2370
  )
2369
2371
  );