@ai-sdk/openai 4.0.0-beta.29 → 4.0.0-beta.30

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,80 +1,33 @@
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 index_exports = {};
22
- __export(index_exports, {
23
- OpenAIChatLanguageModel: () => OpenAIChatLanguageModel,
24
- OpenAICompletionLanguageModel: () => OpenAICompletionLanguageModel,
25
- OpenAIEmbeddingModel: () => OpenAIEmbeddingModel,
26
- OpenAIImageModel: () => OpenAIImageModel,
27
- OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
28
- OpenAISpeechModel: () => OpenAISpeechModel,
29
- OpenAITranscriptionModel: () => OpenAITranscriptionModel,
30
- applyPatch: () => applyPatch,
31
- applyPatchArgsSchema: () => applyPatchArgsSchema,
32
- applyPatchInputSchema: () => applyPatchInputSchema,
33
- applyPatchOutputSchema: () => applyPatchOutputSchema,
34
- applyPatchToolFactory: () => applyPatchToolFactory,
35
- codeInterpreter: () => codeInterpreter,
36
- codeInterpreterArgsSchema: () => codeInterpreterArgsSchema,
37
- codeInterpreterInputSchema: () => codeInterpreterInputSchema,
38
- codeInterpreterOutputSchema: () => codeInterpreterOutputSchema,
39
- codeInterpreterToolFactory: () => codeInterpreterToolFactory,
40
- fileSearch: () => fileSearch,
41
- fileSearchArgsSchema: () => fileSearchArgsSchema,
42
- fileSearchOutputSchema: () => fileSearchOutputSchema,
43
- hasDefaultResponseFormat: () => hasDefaultResponseFormat,
44
- imageGeneration: () => imageGeneration,
45
- imageGenerationArgsSchema: () => imageGenerationArgsSchema,
46
- imageGenerationOutputSchema: () => imageGenerationOutputSchema,
47
- modelMaxImagesPerCall: () => modelMaxImagesPerCall,
48
- openAITranscriptionModelOptions: () => openAITranscriptionModelOptions,
49
- openaiEmbeddingModelOptions: () => openaiEmbeddingModelOptions,
50
- openaiLanguageModelChatOptions: () => openaiLanguageModelChatOptions,
51
- openaiLanguageModelCompletionOptions: () => openaiLanguageModelCompletionOptions,
52
- openaiSpeechModelOptionsSchema: () => openaiSpeechModelOptionsSchema,
53
- webSearchPreview: () => webSearchPreview,
54
- webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
55
- webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
56
- });
57
- module.exports = __toCommonJS(index_exports);
58
-
59
1
  // src/chat/openai-chat-language-model.ts
60
- var import_provider3 = require("@ai-sdk/provider");
61
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ InvalidResponseDataError
4
+ } from "@ai-sdk/provider";
5
+ import {
6
+ combineHeaders,
7
+ createEventSourceResponseHandler,
8
+ createJsonResponseHandler,
9
+ generateId,
10
+ isCustomReasoning,
11
+ isParsableJson,
12
+ parseProviderOptions,
13
+ postJsonToApi
14
+ } from "@ai-sdk/provider-utils";
62
15
 
63
16
  // src/openai-error.ts
64
- var import_v4 = require("zod/v4");
65
- var import_provider_utils = require("@ai-sdk/provider-utils");
66
- var openaiErrorDataSchema = import_v4.z.object({
67
- error: import_v4.z.object({
68
- message: import_v4.z.string(),
17
+ import { z } from "zod/v4";
18
+ import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
19
+ var openaiErrorDataSchema = z.object({
20
+ error: z.object({
21
+ message: z.string(),
69
22
  // The additional information below is handled loosely to support
70
23
  // OpenAI-compatible providers that have slightly different error
71
24
  // responses:
72
- type: import_v4.z.string().nullish(),
73
- param: import_v4.z.any().nullish(),
74
- code: import_v4.z.union([import_v4.z.string(), import_v4.z.number()]).nullish()
25
+ type: z.string().nullish(),
26
+ param: z.any().nullish(),
27
+ code: z.union([z.string(), z.number()]).nullish()
75
28
  })
76
29
  });
77
- var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
30
+ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
78
31
  errorSchema: openaiErrorDataSchema,
79
32
  errorToMessage: (data) => data.error.message
80
33
  });
@@ -135,8 +88,14 @@ function convertOpenAIChatUsage(usage) {
135
88
  }
136
89
 
137
90
  // src/chat/convert-to-openai-chat-messages.ts
138
- var import_provider = require("@ai-sdk/provider");
139
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
91
+ import {
92
+ UnsupportedFunctionalityError
93
+ } from "@ai-sdk/provider";
94
+ import {
95
+ convertToBase64,
96
+ isProviderReference,
97
+ resolveProviderReference
98
+ } from "@ai-sdk/provider-utils";
140
99
  function convertToOpenAIChatMessages({
141
100
  prompt,
142
101
  systemMessageMode = "system"
@@ -186,11 +145,11 @@ function convertToOpenAIChatMessages({
186
145
  return { type: "text", text: part.text };
187
146
  }
188
147
  case "file": {
189
- if ((0, import_provider_utils2.isProviderReference)(part.data)) {
148
+ if (isProviderReference(part.data)) {
190
149
  return {
191
150
  type: "file",
192
151
  file: {
193
- file_id: (0, import_provider_utils2.resolveProviderReference)({
152
+ file_id: resolveProviderReference({
194
153
  reference: part.data,
195
154
  provider: "openai"
196
155
  })
@@ -202,13 +161,13 @@ function convertToOpenAIChatMessages({
202
161
  return {
203
162
  type: "image_url",
204
163
  image_url: {
205
- url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
164
+ url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
206
165
  detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
207
166
  }
208
167
  };
209
168
  } else if (part.mediaType.startsWith("audio/")) {
210
169
  if (part.data instanceof URL) {
211
- throw new import_provider.UnsupportedFunctionalityError({
170
+ throw new UnsupportedFunctionalityError({
212
171
  functionality: "audio file parts with URLs"
213
172
  });
214
173
  }
@@ -217,7 +176,7 @@ function convertToOpenAIChatMessages({
217
176
  return {
218
177
  type: "input_audio",
219
178
  input_audio: {
220
- data: (0, import_provider_utils2.convertToBase64)(part.data),
179
+ data: convertToBase64(part.data),
221
180
  format: "wav"
222
181
  }
223
182
  };
@@ -227,20 +186,20 @@ function convertToOpenAIChatMessages({
227
186
  return {
228
187
  type: "input_audio",
229
188
  input_audio: {
230
- data: (0, import_provider_utils2.convertToBase64)(part.data),
189
+ data: convertToBase64(part.data),
231
190
  format: "mp3"
232
191
  }
233
192
  };
234
193
  }
235
194
  default: {
236
- throw new import_provider.UnsupportedFunctionalityError({
195
+ throw new UnsupportedFunctionalityError({
237
196
  functionality: `audio content parts with media type ${part.mediaType}`
238
197
  });
239
198
  }
240
199
  }
241
200
  } else if (part.mediaType === "application/pdf") {
242
201
  if (part.data instanceof URL) {
243
- throw new import_provider.UnsupportedFunctionalityError({
202
+ throw new UnsupportedFunctionalityError({
244
203
  functionality: "PDF file parts with URLs"
245
204
  });
246
205
  }
@@ -248,11 +207,11 @@ function convertToOpenAIChatMessages({
248
207
  type: "file",
249
208
  file: {
250
209
  filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
251
- file_data: `data:application/pdf;base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`
210
+ file_data: `data:application/pdf;base64,${convertToBase64(part.data)}`
252
211
  }
253
212
  };
254
213
  } else {
255
- throw new import_provider.UnsupportedFunctionalityError({
214
+ throw new UnsupportedFunctionalityError({
256
215
  functionality: `file part media type ${part.mediaType}`
257
216
  });
258
217
  }
@@ -360,139 +319,139 @@ function mapOpenAIFinishReason(finishReason) {
360
319
  }
361
320
 
362
321
  // src/chat/openai-chat-api.ts
363
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
364
- var import_v42 = require("zod/v4");
365
- var openaiChatResponseSchema = (0, import_provider_utils3.lazySchema)(
366
- () => (0, import_provider_utils3.zodSchema)(
367
- import_v42.z.object({
368
- id: import_v42.z.string().nullish(),
369
- created: import_v42.z.number().nullish(),
370
- model: import_v42.z.string().nullish(),
371
- choices: import_v42.z.array(
372
- import_v42.z.object({
373
- message: import_v42.z.object({
374
- role: import_v42.z.literal("assistant").nullish(),
375
- content: import_v42.z.string().nullish(),
376
- tool_calls: import_v42.z.array(
377
- import_v42.z.object({
378
- id: import_v42.z.string().nullish(),
379
- type: import_v42.z.literal("function"),
380
- function: import_v42.z.object({
381
- name: import_v42.z.string(),
382
- arguments: import_v42.z.string()
322
+ import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
323
+ import { z as z2 } from "zod/v4";
324
+ var openaiChatResponseSchema = lazySchema(
325
+ () => zodSchema(
326
+ z2.object({
327
+ id: z2.string().nullish(),
328
+ created: z2.number().nullish(),
329
+ model: z2.string().nullish(),
330
+ choices: z2.array(
331
+ z2.object({
332
+ message: z2.object({
333
+ role: z2.literal("assistant").nullish(),
334
+ content: z2.string().nullish(),
335
+ tool_calls: z2.array(
336
+ z2.object({
337
+ id: z2.string().nullish(),
338
+ type: z2.literal("function"),
339
+ function: z2.object({
340
+ name: z2.string(),
341
+ arguments: z2.string()
383
342
  })
384
343
  })
385
344
  ).nullish(),
386
- annotations: import_v42.z.array(
387
- import_v42.z.object({
388
- type: import_v42.z.literal("url_citation"),
389
- url_citation: import_v42.z.object({
390
- start_index: import_v42.z.number(),
391
- end_index: import_v42.z.number(),
392
- url: import_v42.z.string(),
393
- title: import_v42.z.string()
345
+ annotations: z2.array(
346
+ z2.object({
347
+ type: z2.literal("url_citation"),
348
+ url_citation: z2.object({
349
+ start_index: z2.number(),
350
+ end_index: z2.number(),
351
+ url: z2.string(),
352
+ title: z2.string()
394
353
  })
395
354
  })
396
355
  ).nullish()
397
356
  }),
398
- index: import_v42.z.number(),
399
- logprobs: import_v42.z.object({
400
- content: import_v42.z.array(
401
- import_v42.z.object({
402
- token: import_v42.z.string(),
403
- logprob: import_v42.z.number(),
404
- top_logprobs: import_v42.z.array(
405
- import_v42.z.object({
406
- token: import_v42.z.string(),
407
- logprob: import_v42.z.number()
357
+ index: z2.number(),
358
+ logprobs: z2.object({
359
+ content: z2.array(
360
+ z2.object({
361
+ token: z2.string(),
362
+ logprob: z2.number(),
363
+ top_logprobs: z2.array(
364
+ z2.object({
365
+ token: z2.string(),
366
+ logprob: z2.number()
408
367
  })
409
368
  )
410
369
  })
411
370
  ).nullish()
412
371
  }).nullish(),
413
- finish_reason: import_v42.z.string().nullish()
372
+ finish_reason: z2.string().nullish()
414
373
  })
415
374
  ),
416
- usage: import_v42.z.object({
417
- prompt_tokens: import_v42.z.number().nullish(),
418
- completion_tokens: import_v42.z.number().nullish(),
419
- total_tokens: import_v42.z.number().nullish(),
420
- prompt_tokens_details: import_v42.z.object({
421
- cached_tokens: import_v42.z.number().nullish()
375
+ usage: z2.object({
376
+ prompt_tokens: z2.number().nullish(),
377
+ completion_tokens: z2.number().nullish(),
378
+ total_tokens: z2.number().nullish(),
379
+ prompt_tokens_details: z2.object({
380
+ cached_tokens: z2.number().nullish()
422
381
  }).nullish(),
423
- completion_tokens_details: import_v42.z.object({
424
- reasoning_tokens: import_v42.z.number().nullish(),
425
- accepted_prediction_tokens: import_v42.z.number().nullish(),
426
- rejected_prediction_tokens: import_v42.z.number().nullish()
382
+ completion_tokens_details: z2.object({
383
+ reasoning_tokens: z2.number().nullish(),
384
+ accepted_prediction_tokens: z2.number().nullish(),
385
+ rejected_prediction_tokens: z2.number().nullish()
427
386
  }).nullish()
428
387
  }).nullish()
429
388
  })
430
389
  )
431
390
  );
432
- var openaiChatChunkSchema = (0, import_provider_utils3.lazySchema)(
433
- () => (0, import_provider_utils3.zodSchema)(
434
- import_v42.z.union([
435
- import_v42.z.object({
436
- id: import_v42.z.string().nullish(),
437
- created: import_v42.z.number().nullish(),
438
- model: import_v42.z.string().nullish(),
439
- choices: import_v42.z.array(
440
- import_v42.z.object({
441
- delta: import_v42.z.object({
442
- role: import_v42.z.enum(["assistant"]).nullish(),
443
- content: import_v42.z.string().nullish(),
444
- tool_calls: import_v42.z.array(
445
- import_v42.z.object({
446
- index: import_v42.z.number(),
447
- id: import_v42.z.string().nullish(),
448
- type: import_v42.z.literal("function").nullish(),
449
- function: import_v42.z.object({
450
- name: import_v42.z.string().nullish(),
451
- arguments: import_v42.z.string().nullish()
391
+ var openaiChatChunkSchema = lazySchema(
392
+ () => zodSchema(
393
+ z2.union([
394
+ z2.object({
395
+ id: z2.string().nullish(),
396
+ created: z2.number().nullish(),
397
+ model: z2.string().nullish(),
398
+ choices: z2.array(
399
+ z2.object({
400
+ delta: z2.object({
401
+ role: z2.enum(["assistant"]).nullish(),
402
+ content: z2.string().nullish(),
403
+ tool_calls: z2.array(
404
+ z2.object({
405
+ index: z2.number(),
406
+ id: z2.string().nullish(),
407
+ type: z2.literal("function").nullish(),
408
+ function: z2.object({
409
+ name: z2.string().nullish(),
410
+ arguments: z2.string().nullish()
452
411
  })
453
412
  })
454
413
  ).nullish(),
455
- annotations: import_v42.z.array(
456
- import_v42.z.object({
457
- type: import_v42.z.literal("url_citation"),
458
- url_citation: import_v42.z.object({
459
- start_index: import_v42.z.number(),
460
- end_index: import_v42.z.number(),
461
- url: import_v42.z.string(),
462
- title: import_v42.z.string()
414
+ annotations: z2.array(
415
+ z2.object({
416
+ type: z2.literal("url_citation"),
417
+ url_citation: z2.object({
418
+ start_index: z2.number(),
419
+ end_index: z2.number(),
420
+ url: z2.string(),
421
+ title: z2.string()
463
422
  })
464
423
  })
465
424
  ).nullish()
466
425
  }).nullish(),
467
- logprobs: import_v42.z.object({
468
- content: import_v42.z.array(
469
- import_v42.z.object({
470
- token: import_v42.z.string(),
471
- logprob: import_v42.z.number(),
472
- top_logprobs: import_v42.z.array(
473
- import_v42.z.object({
474
- token: import_v42.z.string(),
475
- logprob: import_v42.z.number()
426
+ logprobs: z2.object({
427
+ content: z2.array(
428
+ z2.object({
429
+ token: z2.string(),
430
+ logprob: z2.number(),
431
+ top_logprobs: z2.array(
432
+ z2.object({
433
+ token: z2.string(),
434
+ logprob: z2.number()
476
435
  })
477
436
  )
478
437
  })
479
438
  ).nullish()
480
439
  }).nullish(),
481
- finish_reason: import_v42.z.string().nullish(),
482
- index: import_v42.z.number()
440
+ finish_reason: z2.string().nullish(),
441
+ index: z2.number()
483
442
  })
484
443
  ),
485
- usage: import_v42.z.object({
486
- prompt_tokens: import_v42.z.number().nullish(),
487
- completion_tokens: import_v42.z.number().nullish(),
488
- total_tokens: import_v42.z.number().nullish(),
489
- prompt_tokens_details: import_v42.z.object({
490
- cached_tokens: import_v42.z.number().nullish()
444
+ usage: z2.object({
445
+ prompt_tokens: z2.number().nullish(),
446
+ completion_tokens: z2.number().nullish(),
447
+ total_tokens: z2.number().nullish(),
448
+ prompt_tokens_details: z2.object({
449
+ cached_tokens: z2.number().nullish()
491
450
  }).nullish(),
492
- completion_tokens_details: import_v42.z.object({
493
- reasoning_tokens: import_v42.z.number().nullish(),
494
- accepted_prediction_tokens: import_v42.z.number().nullish(),
495
- rejected_prediction_tokens: import_v42.z.number().nullish()
451
+ completion_tokens_details: z2.object({
452
+ reasoning_tokens: z2.number().nullish(),
453
+ accepted_prediction_tokens: z2.number().nullish(),
454
+ rejected_prediction_tokens: z2.number().nullish()
496
455
  }).nullish()
497
456
  }).nullish()
498
457
  }),
@@ -502,18 +461,18 @@ var openaiChatChunkSchema = (0, import_provider_utils3.lazySchema)(
502
461
  );
503
462
 
504
463
  // src/chat/openai-chat-options.ts
505
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
506
- var import_v43 = require("zod/v4");
507
- var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
508
- () => (0, import_provider_utils4.zodSchema)(
509
- import_v43.z.object({
464
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
465
+ import { z as z3 } from "zod/v4";
466
+ var openaiLanguageModelChatOptions = lazySchema2(
467
+ () => zodSchema2(
468
+ z3.object({
510
469
  /**
511
470
  * Modify the likelihood of specified tokens appearing in the completion.
512
471
  *
513
472
  * Accepts a JSON object that maps tokens (specified by their token ID in
514
473
  * the GPT tokenizer) to an associated bias value from -100 to 100.
515
474
  */
516
- logitBias: import_v43.z.record(import_v43.z.coerce.number(), import_v43.z.number()).optional(),
475
+ logitBias: z3.record(z3.coerce.number(), z3.number()).optional(),
517
476
  /**
518
477
  * Return the log probabilities of the tokens.
519
478
  *
@@ -523,36 +482,36 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
523
482
  * Setting to a number will return the log probabilities of the top n
524
483
  * tokens that were generated.
525
484
  */
526
- logprobs: import_v43.z.union([import_v43.z.boolean(), import_v43.z.number()]).optional(),
485
+ logprobs: z3.union([z3.boolean(), z3.number()]).optional(),
527
486
  /**
528
487
  * Whether to enable parallel function calling during tool use. Default to true.
529
488
  */
530
- parallelToolCalls: import_v43.z.boolean().optional(),
489
+ parallelToolCalls: z3.boolean().optional(),
531
490
  /**
532
491
  * A unique identifier representing your end-user, which can help OpenAI to
533
492
  * monitor and detect abuse.
534
493
  */
535
- user: import_v43.z.string().optional(),
494
+ user: z3.string().optional(),
536
495
  /**
537
496
  * Reasoning effort for reasoning models. Defaults to `medium`.
538
497
  */
539
- reasoningEffort: import_v43.z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional(),
498
+ reasoningEffort: z3.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional(),
540
499
  /**
541
500
  * Maximum number of completion tokens to generate. Useful for reasoning models.
542
501
  */
543
- maxCompletionTokens: import_v43.z.number().optional(),
502
+ maxCompletionTokens: z3.number().optional(),
544
503
  /**
545
504
  * Whether to enable persistence in responses API.
546
505
  */
547
- store: import_v43.z.boolean().optional(),
506
+ store: z3.boolean().optional(),
548
507
  /**
549
508
  * Metadata to associate with the request.
550
509
  */
551
- metadata: import_v43.z.record(import_v43.z.string().max(64), import_v43.z.string().max(512)).optional(),
510
+ metadata: z3.record(z3.string().max(64), z3.string().max(512)).optional(),
552
511
  /**
553
512
  * Parameters for prediction mode.
554
513
  */
555
- prediction: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(),
514
+ prediction: z3.record(z3.string(), z3.any()).optional(),
556
515
  /**
557
516
  * Service tier for the request.
558
517
  * - 'auto': Default service tier. The request will be processed with the service tier configured in the
@@ -563,23 +522,23 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
563
522
  *
564
523
  * @default 'auto'
565
524
  */
566
- serviceTier: import_v43.z.enum(["auto", "flex", "priority", "default"]).optional(),
525
+ serviceTier: z3.enum(["auto", "flex", "priority", "default"]).optional(),
567
526
  /**
568
527
  * Whether to use strict JSON schema validation.
569
528
  *
570
529
  * @default true
571
530
  */
572
- strictJsonSchema: import_v43.z.boolean().optional(),
531
+ strictJsonSchema: z3.boolean().optional(),
573
532
  /**
574
533
  * Controls the verbosity of the model's responses.
575
534
  * Lower values will result in more concise responses, while higher values will result in more verbose responses.
576
535
  */
577
- textVerbosity: import_v43.z.enum(["low", "medium", "high"]).optional(),
536
+ textVerbosity: z3.enum(["low", "medium", "high"]).optional(),
578
537
  /**
579
538
  * A cache key for prompt caching. Allows manual control over prompt caching behavior.
580
539
  * Useful for improving cache hit rates and working around automatic caching issues.
581
540
  */
582
- promptCacheKey: import_v43.z.string().optional(),
541
+ promptCacheKey: z3.string().optional(),
583
542
  /**
584
543
  * The retention policy for the prompt cache.
585
544
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -588,7 +547,7 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
588
547
  *
589
548
  * @default 'in_memory'
590
549
  */
591
- promptCacheRetention: import_v43.z.enum(["in_memory", "24h"]).optional(),
550
+ promptCacheRetention: z3.enum(["in_memory", "24h"]).optional(),
592
551
  /**
593
552
  * A stable identifier used to help detect users of your application
594
553
  * that may be violating OpenAI's usage policies. The IDs should be a
@@ -596,7 +555,7 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
596
555
  * username or email address, in order to avoid sending us any identifying
597
556
  * information.
598
557
  */
599
- safetyIdentifier: import_v43.z.string().optional(),
558
+ safetyIdentifier: z3.string().optional(),
600
559
  /**
601
560
  * Override the system message mode for this model.
602
561
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -605,7 +564,7 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
605
564
  *
606
565
  * If not specified, the mode is automatically determined based on the model.
607
566
  */
608
- systemMessageMode: import_v43.z.enum(["system", "developer", "remove"]).optional(),
567
+ systemMessageMode: z3.enum(["system", "developer", "remove"]).optional(),
609
568
  /**
610
569
  * Force treating this model as a reasoning model.
611
570
  *
@@ -615,13 +574,15 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
615
574
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
616
575
  * and defaults `systemMessageMode` to `developer` unless overridden.
617
576
  */
618
- forceReasoning: import_v43.z.boolean().optional()
577
+ forceReasoning: z3.boolean().optional()
619
578
  })
620
579
  )
621
580
  );
622
581
 
623
582
  // src/chat/openai-chat-prepare-tools.ts
624
- var import_provider2 = require("@ai-sdk/provider");
583
+ import {
584
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
585
+ } from "@ai-sdk/provider";
625
586
  function prepareChatTools({
626
587
  tools,
627
588
  toolChoice
@@ -675,7 +636,7 @@ function prepareChatTools({
675
636
  };
676
637
  default: {
677
638
  const _exhaustiveCheck = type;
678
- throw new import_provider2.UnsupportedFunctionalityError({
639
+ throw new UnsupportedFunctionalityError2({
679
640
  functionality: `tool choice type: ${_exhaustiveCheck}`
680
641
  });
681
642
  }
@@ -713,13 +674,13 @@ var OpenAIChatLanguageModel = class {
713
674
  }) {
714
675
  var _a, _b, _c, _d, _e, _f;
715
676
  const warnings = [];
716
- const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
677
+ const openaiOptions = (_a = await parseProviderOptions({
717
678
  provider: "openai",
718
679
  providerOptions,
719
680
  schema: openaiLanguageModelChatOptions
720
681
  })) != null ? _a : {};
721
682
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
722
- const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : (0, import_provider_utils5.isCustomReasoning)(reasoning) ? reasoning : void 0;
683
+ const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning : void 0;
723
684
  const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
724
685
  if (topK != null) {
725
686
  warnings.push({ type: "unsupported", feature: "topK" });
@@ -885,15 +846,15 @@ var OpenAIChatLanguageModel = class {
885
846
  responseHeaders,
886
847
  value: response,
887
848
  rawValue: rawResponse
888
- } = await (0, import_provider_utils5.postJsonToApi)({
849
+ } = await postJsonToApi({
889
850
  url: this.config.url({
890
851
  path: "/chat/completions",
891
852
  modelId: this.modelId
892
853
  }),
893
- headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
854
+ headers: combineHeaders(this.config.headers(), options.headers),
894
855
  body,
895
856
  failedResponseHandler: openaiFailedResponseHandler,
896
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
857
+ successfulResponseHandler: createJsonResponseHandler(
897
858
  openaiChatResponseSchema
898
859
  ),
899
860
  abortSignal: options.abortSignal,
@@ -908,7 +869,7 @@ var OpenAIChatLanguageModel = class {
908
869
  for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
909
870
  content.push({
910
871
  type: "tool-call",
911
- toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils5.generateId)(),
872
+ toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
912
873
  toolName: toolCall.function.name,
913
874
  input: toolCall.function.arguments
914
875
  });
@@ -917,7 +878,7 @@ var OpenAIChatLanguageModel = class {
917
878
  content.push({
918
879
  type: "source",
919
880
  sourceType: "url",
920
- id: (0, import_provider_utils5.generateId)(),
881
+ id: generateId(),
921
882
  url: annotation.url_citation.url,
922
883
  title: annotation.url_citation.title
923
884
  });
@@ -959,15 +920,15 @@ var OpenAIChatLanguageModel = class {
959
920
  include_usage: true
960
921
  }
961
922
  };
962
- const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
923
+ const { responseHeaders, value: response } = await postJsonToApi({
963
924
  url: this.config.url({
964
925
  path: "/chat/completions",
965
926
  modelId: this.modelId
966
927
  }),
967
- headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
928
+ headers: combineHeaders(this.config.headers(), options.headers),
968
929
  body,
969
930
  failedResponseHandler: openaiFailedResponseHandler,
970
- successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(
931
+ successfulResponseHandler: createEventSourceResponseHandler(
971
932
  openaiChatChunkSchema
972
933
  ),
973
934
  abortSignal: options.abortSignal,
@@ -1053,19 +1014,19 @@ var OpenAIChatLanguageModel = class {
1053
1014
  const index = toolCallDelta.index;
1054
1015
  if (toolCalls[index] == null) {
1055
1016
  if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
1056
- throw new import_provider3.InvalidResponseDataError({
1017
+ throw new InvalidResponseDataError({
1057
1018
  data: toolCallDelta,
1058
1019
  message: `Expected 'function' type.`
1059
1020
  });
1060
1021
  }
1061
1022
  if (toolCallDelta.id == null) {
1062
- throw new import_provider3.InvalidResponseDataError({
1023
+ throw new InvalidResponseDataError({
1063
1024
  data: toolCallDelta,
1064
1025
  message: `Expected 'id' to be a string.`
1065
1026
  });
1066
1027
  }
1067
1028
  if (((_f = toolCallDelta.function) == null ? void 0 : _f.name) == null) {
1068
- throw new import_provider3.InvalidResponseDataError({
1029
+ throw new InvalidResponseDataError({
1069
1030
  data: toolCallDelta,
1070
1031
  message: `Expected 'function.name' to be a string.`
1071
1032
  });
@@ -1093,14 +1054,14 @@ var OpenAIChatLanguageModel = class {
1093
1054
  delta: toolCall2.function.arguments
1094
1055
  });
1095
1056
  }
1096
- if ((0, import_provider_utils5.isParsableJson)(toolCall2.function.arguments)) {
1057
+ if (isParsableJson(toolCall2.function.arguments)) {
1097
1058
  controller.enqueue({
1098
1059
  type: "tool-input-end",
1099
1060
  id: toolCall2.id
1100
1061
  });
1101
1062
  controller.enqueue({
1102
1063
  type: "tool-call",
1103
- toolCallId: (_j = toolCall2.id) != null ? _j : (0, import_provider_utils5.generateId)(),
1064
+ toolCallId: (_j = toolCall2.id) != null ? _j : generateId(),
1104
1065
  toolName: toolCall2.function.name,
1105
1066
  input: toolCall2.function.arguments
1106
1067
  });
@@ -1121,14 +1082,14 @@ var OpenAIChatLanguageModel = class {
1121
1082
  id: toolCall.id,
1122
1083
  delta: (_n = toolCallDelta.function.arguments) != null ? _n : ""
1123
1084
  });
1124
- if (((_o = toolCall.function) == null ? void 0 : _o.name) != null && ((_p = toolCall.function) == null ? void 0 : _p.arguments) != null && (0, import_provider_utils5.isParsableJson)(toolCall.function.arguments)) {
1085
+ if (((_o = toolCall.function) == null ? void 0 : _o.name) != null && ((_p = toolCall.function) == null ? void 0 : _p.arguments) != null && isParsableJson(toolCall.function.arguments)) {
1125
1086
  controller.enqueue({
1126
1087
  type: "tool-input-end",
1127
1088
  id: toolCall.id
1128
1089
  });
1129
1090
  controller.enqueue({
1130
1091
  type: "tool-call",
1131
- toolCallId: (_q = toolCall.id) != null ? _q : (0, import_provider_utils5.generateId)(),
1092
+ toolCallId: (_q = toolCall.id) != null ? _q : generateId(),
1132
1093
  toolName: toolCall.function.name,
1133
1094
  input: toolCall.function.arguments
1134
1095
  });
@@ -1141,7 +1102,7 @@ var OpenAIChatLanguageModel = class {
1141
1102
  controller.enqueue({
1142
1103
  type: "source",
1143
1104
  sourceType: "url",
1144
- id: (0, import_provider_utils5.generateId)(),
1105
+ id: generateId(),
1145
1106
  url: annotation.url_citation.url,
1146
1107
  title: annotation.url_citation.title
1147
1108
  });
@@ -1168,7 +1129,13 @@ var OpenAIChatLanguageModel = class {
1168
1129
  };
1169
1130
 
1170
1131
  // src/completion/openai-completion-language-model.ts
1171
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1132
+ import {
1133
+ combineHeaders as combineHeaders2,
1134
+ createEventSourceResponseHandler as createEventSourceResponseHandler2,
1135
+ createJsonResponseHandler as createJsonResponseHandler2,
1136
+ parseProviderOptions as parseProviderOptions2,
1137
+ postJsonToApi as postJsonToApi2
1138
+ } from "@ai-sdk/provider-utils";
1172
1139
 
1173
1140
  // src/completion/convert-openai-completion-usage.ts
1174
1141
  function convertOpenAICompletionUsage(usage) {
@@ -1208,7 +1175,10 @@ function convertOpenAICompletionUsage(usage) {
1208
1175
  }
1209
1176
 
1210
1177
  // src/completion/convert-to-openai-completion-prompt.ts
1211
- var import_provider4 = require("@ai-sdk/provider");
1178
+ import {
1179
+ InvalidPromptError,
1180
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError3
1181
+ } from "@ai-sdk/provider";
1212
1182
  function convertToOpenAICompletionPrompt({
1213
1183
  prompt,
1214
1184
  user = "user",
@@ -1224,7 +1194,7 @@ function convertToOpenAICompletionPrompt({
1224
1194
  for (const { role, content } of prompt) {
1225
1195
  switch (role) {
1226
1196
  case "system": {
1227
- throw new import_provider4.InvalidPromptError({
1197
+ throw new InvalidPromptError({
1228
1198
  message: "Unexpected system message in prompt: ${content}",
1229
1199
  prompt
1230
1200
  });
@@ -1250,7 +1220,7 @@ ${userMessage}
1250
1220
  return part.text;
1251
1221
  }
1252
1222
  case "tool-call": {
1253
- throw new import_provider4.UnsupportedFunctionalityError({
1223
+ throw new UnsupportedFunctionalityError3({
1254
1224
  functionality: "tool-call messages"
1255
1225
  });
1256
1226
  }
@@ -1263,7 +1233,7 @@ ${assistantMessage}
1263
1233
  break;
1264
1234
  }
1265
1235
  case "tool": {
1266
- throw new import_provider4.UnsupportedFunctionalityError({
1236
+ throw new UnsupportedFunctionalityError3({
1267
1237
  functionality: "tool messages"
1268
1238
  });
1269
1239
  }
@@ -1313,56 +1283,56 @@ function mapOpenAIFinishReason2(finishReason) {
1313
1283
  }
1314
1284
 
1315
1285
  // src/completion/openai-completion-api.ts
1316
- var import_v44 = require("zod/v4");
1317
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1318
- var openaiCompletionResponseSchema = (0, import_provider_utils6.lazySchema)(
1319
- () => (0, import_provider_utils6.zodSchema)(
1320
- import_v44.z.object({
1321
- id: import_v44.z.string().nullish(),
1322
- created: import_v44.z.number().nullish(),
1323
- model: import_v44.z.string().nullish(),
1324
- choices: import_v44.z.array(
1325
- import_v44.z.object({
1326
- text: import_v44.z.string(),
1327
- finish_reason: import_v44.z.string(),
1328
- logprobs: import_v44.z.object({
1329
- tokens: import_v44.z.array(import_v44.z.string()),
1330
- token_logprobs: import_v44.z.array(import_v44.z.number()),
1331
- top_logprobs: import_v44.z.array(import_v44.z.record(import_v44.z.string(), import_v44.z.number())).nullish()
1286
+ import { z as z4 } from "zod/v4";
1287
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
1288
+ var openaiCompletionResponseSchema = lazySchema3(
1289
+ () => zodSchema3(
1290
+ z4.object({
1291
+ id: z4.string().nullish(),
1292
+ created: z4.number().nullish(),
1293
+ model: z4.string().nullish(),
1294
+ choices: z4.array(
1295
+ z4.object({
1296
+ text: z4.string(),
1297
+ finish_reason: z4.string(),
1298
+ logprobs: z4.object({
1299
+ tokens: z4.array(z4.string()),
1300
+ token_logprobs: z4.array(z4.number()),
1301
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1332
1302
  }).nullish()
1333
1303
  })
1334
1304
  ),
1335
- usage: import_v44.z.object({
1336
- prompt_tokens: import_v44.z.number(),
1337
- completion_tokens: import_v44.z.number(),
1338
- total_tokens: import_v44.z.number()
1305
+ usage: z4.object({
1306
+ prompt_tokens: z4.number(),
1307
+ completion_tokens: z4.number(),
1308
+ total_tokens: z4.number()
1339
1309
  }).nullish()
1340
1310
  })
1341
1311
  )
1342
1312
  );
1343
- var openaiCompletionChunkSchema = (0, import_provider_utils6.lazySchema)(
1344
- () => (0, import_provider_utils6.zodSchema)(
1345
- import_v44.z.union([
1346
- import_v44.z.object({
1347
- id: import_v44.z.string().nullish(),
1348
- created: import_v44.z.number().nullish(),
1349
- model: import_v44.z.string().nullish(),
1350
- choices: import_v44.z.array(
1351
- import_v44.z.object({
1352
- text: import_v44.z.string(),
1353
- finish_reason: import_v44.z.string().nullish(),
1354
- index: import_v44.z.number(),
1355
- logprobs: import_v44.z.object({
1356
- tokens: import_v44.z.array(import_v44.z.string()),
1357
- token_logprobs: import_v44.z.array(import_v44.z.number()),
1358
- top_logprobs: import_v44.z.array(import_v44.z.record(import_v44.z.string(), import_v44.z.number())).nullish()
1313
+ var openaiCompletionChunkSchema = lazySchema3(
1314
+ () => zodSchema3(
1315
+ z4.union([
1316
+ z4.object({
1317
+ id: z4.string().nullish(),
1318
+ created: z4.number().nullish(),
1319
+ model: z4.string().nullish(),
1320
+ choices: z4.array(
1321
+ z4.object({
1322
+ text: z4.string(),
1323
+ finish_reason: z4.string().nullish(),
1324
+ index: z4.number(),
1325
+ logprobs: z4.object({
1326
+ tokens: z4.array(z4.string()),
1327
+ token_logprobs: z4.array(z4.number()),
1328
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1359
1329
  }).nullish()
1360
1330
  })
1361
1331
  ),
1362
- usage: import_v44.z.object({
1363
- prompt_tokens: import_v44.z.number(),
1364
- completion_tokens: import_v44.z.number(),
1365
- total_tokens: import_v44.z.number()
1332
+ usage: z4.object({
1333
+ prompt_tokens: z4.number(),
1334
+ completion_tokens: z4.number(),
1335
+ total_tokens: z4.number()
1366
1336
  }).nullish()
1367
1337
  }),
1368
1338
  openaiErrorDataSchema
@@ -1371,15 +1341,15 @@ var openaiCompletionChunkSchema = (0, import_provider_utils6.lazySchema)(
1371
1341
  );
1372
1342
 
1373
1343
  // src/completion/openai-completion-options.ts
1374
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1375
- var import_v45 = require("zod/v4");
1376
- var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema)(
1377
- () => (0, import_provider_utils7.zodSchema)(
1378
- import_v45.z.object({
1344
+ import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
1345
+ import { z as z5 } from "zod/v4";
1346
+ var openaiLanguageModelCompletionOptions = lazySchema4(
1347
+ () => zodSchema4(
1348
+ z5.object({
1379
1349
  /**
1380
1350
  * Echo back the prompt in addition to the completion.
1381
1351
  */
1382
- echo: import_v45.z.boolean().optional(),
1352
+ echo: z5.boolean().optional(),
1383
1353
  /**
1384
1354
  * Modify the likelihood of specified tokens appearing in the completion.
1385
1355
  *
@@ -1394,16 +1364,16 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
1394
1364
  * As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1395
1365
  * token from being generated.
1396
1366
  */
1397
- logitBias: import_v45.z.record(import_v45.z.string(), import_v45.z.number()).optional(),
1367
+ logitBias: z5.record(z5.string(), z5.number()).optional(),
1398
1368
  /**
1399
1369
  * The suffix that comes after a completion of inserted text.
1400
1370
  */
1401
- suffix: import_v45.z.string().optional(),
1371
+ suffix: z5.string().optional(),
1402
1372
  /**
1403
1373
  * A unique identifier representing your end-user, which can help OpenAI to
1404
1374
  * monitor and detect abuse. Learn more.
1405
1375
  */
1406
- user: import_v45.z.string().optional(),
1376
+ user: z5.string().optional(),
1407
1377
  /**
1408
1378
  * Return the log probabilities of the tokens. Including logprobs will increase
1409
1379
  * the response size and can slow down response times. However, it can
@@ -1413,7 +1383,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
1413
1383
  * Setting to a number will return the log probabilities of the top n
1414
1384
  * tokens that were generated.
1415
1385
  */
1416
- logprobs: import_v45.z.union([import_v45.z.boolean(), import_v45.z.number()]).optional()
1386
+ logprobs: z5.union([z5.boolean(), z5.number()]).optional()
1417
1387
  })
1418
1388
  )
1419
1389
  );
@@ -1451,12 +1421,12 @@ var OpenAICompletionLanguageModel = class {
1451
1421
  }) {
1452
1422
  const warnings = [];
1453
1423
  const openaiOptions = {
1454
- ...await (0, import_provider_utils8.parseProviderOptions)({
1424
+ ...await parseProviderOptions2({
1455
1425
  provider: "openai",
1456
1426
  providerOptions,
1457
1427
  schema: openaiLanguageModelCompletionOptions
1458
1428
  }),
1459
- ...await (0, import_provider_utils8.parseProviderOptions)({
1429
+ ...await parseProviderOptions2({
1460
1430
  provider: this.providerOptionsName,
1461
1431
  providerOptions,
1462
1432
  schema: openaiLanguageModelCompletionOptions
@@ -1512,15 +1482,15 @@ var OpenAICompletionLanguageModel = class {
1512
1482
  responseHeaders,
1513
1483
  value: response,
1514
1484
  rawValue: rawResponse
1515
- } = await (0, import_provider_utils8.postJsonToApi)({
1485
+ } = await postJsonToApi2({
1516
1486
  url: this.config.url({
1517
1487
  path: "/completions",
1518
1488
  modelId: this.modelId
1519
1489
  }),
1520
- headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
1490
+ headers: combineHeaders2(this.config.headers(), options.headers),
1521
1491
  body: args,
1522
1492
  failedResponseHandler: openaiFailedResponseHandler,
1523
- successfulResponseHandler: (0, import_provider_utils8.createJsonResponseHandler)(
1493
+ successfulResponseHandler: createJsonResponseHandler2(
1524
1494
  openaiCompletionResponseSchema
1525
1495
  ),
1526
1496
  abortSignal: options.abortSignal,
@@ -1557,15 +1527,15 @@ var OpenAICompletionLanguageModel = class {
1557
1527
  include_usage: true
1558
1528
  }
1559
1529
  };
1560
- const { responseHeaders, value: response } = await (0, import_provider_utils8.postJsonToApi)({
1530
+ const { responseHeaders, value: response } = await postJsonToApi2({
1561
1531
  url: this.config.url({
1562
1532
  path: "/completions",
1563
1533
  modelId: this.modelId
1564
1534
  }),
1565
- headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
1535
+ headers: combineHeaders2(this.config.headers(), options.headers),
1566
1536
  body,
1567
1537
  failedResponseHandler: openaiFailedResponseHandler,
1568
- successfulResponseHandler: (0, import_provider_utils8.createEventSourceResponseHandler)(
1538
+ successfulResponseHandler: createEventSourceResponseHandler2(
1569
1539
  openaiCompletionChunkSchema
1570
1540
  ),
1571
1541
  abortSignal: options.abortSignal,
@@ -1648,37 +1618,44 @@ var OpenAICompletionLanguageModel = class {
1648
1618
  };
1649
1619
 
1650
1620
  // src/embedding/openai-embedding-model.ts
1651
- var import_provider5 = require("@ai-sdk/provider");
1652
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1621
+ import {
1622
+ TooManyEmbeddingValuesForCallError
1623
+ } from "@ai-sdk/provider";
1624
+ import {
1625
+ combineHeaders as combineHeaders3,
1626
+ createJsonResponseHandler as createJsonResponseHandler3,
1627
+ parseProviderOptions as parseProviderOptions3,
1628
+ postJsonToApi as postJsonToApi3
1629
+ } from "@ai-sdk/provider-utils";
1653
1630
 
1654
1631
  // src/embedding/openai-embedding-options.ts
1655
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1656
- var import_v46 = require("zod/v4");
1657
- var openaiEmbeddingModelOptions = (0, import_provider_utils9.lazySchema)(
1658
- () => (0, import_provider_utils9.zodSchema)(
1659
- import_v46.z.object({
1632
+ import { lazySchema as lazySchema5, zodSchema as zodSchema5 } from "@ai-sdk/provider-utils";
1633
+ import { z as z6 } from "zod/v4";
1634
+ var openaiEmbeddingModelOptions = lazySchema5(
1635
+ () => zodSchema5(
1636
+ z6.object({
1660
1637
  /**
1661
1638
  * The number of dimensions the resulting output embeddings should have.
1662
1639
  * Only supported in text-embedding-3 and later models.
1663
1640
  */
1664
- dimensions: import_v46.z.number().optional(),
1641
+ dimensions: z6.number().optional(),
1665
1642
  /**
1666
1643
  * A unique identifier representing your end-user, which can help OpenAI to
1667
1644
  * monitor and detect abuse. Learn more.
1668
1645
  */
1669
- user: import_v46.z.string().optional()
1646
+ user: z6.string().optional()
1670
1647
  })
1671
1648
  )
1672
1649
  );
1673
1650
 
1674
1651
  // src/embedding/openai-embedding-api.ts
1675
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1676
- var import_v47 = require("zod/v4");
1677
- var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
1678
- () => (0, import_provider_utils10.zodSchema)(
1679
- import_v47.z.object({
1680
- data: import_v47.z.array(import_v47.z.object({ embedding: import_v47.z.array(import_v47.z.number()) })),
1681
- usage: import_v47.z.object({ prompt_tokens: import_v47.z.number() }).nullish()
1652
+ import { lazySchema as lazySchema6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
1653
+ import { z as z7 } from "zod/v4";
1654
+ var openaiTextEmbeddingResponseSchema = lazySchema6(
1655
+ () => zodSchema6(
1656
+ z7.object({
1657
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1658
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1682
1659
  })
1683
1660
  )
1684
1661
  );
@@ -1703,14 +1680,14 @@ var OpenAIEmbeddingModel = class {
1703
1680
  }) {
1704
1681
  var _a;
1705
1682
  if (values.length > this.maxEmbeddingsPerCall) {
1706
- throw new import_provider5.TooManyEmbeddingValuesForCallError({
1683
+ throw new TooManyEmbeddingValuesForCallError({
1707
1684
  provider: this.provider,
1708
1685
  modelId: this.modelId,
1709
1686
  maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
1710
1687
  values
1711
1688
  });
1712
1689
  }
1713
- const openaiOptions = (_a = await (0, import_provider_utils11.parseProviderOptions)({
1690
+ const openaiOptions = (_a = await parseProviderOptions3({
1714
1691
  provider: "openai",
1715
1692
  providerOptions,
1716
1693
  schema: openaiEmbeddingModelOptions
@@ -1719,12 +1696,12 @@ var OpenAIEmbeddingModel = class {
1719
1696
  responseHeaders,
1720
1697
  value: response,
1721
1698
  rawValue
1722
- } = await (0, import_provider_utils11.postJsonToApi)({
1699
+ } = await postJsonToApi3({
1723
1700
  url: this.config.url({
1724
1701
  path: "/embeddings",
1725
1702
  modelId: this.modelId
1726
1703
  }),
1727
- headers: (0, import_provider_utils11.combineHeaders)(this.config.headers(), headers),
1704
+ headers: combineHeaders3(this.config.headers(), headers),
1728
1705
  body: {
1729
1706
  model: this.modelId,
1730
1707
  input: values,
@@ -1733,7 +1710,7 @@ var OpenAIEmbeddingModel = class {
1733
1710
  user: openaiOptions.user
1734
1711
  },
1735
1712
  failedResponseHandler: openaiFailedResponseHandler,
1736
- successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
1713
+ successfulResponseHandler: createJsonResponseHandler3(
1737
1714
  openaiTextEmbeddingResponseSchema
1738
1715
  ),
1739
1716
  abortSignal,
@@ -1749,32 +1726,40 @@ var OpenAIEmbeddingModel = class {
1749
1726
  };
1750
1727
 
1751
1728
  // src/image/openai-image-model.ts
1752
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1729
+ import {
1730
+ combineHeaders as combineHeaders4,
1731
+ convertBase64ToUint8Array,
1732
+ convertToFormData,
1733
+ createJsonResponseHandler as createJsonResponseHandler4,
1734
+ downloadBlob,
1735
+ postFormDataToApi,
1736
+ postJsonToApi as postJsonToApi4
1737
+ } from "@ai-sdk/provider-utils";
1753
1738
 
1754
1739
  // src/image/openai-image-api.ts
1755
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1756
- var import_v48 = require("zod/v4");
1757
- var openaiImageResponseSchema = (0, import_provider_utils12.lazySchema)(
1758
- () => (0, import_provider_utils12.zodSchema)(
1759
- import_v48.z.object({
1760
- created: import_v48.z.number().nullish(),
1761
- data: import_v48.z.array(
1762
- import_v48.z.object({
1763
- b64_json: import_v48.z.string(),
1764
- revised_prompt: import_v48.z.string().nullish()
1740
+ import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1741
+ import { z as z8 } from "zod/v4";
1742
+ var openaiImageResponseSchema = lazySchema7(
1743
+ () => zodSchema7(
1744
+ z8.object({
1745
+ created: z8.number().nullish(),
1746
+ data: z8.array(
1747
+ z8.object({
1748
+ b64_json: z8.string(),
1749
+ revised_prompt: z8.string().nullish()
1765
1750
  })
1766
1751
  ),
1767
- background: import_v48.z.string().nullish(),
1768
- output_format: import_v48.z.string().nullish(),
1769
- size: import_v48.z.string().nullish(),
1770
- quality: import_v48.z.string().nullish(),
1771
- usage: import_v48.z.object({
1772
- input_tokens: import_v48.z.number().nullish(),
1773
- output_tokens: import_v48.z.number().nullish(),
1774
- total_tokens: import_v48.z.number().nullish(),
1775
- input_tokens_details: import_v48.z.object({
1776
- image_tokens: import_v48.z.number().nullish(),
1777
- text_tokens: import_v48.z.number().nullish()
1752
+ background: z8.string().nullish(),
1753
+ output_format: z8.string().nullish(),
1754
+ size: z8.string().nullish(),
1755
+ quality: z8.string().nullish(),
1756
+ usage: z8.object({
1757
+ input_tokens: z8.number().nullish(),
1758
+ output_tokens: z8.number().nullish(),
1759
+ total_tokens: z8.number().nullish(),
1760
+ input_tokens_details: z8.object({
1761
+ image_tokens: z8.number().nullish(),
1762
+ text_tokens: z8.number().nullish()
1778
1763
  }).nullish()
1779
1764
  }).nullish()
1780
1765
  })
@@ -1842,13 +1827,13 @@ var OpenAIImageModel = class {
1842
1827
  }
1843
1828
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1844
1829
  if (files != null) {
1845
- const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils13.postFormDataToApi)({
1830
+ const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi({
1846
1831
  url: this.config.url({
1847
1832
  path: "/images/edits",
1848
1833
  modelId: this.modelId
1849
1834
  }),
1850
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), headers),
1851
- formData: (0, import_provider_utils13.convertToFormData)({
1835
+ headers: combineHeaders4(this.config.headers(), headers),
1836
+ formData: convertToFormData({
1852
1837
  model: this.modelId,
1853
1838
  prompt,
1854
1839
  image: await Promise.all(
@@ -1857,12 +1842,12 @@ var OpenAIImageModel = class {
1857
1842
  [
1858
1843
  file.data instanceof Uint8Array ? new Blob([file.data], {
1859
1844
  type: file.mediaType
1860
- }) : new Blob([(0, import_provider_utils13.convertBase64ToUint8Array)(file.data)], {
1845
+ }) : new Blob([convertBase64ToUint8Array(file.data)], {
1861
1846
  type: file.mediaType
1862
1847
  })
1863
1848
  ],
1864
1849
  { type: file.mediaType }
1865
- ) : (0, import_provider_utils13.downloadBlob)(file.url)
1850
+ ) : downloadBlob(file.url)
1866
1851
  )
1867
1852
  ),
1868
1853
  mask: mask != null ? await fileToBlob(mask) : void 0,
@@ -1871,7 +1856,7 @@ var OpenAIImageModel = class {
1871
1856
  ...(_d = providerOptions.openai) != null ? _d : {}
1872
1857
  }),
1873
1858
  failedResponseHandler: openaiFailedResponseHandler,
1874
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
1859
+ successfulResponseHandler: createJsonResponseHandler4(
1875
1860
  openaiImageResponseSchema
1876
1861
  ),
1877
1862
  abortSignal,
@@ -1912,12 +1897,12 @@ var OpenAIImageModel = class {
1912
1897
  }
1913
1898
  };
1914
1899
  }
1915
- const { value: response, responseHeaders } = await (0, import_provider_utils13.postJsonToApi)({
1900
+ const { value: response, responseHeaders } = await postJsonToApi4({
1916
1901
  url: this.config.url({
1917
1902
  path: "/images/generations",
1918
1903
  modelId: this.modelId
1919
1904
  }),
1920
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), headers),
1905
+ headers: combineHeaders4(this.config.headers(), headers),
1921
1906
  body: {
1922
1907
  model: this.modelId,
1923
1908
  prompt,
@@ -1927,7 +1912,7 @@ var OpenAIImageModel = class {
1927
1912
  ...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
1928
1913
  },
1929
1914
  failedResponseHandler: openaiFailedResponseHandler,
1930
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
1915
+ successfulResponseHandler: createJsonResponseHandler4(
1931
1916
  openaiImageResponseSchema
1932
1917
  ),
1933
1918
  abortSignal,
@@ -1989,43 +1974,50 @@ function distributeTokenDetails(details, index, total) {
1989
1974
  async function fileToBlob(file) {
1990
1975
  if (!file) return void 0;
1991
1976
  if (file.type === "url") {
1992
- return (0, import_provider_utils13.downloadBlob)(file.url);
1977
+ return downloadBlob(file.url);
1993
1978
  }
1994
- const data = file.data instanceof Uint8Array ? file.data : (0, import_provider_utils13.convertBase64ToUint8Array)(file.data);
1979
+ const data = file.data instanceof Uint8Array ? file.data : convertBase64ToUint8Array(file.data);
1995
1980
  return new Blob([data], { type: file.mediaType });
1996
1981
  }
1997
1982
 
1998
1983
  // src/transcription/openai-transcription-model.ts
1999
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
1984
+ import {
1985
+ combineHeaders as combineHeaders5,
1986
+ convertBase64ToUint8Array as convertBase64ToUint8Array2,
1987
+ createJsonResponseHandler as createJsonResponseHandler5,
1988
+ mediaTypeToExtension,
1989
+ parseProviderOptions as parseProviderOptions4,
1990
+ postFormDataToApi as postFormDataToApi2
1991
+ } from "@ai-sdk/provider-utils";
2000
1992
 
2001
1993
  // src/transcription/openai-transcription-api.ts
2002
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2003
- var import_v49 = require("zod/v4");
2004
- var openaiTranscriptionResponseSchema = (0, import_provider_utils14.lazySchema)(
2005
- () => (0, import_provider_utils14.zodSchema)(
2006
- import_v49.z.object({
2007
- text: import_v49.z.string(),
2008
- language: import_v49.z.string().nullish(),
2009
- duration: import_v49.z.number().nullish(),
2010
- words: import_v49.z.array(
2011
- import_v49.z.object({
2012
- word: import_v49.z.string(),
2013
- start: import_v49.z.number(),
2014
- end: import_v49.z.number()
1994
+ import { lazySchema as lazySchema8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
1995
+ import { z as z9 } from "zod/v4";
1996
+ var openaiTranscriptionResponseSchema = lazySchema8(
1997
+ () => zodSchema8(
1998
+ z9.object({
1999
+ text: z9.string(),
2000
+ language: z9.string().nullish(),
2001
+ duration: z9.number().nullish(),
2002
+ words: z9.array(
2003
+ z9.object({
2004
+ word: z9.string(),
2005
+ start: z9.number(),
2006
+ end: z9.number()
2015
2007
  })
2016
2008
  ).nullish(),
2017
- segments: import_v49.z.array(
2018
- import_v49.z.object({
2019
- id: import_v49.z.number(),
2020
- seek: import_v49.z.number(),
2021
- start: import_v49.z.number(),
2022
- end: import_v49.z.number(),
2023
- text: import_v49.z.string(),
2024
- tokens: import_v49.z.array(import_v49.z.number()),
2025
- temperature: import_v49.z.number(),
2026
- avg_logprob: import_v49.z.number(),
2027
- compression_ratio: import_v49.z.number(),
2028
- no_speech_prob: import_v49.z.number()
2009
+ segments: z9.array(
2010
+ z9.object({
2011
+ id: z9.number(),
2012
+ seek: z9.number(),
2013
+ start: z9.number(),
2014
+ end: z9.number(),
2015
+ text: z9.string(),
2016
+ tokens: z9.array(z9.number()),
2017
+ temperature: z9.number(),
2018
+ avg_logprob: z9.number(),
2019
+ compression_ratio: z9.number(),
2020
+ no_speech_prob: z9.number()
2029
2021
  })
2030
2022
  ).nullish()
2031
2023
  })
@@ -2033,33 +2025,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils14.lazySchema)(
2033
2025
  );
2034
2026
 
2035
2027
  // src/transcription/openai-transcription-options.ts
2036
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
2037
- var import_v410 = require("zod/v4");
2038
- var openAITranscriptionModelOptions = (0, import_provider_utils15.lazySchema)(
2039
- () => (0, import_provider_utils15.zodSchema)(
2040
- import_v410.z.object({
2028
+ import { lazySchema as lazySchema9, zodSchema as zodSchema9 } from "@ai-sdk/provider-utils";
2029
+ import { z as z10 } from "zod/v4";
2030
+ var openAITranscriptionModelOptions = lazySchema9(
2031
+ () => zodSchema9(
2032
+ z10.object({
2041
2033
  /**
2042
2034
  * Additional information to include in the transcription response.
2043
2035
  */
2044
- include: import_v410.z.array(import_v410.z.string()).optional(),
2036
+ include: z10.array(z10.string()).optional(),
2045
2037
  /**
2046
2038
  * The language of the input audio in ISO-639-1 format.
2047
2039
  */
2048
- language: import_v410.z.string().optional(),
2040
+ language: z10.string().optional(),
2049
2041
  /**
2050
2042
  * An optional text to guide the model's style or continue a previous audio segment.
2051
2043
  */
2052
- prompt: import_v410.z.string().optional(),
2044
+ prompt: z10.string().optional(),
2053
2045
  /**
2054
2046
  * The sampling temperature, between 0 and 1.
2055
2047
  * @default 0
2056
2048
  */
2057
- temperature: import_v410.z.number().min(0).max(1).default(0).optional(),
2049
+ temperature: z10.number().min(0).max(1).default(0).optional(),
2058
2050
  /**
2059
2051
  * The timestamp granularities to populate for this transcription.
2060
2052
  * @default ['segment']
2061
2053
  */
2062
- timestampGranularities: import_v410.z.array(import_v410.z.enum(["word", "segment"])).default(["segment"]).optional()
2054
+ timestampGranularities: z10.array(z10.enum(["word", "segment"])).default(["segment"]).optional()
2063
2055
  })
2064
2056
  )
2065
2057
  );
@@ -2139,15 +2131,15 @@ var OpenAITranscriptionModel = class {
2139
2131
  providerOptions
2140
2132
  }) {
2141
2133
  const warnings = [];
2142
- const openAIOptions = await (0, import_provider_utils16.parseProviderOptions)({
2134
+ const openAIOptions = await parseProviderOptions4({
2143
2135
  provider: "openai",
2144
2136
  providerOptions,
2145
2137
  schema: openAITranscriptionModelOptions
2146
2138
  });
2147
2139
  const formData = new FormData();
2148
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(audio)]);
2140
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array2(audio)]);
2149
2141
  formData.append("model", this.modelId);
2150
- const fileExtension = (0, import_provider_utils16.mediaTypeToExtension)(mediaType);
2142
+ const fileExtension = mediaTypeToExtension(mediaType);
2151
2143
  formData.append(
2152
2144
  "file",
2153
2145
  new File([blob], "audio", { type: mediaType }),
@@ -2192,15 +2184,15 @@ var OpenAITranscriptionModel = class {
2192
2184
  value: response,
2193
2185
  responseHeaders,
2194
2186
  rawValue: rawResponse
2195
- } = await (0, import_provider_utils16.postFormDataToApi)({
2187
+ } = await postFormDataToApi2({
2196
2188
  url: this.config.url({
2197
2189
  path: "/audio/transcriptions",
2198
2190
  modelId: this.modelId
2199
2191
  }),
2200
- headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
2192
+ headers: combineHeaders5(this.config.headers(), options.headers),
2201
2193
  formData,
2202
2194
  failedResponseHandler: openaiFailedResponseHandler,
2203
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
2195
+ successfulResponseHandler: createJsonResponseHandler5(
2204
2196
  openaiTranscriptionResponseSchema
2205
2197
  ),
2206
2198
  abortSignal: options.abortSignal,
@@ -2232,16 +2224,21 @@ var OpenAITranscriptionModel = class {
2232
2224
  };
2233
2225
 
2234
2226
  // src/speech/openai-speech-model.ts
2235
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
2227
+ import {
2228
+ combineHeaders as combineHeaders6,
2229
+ createBinaryResponseHandler,
2230
+ parseProviderOptions as parseProviderOptions5,
2231
+ postJsonToApi as postJsonToApi5
2232
+ } from "@ai-sdk/provider-utils";
2236
2233
 
2237
2234
  // src/speech/openai-speech-options.ts
2238
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
2239
- var import_v411 = require("zod/v4");
2240
- var openaiSpeechModelOptionsSchema = (0, import_provider_utils17.lazySchema)(
2241
- () => (0, import_provider_utils17.zodSchema)(
2242
- import_v411.z.object({
2243
- instructions: import_v411.z.string().nullish(),
2244
- speed: import_v411.z.number().min(0.25).max(4).default(1).nullish()
2235
+ import { lazySchema as lazySchema10, zodSchema as zodSchema10 } from "@ai-sdk/provider-utils";
2236
+ import { z as z11 } from "zod/v4";
2237
+ var openaiSpeechModelOptionsSchema = lazySchema10(
2238
+ () => zodSchema10(
2239
+ z11.object({
2240
+ instructions: z11.string().nullish(),
2241
+ speed: z11.number().min(0.25).max(4).default(1).nullish()
2245
2242
  })
2246
2243
  )
2247
2244
  );
@@ -2266,7 +2263,7 @@ var OpenAISpeechModel = class {
2266
2263
  providerOptions
2267
2264
  }) {
2268
2265
  const warnings = [];
2269
- const openAIOptions = await (0, import_provider_utils18.parseProviderOptions)({
2266
+ const openAIOptions = await parseProviderOptions5({
2270
2267
  provider: "openai",
2271
2268
  providerOptions,
2272
2269
  schema: openaiSpeechModelOptionsSchema
@@ -2319,15 +2316,15 @@ var OpenAISpeechModel = class {
2319
2316
  value: audio,
2320
2317
  responseHeaders,
2321
2318
  rawValue: rawResponse
2322
- } = await (0, import_provider_utils18.postJsonToApi)({
2319
+ } = await postJsonToApi5({
2323
2320
  url: this.config.url({
2324
2321
  path: "/audio/speech",
2325
2322
  modelId: this.modelId
2326
2323
  }),
2327
- headers: (0, import_provider_utils18.combineHeaders)(this.config.headers(), options.headers),
2324
+ headers: combineHeaders6(this.config.headers(), options.headers),
2328
2325
  body: requestBody,
2329
2326
  failedResponseHandler: openaiFailedResponseHandler,
2330
- successfulResponseHandler: (0, import_provider_utils18.createBinaryResponseHandler)(),
2327
+ successfulResponseHandler: createBinaryResponseHandler(),
2331
2328
  abortSignal: options.abortSignal,
2332
2329
  fetch: this.config.fetch
2333
2330
  });
@@ -2348,8 +2345,19 @@ var OpenAISpeechModel = class {
2348
2345
  };
2349
2346
 
2350
2347
  // src/responses/openai-responses-language-model.ts
2351
- var import_provider8 = require("@ai-sdk/provider");
2352
- var import_provider_utils34 = require("@ai-sdk/provider-utils");
2348
+ import {
2349
+ APICallError
2350
+ } from "@ai-sdk/provider";
2351
+ import {
2352
+ combineHeaders as combineHeaders7,
2353
+ createEventSourceResponseHandler as createEventSourceResponseHandler3,
2354
+ createJsonResponseHandler as createJsonResponseHandler6,
2355
+ createToolNameMapping,
2356
+ generateId as generateId2,
2357
+ isCustomReasoning as isCustomReasoning2,
2358
+ parseProviderOptions as parseProviderOptions7,
2359
+ postJsonToApi as postJsonToApi6
2360
+ } from "@ai-sdk/provider-utils";
2353
2361
 
2354
2362
  // src/responses/convert-openai-responses-usage.ts
2355
2363
  function convertOpenAIResponsesUsage(usage) {
@@ -2391,46 +2399,60 @@ function convertOpenAIResponsesUsage(usage) {
2391
2399
  }
2392
2400
 
2393
2401
  // src/responses/convert-to-openai-responses-input.ts
2394
- var import_provider6 = require("@ai-sdk/provider");
2395
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
2396
- var import_v416 = require("zod/v4");
2402
+ import {
2403
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2404
+ } from "@ai-sdk/provider";
2405
+ import {
2406
+ convertToBase64 as convertToBase642,
2407
+ isNonNullable,
2408
+ isProviderReference as isProviderReference2,
2409
+ parseJSON,
2410
+ parseProviderOptions as parseProviderOptions6,
2411
+ resolveProviderReference as resolveProviderReference2,
2412
+ validateTypes
2413
+ } from "@ai-sdk/provider-utils";
2414
+ import { z as z16 } from "zod/v4";
2397
2415
 
2398
2416
  // src/tool/apply-patch.ts
2399
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
2400
- var import_v412 = require("zod/v4");
2401
- var applyPatchInputSchema = (0, import_provider_utils19.lazySchema)(
2402
- () => (0, import_provider_utils19.zodSchema)(
2403
- import_v412.z.object({
2404
- callId: import_v412.z.string(),
2405
- operation: import_v412.z.discriminatedUnion("type", [
2406
- import_v412.z.object({
2407
- type: import_v412.z.literal("create_file"),
2408
- path: import_v412.z.string(),
2409
- diff: import_v412.z.string()
2417
+ import {
2418
+ createProviderToolFactoryWithOutputSchema,
2419
+ lazySchema as lazySchema11,
2420
+ zodSchema as zodSchema11
2421
+ } from "@ai-sdk/provider-utils";
2422
+ import { z as z12 } from "zod/v4";
2423
+ var applyPatchInputSchema = lazySchema11(
2424
+ () => zodSchema11(
2425
+ z12.object({
2426
+ callId: z12.string(),
2427
+ operation: z12.discriminatedUnion("type", [
2428
+ z12.object({
2429
+ type: z12.literal("create_file"),
2430
+ path: z12.string(),
2431
+ diff: z12.string()
2410
2432
  }),
2411
- import_v412.z.object({
2412
- type: import_v412.z.literal("delete_file"),
2413
- path: import_v412.z.string()
2433
+ z12.object({
2434
+ type: z12.literal("delete_file"),
2435
+ path: z12.string()
2414
2436
  }),
2415
- import_v412.z.object({
2416
- type: import_v412.z.literal("update_file"),
2417
- path: import_v412.z.string(),
2418
- diff: import_v412.z.string()
2437
+ z12.object({
2438
+ type: z12.literal("update_file"),
2439
+ path: z12.string(),
2440
+ diff: z12.string()
2419
2441
  })
2420
2442
  ])
2421
2443
  })
2422
2444
  )
2423
2445
  );
2424
- var applyPatchOutputSchema = (0, import_provider_utils19.lazySchema)(
2425
- () => (0, import_provider_utils19.zodSchema)(
2426
- import_v412.z.object({
2427
- status: import_v412.z.enum(["completed", "failed"]),
2428
- output: import_v412.z.string().optional()
2446
+ var applyPatchOutputSchema = lazySchema11(
2447
+ () => zodSchema11(
2448
+ z12.object({
2449
+ status: z12.enum(["completed", "failed"]),
2450
+ output: z12.string().optional()
2429
2451
  })
2430
2452
  )
2431
2453
  );
2432
- var applyPatchArgsSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v412.z.object({})));
2433
- var applyPatchToolFactory = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
2454
+ var applyPatchArgsSchema = lazySchema11(() => zodSchema11(z12.object({})));
2455
+ var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2434
2456
  id: "openai.apply_patch",
2435
2457
  inputSchema: applyPatchInputSchema,
2436
2458
  outputSchema: applyPatchOutputSchema
@@ -2438,115 +2460,123 @@ var applyPatchToolFactory = (0, import_provider_utils19.createProviderToolFactor
2438
2460
  var applyPatch = applyPatchToolFactory;
2439
2461
 
2440
2462
  // src/tool/local-shell.ts
2441
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
2442
- var import_v413 = require("zod/v4");
2443
- var localShellInputSchema = (0, import_provider_utils20.lazySchema)(
2444
- () => (0, import_provider_utils20.zodSchema)(
2445
- import_v413.z.object({
2446
- action: import_v413.z.object({
2447
- type: import_v413.z.literal("exec"),
2448
- command: import_v413.z.array(import_v413.z.string()),
2449
- timeoutMs: import_v413.z.number().optional(),
2450
- user: import_v413.z.string().optional(),
2451
- workingDirectory: import_v413.z.string().optional(),
2452
- env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
2463
+ import {
2464
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2465
+ lazySchema as lazySchema12,
2466
+ zodSchema as zodSchema12
2467
+ } from "@ai-sdk/provider-utils";
2468
+ import { z as z13 } from "zod/v4";
2469
+ var localShellInputSchema = lazySchema12(
2470
+ () => zodSchema12(
2471
+ z13.object({
2472
+ action: z13.object({
2473
+ type: z13.literal("exec"),
2474
+ command: z13.array(z13.string()),
2475
+ timeoutMs: z13.number().optional(),
2476
+ user: z13.string().optional(),
2477
+ workingDirectory: z13.string().optional(),
2478
+ env: z13.record(z13.string(), z13.string()).optional()
2453
2479
  })
2454
2480
  })
2455
2481
  )
2456
2482
  );
2457
- var localShellOutputSchema = (0, import_provider_utils20.lazySchema)(
2458
- () => (0, import_provider_utils20.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
2483
+ var localShellOutputSchema = lazySchema12(
2484
+ () => zodSchema12(z13.object({ output: z13.string() }))
2459
2485
  );
2460
- var localShell = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
2486
+ var localShell = createProviderToolFactoryWithOutputSchema2({
2461
2487
  id: "openai.local_shell",
2462
2488
  inputSchema: localShellInputSchema,
2463
2489
  outputSchema: localShellOutputSchema
2464
2490
  });
2465
2491
 
2466
2492
  // src/tool/shell.ts
2467
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
2468
- var import_v414 = require("zod/v4");
2469
- var shellInputSchema = (0, import_provider_utils21.lazySchema)(
2470
- () => (0, import_provider_utils21.zodSchema)(
2471
- import_v414.z.object({
2472
- action: import_v414.z.object({
2473
- commands: import_v414.z.array(import_v414.z.string()),
2474
- timeoutMs: import_v414.z.number().optional(),
2475
- maxOutputLength: import_v414.z.number().optional()
2493
+ import {
2494
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2495
+ lazySchema as lazySchema13,
2496
+ zodSchema as zodSchema13
2497
+ } from "@ai-sdk/provider-utils";
2498
+ import { z as z14 } from "zod/v4";
2499
+ var shellInputSchema = lazySchema13(
2500
+ () => zodSchema13(
2501
+ z14.object({
2502
+ action: z14.object({
2503
+ commands: z14.array(z14.string()),
2504
+ timeoutMs: z14.number().optional(),
2505
+ maxOutputLength: z14.number().optional()
2476
2506
  })
2477
2507
  })
2478
2508
  )
2479
2509
  );
2480
- var shellOutputSchema = (0, import_provider_utils21.lazySchema)(
2481
- () => (0, import_provider_utils21.zodSchema)(
2482
- import_v414.z.object({
2483
- output: import_v414.z.array(
2484
- import_v414.z.object({
2485
- stdout: import_v414.z.string(),
2486
- stderr: import_v414.z.string(),
2487
- outcome: import_v414.z.discriminatedUnion("type", [
2488
- import_v414.z.object({ type: import_v414.z.literal("timeout") }),
2489
- import_v414.z.object({ type: import_v414.z.literal("exit"), exitCode: import_v414.z.number() })
2510
+ var shellOutputSchema = lazySchema13(
2511
+ () => zodSchema13(
2512
+ z14.object({
2513
+ output: z14.array(
2514
+ z14.object({
2515
+ stdout: z14.string(),
2516
+ stderr: z14.string(),
2517
+ outcome: z14.discriminatedUnion("type", [
2518
+ z14.object({ type: z14.literal("timeout") }),
2519
+ z14.object({ type: z14.literal("exit"), exitCode: z14.number() })
2490
2520
  ])
2491
2521
  })
2492
2522
  )
2493
2523
  })
2494
2524
  )
2495
2525
  );
2496
- var shellSkillsSchema = import_v414.z.array(
2497
- import_v414.z.discriminatedUnion("type", [
2498
- import_v414.z.object({
2499
- type: import_v414.z.literal("skillReference"),
2500
- providerReference: import_v414.z.record(import_v414.z.string(), import_v414.z.string()),
2501
- version: import_v414.z.string().optional()
2526
+ var shellSkillsSchema = z14.array(
2527
+ z14.discriminatedUnion("type", [
2528
+ z14.object({
2529
+ type: z14.literal("skillReference"),
2530
+ providerReference: z14.record(z14.string(), z14.string()),
2531
+ version: z14.string().optional()
2502
2532
  }),
2503
- import_v414.z.object({
2504
- type: import_v414.z.literal("inline"),
2505
- name: import_v414.z.string(),
2506
- description: import_v414.z.string(),
2507
- source: import_v414.z.object({
2508
- type: import_v414.z.literal("base64"),
2509
- mediaType: import_v414.z.literal("application/zip"),
2510
- data: import_v414.z.string()
2533
+ z14.object({
2534
+ type: z14.literal("inline"),
2535
+ name: z14.string(),
2536
+ description: z14.string(),
2537
+ source: z14.object({
2538
+ type: z14.literal("base64"),
2539
+ mediaType: z14.literal("application/zip"),
2540
+ data: z14.string()
2511
2541
  })
2512
2542
  })
2513
2543
  ])
2514
2544
  ).optional();
2515
- var shellArgsSchema = (0, import_provider_utils21.lazySchema)(
2516
- () => (0, import_provider_utils21.zodSchema)(
2517
- import_v414.z.object({
2518
- environment: import_v414.z.union([
2519
- import_v414.z.object({
2520
- type: import_v414.z.literal("containerAuto"),
2521
- fileIds: import_v414.z.array(import_v414.z.string()).optional(),
2522
- memoryLimit: import_v414.z.enum(["1g", "4g", "16g", "64g"]).optional(),
2523
- networkPolicy: import_v414.z.discriminatedUnion("type", [
2524
- import_v414.z.object({ type: import_v414.z.literal("disabled") }),
2525
- import_v414.z.object({
2526
- type: import_v414.z.literal("allowlist"),
2527
- allowedDomains: import_v414.z.array(import_v414.z.string()),
2528
- domainSecrets: import_v414.z.array(
2529
- import_v414.z.object({
2530
- domain: import_v414.z.string(),
2531
- name: import_v414.z.string(),
2532
- value: import_v414.z.string()
2545
+ var shellArgsSchema = lazySchema13(
2546
+ () => zodSchema13(
2547
+ z14.object({
2548
+ environment: z14.union([
2549
+ z14.object({
2550
+ type: z14.literal("containerAuto"),
2551
+ fileIds: z14.array(z14.string()).optional(),
2552
+ memoryLimit: z14.enum(["1g", "4g", "16g", "64g"]).optional(),
2553
+ networkPolicy: z14.discriminatedUnion("type", [
2554
+ z14.object({ type: z14.literal("disabled") }),
2555
+ z14.object({
2556
+ type: z14.literal("allowlist"),
2557
+ allowedDomains: z14.array(z14.string()),
2558
+ domainSecrets: z14.array(
2559
+ z14.object({
2560
+ domain: z14.string(),
2561
+ name: z14.string(),
2562
+ value: z14.string()
2533
2563
  })
2534
2564
  ).optional()
2535
2565
  })
2536
2566
  ]).optional(),
2537
2567
  skills: shellSkillsSchema
2538
2568
  }),
2539
- import_v414.z.object({
2540
- type: import_v414.z.literal("containerReference"),
2541
- containerId: import_v414.z.string()
2569
+ z14.object({
2570
+ type: z14.literal("containerReference"),
2571
+ containerId: z14.string()
2542
2572
  }),
2543
- import_v414.z.object({
2544
- type: import_v414.z.literal("local").optional(),
2545
- skills: import_v414.z.array(
2546
- import_v414.z.object({
2547
- name: import_v414.z.string(),
2548
- description: import_v414.z.string(),
2549
- path: import_v414.z.string()
2573
+ z14.object({
2574
+ type: z14.literal("local").optional(),
2575
+ skills: z14.array(
2576
+ z14.object({
2577
+ name: z14.string(),
2578
+ description: z14.string(),
2579
+ path: z14.string()
2550
2580
  })
2551
2581
  ).optional()
2552
2582
  })
@@ -2554,40 +2584,44 @@ var shellArgsSchema = (0, import_provider_utils21.lazySchema)(
2554
2584
  })
2555
2585
  )
2556
2586
  );
2557
- var shell = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
2587
+ var shell = createProviderToolFactoryWithOutputSchema3({
2558
2588
  id: "openai.shell",
2559
2589
  inputSchema: shellInputSchema,
2560
2590
  outputSchema: shellOutputSchema
2561
2591
  });
2562
2592
 
2563
2593
  // src/tool/tool-search.ts
2564
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2565
- var import_v415 = require("zod/v4");
2566
- var toolSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
2567
- () => (0, import_provider_utils22.zodSchema)(
2568
- import_v415.z.object({
2569
- execution: import_v415.z.enum(["server", "client"]).optional(),
2570
- description: import_v415.z.string().optional(),
2571
- parameters: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
2594
+ import {
2595
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2596
+ lazySchema as lazySchema14,
2597
+ zodSchema as zodSchema14
2598
+ } from "@ai-sdk/provider-utils";
2599
+ import { z as z15 } from "zod/v4";
2600
+ var toolSearchArgsSchema = lazySchema14(
2601
+ () => zodSchema14(
2602
+ z15.object({
2603
+ execution: z15.enum(["server", "client"]).optional(),
2604
+ description: z15.string().optional(),
2605
+ parameters: z15.record(z15.string(), z15.unknown()).optional()
2572
2606
  })
2573
2607
  )
2574
2608
  );
2575
- var toolSearchInputSchema = (0, import_provider_utils22.lazySchema)(
2576
- () => (0, import_provider_utils22.zodSchema)(
2577
- import_v415.z.object({
2578
- arguments: import_v415.z.unknown().optional(),
2579
- call_id: import_v415.z.string().nullish()
2609
+ var toolSearchInputSchema = lazySchema14(
2610
+ () => zodSchema14(
2611
+ z15.object({
2612
+ arguments: z15.unknown().optional(),
2613
+ call_id: z15.string().nullish()
2580
2614
  })
2581
2615
  )
2582
2616
  );
2583
- var toolSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
2584
- () => (0, import_provider_utils22.zodSchema)(
2585
- import_v415.z.object({
2586
- tools: import_v415.z.array(import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()))
2617
+ var toolSearchOutputSchema = lazySchema14(
2618
+ () => zodSchema14(
2619
+ z15.object({
2620
+ tools: z15.array(z15.record(z15.string(), z15.unknown()))
2587
2621
  })
2588
2622
  )
2589
2623
  );
2590
- var toolSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
2624
+ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
2591
2625
  id: "openai.tool_search",
2592
2626
  inputSchema: toolSearchInputSchema,
2593
2627
  outputSchema: toolSearchOutputSchema
@@ -2653,8 +2687,8 @@ async function convertToOpenAIResponsesInput({
2653
2687
  return { type: "input_text", text: part.text };
2654
2688
  }
2655
2689
  case "file": {
2656
- if ((0, import_provider_utils23.isProviderReference)(part.data)) {
2657
- const fileId = (0, import_provider_utils23.resolveProviderReference)({
2690
+ if (isProviderReference2(part.data)) {
2691
+ const fileId = resolveProviderReference2({
2658
2692
  reference: part.data,
2659
2693
  provider: providerOptionsName
2660
2694
  });
@@ -2675,7 +2709,7 @@ async function convertToOpenAIResponsesInput({
2675
2709
  return {
2676
2710
  type: "input_image",
2677
2711
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2678
- image_url: `data:${mediaType};base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2712
+ image_url: `data:${mediaType};base64,${convertToBase642(part.data)}`
2679
2713
  },
2680
2714
  detail: (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2[providerOptionsName]) == null ? void 0 : _d2.imageDetail
2681
2715
  };
@@ -2690,11 +2724,11 @@ async function convertToOpenAIResponsesInput({
2690
2724
  type: "input_file",
2691
2725
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2692
2726
  filename: (_e2 = part.filename) != null ? _e2 : `part-${index}.pdf`,
2693
- file_data: `data:application/pdf;base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2727
+ file_data: `data:application/pdf;base64,${convertToBase642(part.data)}`
2694
2728
  }
2695
2729
  };
2696
2730
  } else {
2697
- throw new import_provider6.UnsupportedFunctionalityError({
2731
+ throw new UnsupportedFunctionalityError4({
2698
2732
  functionality: `file part media type ${part.mediaType}`
2699
2733
  });
2700
2734
  }
@@ -2740,10 +2774,10 @@ async function convertToOpenAIResponsesInput({
2740
2774
  input.push({ type: "item_reference", id });
2741
2775
  break;
2742
2776
  }
2743
- const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils23.parseJSON)({
2777
+ const parsedInput = typeof part.input === "string" ? await parseJSON({
2744
2778
  text: part.input,
2745
2779
  schema: toolSearchInputSchema
2746
- }) : await (0, import_provider_utils23.validateTypes)({
2780
+ }) : await validateTypes({
2747
2781
  value: part.input,
2748
2782
  schema: toolSearchInputSchema
2749
2783
  });
@@ -2769,7 +2803,7 @@ async function convertToOpenAIResponsesInput({
2769
2803
  break;
2770
2804
  }
2771
2805
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2772
- const parsedInput = await (0, import_provider_utils23.validateTypes)({
2806
+ const parsedInput = await validateTypes({
2773
2807
  value: part.input,
2774
2808
  schema: localShellInputSchema
2775
2809
  });
@@ -2789,7 +2823,7 @@ async function convertToOpenAIResponsesInput({
2789
2823
  break;
2790
2824
  }
2791
2825
  if (hasShellTool && resolvedToolName === "shell") {
2792
- const parsedInput = await (0, import_provider_utils23.validateTypes)({
2826
+ const parsedInput = await validateTypes({
2793
2827
  value: part.input,
2794
2828
  schema: shellInputSchema
2795
2829
  });
@@ -2807,7 +2841,7 @@ async function convertToOpenAIResponsesInput({
2807
2841
  break;
2808
2842
  }
2809
2843
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
2810
- const parsedInput = await (0, import_provider_utils23.validateTypes)({
2844
+ const parsedInput = await validateTypes({
2811
2845
  value: part.input,
2812
2846
  schema: applyPatchInputSchema
2813
2847
  });
@@ -2855,7 +2889,7 @@ async function convertToOpenAIResponsesInput({
2855
2889
  if (store) {
2856
2890
  input.push({ type: "item_reference", id: itemId });
2857
2891
  } else if (part.output.type === "json") {
2858
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2892
+ const parsedOutput = await validateTypes({
2859
2893
  value: part.output.value,
2860
2894
  schema: toolSearchOutputSchema
2861
2895
  });
@@ -2872,7 +2906,7 @@ async function convertToOpenAIResponsesInput({
2872
2906
  }
2873
2907
  if (hasShellTool && resolvedResultToolName === "shell") {
2874
2908
  if (part.output.type === "json") {
2875
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2909
+ const parsedOutput = await validateTypes({
2876
2910
  value: part.output.value,
2877
2911
  schema: shellOutputSchema
2878
2912
  });
@@ -2903,7 +2937,7 @@ async function convertToOpenAIResponsesInput({
2903
2937
  break;
2904
2938
  }
2905
2939
  case "reasoning": {
2906
- const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
2940
+ const providerOptions = await parseProviderOptions6({
2907
2941
  provider: providerOptionsName,
2908
2942
  providerOptions: part.providerOptions,
2909
2943
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -3033,7 +3067,7 @@ async function convertToOpenAIResponsesInput({
3033
3067
  part.toolName
3034
3068
  );
3035
3069
  if (resolvedToolName === "tool_search" && output.type === "json") {
3036
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
3070
+ const parsedOutput = await validateTypes({
3037
3071
  value: output.value,
3038
3072
  schema: toolSearchOutputSchema
3039
3073
  });
@@ -3047,7 +3081,7 @@ async function convertToOpenAIResponsesInput({
3047
3081
  continue;
3048
3082
  }
3049
3083
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3050
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
3084
+ const parsedOutput = await validateTypes({
3051
3085
  value: output.value,
3052
3086
  schema: localShellOutputSchema
3053
3087
  });
@@ -3059,7 +3093,7 @@ async function convertToOpenAIResponsesInput({
3059
3093
  continue;
3060
3094
  }
3061
3095
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
3062
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
3096
+ const parsedOutput = await validateTypes({
3063
3097
  value: output.value,
3064
3098
  schema: shellOutputSchema
3065
3099
  });
@@ -3078,7 +3112,7 @@ async function convertToOpenAIResponsesInput({
3078
3112
  continue;
3079
3113
  }
3080
3114
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
3081
- const parsedOutput = await (0, import_provider_utils23.validateTypes)({
3115
+ const parsedOutput = await validateTypes({
3082
3116
  value: output.value,
3083
3117
  schema: applyPatchOutputSchema
3084
3118
  });
@@ -3138,7 +3172,7 @@ async function convertToOpenAIResponsesInput({
3138
3172
  });
3139
3173
  return void 0;
3140
3174
  }
3141
- }).filter(import_provider_utils23.isNonNullable);
3175
+ }).filter(isNonNullable);
3142
3176
  break;
3143
3177
  default:
3144
3178
  outputValue = "";
@@ -3203,7 +3237,7 @@ async function convertToOpenAIResponsesInput({
3203
3237
  return void 0;
3204
3238
  }
3205
3239
  }
3206
- }).filter(import_provider_utils23.isNonNullable);
3240
+ }).filter(isNonNullable);
3207
3241
  break;
3208
3242
  }
3209
3243
  input.push({
@@ -3233,9 +3267,9 @@ async function convertToOpenAIResponsesInput({
3233
3267
  }
3234
3268
  return { input, warnings };
3235
3269
  }
3236
- var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
3237
- itemId: import_v416.z.string().nullish(),
3238
- reasoningEncryptedContent: import_v416.z.string().nullish()
3270
+ var openaiResponsesReasoningProviderOptionsSchema = z16.object({
3271
+ itemId: z16.string().nullish(),
3272
+ reasoningEncryptedContent: z16.string().nullish()
3239
3273
  });
3240
3274
 
3241
3275
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3257,552 +3291,552 @@ function mapOpenAIResponseFinishReason({
3257
3291
  }
3258
3292
 
3259
3293
  // src/responses/openai-responses-api.ts
3260
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
3261
- var import_v417 = require("zod/v4");
3262
- var jsonValueSchema = import_v417.z.lazy(
3263
- () => import_v417.z.union([
3264
- import_v417.z.string(),
3265
- import_v417.z.number(),
3266
- import_v417.z.boolean(),
3267
- import_v417.z.null(),
3268
- import_v417.z.array(jsonValueSchema),
3269
- import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional())
3294
+ import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
3295
+ import { z as z17 } from "zod/v4";
3296
+ var jsonValueSchema = z17.lazy(
3297
+ () => z17.union([
3298
+ z17.string(),
3299
+ z17.number(),
3300
+ z17.boolean(),
3301
+ z17.null(),
3302
+ z17.array(jsonValueSchema),
3303
+ z17.record(z17.string(), jsonValueSchema.optional())
3270
3304
  ])
3271
3305
  );
3272
- var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
3273
- () => (0, import_provider_utils24.zodSchema)(
3274
- import_v417.z.union([
3275
- import_v417.z.object({
3276
- type: import_v417.z.literal("response.output_text.delta"),
3277
- item_id: import_v417.z.string(),
3278
- delta: import_v417.z.string(),
3279
- logprobs: import_v417.z.array(
3280
- import_v417.z.object({
3281
- token: import_v417.z.string(),
3282
- logprob: import_v417.z.number(),
3283
- top_logprobs: import_v417.z.array(
3284
- import_v417.z.object({
3285
- token: import_v417.z.string(),
3286
- logprob: import_v417.z.number()
3306
+ var openaiResponsesChunkSchema = lazySchema15(
3307
+ () => zodSchema15(
3308
+ z17.union([
3309
+ z17.object({
3310
+ type: z17.literal("response.output_text.delta"),
3311
+ item_id: z17.string(),
3312
+ delta: z17.string(),
3313
+ logprobs: z17.array(
3314
+ z17.object({
3315
+ token: z17.string(),
3316
+ logprob: z17.number(),
3317
+ top_logprobs: z17.array(
3318
+ z17.object({
3319
+ token: z17.string(),
3320
+ logprob: z17.number()
3287
3321
  })
3288
3322
  )
3289
3323
  })
3290
3324
  ).nullish()
3291
3325
  }),
3292
- import_v417.z.object({
3293
- type: import_v417.z.enum(["response.completed", "response.incomplete"]),
3294
- response: import_v417.z.object({
3295
- incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3296
- usage: import_v417.z.object({
3297
- input_tokens: import_v417.z.number(),
3298
- input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3299
- output_tokens: import_v417.z.number(),
3300
- output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3326
+ z17.object({
3327
+ type: z17.enum(["response.completed", "response.incomplete"]),
3328
+ response: z17.object({
3329
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3330
+ usage: z17.object({
3331
+ input_tokens: z17.number(),
3332
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3333
+ output_tokens: z17.number(),
3334
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3301
3335
  }),
3302
- service_tier: import_v417.z.string().nullish()
3336
+ service_tier: z17.string().nullish()
3303
3337
  })
3304
3338
  }),
3305
- import_v417.z.object({
3306
- type: import_v417.z.literal("response.failed"),
3307
- response: import_v417.z.object({
3308
- error: import_v417.z.object({
3309
- code: import_v417.z.string().nullish(),
3310
- message: import_v417.z.string()
3339
+ z17.object({
3340
+ type: z17.literal("response.failed"),
3341
+ response: z17.object({
3342
+ error: z17.object({
3343
+ code: z17.string().nullish(),
3344
+ message: z17.string()
3311
3345
  }).nullish(),
3312
- incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3313
- usage: import_v417.z.object({
3314
- input_tokens: import_v417.z.number(),
3315
- input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3316
- output_tokens: import_v417.z.number(),
3317
- output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3346
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3347
+ usage: z17.object({
3348
+ input_tokens: z17.number(),
3349
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3350
+ output_tokens: z17.number(),
3351
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3318
3352
  }).nullish(),
3319
- service_tier: import_v417.z.string().nullish()
3353
+ service_tier: z17.string().nullish()
3320
3354
  })
3321
3355
  }),
3322
- import_v417.z.object({
3323
- type: import_v417.z.literal("response.created"),
3324
- response: import_v417.z.object({
3325
- id: import_v417.z.string(),
3326
- created_at: import_v417.z.number(),
3327
- model: import_v417.z.string(),
3328
- service_tier: import_v417.z.string().nullish()
3356
+ z17.object({
3357
+ type: z17.literal("response.created"),
3358
+ response: z17.object({
3359
+ id: z17.string(),
3360
+ created_at: z17.number(),
3361
+ model: z17.string(),
3362
+ service_tier: z17.string().nullish()
3329
3363
  })
3330
3364
  }),
3331
- import_v417.z.object({
3332
- type: import_v417.z.literal("response.output_item.added"),
3333
- output_index: import_v417.z.number(),
3334
- item: import_v417.z.discriminatedUnion("type", [
3335
- import_v417.z.object({
3336
- type: import_v417.z.literal("message"),
3337
- id: import_v417.z.string(),
3338
- phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3365
+ z17.object({
3366
+ type: z17.literal("response.output_item.added"),
3367
+ output_index: z17.number(),
3368
+ item: z17.discriminatedUnion("type", [
3369
+ z17.object({
3370
+ type: z17.literal("message"),
3371
+ id: z17.string(),
3372
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3339
3373
  }),
3340
- import_v417.z.object({
3341
- type: import_v417.z.literal("reasoning"),
3342
- id: import_v417.z.string(),
3343
- encrypted_content: import_v417.z.string().nullish()
3374
+ z17.object({
3375
+ type: z17.literal("reasoning"),
3376
+ id: z17.string(),
3377
+ encrypted_content: z17.string().nullish()
3344
3378
  }),
3345
- import_v417.z.object({
3346
- type: import_v417.z.literal("function_call"),
3347
- id: import_v417.z.string(),
3348
- call_id: import_v417.z.string(),
3349
- name: import_v417.z.string(),
3350
- arguments: import_v417.z.string()
3379
+ z17.object({
3380
+ type: z17.literal("function_call"),
3381
+ id: z17.string(),
3382
+ call_id: z17.string(),
3383
+ name: z17.string(),
3384
+ arguments: z17.string()
3351
3385
  }),
3352
- import_v417.z.object({
3353
- type: import_v417.z.literal("web_search_call"),
3354
- id: import_v417.z.string(),
3355
- status: import_v417.z.string()
3386
+ z17.object({
3387
+ type: z17.literal("web_search_call"),
3388
+ id: z17.string(),
3389
+ status: z17.string()
3356
3390
  }),
3357
- import_v417.z.object({
3358
- type: import_v417.z.literal("computer_call"),
3359
- id: import_v417.z.string(),
3360
- status: import_v417.z.string()
3391
+ z17.object({
3392
+ type: z17.literal("computer_call"),
3393
+ id: z17.string(),
3394
+ status: z17.string()
3361
3395
  }),
3362
- import_v417.z.object({
3363
- type: import_v417.z.literal("file_search_call"),
3364
- id: import_v417.z.string()
3396
+ z17.object({
3397
+ type: z17.literal("file_search_call"),
3398
+ id: z17.string()
3365
3399
  }),
3366
- import_v417.z.object({
3367
- type: import_v417.z.literal("image_generation_call"),
3368
- id: import_v417.z.string()
3400
+ z17.object({
3401
+ type: z17.literal("image_generation_call"),
3402
+ id: z17.string()
3369
3403
  }),
3370
- import_v417.z.object({
3371
- type: import_v417.z.literal("code_interpreter_call"),
3372
- id: import_v417.z.string(),
3373
- container_id: import_v417.z.string(),
3374
- code: import_v417.z.string().nullable(),
3375
- outputs: import_v417.z.array(
3376
- import_v417.z.discriminatedUnion("type", [
3377
- import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3378
- import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3404
+ z17.object({
3405
+ type: z17.literal("code_interpreter_call"),
3406
+ id: z17.string(),
3407
+ container_id: z17.string(),
3408
+ code: z17.string().nullable(),
3409
+ outputs: z17.array(
3410
+ z17.discriminatedUnion("type", [
3411
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3412
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3379
3413
  ])
3380
3414
  ).nullable(),
3381
- status: import_v417.z.string()
3415
+ status: z17.string()
3382
3416
  }),
3383
- import_v417.z.object({
3384
- type: import_v417.z.literal("mcp_call"),
3385
- id: import_v417.z.string(),
3386
- status: import_v417.z.string(),
3387
- approval_request_id: import_v417.z.string().nullish()
3417
+ z17.object({
3418
+ type: z17.literal("mcp_call"),
3419
+ id: z17.string(),
3420
+ status: z17.string(),
3421
+ approval_request_id: z17.string().nullish()
3388
3422
  }),
3389
- import_v417.z.object({
3390
- type: import_v417.z.literal("mcp_list_tools"),
3391
- id: import_v417.z.string()
3423
+ z17.object({
3424
+ type: z17.literal("mcp_list_tools"),
3425
+ id: z17.string()
3392
3426
  }),
3393
- import_v417.z.object({
3394
- type: import_v417.z.literal("mcp_approval_request"),
3395
- id: import_v417.z.string()
3427
+ z17.object({
3428
+ type: z17.literal("mcp_approval_request"),
3429
+ id: z17.string()
3396
3430
  }),
3397
- import_v417.z.object({
3398
- type: import_v417.z.literal("apply_patch_call"),
3399
- id: import_v417.z.string(),
3400
- call_id: import_v417.z.string(),
3401
- status: import_v417.z.enum(["in_progress", "completed"]),
3402
- operation: import_v417.z.discriminatedUnion("type", [
3403
- import_v417.z.object({
3404
- type: import_v417.z.literal("create_file"),
3405
- path: import_v417.z.string(),
3406
- diff: import_v417.z.string()
3431
+ z17.object({
3432
+ type: z17.literal("apply_patch_call"),
3433
+ id: z17.string(),
3434
+ call_id: z17.string(),
3435
+ status: z17.enum(["in_progress", "completed"]),
3436
+ operation: z17.discriminatedUnion("type", [
3437
+ z17.object({
3438
+ type: z17.literal("create_file"),
3439
+ path: z17.string(),
3440
+ diff: z17.string()
3407
3441
  }),
3408
- import_v417.z.object({
3409
- type: import_v417.z.literal("delete_file"),
3410
- path: import_v417.z.string()
3442
+ z17.object({
3443
+ type: z17.literal("delete_file"),
3444
+ path: z17.string()
3411
3445
  }),
3412
- import_v417.z.object({
3413
- type: import_v417.z.literal("update_file"),
3414
- path: import_v417.z.string(),
3415
- diff: import_v417.z.string()
3446
+ z17.object({
3447
+ type: z17.literal("update_file"),
3448
+ path: z17.string(),
3449
+ diff: z17.string()
3416
3450
  })
3417
3451
  ])
3418
3452
  }),
3419
- import_v417.z.object({
3420
- type: import_v417.z.literal("custom_tool_call"),
3421
- id: import_v417.z.string(),
3422
- call_id: import_v417.z.string(),
3423
- name: import_v417.z.string(),
3424
- input: import_v417.z.string()
3453
+ z17.object({
3454
+ type: z17.literal("custom_tool_call"),
3455
+ id: z17.string(),
3456
+ call_id: z17.string(),
3457
+ name: z17.string(),
3458
+ input: z17.string()
3425
3459
  }),
3426
- import_v417.z.object({
3427
- type: import_v417.z.literal("shell_call"),
3428
- id: import_v417.z.string(),
3429
- call_id: import_v417.z.string(),
3430
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3431
- action: import_v417.z.object({
3432
- commands: import_v417.z.array(import_v417.z.string())
3460
+ z17.object({
3461
+ type: z17.literal("shell_call"),
3462
+ id: z17.string(),
3463
+ call_id: z17.string(),
3464
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3465
+ action: z17.object({
3466
+ commands: z17.array(z17.string())
3433
3467
  })
3434
3468
  }),
3435
- import_v417.z.object({
3436
- type: import_v417.z.literal("compaction"),
3437
- id: import_v417.z.string(),
3438
- encrypted_content: import_v417.z.string().nullish()
3469
+ z17.object({
3470
+ type: z17.literal("compaction"),
3471
+ id: z17.string(),
3472
+ encrypted_content: z17.string().nullish()
3439
3473
  }),
3440
- import_v417.z.object({
3441
- type: import_v417.z.literal("shell_call_output"),
3442
- id: import_v417.z.string(),
3443
- call_id: import_v417.z.string(),
3444
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3445
- output: import_v417.z.array(
3446
- import_v417.z.object({
3447
- stdout: import_v417.z.string(),
3448
- stderr: import_v417.z.string(),
3449
- outcome: import_v417.z.discriminatedUnion("type", [
3450
- import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3451
- import_v417.z.object({
3452
- type: import_v417.z.literal("exit"),
3453
- exit_code: import_v417.z.number()
3474
+ z17.object({
3475
+ type: z17.literal("shell_call_output"),
3476
+ id: z17.string(),
3477
+ call_id: z17.string(),
3478
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3479
+ output: z17.array(
3480
+ z17.object({
3481
+ stdout: z17.string(),
3482
+ stderr: z17.string(),
3483
+ outcome: z17.discriminatedUnion("type", [
3484
+ z17.object({ type: z17.literal("timeout") }),
3485
+ z17.object({
3486
+ type: z17.literal("exit"),
3487
+ exit_code: z17.number()
3454
3488
  })
3455
3489
  ])
3456
3490
  })
3457
3491
  )
3458
3492
  }),
3459
- import_v417.z.object({
3460
- type: import_v417.z.literal("tool_search_call"),
3461
- id: import_v417.z.string(),
3462
- execution: import_v417.z.enum(["server", "client"]),
3463
- call_id: import_v417.z.string().nullable(),
3464
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3465
- arguments: import_v417.z.unknown()
3493
+ z17.object({
3494
+ type: z17.literal("tool_search_call"),
3495
+ id: z17.string(),
3496
+ execution: z17.enum(["server", "client"]),
3497
+ call_id: z17.string().nullable(),
3498
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3499
+ arguments: z17.unknown()
3466
3500
  }),
3467
- import_v417.z.object({
3468
- type: import_v417.z.literal("tool_search_output"),
3469
- id: import_v417.z.string(),
3470
- execution: import_v417.z.enum(["server", "client"]),
3471
- call_id: import_v417.z.string().nullable(),
3472
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3473
- tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3501
+ z17.object({
3502
+ type: z17.literal("tool_search_output"),
3503
+ id: z17.string(),
3504
+ execution: z17.enum(["server", "client"]),
3505
+ call_id: z17.string().nullable(),
3506
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3507
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
3474
3508
  })
3475
3509
  ])
3476
3510
  }),
3477
- import_v417.z.object({
3478
- type: import_v417.z.literal("response.output_item.done"),
3479
- output_index: import_v417.z.number(),
3480
- item: import_v417.z.discriminatedUnion("type", [
3481
- import_v417.z.object({
3482
- type: import_v417.z.literal("message"),
3483
- id: import_v417.z.string(),
3484
- phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3511
+ z17.object({
3512
+ type: z17.literal("response.output_item.done"),
3513
+ output_index: z17.number(),
3514
+ item: z17.discriminatedUnion("type", [
3515
+ z17.object({
3516
+ type: z17.literal("message"),
3517
+ id: z17.string(),
3518
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3485
3519
  }),
3486
- import_v417.z.object({
3487
- type: import_v417.z.literal("reasoning"),
3488
- id: import_v417.z.string(),
3489
- encrypted_content: import_v417.z.string().nullish()
3520
+ z17.object({
3521
+ type: z17.literal("reasoning"),
3522
+ id: z17.string(),
3523
+ encrypted_content: z17.string().nullish()
3490
3524
  }),
3491
- import_v417.z.object({
3492
- type: import_v417.z.literal("function_call"),
3493
- id: import_v417.z.string(),
3494
- call_id: import_v417.z.string(),
3495
- name: import_v417.z.string(),
3496
- arguments: import_v417.z.string(),
3497
- status: import_v417.z.literal("completed")
3525
+ z17.object({
3526
+ type: z17.literal("function_call"),
3527
+ id: z17.string(),
3528
+ call_id: z17.string(),
3529
+ name: z17.string(),
3530
+ arguments: z17.string(),
3531
+ status: z17.literal("completed")
3498
3532
  }),
3499
- import_v417.z.object({
3500
- type: import_v417.z.literal("custom_tool_call"),
3501
- id: import_v417.z.string(),
3502
- call_id: import_v417.z.string(),
3503
- name: import_v417.z.string(),
3504
- input: import_v417.z.string(),
3505
- status: import_v417.z.literal("completed")
3533
+ z17.object({
3534
+ type: z17.literal("custom_tool_call"),
3535
+ id: z17.string(),
3536
+ call_id: z17.string(),
3537
+ name: z17.string(),
3538
+ input: z17.string(),
3539
+ status: z17.literal("completed")
3506
3540
  }),
3507
- import_v417.z.object({
3508
- type: import_v417.z.literal("code_interpreter_call"),
3509
- id: import_v417.z.string(),
3510
- code: import_v417.z.string().nullable(),
3511
- container_id: import_v417.z.string(),
3512
- outputs: import_v417.z.array(
3513
- import_v417.z.discriminatedUnion("type", [
3514
- import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3515
- import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3541
+ z17.object({
3542
+ type: z17.literal("code_interpreter_call"),
3543
+ id: z17.string(),
3544
+ code: z17.string().nullable(),
3545
+ container_id: z17.string(),
3546
+ outputs: z17.array(
3547
+ z17.discriminatedUnion("type", [
3548
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3549
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3516
3550
  ])
3517
3551
  ).nullable()
3518
3552
  }),
3519
- import_v417.z.object({
3520
- type: import_v417.z.literal("image_generation_call"),
3521
- id: import_v417.z.string(),
3522
- result: import_v417.z.string()
3553
+ z17.object({
3554
+ type: z17.literal("image_generation_call"),
3555
+ id: z17.string(),
3556
+ result: z17.string()
3523
3557
  }),
3524
- import_v417.z.object({
3525
- type: import_v417.z.literal("web_search_call"),
3526
- id: import_v417.z.string(),
3527
- status: import_v417.z.string(),
3528
- action: import_v417.z.discriminatedUnion("type", [
3529
- import_v417.z.object({
3530
- type: import_v417.z.literal("search"),
3531
- query: import_v417.z.string().nullish(),
3532
- sources: import_v417.z.array(
3533
- import_v417.z.discriminatedUnion("type", [
3534
- import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3535
- import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
3558
+ z17.object({
3559
+ type: z17.literal("web_search_call"),
3560
+ id: z17.string(),
3561
+ status: z17.string(),
3562
+ action: z17.discriminatedUnion("type", [
3563
+ z17.object({
3564
+ type: z17.literal("search"),
3565
+ query: z17.string().nullish(),
3566
+ sources: z17.array(
3567
+ z17.discriminatedUnion("type", [
3568
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3569
+ z17.object({ type: z17.literal("api"), name: z17.string() })
3536
3570
  ])
3537
3571
  ).nullish()
3538
3572
  }),
3539
- import_v417.z.object({
3540
- type: import_v417.z.literal("open_page"),
3541
- url: import_v417.z.string().nullish()
3573
+ z17.object({
3574
+ type: z17.literal("open_page"),
3575
+ url: z17.string().nullish()
3542
3576
  }),
3543
- import_v417.z.object({
3544
- type: import_v417.z.literal("find_in_page"),
3545
- url: import_v417.z.string().nullish(),
3546
- pattern: import_v417.z.string().nullish()
3577
+ z17.object({
3578
+ type: z17.literal("find_in_page"),
3579
+ url: z17.string().nullish(),
3580
+ pattern: z17.string().nullish()
3547
3581
  })
3548
3582
  ]).nullish()
3549
3583
  }),
3550
- import_v417.z.object({
3551
- type: import_v417.z.literal("file_search_call"),
3552
- id: import_v417.z.string(),
3553
- queries: import_v417.z.array(import_v417.z.string()),
3554
- results: import_v417.z.array(
3555
- import_v417.z.object({
3556
- attributes: import_v417.z.record(
3557
- import_v417.z.string(),
3558
- import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3584
+ z17.object({
3585
+ type: z17.literal("file_search_call"),
3586
+ id: z17.string(),
3587
+ queries: z17.array(z17.string()),
3588
+ results: z17.array(
3589
+ z17.object({
3590
+ attributes: z17.record(
3591
+ z17.string(),
3592
+ z17.union([z17.string(), z17.number(), z17.boolean()])
3559
3593
  ),
3560
- file_id: import_v417.z.string(),
3561
- filename: import_v417.z.string(),
3562
- score: import_v417.z.number(),
3563
- text: import_v417.z.string()
3594
+ file_id: z17.string(),
3595
+ filename: z17.string(),
3596
+ score: z17.number(),
3597
+ text: z17.string()
3564
3598
  })
3565
3599
  ).nullish()
3566
3600
  }),
3567
- import_v417.z.object({
3568
- type: import_v417.z.literal("local_shell_call"),
3569
- id: import_v417.z.string(),
3570
- call_id: import_v417.z.string(),
3571
- action: import_v417.z.object({
3572
- type: import_v417.z.literal("exec"),
3573
- command: import_v417.z.array(import_v417.z.string()),
3574
- timeout_ms: import_v417.z.number().optional(),
3575
- user: import_v417.z.string().optional(),
3576
- working_directory: import_v417.z.string().optional(),
3577
- env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3601
+ z17.object({
3602
+ type: z17.literal("local_shell_call"),
3603
+ id: z17.string(),
3604
+ call_id: z17.string(),
3605
+ action: z17.object({
3606
+ type: z17.literal("exec"),
3607
+ command: z17.array(z17.string()),
3608
+ timeout_ms: z17.number().optional(),
3609
+ user: z17.string().optional(),
3610
+ working_directory: z17.string().optional(),
3611
+ env: z17.record(z17.string(), z17.string()).optional()
3578
3612
  })
3579
3613
  }),
3580
- import_v417.z.object({
3581
- type: import_v417.z.literal("computer_call"),
3582
- id: import_v417.z.string(),
3583
- status: import_v417.z.literal("completed")
3614
+ z17.object({
3615
+ type: z17.literal("computer_call"),
3616
+ id: z17.string(),
3617
+ status: z17.literal("completed")
3584
3618
  }),
3585
- import_v417.z.object({
3586
- type: import_v417.z.literal("mcp_call"),
3587
- id: import_v417.z.string(),
3588
- status: import_v417.z.string(),
3589
- arguments: import_v417.z.string(),
3590
- name: import_v417.z.string(),
3591
- server_label: import_v417.z.string(),
3592
- output: import_v417.z.string().nullish(),
3593
- error: import_v417.z.union([
3594
- import_v417.z.string(),
3595
- import_v417.z.object({
3596
- type: import_v417.z.string().optional(),
3597
- code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3598
- message: import_v417.z.string().optional()
3619
+ z17.object({
3620
+ type: z17.literal("mcp_call"),
3621
+ id: z17.string(),
3622
+ status: z17.string(),
3623
+ arguments: z17.string(),
3624
+ name: z17.string(),
3625
+ server_label: z17.string(),
3626
+ output: z17.string().nullish(),
3627
+ error: z17.union([
3628
+ z17.string(),
3629
+ z17.object({
3630
+ type: z17.string().optional(),
3631
+ code: z17.union([z17.number(), z17.string()]).optional(),
3632
+ message: z17.string().optional()
3599
3633
  }).loose()
3600
3634
  ]).nullish(),
3601
- approval_request_id: import_v417.z.string().nullish()
3635
+ approval_request_id: z17.string().nullish()
3602
3636
  }),
3603
- import_v417.z.object({
3604
- type: import_v417.z.literal("mcp_list_tools"),
3605
- id: import_v417.z.string(),
3606
- server_label: import_v417.z.string(),
3607
- tools: import_v417.z.array(
3608
- import_v417.z.object({
3609
- name: import_v417.z.string(),
3610
- description: import_v417.z.string().optional(),
3611
- input_schema: import_v417.z.any(),
3612
- annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3637
+ z17.object({
3638
+ type: z17.literal("mcp_list_tools"),
3639
+ id: z17.string(),
3640
+ server_label: z17.string(),
3641
+ tools: z17.array(
3642
+ z17.object({
3643
+ name: z17.string(),
3644
+ description: z17.string().optional(),
3645
+ input_schema: z17.any(),
3646
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
3613
3647
  })
3614
3648
  ),
3615
- error: import_v417.z.union([
3616
- import_v417.z.string(),
3617
- import_v417.z.object({
3618
- type: import_v417.z.string().optional(),
3619
- code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3620
- message: import_v417.z.string().optional()
3649
+ error: z17.union([
3650
+ z17.string(),
3651
+ z17.object({
3652
+ type: z17.string().optional(),
3653
+ code: z17.union([z17.number(), z17.string()]).optional(),
3654
+ message: z17.string().optional()
3621
3655
  }).loose()
3622
3656
  ]).optional()
3623
3657
  }),
3624
- import_v417.z.object({
3625
- type: import_v417.z.literal("mcp_approval_request"),
3626
- id: import_v417.z.string(),
3627
- server_label: import_v417.z.string(),
3628
- name: import_v417.z.string(),
3629
- arguments: import_v417.z.string(),
3630
- approval_request_id: import_v417.z.string().optional()
3658
+ z17.object({
3659
+ type: z17.literal("mcp_approval_request"),
3660
+ id: z17.string(),
3661
+ server_label: z17.string(),
3662
+ name: z17.string(),
3663
+ arguments: z17.string(),
3664
+ approval_request_id: z17.string().optional()
3631
3665
  }),
3632
- import_v417.z.object({
3633
- type: import_v417.z.literal("apply_patch_call"),
3634
- id: import_v417.z.string(),
3635
- call_id: import_v417.z.string(),
3636
- status: import_v417.z.enum(["in_progress", "completed"]),
3637
- operation: import_v417.z.discriminatedUnion("type", [
3638
- import_v417.z.object({
3639
- type: import_v417.z.literal("create_file"),
3640
- path: import_v417.z.string(),
3641
- diff: import_v417.z.string()
3666
+ z17.object({
3667
+ type: z17.literal("apply_patch_call"),
3668
+ id: z17.string(),
3669
+ call_id: z17.string(),
3670
+ status: z17.enum(["in_progress", "completed"]),
3671
+ operation: z17.discriminatedUnion("type", [
3672
+ z17.object({
3673
+ type: z17.literal("create_file"),
3674
+ path: z17.string(),
3675
+ diff: z17.string()
3642
3676
  }),
3643
- import_v417.z.object({
3644
- type: import_v417.z.literal("delete_file"),
3645
- path: import_v417.z.string()
3677
+ z17.object({
3678
+ type: z17.literal("delete_file"),
3679
+ path: z17.string()
3646
3680
  }),
3647
- import_v417.z.object({
3648
- type: import_v417.z.literal("update_file"),
3649
- path: import_v417.z.string(),
3650
- diff: import_v417.z.string()
3681
+ z17.object({
3682
+ type: z17.literal("update_file"),
3683
+ path: z17.string(),
3684
+ diff: z17.string()
3651
3685
  })
3652
3686
  ])
3653
3687
  }),
3654
- import_v417.z.object({
3655
- type: import_v417.z.literal("shell_call"),
3656
- id: import_v417.z.string(),
3657
- call_id: import_v417.z.string(),
3658
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3659
- action: import_v417.z.object({
3660
- commands: import_v417.z.array(import_v417.z.string())
3688
+ z17.object({
3689
+ type: z17.literal("shell_call"),
3690
+ id: z17.string(),
3691
+ call_id: z17.string(),
3692
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3693
+ action: z17.object({
3694
+ commands: z17.array(z17.string())
3661
3695
  })
3662
3696
  }),
3663
- import_v417.z.object({
3664
- type: import_v417.z.literal("compaction"),
3665
- id: import_v417.z.string(),
3666
- encrypted_content: import_v417.z.string()
3697
+ z17.object({
3698
+ type: z17.literal("compaction"),
3699
+ id: z17.string(),
3700
+ encrypted_content: z17.string()
3667
3701
  }),
3668
- import_v417.z.object({
3669
- type: import_v417.z.literal("shell_call_output"),
3670
- id: import_v417.z.string(),
3671
- call_id: import_v417.z.string(),
3672
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3673
- output: import_v417.z.array(
3674
- import_v417.z.object({
3675
- stdout: import_v417.z.string(),
3676
- stderr: import_v417.z.string(),
3677
- outcome: import_v417.z.discriminatedUnion("type", [
3678
- import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3679
- import_v417.z.object({
3680
- type: import_v417.z.literal("exit"),
3681
- exit_code: import_v417.z.number()
3702
+ z17.object({
3703
+ type: z17.literal("shell_call_output"),
3704
+ id: z17.string(),
3705
+ call_id: z17.string(),
3706
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3707
+ output: z17.array(
3708
+ z17.object({
3709
+ stdout: z17.string(),
3710
+ stderr: z17.string(),
3711
+ outcome: z17.discriminatedUnion("type", [
3712
+ z17.object({ type: z17.literal("timeout") }),
3713
+ z17.object({
3714
+ type: z17.literal("exit"),
3715
+ exit_code: z17.number()
3682
3716
  })
3683
3717
  ])
3684
3718
  })
3685
3719
  )
3686
3720
  }),
3687
- import_v417.z.object({
3688
- type: import_v417.z.literal("tool_search_call"),
3689
- id: import_v417.z.string(),
3690
- execution: import_v417.z.enum(["server", "client"]),
3691
- call_id: import_v417.z.string().nullable(),
3692
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3693
- arguments: import_v417.z.unknown()
3721
+ z17.object({
3722
+ type: z17.literal("tool_search_call"),
3723
+ id: z17.string(),
3724
+ execution: z17.enum(["server", "client"]),
3725
+ call_id: z17.string().nullable(),
3726
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3727
+ arguments: z17.unknown()
3694
3728
  }),
3695
- import_v417.z.object({
3696
- type: import_v417.z.literal("tool_search_output"),
3697
- id: import_v417.z.string(),
3698
- execution: import_v417.z.enum(["server", "client"]),
3699
- call_id: import_v417.z.string().nullable(),
3700
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3701
- tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3729
+ z17.object({
3730
+ type: z17.literal("tool_search_output"),
3731
+ id: z17.string(),
3732
+ execution: z17.enum(["server", "client"]),
3733
+ call_id: z17.string().nullable(),
3734
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3735
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
3702
3736
  })
3703
3737
  ])
3704
3738
  }),
3705
- import_v417.z.object({
3706
- type: import_v417.z.literal("response.function_call_arguments.delta"),
3707
- item_id: import_v417.z.string(),
3708
- output_index: import_v417.z.number(),
3709
- delta: import_v417.z.string()
3739
+ z17.object({
3740
+ type: z17.literal("response.function_call_arguments.delta"),
3741
+ item_id: z17.string(),
3742
+ output_index: z17.number(),
3743
+ delta: z17.string()
3710
3744
  }),
3711
- import_v417.z.object({
3712
- type: import_v417.z.literal("response.custom_tool_call_input.delta"),
3713
- item_id: import_v417.z.string(),
3714
- output_index: import_v417.z.number(),
3715
- delta: import_v417.z.string()
3745
+ z17.object({
3746
+ type: z17.literal("response.custom_tool_call_input.delta"),
3747
+ item_id: z17.string(),
3748
+ output_index: z17.number(),
3749
+ delta: z17.string()
3716
3750
  }),
3717
- import_v417.z.object({
3718
- type: import_v417.z.literal("response.image_generation_call.partial_image"),
3719
- item_id: import_v417.z.string(),
3720
- output_index: import_v417.z.number(),
3721
- partial_image_b64: import_v417.z.string()
3751
+ z17.object({
3752
+ type: z17.literal("response.image_generation_call.partial_image"),
3753
+ item_id: z17.string(),
3754
+ output_index: z17.number(),
3755
+ partial_image_b64: z17.string()
3722
3756
  }),
3723
- import_v417.z.object({
3724
- type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
3725
- item_id: import_v417.z.string(),
3726
- output_index: import_v417.z.number(),
3727
- delta: import_v417.z.string()
3757
+ z17.object({
3758
+ type: z17.literal("response.code_interpreter_call_code.delta"),
3759
+ item_id: z17.string(),
3760
+ output_index: z17.number(),
3761
+ delta: z17.string()
3728
3762
  }),
3729
- import_v417.z.object({
3730
- type: import_v417.z.literal("response.code_interpreter_call_code.done"),
3731
- item_id: import_v417.z.string(),
3732
- output_index: import_v417.z.number(),
3733
- code: import_v417.z.string()
3763
+ z17.object({
3764
+ type: z17.literal("response.code_interpreter_call_code.done"),
3765
+ item_id: z17.string(),
3766
+ output_index: z17.number(),
3767
+ code: z17.string()
3734
3768
  }),
3735
- import_v417.z.object({
3736
- type: import_v417.z.literal("response.output_text.annotation.added"),
3737
- annotation: import_v417.z.discriminatedUnion("type", [
3738
- import_v417.z.object({
3739
- type: import_v417.z.literal("url_citation"),
3740
- start_index: import_v417.z.number(),
3741
- end_index: import_v417.z.number(),
3742
- url: import_v417.z.string(),
3743
- title: import_v417.z.string()
3769
+ z17.object({
3770
+ type: z17.literal("response.output_text.annotation.added"),
3771
+ annotation: z17.discriminatedUnion("type", [
3772
+ z17.object({
3773
+ type: z17.literal("url_citation"),
3774
+ start_index: z17.number(),
3775
+ end_index: z17.number(),
3776
+ url: z17.string(),
3777
+ title: z17.string()
3744
3778
  }),
3745
- import_v417.z.object({
3746
- type: import_v417.z.literal("file_citation"),
3747
- file_id: import_v417.z.string(),
3748
- filename: import_v417.z.string(),
3749
- index: import_v417.z.number()
3779
+ z17.object({
3780
+ type: z17.literal("file_citation"),
3781
+ file_id: z17.string(),
3782
+ filename: z17.string(),
3783
+ index: z17.number()
3750
3784
  }),
3751
- import_v417.z.object({
3752
- type: import_v417.z.literal("container_file_citation"),
3753
- container_id: import_v417.z.string(),
3754
- file_id: import_v417.z.string(),
3755
- filename: import_v417.z.string(),
3756
- start_index: import_v417.z.number(),
3757
- end_index: import_v417.z.number()
3785
+ z17.object({
3786
+ type: z17.literal("container_file_citation"),
3787
+ container_id: z17.string(),
3788
+ file_id: z17.string(),
3789
+ filename: z17.string(),
3790
+ start_index: z17.number(),
3791
+ end_index: z17.number()
3758
3792
  }),
3759
- import_v417.z.object({
3760
- type: import_v417.z.literal("file_path"),
3761
- file_id: import_v417.z.string(),
3762
- index: import_v417.z.number()
3793
+ z17.object({
3794
+ type: z17.literal("file_path"),
3795
+ file_id: z17.string(),
3796
+ index: z17.number()
3763
3797
  })
3764
3798
  ])
3765
3799
  }),
3766
- import_v417.z.object({
3767
- type: import_v417.z.literal("response.reasoning_summary_part.added"),
3768
- item_id: import_v417.z.string(),
3769
- summary_index: import_v417.z.number()
3800
+ z17.object({
3801
+ type: z17.literal("response.reasoning_summary_part.added"),
3802
+ item_id: z17.string(),
3803
+ summary_index: z17.number()
3770
3804
  }),
3771
- import_v417.z.object({
3772
- type: import_v417.z.literal("response.reasoning_summary_text.delta"),
3773
- item_id: import_v417.z.string(),
3774
- summary_index: import_v417.z.number(),
3775
- delta: import_v417.z.string()
3805
+ z17.object({
3806
+ type: z17.literal("response.reasoning_summary_text.delta"),
3807
+ item_id: z17.string(),
3808
+ summary_index: z17.number(),
3809
+ delta: z17.string()
3776
3810
  }),
3777
- import_v417.z.object({
3778
- type: import_v417.z.literal("response.reasoning_summary_part.done"),
3779
- item_id: import_v417.z.string(),
3780
- summary_index: import_v417.z.number()
3811
+ z17.object({
3812
+ type: z17.literal("response.reasoning_summary_part.done"),
3813
+ item_id: z17.string(),
3814
+ summary_index: z17.number()
3781
3815
  }),
3782
- import_v417.z.object({
3783
- type: import_v417.z.literal("response.apply_patch_call_operation_diff.delta"),
3784
- item_id: import_v417.z.string(),
3785
- output_index: import_v417.z.number(),
3786
- delta: import_v417.z.string(),
3787
- obfuscation: import_v417.z.string().nullish()
3816
+ z17.object({
3817
+ type: z17.literal("response.apply_patch_call_operation_diff.delta"),
3818
+ item_id: z17.string(),
3819
+ output_index: z17.number(),
3820
+ delta: z17.string(),
3821
+ obfuscation: z17.string().nullish()
3788
3822
  }),
3789
- import_v417.z.object({
3790
- type: import_v417.z.literal("response.apply_patch_call_operation_diff.done"),
3791
- item_id: import_v417.z.string(),
3792
- output_index: import_v417.z.number(),
3793
- diff: import_v417.z.string()
3823
+ z17.object({
3824
+ type: z17.literal("response.apply_patch_call_operation_diff.done"),
3825
+ item_id: z17.string(),
3826
+ output_index: z17.number(),
3827
+ diff: z17.string()
3794
3828
  }),
3795
- import_v417.z.object({
3796
- type: import_v417.z.literal("error"),
3797
- sequence_number: import_v417.z.number(),
3798
- error: import_v417.z.object({
3799
- type: import_v417.z.string(),
3800
- code: import_v417.z.string(),
3801
- message: import_v417.z.string(),
3802
- param: import_v417.z.string().nullish()
3829
+ z17.object({
3830
+ type: z17.literal("error"),
3831
+ sequence_number: z17.number(),
3832
+ error: z17.object({
3833
+ type: z17.string(),
3834
+ code: z17.string(),
3835
+ message: z17.string(),
3836
+ param: z17.string().nullish()
3803
3837
  })
3804
3838
  }),
3805
- import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
3839
+ z17.object({ type: z17.string() }).loose().transform((value) => ({
3806
3840
  type: "unknown_chunk",
3807
3841
  message: value.type
3808
3842
  }))
@@ -3810,315 +3844,315 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
3810
3844
  ])
3811
3845
  )
3812
3846
  );
3813
- var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
3814
- () => (0, import_provider_utils24.zodSchema)(
3815
- import_v417.z.object({
3816
- id: import_v417.z.string().optional(),
3817
- created_at: import_v417.z.number().optional(),
3818
- error: import_v417.z.object({
3819
- message: import_v417.z.string(),
3820
- type: import_v417.z.string(),
3821
- param: import_v417.z.string().nullish(),
3822
- code: import_v417.z.string()
3847
+ var openaiResponsesResponseSchema = lazySchema15(
3848
+ () => zodSchema15(
3849
+ z17.object({
3850
+ id: z17.string().optional(),
3851
+ created_at: z17.number().optional(),
3852
+ error: z17.object({
3853
+ message: z17.string(),
3854
+ type: z17.string(),
3855
+ param: z17.string().nullish(),
3856
+ code: z17.string()
3823
3857
  }).nullish(),
3824
- model: import_v417.z.string().optional(),
3825
- output: import_v417.z.array(
3826
- import_v417.z.discriminatedUnion("type", [
3827
- import_v417.z.object({
3828
- type: import_v417.z.literal("message"),
3829
- role: import_v417.z.literal("assistant"),
3830
- id: import_v417.z.string(),
3831
- phase: import_v417.z.enum(["commentary", "final_answer"]).nullish(),
3832
- content: import_v417.z.array(
3833
- import_v417.z.object({
3834
- type: import_v417.z.literal("output_text"),
3835
- text: import_v417.z.string(),
3836
- logprobs: import_v417.z.array(
3837
- import_v417.z.object({
3838
- token: import_v417.z.string(),
3839
- logprob: import_v417.z.number(),
3840
- top_logprobs: import_v417.z.array(
3841
- import_v417.z.object({
3842
- token: import_v417.z.string(),
3843
- logprob: import_v417.z.number()
3858
+ model: z17.string().optional(),
3859
+ output: z17.array(
3860
+ z17.discriminatedUnion("type", [
3861
+ z17.object({
3862
+ type: z17.literal("message"),
3863
+ role: z17.literal("assistant"),
3864
+ id: z17.string(),
3865
+ phase: z17.enum(["commentary", "final_answer"]).nullish(),
3866
+ content: z17.array(
3867
+ z17.object({
3868
+ type: z17.literal("output_text"),
3869
+ text: z17.string(),
3870
+ logprobs: z17.array(
3871
+ z17.object({
3872
+ token: z17.string(),
3873
+ logprob: z17.number(),
3874
+ top_logprobs: z17.array(
3875
+ z17.object({
3876
+ token: z17.string(),
3877
+ logprob: z17.number()
3844
3878
  })
3845
3879
  )
3846
3880
  })
3847
3881
  ).nullish(),
3848
- annotations: import_v417.z.array(
3849
- import_v417.z.discriminatedUnion("type", [
3850
- import_v417.z.object({
3851
- type: import_v417.z.literal("url_citation"),
3852
- start_index: import_v417.z.number(),
3853
- end_index: import_v417.z.number(),
3854
- url: import_v417.z.string(),
3855
- title: import_v417.z.string()
3882
+ annotations: z17.array(
3883
+ z17.discriminatedUnion("type", [
3884
+ z17.object({
3885
+ type: z17.literal("url_citation"),
3886
+ start_index: z17.number(),
3887
+ end_index: z17.number(),
3888
+ url: z17.string(),
3889
+ title: z17.string()
3856
3890
  }),
3857
- import_v417.z.object({
3858
- type: import_v417.z.literal("file_citation"),
3859
- file_id: import_v417.z.string(),
3860
- filename: import_v417.z.string(),
3861
- index: import_v417.z.number()
3891
+ z17.object({
3892
+ type: z17.literal("file_citation"),
3893
+ file_id: z17.string(),
3894
+ filename: z17.string(),
3895
+ index: z17.number()
3862
3896
  }),
3863
- import_v417.z.object({
3864
- type: import_v417.z.literal("container_file_citation"),
3865
- container_id: import_v417.z.string(),
3866
- file_id: import_v417.z.string(),
3867
- filename: import_v417.z.string(),
3868
- start_index: import_v417.z.number(),
3869
- end_index: import_v417.z.number()
3897
+ z17.object({
3898
+ type: z17.literal("container_file_citation"),
3899
+ container_id: z17.string(),
3900
+ file_id: z17.string(),
3901
+ filename: z17.string(),
3902
+ start_index: z17.number(),
3903
+ end_index: z17.number()
3870
3904
  }),
3871
- import_v417.z.object({
3872
- type: import_v417.z.literal("file_path"),
3873
- file_id: import_v417.z.string(),
3874
- index: import_v417.z.number()
3905
+ z17.object({
3906
+ type: z17.literal("file_path"),
3907
+ file_id: z17.string(),
3908
+ index: z17.number()
3875
3909
  })
3876
3910
  ])
3877
3911
  )
3878
3912
  })
3879
3913
  )
3880
3914
  }),
3881
- import_v417.z.object({
3882
- type: import_v417.z.literal("web_search_call"),
3883
- id: import_v417.z.string(),
3884
- status: import_v417.z.string(),
3885
- action: import_v417.z.discriminatedUnion("type", [
3886
- import_v417.z.object({
3887
- type: import_v417.z.literal("search"),
3888
- query: import_v417.z.string().nullish(),
3889
- sources: import_v417.z.array(
3890
- import_v417.z.discriminatedUnion("type", [
3891
- import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3892
- import_v417.z.object({
3893
- type: import_v417.z.literal("api"),
3894
- name: import_v417.z.string()
3915
+ z17.object({
3916
+ type: z17.literal("web_search_call"),
3917
+ id: z17.string(),
3918
+ status: z17.string(),
3919
+ action: z17.discriminatedUnion("type", [
3920
+ z17.object({
3921
+ type: z17.literal("search"),
3922
+ query: z17.string().nullish(),
3923
+ sources: z17.array(
3924
+ z17.discriminatedUnion("type", [
3925
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3926
+ z17.object({
3927
+ type: z17.literal("api"),
3928
+ name: z17.string()
3895
3929
  })
3896
3930
  ])
3897
3931
  ).nullish()
3898
3932
  }),
3899
- import_v417.z.object({
3900
- type: import_v417.z.literal("open_page"),
3901
- url: import_v417.z.string().nullish()
3933
+ z17.object({
3934
+ type: z17.literal("open_page"),
3935
+ url: z17.string().nullish()
3902
3936
  }),
3903
- import_v417.z.object({
3904
- type: import_v417.z.literal("find_in_page"),
3905
- url: import_v417.z.string().nullish(),
3906
- pattern: import_v417.z.string().nullish()
3937
+ z17.object({
3938
+ type: z17.literal("find_in_page"),
3939
+ url: z17.string().nullish(),
3940
+ pattern: z17.string().nullish()
3907
3941
  })
3908
3942
  ]).nullish()
3909
3943
  }),
3910
- import_v417.z.object({
3911
- type: import_v417.z.literal("file_search_call"),
3912
- id: import_v417.z.string(),
3913
- queries: import_v417.z.array(import_v417.z.string()),
3914
- results: import_v417.z.array(
3915
- import_v417.z.object({
3916
- attributes: import_v417.z.record(
3917
- import_v417.z.string(),
3918
- import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3944
+ z17.object({
3945
+ type: z17.literal("file_search_call"),
3946
+ id: z17.string(),
3947
+ queries: z17.array(z17.string()),
3948
+ results: z17.array(
3949
+ z17.object({
3950
+ attributes: z17.record(
3951
+ z17.string(),
3952
+ z17.union([z17.string(), z17.number(), z17.boolean()])
3919
3953
  ),
3920
- file_id: import_v417.z.string(),
3921
- filename: import_v417.z.string(),
3922
- score: import_v417.z.number(),
3923
- text: import_v417.z.string()
3954
+ file_id: z17.string(),
3955
+ filename: z17.string(),
3956
+ score: z17.number(),
3957
+ text: z17.string()
3924
3958
  })
3925
3959
  ).nullish()
3926
3960
  }),
3927
- import_v417.z.object({
3928
- type: import_v417.z.literal("code_interpreter_call"),
3929
- id: import_v417.z.string(),
3930
- code: import_v417.z.string().nullable(),
3931
- container_id: import_v417.z.string(),
3932
- outputs: import_v417.z.array(
3933
- import_v417.z.discriminatedUnion("type", [
3934
- import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3935
- import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3961
+ z17.object({
3962
+ type: z17.literal("code_interpreter_call"),
3963
+ id: z17.string(),
3964
+ code: z17.string().nullable(),
3965
+ container_id: z17.string(),
3966
+ outputs: z17.array(
3967
+ z17.discriminatedUnion("type", [
3968
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3969
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3936
3970
  ])
3937
3971
  ).nullable()
3938
3972
  }),
3939
- import_v417.z.object({
3940
- type: import_v417.z.literal("image_generation_call"),
3941
- id: import_v417.z.string(),
3942
- result: import_v417.z.string()
3973
+ z17.object({
3974
+ type: z17.literal("image_generation_call"),
3975
+ id: z17.string(),
3976
+ result: z17.string()
3943
3977
  }),
3944
- import_v417.z.object({
3945
- type: import_v417.z.literal("local_shell_call"),
3946
- id: import_v417.z.string(),
3947
- call_id: import_v417.z.string(),
3948
- action: import_v417.z.object({
3949
- type: import_v417.z.literal("exec"),
3950
- command: import_v417.z.array(import_v417.z.string()),
3951
- timeout_ms: import_v417.z.number().optional(),
3952
- user: import_v417.z.string().optional(),
3953
- working_directory: import_v417.z.string().optional(),
3954
- env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3978
+ z17.object({
3979
+ type: z17.literal("local_shell_call"),
3980
+ id: z17.string(),
3981
+ call_id: z17.string(),
3982
+ action: z17.object({
3983
+ type: z17.literal("exec"),
3984
+ command: z17.array(z17.string()),
3985
+ timeout_ms: z17.number().optional(),
3986
+ user: z17.string().optional(),
3987
+ working_directory: z17.string().optional(),
3988
+ env: z17.record(z17.string(), z17.string()).optional()
3955
3989
  })
3956
3990
  }),
3957
- import_v417.z.object({
3958
- type: import_v417.z.literal("function_call"),
3959
- call_id: import_v417.z.string(),
3960
- name: import_v417.z.string(),
3961
- arguments: import_v417.z.string(),
3962
- id: import_v417.z.string()
3991
+ z17.object({
3992
+ type: z17.literal("function_call"),
3993
+ call_id: z17.string(),
3994
+ name: z17.string(),
3995
+ arguments: z17.string(),
3996
+ id: z17.string()
3963
3997
  }),
3964
- import_v417.z.object({
3965
- type: import_v417.z.literal("custom_tool_call"),
3966
- call_id: import_v417.z.string(),
3967
- name: import_v417.z.string(),
3968
- input: import_v417.z.string(),
3969
- id: import_v417.z.string()
3998
+ z17.object({
3999
+ type: z17.literal("custom_tool_call"),
4000
+ call_id: z17.string(),
4001
+ name: z17.string(),
4002
+ input: z17.string(),
4003
+ id: z17.string()
3970
4004
  }),
3971
- import_v417.z.object({
3972
- type: import_v417.z.literal("computer_call"),
3973
- id: import_v417.z.string(),
3974
- status: import_v417.z.string().optional()
4005
+ z17.object({
4006
+ type: z17.literal("computer_call"),
4007
+ id: z17.string(),
4008
+ status: z17.string().optional()
3975
4009
  }),
3976
- import_v417.z.object({
3977
- type: import_v417.z.literal("reasoning"),
3978
- id: import_v417.z.string(),
3979
- encrypted_content: import_v417.z.string().nullish(),
3980
- summary: import_v417.z.array(
3981
- import_v417.z.object({
3982
- type: import_v417.z.literal("summary_text"),
3983
- text: import_v417.z.string()
4010
+ z17.object({
4011
+ type: z17.literal("reasoning"),
4012
+ id: z17.string(),
4013
+ encrypted_content: z17.string().nullish(),
4014
+ summary: z17.array(
4015
+ z17.object({
4016
+ type: z17.literal("summary_text"),
4017
+ text: z17.string()
3984
4018
  })
3985
4019
  )
3986
4020
  }),
3987
- import_v417.z.object({
3988
- type: import_v417.z.literal("mcp_call"),
3989
- id: import_v417.z.string(),
3990
- status: import_v417.z.string(),
3991
- arguments: import_v417.z.string(),
3992
- name: import_v417.z.string(),
3993
- server_label: import_v417.z.string(),
3994
- output: import_v417.z.string().nullish(),
3995
- error: import_v417.z.union([
3996
- import_v417.z.string(),
3997
- import_v417.z.object({
3998
- type: import_v417.z.string().optional(),
3999
- code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
4000
- message: import_v417.z.string().optional()
4021
+ z17.object({
4022
+ type: z17.literal("mcp_call"),
4023
+ id: z17.string(),
4024
+ status: z17.string(),
4025
+ arguments: z17.string(),
4026
+ name: z17.string(),
4027
+ server_label: z17.string(),
4028
+ output: z17.string().nullish(),
4029
+ error: z17.union([
4030
+ z17.string(),
4031
+ z17.object({
4032
+ type: z17.string().optional(),
4033
+ code: z17.union([z17.number(), z17.string()]).optional(),
4034
+ message: z17.string().optional()
4001
4035
  }).loose()
4002
4036
  ]).nullish(),
4003
- approval_request_id: import_v417.z.string().nullish()
4037
+ approval_request_id: z17.string().nullish()
4004
4038
  }),
4005
- import_v417.z.object({
4006
- type: import_v417.z.literal("mcp_list_tools"),
4007
- id: import_v417.z.string(),
4008
- server_label: import_v417.z.string(),
4009
- tools: import_v417.z.array(
4010
- import_v417.z.object({
4011
- name: import_v417.z.string(),
4012
- description: import_v417.z.string().optional(),
4013
- input_schema: import_v417.z.any(),
4014
- annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
4039
+ z17.object({
4040
+ type: z17.literal("mcp_list_tools"),
4041
+ id: z17.string(),
4042
+ server_label: z17.string(),
4043
+ tools: z17.array(
4044
+ z17.object({
4045
+ name: z17.string(),
4046
+ description: z17.string().optional(),
4047
+ input_schema: z17.any(),
4048
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
4015
4049
  })
4016
4050
  ),
4017
- error: import_v417.z.union([
4018
- import_v417.z.string(),
4019
- import_v417.z.object({
4020
- type: import_v417.z.string().optional(),
4021
- code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
4022
- message: import_v417.z.string().optional()
4051
+ error: z17.union([
4052
+ z17.string(),
4053
+ z17.object({
4054
+ type: z17.string().optional(),
4055
+ code: z17.union([z17.number(), z17.string()]).optional(),
4056
+ message: z17.string().optional()
4023
4057
  }).loose()
4024
4058
  ]).optional()
4025
4059
  }),
4026
- import_v417.z.object({
4027
- type: import_v417.z.literal("mcp_approval_request"),
4028
- id: import_v417.z.string(),
4029
- server_label: import_v417.z.string(),
4030
- name: import_v417.z.string(),
4031
- arguments: import_v417.z.string(),
4032
- approval_request_id: import_v417.z.string().optional()
4060
+ z17.object({
4061
+ type: z17.literal("mcp_approval_request"),
4062
+ id: z17.string(),
4063
+ server_label: z17.string(),
4064
+ name: z17.string(),
4065
+ arguments: z17.string(),
4066
+ approval_request_id: z17.string().optional()
4033
4067
  }),
4034
- import_v417.z.object({
4035
- type: import_v417.z.literal("apply_patch_call"),
4036
- id: import_v417.z.string(),
4037
- call_id: import_v417.z.string(),
4038
- status: import_v417.z.enum(["in_progress", "completed"]),
4039
- operation: import_v417.z.discriminatedUnion("type", [
4040
- import_v417.z.object({
4041
- type: import_v417.z.literal("create_file"),
4042
- path: import_v417.z.string(),
4043
- diff: import_v417.z.string()
4068
+ z17.object({
4069
+ type: z17.literal("apply_patch_call"),
4070
+ id: z17.string(),
4071
+ call_id: z17.string(),
4072
+ status: z17.enum(["in_progress", "completed"]),
4073
+ operation: z17.discriminatedUnion("type", [
4074
+ z17.object({
4075
+ type: z17.literal("create_file"),
4076
+ path: z17.string(),
4077
+ diff: z17.string()
4044
4078
  }),
4045
- import_v417.z.object({
4046
- type: import_v417.z.literal("delete_file"),
4047
- path: import_v417.z.string()
4079
+ z17.object({
4080
+ type: z17.literal("delete_file"),
4081
+ path: z17.string()
4048
4082
  }),
4049
- import_v417.z.object({
4050
- type: import_v417.z.literal("update_file"),
4051
- path: import_v417.z.string(),
4052
- diff: import_v417.z.string()
4083
+ z17.object({
4084
+ type: z17.literal("update_file"),
4085
+ path: z17.string(),
4086
+ diff: z17.string()
4053
4087
  })
4054
4088
  ])
4055
4089
  }),
4056
- import_v417.z.object({
4057
- type: import_v417.z.literal("shell_call"),
4058
- id: import_v417.z.string(),
4059
- call_id: import_v417.z.string(),
4060
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4061
- action: import_v417.z.object({
4062
- commands: import_v417.z.array(import_v417.z.string())
4090
+ z17.object({
4091
+ type: z17.literal("shell_call"),
4092
+ id: z17.string(),
4093
+ call_id: z17.string(),
4094
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4095
+ action: z17.object({
4096
+ commands: z17.array(z17.string())
4063
4097
  })
4064
4098
  }),
4065
- import_v417.z.object({
4066
- type: import_v417.z.literal("compaction"),
4067
- id: import_v417.z.string(),
4068
- encrypted_content: import_v417.z.string()
4099
+ z17.object({
4100
+ type: z17.literal("compaction"),
4101
+ id: z17.string(),
4102
+ encrypted_content: z17.string()
4069
4103
  }),
4070
- import_v417.z.object({
4071
- type: import_v417.z.literal("shell_call_output"),
4072
- id: import_v417.z.string(),
4073
- call_id: import_v417.z.string(),
4074
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4075
- output: import_v417.z.array(
4076
- import_v417.z.object({
4077
- stdout: import_v417.z.string(),
4078
- stderr: import_v417.z.string(),
4079
- outcome: import_v417.z.discriminatedUnion("type", [
4080
- import_v417.z.object({ type: import_v417.z.literal("timeout") }),
4081
- import_v417.z.object({
4082
- type: import_v417.z.literal("exit"),
4083
- exit_code: import_v417.z.number()
4104
+ z17.object({
4105
+ type: z17.literal("shell_call_output"),
4106
+ id: z17.string(),
4107
+ call_id: z17.string(),
4108
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4109
+ output: z17.array(
4110
+ z17.object({
4111
+ stdout: z17.string(),
4112
+ stderr: z17.string(),
4113
+ outcome: z17.discriminatedUnion("type", [
4114
+ z17.object({ type: z17.literal("timeout") }),
4115
+ z17.object({
4116
+ type: z17.literal("exit"),
4117
+ exit_code: z17.number()
4084
4118
  })
4085
4119
  ])
4086
4120
  })
4087
4121
  )
4088
4122
  }),
4089
- import_v417.z.object({
4090
- type: import_v417.z.literal("tool_search_call"),
4091
- id: import_v417.z.string(),
4092
- execution: import_v417.z.enum(["server", "client"]),
4093
- call_id: import_v417.z.string().nullable(),
4094
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4095
- arguments: import_v417.z.unknown()
4123
+ z17.object({
4124
+ type: z17.literal("tool_search_call"),
4125
+ id: z17.string(),
4126
+ execution: z17.enum(["server", "client"]),
4127
+ call_id: z17.string().nullable(),
4128
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4129
+ arguments: z17.unknown()
4096
4130
  }),
4097
- import_v417.z.object({
4098
- type: import_v417.z.literal("tool_search_output"),
4099
- id: import_v417.z.string(),
4100
- execution: import_v417.z.enum(["server", "client"]),
4101
- call_id: import_v417.z.string().nullable(),
4102
- status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4103
- tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
4131
+ z17.object({
4132
+ type: z17.literal("tool_search_output"),
4133
+ id: z17.string(),
4134
+ execution: z17.enum(["server", "client"]),
4135
+ call_id: z17.string().nullable(),
4136
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4137
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
4104
4138
  })
4105
4139
  ])
4106
4140
  ).optional(),
4107
- service_tier: import_v417.z.string().nullish(),
4108
- incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
4109
- usage: import_v417.z.object({
4110
- input_tokens: import_v417.z.number(),
4111
- input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
4112
- output_tokens: import_v417.z.number(),
4113
- output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
4141
+ service_tier: z17.string().nullish(),
4142
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
4143
+ usage: z17.object({
4144
+ input_tokens: z17.number(),
4145
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
4146
+ output_tokens: z17.number(),
4147
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
4114
4148
  }).optional()
4115
4149
  })
4116
4150
  )
4117
4151
  );
4118
4152
 
4119
4153
  // src/responses/openai-responses-options.ts
4120
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4121
- var import_v418 = require("zod/v4");
4154
+ import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
4155
+ import { z as z18 } from "zod/v4";
4122
4156
  var TOP_LOGPROBS_MAX = 20;
4123
4157
  var openaiResponsesReasoningModelIds = [
4124
4158
  "o1",
@@ -4183,9 +4217,9 @@ var openaiResponsesModelIds = [
4183
4217
  "gpt-5-chat-latest",
4184
4218
  ...openaiResponsesReasoningModelIds
4185
4219
  ];
4186
- var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazySchema)(
4187
- () => (0, import_provider_utils25.zodSchema)(
4188
- import_v418.z.object({
4220
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema16(
4221
+ () => zodSchema16(
4222
+ z18.object({
4189
4223
  /**
4190
4224
  * The ID of the OpenAI Conversation to continue.
4191
4225
  * You must create a conversation first via the OpenAI API.
@@ -4193,13 +4227,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4193
4227
  * Defaults to `undefined`.
4194
4228
  * @see https://platform.openai.com/docs/api-reference/conversations/create
4195
4229
  */
4196
- conversation: import_v418.z.string().nullish(),
4230
+ conversation: z18.string().nullish(),
4197
4231
  /**
4198
4232
  * The set of extra fields to include in the response (advanced, usually not needed).
4199
4233
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
4200
4234
  */
4201
- include: import_v418.z.array(
4202
- import_v418.z.enum([
4235
+ include: z18.array(
4236
+ z18.enum([
4203
4237
  "reasoning.encrypted_content",
4204
4238
  // handled internally by default, only needed for unknown reasoning models
4205
4239
  "file_search_call.results",
@@ -4211,7 +4245,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4211
4245
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
4212
4246
  * Defaults to `undefined`.
4213
4247
  */
4214
- instructions: import_v418.z.string().nullish(),
4248
+ instructions: z18.string().nullish(),
4215
4249
  /**
4216
4250
  * Return the log probabilities of the tokens. Including logprobs will increase
4217
4251
  * the response size and can slow down response times. However, it can
@@ -4226,30 +4260,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4226
4260
  * @see https://platform.openai.com/docs/api-reference/responses/create
4227
4261
  * @see https://cookbook.openai.com/examples/using_logprobs
4228
4262
  */
4229
- logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4263
+ logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4230
4264
  /**
4231
4265
  * The maximum number of total calls to built-in tools that can be processed in a response.
4232
4266
  * This maximum number applies across all built-in tool calls, not per individual tool.
4233
4267
  * Any further attempts to call a tool by the model will be ignored.
4234
4268
  */
4235
- maxToolCalls: import_v418.z.number().nullish(),
4269
+ maxToolCalls: z18.number().nullish(),
4236
4270
  /**
4237
4271
  * Additional metadata to store with the generation.
4238
4272
  */
4239
- metadata: import_v418.z.any().nullish(),
4273
+ metadata: z18.any().nullish(),
4240
4274
  /**
4241
4275
  * Whether to use parallel tool calls. Defaults to `true`.
4242
4276
  */
4243
- parallelToolCalls: import_v418.z.boolean().nullish(),
4277
+ parallelToolCalls: z18.boolean().nullish(),
4244
4278
  /**
4245
4279
  * The ID of the previous response. You can use it to continue a conversation.
4246
4280
  * Defaults to `undefined`.
4247
4281
  */
4248
- previousResponseId: import_v418.z.string().nullish(),
4282
+ previousResponseId: z18.string().nullish(),
4249
4283
  /**
4250
4284
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
4251
4285
  */
4252
- promptCacheKey: import_v418.z.string().nullish(),
4286
+ promptCacheKey: z18.string().nullish(),
4253
4287
  /**
4254
4288
  * The retention policy for the prompt cache.
4255
4289
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4258,7 +4292,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4258
4292
  *
4259
4293
  * @default 'in_memory'
4260
4294
  */
4261
- promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
4295
+ promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
4262
4296
  /**
4263
4297
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4264
4298
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4269,17 +4303,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4269
4303
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4270
4304
  * an error.
4271
4305
  */
4272
- reasoningEffort: import_v418.z.string().nullish(),
4306
+ reasoningEffort: z18.string().nullish(),
4273
4307
  /**
4274
4308
  * Controls reasoning summary output from the model.
4275
4309
  * Set to "auto" to automatically receive the richest level available,
4276
4310
  * or "detailed" for comprehensive summaries.
4277
4311
  */
4278
- reasoningSummary: import_v418.z.string().nullish(),
4312
+ reasoningSummary: z18.string().nullish(),
4279
4313
  /**
4280
4314
  * The identifier for safety monitoring and tracking.
4281
4315
  */
4282
- safetyIdentifier: import_v418.z.string().nullish(),
4316
+ safetyIdentifier: z18.string().nullish(),
4283
4317
  /**
4284
4318
  * Service tier for the request.
4285
4319
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4287,34 +4321,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4287
4321
  *
4288
4322
  * Defaults to 'auto'.
4289
4323
  */
4290
- serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
4324
+ serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
4291
4325
  /**
4292
4326
  * Whether to store the generation. Defaults to `true`.
4293
4327
  */
4294
- store: import_v418.z.boolean().nullish(),
4328
+ store: z18.boolean().nullish(),
4295
4329
  /**
4296
4330
  * Whether to use strict JSON schema validation.
4297
4331
  * Defaults to `true`.
4298
4332
  */
4299
- strictJsonSchema: import_v418.z.boolean().nullish(),
4333
+ strictJsonSchema: z18.boolean().nullish(),
4300
4334
  /**
4301
4335
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4302
4336
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4303
4337
  * Valid values: 'low', 'medium', 'high'.
4304
4338
  */
4305
- textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
4339
+ textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
4306
4340
  /**
4307
4341
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4308
4342
  * 'disabled' turns truncation off.
4309
4343
  */
4310
- truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
4344
+ truncation: z18.enum(["auto", "disabled"]).nullish(),
4311
4345
  /**
4312
4346
  * A unique identifier representing your end-user, which can help OpenAI to
4313
4347
  * monitor and detect abuse.
4314
4348
  * Defaults to `undefined`.
4315
4349
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4316
4350
  */
4317
- user: import_v418.z.string().nullish(),
4351
+ user: z18.string().nullish(),
4318
4352
  /**
4319
4353
  * Override the system message mode for this model.
4320
4354
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4323,7 +4357,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4323
4357
  *
4324
4358
  * If not specified, the mode is automatically determined based on the model.
4325
4359
  */
4326
- systemMessageMode: import_v418.z.enum(["system", "developer", "remove"]).optional(),
4360
+ systemMessageMode: z18.enum(["system", "developer", "remove"]).optional(),
4327
4361
  /**
4328
4362
  * Force treating this model as a reasoning model.
4329
4363
  *
@@ -4333,14 +4367,14 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4333
4367
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4334
4368
  * and defaults `systemMessageMode` to `developer` unless overridden.
4335
4369
  */
4336
- forceReasoning: import_v418.z.boolean().optional(),
4370
+ forceReasoning: z18.boolean().optional(),
4337
4371
  /**
4338
4372
  * Enable server-side context management (compaction).
4339
4373
  */
4340
- contextManagement: import_v418.z.array(
4341
- import_v418.z.object({
4342
- type: import_v418.z.literal("compaction"),
4343
- compactThreshold: import_v418.z.number()
4374
+ contextManagement: z18.array(
4375
+ z18.object({
4376
+ type: z18.literal("compaction"),
4377
+ compactThreshold: z18.number()
4344
4378
  })
4345
4379
  ).nullish()
4346
4380
  })
@@ -4348,45 +4382,54 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
4348
4382
  );
4349
4383
 
4350
4384
  // src/responses/openai-responses-prepare-tools.ts
4351
- var import_provider7 = require("@ai-sdk/provider");
4352
- var import_provider_utils33 = require("@ai-sdk/provider-utils");
4385
+ import {
4386
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError5
4387
+ } from "@ai-sdk/provider";
4388
+ import {
4389
+ resolveProviderReference as resolveProviderReference3,
4390
+ validateTypes as validateTypes2
4391
+ } from "@ai-sdk/provider-utils";
4353
4392
 
4354
4393
  // src/tool/code-interpreter.ts
4355
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
4356
- var import_v419 = require("zod/v4");
4357
- var codeInterpreterInputSchema = (0, import_provider_utils26.lazySchema)(
4358
- () => (0, import_provider_utils26.zodSchema)(
4359
- import_v419.z.object({
4360
- code: import_v419.z.string().nullish(),
4361
- containerId: import_v419.z.string()
4394
+ import {
4395
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
4396
+ lazySchema as lazySchema17,
4397
+ zodSchema as zodSchema17
4398
+ } from "@ai-sdk/provider-utils";
4399
+ import { z as z19 } from "zod/v4";
4400
+ var codeInterpreterInputSchema = lazySchema17(
4401
+ () => zodSchema17(
4402
+ z19.object({
4403
+ code: z19.string().nullish(),
4404
+ containerId: z19.string()
4362
4405
  })
4363
4406
  )
4364
4407
  );
4365
- var codeInterpreterOutputSchema = (0, import_provider_utils26.lazySchema)(
4366
- () => (0, import_provider_utils26.zodSchema)(
4367
- import_v419.z.object({
4368
- outputs: import_v419.z.array(
4369
- import_v419.z.discriminatedUnion("type", [
4370
- import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
4371
- import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4408
+ var codeInterpreterOutputSchema = lazySchema17(
4409
+ () => zodSchema17(
4410
+ z19.object({
4411
+ outputs: z19.array(
4412
+ z19.discriminatedUnion("type", [
4413
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4414
+ z19.object({ type: z19.literal("image"), url: z19.string() })
4372
4415
  ])
4373
4416
  ).nullish()
4374
4417
  })
4375
4418
  )
4376
4419
  );
4377
- var codeInterpreterArgsSchema = (0, import_provider_utils26.lazySchema)(
4378
- () => (0, import_provider_utils26.zodSchema)(
4379
- import_v419.z.object({
4380
- container: import_v419.z.union([
4381
- import_v419.z.string(),
4382
- import_v419.z.object({
4383
- fileIds: import_v419.z.array(import_v419.z.string()).optional()
4420
+ var codeInterpreterArgsSchema = lazySchema17(
4421
+ () => zodSchema17(
4422
+ z19.object({
4423
+ container: z19.union([
4424
+ z19.string(),
4425
+ z19.object({
4426
+ fileIds: z19.array(z19.string()).optional()
4384
4427
  })
4385
4428
  ]).optional()
4386
4429
  })
4387
4430
  )
4388
4431
  );
4389
- var codeInterpreterToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4432
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema5({
4390
4433
  id: "openai.code_interpreter",
4391
4434
  inputSchema: codeInterpreterInputSchema,
4392
4435
  outputSchema: codeInterpreterOutputSchema
@@ -4396,81 +4439,89 @@ var codeInterpreter = (args = {}) => {
4396
4439
  };
4397
4440
 
4398
4441
  // src/tool/file-search.ts
4399
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
4400
- var import_v420 = require("zod/v4");
4401
- var comparisonFilterSchema = import_v420.z.object({
4402
- key: import_v420.z.string(),
4403
- type: import_v420.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4404
- value: import_v420.z.union([import_v420.z.string(), import_v420.z.number(), import_v420.z.boolean(), import_v420.z.array(import_v420.z.string())])
4442
+ import {
4443
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
4444
+ lazySchema as lazySchema18,
4445
+ zodSchema as zodSchema18
4446
+ } from "@ai-sdk/provider-utils";
4447
+ import { z as z20 } from "zod/v4";
4448
+ var comparisonFilterSchema = z20.object({
4449
+ key: z20.string(),
4450
+ type: z20.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4451
+ value: z20.union([z20.string(), z20.number(), z20.boolean(), z20.array(z20.string())])
4405
4452
  });
4406
- var compoundFilterSchema = import_v420.z.object({
4407
- type: import_v420.z.enum(["and", "or"]),
4408
- filters: import_v420.z.array(
4409
- import_v420.z.union([comparisonFilterSchema, import_v420.z.lazy(() => compoundFilterSchema)])
4453
+ var compoundFilterSchema = z20.object({
4454
+ type: z20.enum(["and", "or"]),
4455
+ filters: z20.array(
4456
+ z20.union([comparisonFilterSchema, z20.lazy(() => compoundFilterSchema)])
4410
4457
  )
4411
4458
  });
4412
- var fileSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
4413
- () => (0, import_provider_utils27.zodSchema)(
4414
- import_v420.z.object({
4415
- vectorStoreIds: import_v420.z.array(import_v420.z.string()),
4416
- maxNumResults: import_v420.z.number().optional(),
4417
- ranking: import_v420.z.object({
4418
- ranker: import_v420.z.string().optional(),
4419
- scoreThreshold: import_v420.z.number().optional()
4459
+ var fileSearchArgsSchema = lazySchema18(
4460
+ () => zodSchema18(
4461
+ z20.object({
4462
+ vectorStoreIds: z20.array(z20.string()),
4463
+ maxNumResults: z20.number().optional(),
4464
+ ranking: z20.object({
4465
+ ranker: z20.string().optional(),
4466
+ scoreThreshold: z20.number().optional()
4420
4467
  }).optional(),
4421
- filters: import_v420.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4468
+ filters: z20.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4422
4469
  })
4423
4470
  )
4424
4471
  );
4425
- var fileSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
4426
- () => (0, import_provider_utils27.zodSchema)(
4427
- import_v420.z.object({
4428
- queries: import_v420.z.array(import_v420.z.string()),
4429
- results: import_v420.z.array(
4430
- import_v420.z.object({
4431
- attributes: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()),
4432
- fileId: import_v420.z.string(),
4433
- filename: import_v420.z.string(),
4434
- score: import_v420.z.number(),
4435
- text: import_v420.z.string()
4472
+ var fileSearchOutputSchema = lazySchema18(
4473
+ () => zodSchema18(
4474
+ z20.object({
4475
+ queries: z20.array(z20.string()),
4476
+ results: z20.array(
4477
+ z20.object({
4478
+ attributes: z20.record(z20.string(), z20.unknown()),
4479
+ fileId: z20.string(),
4480
+ filename: z20.string(),
4481
+ score: z20.number(),
4482
+ text: z20.string()
4436
4483
  })
4437
4484
  ).nullable()
4438
4485
  })
4439
4486
  )
4440
4487
  );
4441
- var fileSearch = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
4488
+ var fileSearch = createProviderToolFactoryWithOutputSchema6({
4442
4489
  id: "openai.file_search",
4443
- inputSchema: import_v420.z.object({}),
4490
+ inputSchema: z20.object({}),
4444
4491
  outputSchema: fileSearchOutputSchema
4445
4492
  });
4446
4493
 
4447
4494
  // src/tool/image-generation.ts
4448
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4449
- var import_v421 = require("zod/v4");
4450
- var imageGenerationArgsSchema = (0, import_provider_utils28.lazySchema)(
4451
- () => (0, import_provider_utils28.zodSchema)(
4452
- import_v421.z.object({
4453
- background: import_v421.z.enum(["auto", "opaque", "transparent"]).optional(),
4454
- inputFidelity: import_v421.z.enum(["low", "high"]).optional(),
4455
- inputImageMask: import_v421.z.object({
4456
- fileId: import_v421.z.string().optional(),
4457
- imageUrl: import_v421.z.string().optional()
4495
+ import {
4496
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
4497
+ lazySchema as lazySchema19,
4498
+ zodSchema as zodSchema19
4499
+ } from "@ai-sdk/provider-utils";
4500
+ import { z as z21 } from "zod/v4";
4501
+ var imageGenerationArgsSchema = lazySchema19(
4502
+ () => zodSchema19(
4503
+ z21.object({
4504
+ background: z21.enum(["auto", "opaque", "transparent"]).optional(),
4505
+ inputFidelity: z21.enum(["low", "high"]).optional(),
4506
+ inputImageMask: z21.object({
4507
+ fileId: z21.string().optional(),
4508
+ imageUrl: z21.string().optional()
4458
4509
  }).optional(),
4459
- model: import_v421.z.string().optional(),
4460
- moderation: import_v421.z.enum(["auto"]).optional(),
4461
- outputCompression: import_v421.z.number().int().min(0).max(100).optional(),
4462
- outputFormat: import_v421.z.enum(["png", "jpeg", "webp"]).optional(),
4463
- partialImages: import_v421.z.number().int().min(0).max(3).optional(),
4464
- quality: import_v421.z.enum(["auto", "low", "medium", "high"]).optional(),
4465
- size: import_v421.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4510
+ model: z21.string().optional(),
4511
+ moderation: z21.enum(["auto"]).optional(),
4512
+ outputCompression: z21.number().int().min(0).max(100).optional(),
4513
+ outputFormat: z21.enum(["png", "jpeg", "webp"]).optional(),
4514
+ partialImages: z21.number().int().min(0).max(3).optional(),
4515
+ quality: z21.enum(["auto", "low", "medium", "high"]).optional(),
4516
+ size: z21.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4466
4517
  }).strict()
4467
4518
  )
4468
4519
  );
4469
- var imageGenerationInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
4470
- var imageGenerationOutputSchema = (0, import_provider_utils28.lazySchema)(
4471
- () => (0, import_provider_utils28.zodSchema)(import_v421.z.object({ result: import_v421.z.string() }))
4520
+ var imageGenerationInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
4521
+ var imageGenerationOutputSchema = lazySchema19(
4522
+ () => zodSchema19(z21.object({ result: z21.string() }))
4472
4523
  );
4473
- var imageGenerationToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
4524
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema7({
4474
4525
  id: "openai.image_generation",
4475
4526
  inputSchema: imageGenerationInputSchema,
4476
4527
  outputSchema: imageGenerationOutputSchema
@@ -4480,188 +4531,204 @@ var imageGeneration = (args = {}) => {
4480
4531
  };
4481
4532
 
4482
4533
  // src/tool/custom.ts
4483
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
4484
- var import_v422 = require("zod/v4");
4485
- var customArgsSchema = (0, import_provider_utils29.lazySchema)(
4486
- () => (0, import_provider_utils29.zodSchema)(
4487
- import_v422.z.object({
4488
- description: import_v422.z.string().optional(),
4489
- format: import_v422.z.union([
4490
- import_v422.z.object({
4491
- type: import_v422.z.literal("grammar"),
4492
- syntax: import_v422.z.enum(["regex", "lark"]),
4493
- definition: import_v422.z.string()
4534
+ import {
4535
+ createProviderToolFactory,
4536
+ lazySchema as lazySchema20,
4537
+ zodSchema as zodSchema20
4538
+ } from "@ai-sdk/provider-utils";
4539
+ import { z as z22 } from "zod/v4";
4540
+ var customArgsSchema = lazySchema20(
4541
+ () => zodSchema20(
4542
+ z22.object({
4543
+ description: z22.string().optional(),
4544
+ format: z22.union([
4545
+ z22.object({
4546
+ type: z22.literal("grammar"),
4547
+ syntax: z22.enum(["regex", "lark"]),
4548
+ definition: z22.string()
4494
4549
  }),
4495
- import_v422.z.object({
4496
- type: import_v422.z.literal("text")
4550
+ z22.object({
4551
+ type: z22.literal("text")
4497
4552
  })
4498
4553
  ]).optional()
4499
4554
  })
4500
4555
  )
4501
4556
  );
4502
- var customInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.string()));
4503
- var customToolFactory = (0, import_provider_utils29.createProviderToolFactory)({
4557
+ var customInputSchema = lazySchema20(() => zodSchema20(z22.string()));
4558
+ var customToolFactory = createProviderToolFactory({
4504
4559
  id: "openai.custom",
4505
4560
  inputSchema: customInputSchema
4506
4561
  });
4507
4562
 
4508
4563
  // src/tool/mcp.ts
4509
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
4510
- var import_v423 = require("zod/v4");
4511
- var jsonValueSchema2 = import_v423.z.lazy(
4512
- () => import_v423.z.union([
4513
- import_v423.z.string(),
4514
- import_v423.z.number(),
4515
- import_v423.z.boolean(),
4516
- import_v423.z.null(),
4517
- import_v423.z.array(jsonValueSchema2),
4518
- import_v423.z.record(import_v423.z.string(), jsonValueSchema2)
4564
+ import {
4565
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
4566
+ lazySchema as lazySchema21,
4567
+ zodSchema as zodSchema21
4568
+ } from "@ai-sdk/provider-utils";
4569
+ import { z as z23 } from "zod/v4";
4570
+ var jsonValueSchema2 = z23.lazy(
4571
+ () => z23.union([
4572
+ z23.string(),
4573
+ z23.number(),
4574
+ z23.boolean(),
4575
+ z23.null(),
4576
+ z23.array(jsonValueSchema2),
4577
+ z23.record(z23.string(), jsonValueSchema2)
4519
4578
  ])
4520
4579
  );
4521
- var mcpArgsSchema = (0, import_provider_utils30.lazySchema)(
4522
- () => (0, import_provider_utils30.zodSchema)(
4523
- import_v423.z.object({
4524
- serverLabel: import_v423.z.string(),
4525
- allowedTools: import_v423.z.union([
4526
- import_v423.z.array(import_v423.z.string()),
4527
- import_v423.z.object({
4528
- readOnly: import_v423.z.boolean().optional(),
4529
- toolNames: import_v423.z.array(import_v423.z.string()).optional()
4580
+ var mcpArgsSchema = lazySchema21(
4581
+ () => zodSchema21(
4582
+ z23.object({
4583
+ serverLabel: z23.string(),
4584
+ allowedTools: z23.union([
4585
+ z23.array(z23.string()),
4586
+ z23.object({
4587
+ readOnly: z23.boolean().optional(),
4588
+ toolNames: z23.array(z23.string()).optional()
4530
4589
  })
4531
4590
  ]).optional(),
4532
- authorization: import_v423.z.string().optional(),
4533
- connectorId: import_v423.z.string().optional(),
4534
- headers: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional(),
4535
- requireApproval: import_v423.z.union([
4536
- import_v423.z.enum(["always", "never"]),
4537
- import_v423.z.object({
4538
- never: import_v423.z.object({
4539
- toolNames: import_v423.z.array(import_v423.z.string()).optional()
4591
+ authorization: z23.string().optional(),
4592
+ connectorId: z23.string().optional(),
4593
+ headers: z23.record(z23.string(), z23.string()).optional(),
4594
+ requireApproval: z23.union([
4595
+ z23.enum(["always", "never"]),
4596
+ z23.object({
4597
+ never: z23.object({
4598
+ toolNames: z23.array(z23.string()).optional()
4540
4599
  }).optional()
4541
4600
  })
4542
4601
  ]).optional(),
4543
- serverDescription: import_v423.z.string().optional(),
4544
- serverUrl: import_v423.z.string().optional()
4602
+ serverDescription: z23.string().optional(),
4603
+ serverUrl: z23.string().optional()
4545
4604
  }).refine(
4546
4605
  (v) => v.serverUrl != null || v.connectorId != null,
4547
4606
  "One of serverUrl or connectorId must be provided."
4548
4607
  )
4549
4608
  )
4550
4609
  );
4551
- var mcpInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
4552
- var mcpOutputSchema = (0, import_provider_utils30.lazySchema)(
4553
- () => (0, import_provider_utils30.zodSchema)(
4554
- import_v423.z.object({
4555
- type: import_v423.z.literal("call"),
4556
- serverLabel: import_v423.z.string(),
4557
- name: import_v423.z.string(),
4558
- arguments: import_v423.z.string(),
4559
- output: import_v423.z.string().nullish(),
4560
- error: import_v423.z.union([import_v423.z.string(), jsonValueSchema2]).optional()
4610
+ var mcpInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
4611
+ var mcpOutputSchema = lazySchema21(
4612
+ () => zodSchema21(
4613
+ z23.object({
4614
+ type: z23.literal("call"),
4615
+ serverLabel: z23.string(),
4616
+ name: z23.string(),
4617
+ arguments: z23.string(),
4618
+ output: z23.string().nullish(),
4619
+ error: z23.union([z23.string(), jsonValueSchema2]).optional()
4561
4620
  })
4562
4621
  )
4563
4622
  );
4564
- var mcpToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
4623
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
4565
4624
  id: "openai.mcp",
4566
4625
  inputSchema: mcpInputSchema,
4567
4626
  outputSchema: mcpOutputSchema
4568
4627
  });
4569
4628
 
4570
4629
  // src/tool/web-search.ts
4571
- var import_provider_utils31 = require("@ai-sdk/provider-utils");
4572
- var import_v424 = require("zod/v4");
4573
- var webSearchArgsSchema = (0, import_provider_utils31.lazySchema)(
4574
- () => (0, import_provider_utils31.zodSchema)(
4575
- import_v424.z.object({
4576
- externalWebAccess: import_v424.z.boolean().optional(),
4577
- filters: import_v424.z.object({ allowedDomains: import_v424.z.array(import_v424.z.string()).optional() }).optional(),
4578
- searchContextSize: import_v424.z.enum(["low", "medium", "high"]).optional(),
4579
- userLocation: import_v424.z.object({
4580
- type: import_v424.z.literal("approximate"),
4581
- country: import_v424.z.string().optional(),
4582
- city: import_v424.z.string().optional(),
4583
- region: import_v424.z.string().optional(),
4584
- timezone: import_v424.z.string().optional()
4630
+ import {
4631
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
4632
+ lazySchema as lazySchema22,
4633
+ zodSchema as zodSchema22
4634
+ } from "@ai-sdk/provider-utils";
4635
+ import { z as z24 } from "zod/v4";
4636
+ var webSearchArgsSchema = lazySchema22(
4637
+ () => zodSchema22(
4638
+ z24.object({
4639
+ externalWebAccess: z24.boolean().optional(),
4640
+ filters: z24.object({ allowedDomains: z24.array(z24.string()).optional() }).optional(),
4641
+ searchContextSize: z24.enum(["low", "medium", "high"]).optional(),
4642
+ userLocation: z24.object({
4643
+ type: z24.literal("approximate"),
4644
+ country: z24.string().optional(),
4645
+ city: z24.string().optional(),
4646
+ region: z24.string().optional(),
4647
+ timezone: z24.string().optional()
4585
4648
  }).optional()
4586
4649
  })
4587
4650
  )
4588
4651
  );
4589
- var webSearchInputSchema = (0, import_provider_utils31.lazySchema)(() => (0, import_provider_utils31.zodSchema)(import_v424.z.object({})));
4590
- var webSearchOutputSchema = (0, import_provider_utils31.lazySchema)(
4591
- () => (0, import_provider_utils31.zodSchema)(
4592
- import_v424.z.object({
4593
- action: import_v424.z.discriminatedUnion("type", [
4594
- import_v424.z.object({
4595
- type: import_v424.z.literal("search"),
4596
- query: import_v424.z.string().optional()
4652
+ var webSearchInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
4653
+ var webSearchOutputSchema = lazySchema22(
4654
+ () => zodSchema22(
4655
+ z24.object({
4656
+ action: z24.discriminatedUnion("type", [
4657
+ z24.object({
4658
+ type: z24.literal("search"),
4659
+ query: z24.string().optional()
4597
4660
  }),
4598
- import_v424.z.object({
4599
- type: import_v424.z.literal("openPage"),
4600
- url: import_v424.z.string().nullish()
4661
+ z24.object({
4662
+ type: z24.literal("openPage"),
4663
+ url: z24.string().nullish()
4601
4664
  }),
4602
- import_v424.z.object({
4603
- type: import_v424.z.literal("findInPage"),
4604
- url: import_v424.z.string().nullish(),
4605
- pattern: import_v424.z.string().nullish()
4665
+ z24.object({
4666
+ type: z24.literal("findInPage"),
4667
+ url: z24.string().nullish(),
4668
+ pattern: z24.string().nullish()
4606
4669
  })
4607
4670
  ]).optional(),
4608
- sources: import_v424.z.array(
4609
- import_v424.z.discriminatedUnion("type", [
4610
- import_v424.z.object({ type: import_v424.z.literal("url"), url: import_v424.z.string() }),
4611
- import_v424.z.object({ type: import_v424.z.literal("api"), name: import_v424.z.string() })
4671
+ sources: z24.array(
4672
+ z24.discriminatedUnion("type", [
4673
+ z24.object({ type: z24.literal("url"), url: z24.string() }),
4674
+ z24.object({ type: z24.literal("api"), name: z24.string() })
4612
4675
  ])
4613
4676
  ).optional()
4614
4677
  })
4615
4678
  )
4616
4679
  );
4617
- var webSearchToolFactory = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
4680
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema9({
4618
4681
  id: "openai.web_search",
4619
4682
  inputSchema: webSearchInputSchema,
4620
4683
  outputSchema: webSearchOutputSchema
4621
4684
  });
4622
4685
 
4623
4686
  // src/tool/web-search-preview.ts
4624
- var import_provider_utils32 = require("@ai-sdk/provider-utils");
4625
- var import_v425 = require("zod/v4");
4626
- var webSearchPreviewArgsSchema = (0, import_provider_utils32.lazySchema)(
4627
- () => (0, import_provider_utils32.zodSchema)(
4628
- import_v425.z.object({
4629
- searchContextSize: import_v425.z.enum(["low", "medium", "high"]).optional(),
4630
- userLocation: import_v425.z.object({
4631
- type: import_v425.z.literal("approximate"),
4632
- country: import_v425.z.string().optional(),
4633
- city: import_v425.z.string().optional(),
4634
- region: import_v425.z.string().optional(),
4635
- timezone: import_v425.z.string().optional()
4687
+ import {
4688
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
4689
+ lazySchema as lazySchema23,
4690
+ zodSchema as zodSchema23
4691
+ } from "@ai-sdk/provider-utils";
4692
+ import { z as z25 } from "zod/v4";
4693
+ var webSearchPreviewArgsSchema = lazySchema23(
4694
+ () => zodSchema23(
4695
+ z25.object({
4696
+ searchContextSize: z25.enum(["low", "medium", "high"]).optional(),
4697
+ userLocation: z25.object({
4698
+ type: z25.literal("approximate"),
4699
+ country: z25.string().optional(),
4700
+ city: z25.string().optional(),
4701
+ region: z25.string().optional(),
4702
+ timezone: z25.string().optional()
4636
4703
  }).optional()
4637
4704
  })
4638
4705
  )
4639
4706
  );
4640
- var webSearchPreviewInputSchema = (0, import_provider_utils32.lazySchema)(
4641
- () => (0, import_provider_utils32.zodSchema)(import_v425.z.object({}))
4707
+ var webSearchPreviewInputSchema = lazySchema23(
4708
+ () => zodSchema23(z25.object({}))
4642
4709
  );
4643
- var webSearchPreviewOutputSchema = (0, import_provider_utils32.lazySchema)(
4644
- () => (0, import_provider_utils32.zodSchema)(
4645
- import_v425.z.object({
4646
- action: import_v425.z.discriminatedUnion("type", [
4647
- import_v425.z.object({
4648
- type: import_v425.z.literal("search"),
4649
- query: import_v425.z.string().optional()
4710
+ var webSearchPreviewOutputSchema = lazySchema23(
4711
+ () => zodSchema23(
4712
+ z25.object({
4713
+ action: z25.discriminatedUnion("type", [
4714
+ z25.object({
4715
+ type: z25.literal("search"),
4716
+ query: z25.string().optional()
4650
4717
  }),
4651
- import_v425.z.object({
4652
- type: import_v425.z.literal("openPage"),
4653
- url: import_v425.z.string().nullish()
4718
+ z25.object({
4719
+ type: z25.literal("openPage"),
4720
+ url: z25.string().nullish()
4654
4721
  }),
4655
- import_v425.z.object({
4656
- type: import_v425.z.literal("findInPage"),
4657
- url: import_v425.z.string().nullish(),
4658
- pattern: import_v425.z.string().nullish()
4722
+ z25.object({
4723
+ type: z25.literal("findInPage"),
4724
+ url: z25.string().nullish(),
4725
+ pattern: z25.string().nullish()
4659
4726
  })
4660
4727
  ]).optional()
4661
4728
  })
4662
4729
  )
4663
4730
  );
4664
- var webSearchPreview = (0, import_provider_utils32.createProviderToolFactoryWithOutputSchema)({
4731
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema10({
4665
4732
  id: "openai.web_search_preview",
4666
4733
  inputSchema: webSearchPreviewInputSchema,
4667
4734
  outputSchema: webSearchPreviewOutputSchema
@@ -4700,7 +4767,7 @@ async function prepareResponsesTools({
4700
4767
  case "provider": {
4701
4768
  switch (tool.id) {
4702
4769
  case "openai.file_search": {
4703
- const args = await (0, import_provider_utils33.validateTypes)({
4770
+ const args = await validateTypes2({
4704
4771
  value: tool.args,
4705
4772
  schema: fileSearchArgsSchema
4706
4773
  });
@@ -4723,7 +4790,7 @@ async function prepareResponsesTools({
4723
4790
  break;
4724
4791
  }
4725
4792
  case "openai.shell": {
4726
- const args = await (0, import_provider_utils33.validateTypes)({
4793
+ const args = await validateTypes2({
4727
4794
  value: tool.args,
4728
4795
  schema: shellArgsSchema
4729
4796
  });
@@ -4742,7 +4809,7 @@ async function prepareResponsesTools({
4742
4809
  break;
4743
4810
  }
4744
4811
  case "openai.web_search_preview": {
4745
- const args = await (0, import_provider_utils33.validateTypes)({
4812
+ const args = await validateTypes2({
4746
4813
  value: tool.args,
4747
4814
  schema: webSearchPreviewArgsSchema
4748
4815
  });
@@ -4754,7 +4821,7 @@ async function prepareResponsesTools({
4754
4821
  break;
4755
4822
  }
4756
4823
  case "openai.web_search": {
4757
- const args = await (0, import_provider_utils33.validateTypes)({
4824
+ const args = await validateTypes2({
4758
4825
  value: tool.args,
4759
4826
  schema: webSearchArgsSchema
4760
4827
  });
@@ -4768,7 +4835,7 @@ async function prepareResponsesTools({
4768
4835
  break;
4769
4836
  }
4770
4837
  case "openai.code_interpreter": {
4771
- const args = await (0, import_provider_utils33.validateTypes)({
4838
+ const args = await validateTypes2({
4772
4839
  value: tool.args,
4773
4840
  schema: codeInterpreterArgsSchema
4774
4841
  });
@@ -4779,7 +4846,7 @@ async function prepareResponsesTools({
4779
4846
  break;
4780
4847
  }
4781
4848
  case "openai.image_generation": {
4782
- const args = await (0, import_provider_utils33.validateTypes)({
4849
+ const args = await validateTypes2({
4783
4850
  value: tool.args,
4784
4851
  schema: imageGenerationArgsSchema
4785
4852
  });
@@ -4802,7 +4869,7 @@ async function prepareResponsesTools({
4802
4869
  break;
4803
4870
  }
4804
4871
  case "openai.mcp": {
4805
- const args = await (0, import_provider_utils33.validateTypes)({
4872
+ const args = await validateTypes2({
4806
4873
  value: tool.args,
4807
4874
  schema: mcpArgsSchema
4808
4875
  });
@@ -4828,7 +4895,7 @@ async function prepareResponsesTools({
4828
4895
  break;
4829
4896
  }
4830
4897
  case "openai.custom": {
4831
- const args = await (0, import_provider_utils33.validateTypes)({
4898
+ const args = await validateTypes2({
4832
4899
  value: tool.args,
4833
4900
  schema: customArgsSchema
4834
4901
  });
@@ -4842,7 +4909,7 @@ async function prepareResponsesTools({
4842
4909
  break;
4843
4910
  }
4844
4911
  case "openai.tool_search": {
4845
- const args = await (0, import_provider_utils33.validateTypes)({
4912
+ const args = await validateTypes2({
4846
4913
  value: tool.args,
4847
4914
  schema: toolSearchArgsSchema
4848
4915
  });
@@ -4884,7 +4951,7 @@ async function prepareResponsesTools({
4884
4951
  }
4885
4952
  default: {
4886
4953
  const _exhaustiveCheck = type;
4887
- throw new import_provider7.UnsupportedFunctionalityError({
4954
+ throw new UnsupportedFunctionalityError5({
4888
4955
  functionality: `tool choice type: ${_exhaustiveCheck}`
4889
4956
  });
4890
4957
  }
@@ -4924,7 +4991,7 @@ function mapShellSkills(skills) {
4924
4991
  var _a, _b;
4925
4992
  return skill.type === "skillReference" ? {
4926
4993
  type: "skill_reference",
4927
- skill_id: (0, import_provider_utils33.resolveProviderReference)({
4994
+ skill_id: resolveProviderReference3({
4928
4995
  reference: (_a = skill.providerReference) != null ? _a : {},
4929
4996
  provider: "openai"
4930
4997
  }),
@@ -5007,19 +5074,19 @@ var OpenAIResponsesLanguageModel = class {
5007
5074
  warnings.push({ type: "unsupported", feature: "stopSequences" });
5008
5075
  }
5009
5076
  const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
5010
- let openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
5077
+ let openaiOptions = await parseProviderOptions7({
5011
5078
  provider: providerOptionsName,
5012
5079
  providerOptions,
5013
5080
  schema: openaiLanguageModelResponsesOptionsSchema
5014
5081
  });
5015
5082
  if (openaiOptions == null && providerOptionsName !== "openai") {
5016
- openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
5083
+ openaiOptions = await parseProviderOptions7({
5017
5084
  provider: "openai",
5018
5085
  providerOptions,
5019
5086
  schema: openaiLanguageModelResponsesOptionsSchema
5020
5087
  });
5021
5088
  }
5022
- const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : (0, import_provider_utils34.isCustomReasoning)(reasoning) ? reasoning : void 0;
5089
+ const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : isCustomReasoning2(reasoning) ? reasoning : void 0;
5023
5090
  const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
5024
5091
  if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
5025
5092
  warnings.push({
@@ -5028,7 +5095,7 @@ var OpenAIResponsesLanguageModel = class {
5028
5095
  details: "conversation and previousResponseId cannot be used together"
5029
5096
  });
5030
5097
  }
5031
- const toolNameMapping = (0, import_provider_utils34.createToolNameMapping)({
5098
+ const toolNameMapping = createToolNameMapping({
5032
5099
  tools,
5033
5100
  providerToolNames: {
5034
5101
  "openai.code_interpreter": "code_interpreter",
@@ -5242,19 +5309,19 @@ var OpenAIResponsesLanguageModel = class {
5242
5309
  responseHeaders,
5243
5310
  value: response,
5244
5311
  rawValue: rawResponse
5245
- } = await (0, import_provider_utils34.postJsonToApi)({
5312
+ } = await postJsonToApi6({
5246
5313
  url,
5247
- headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
5314
+ headers: combineHeaders7(this.config.headers(), options.headers),
5248
5315
  body,
5249
5316
  failedResponseHandler: openaiFailedResponseHandler,
5250
- successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
5317
+ successfulResponseHandler: createJsonResponseHandler6(
5251
5318
  openaiResponsesResponseSchema
5252
5319
  ),
5253
5320
  abortSignal: options.abortSignal,
5254
5321
  fetch: this.config.fetch
5255
5322
  });
5256
5323
  if (response.error) {
5257
- throw new import_provider8.APICallError({
5324
+ throw new APICallError({
5258
5325
  message: response.error.message,
5259
5326
  url,
5260
5327
  requestBodyValues: body,
@@ -5423,7 +5490,7 @@ var OpenAIResponsesLanguageModel = class {
5423
5490
  content.push({
5424
5491
  type: "source",
5425
5492
  sourceType: "url",
5426
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils34.generateId)(),
5493
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
5427
5494
  url: annotation.url,
5428
5495
  title: annotation.title
5429
5496
  });
@@ -5431,7 +5498,7 @@ var OpenAIResponsesLanguageModel = class {
5431
5498
  content.push({
5432
5499
  type: "source",
5433
5500
  sourceType: "document",
5434
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils34.generateId)(),
5501
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
5435
5502
  mediaType: "text/plain",
5436
5503
  title: annotation.filename,
5437
5504
  filename: annotation.filename,
@@ -5447,7 +5514,7 @@ var OpenAIResponsesLanguageModel = class {
5447
5514
  content.push({
5448
5515
  type: "source",
5449
5516
  sourceType: "document",
5450
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)(),
5517
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
5451
5518
  mediaType: "text/plain",
5452
5519
  title: annotation.filename,
5453
5520
  filename: annotation.filename,
@@ -5463,7 +5530,7 @@ var OpenAIResponsesLanguageModel = class {
5463
5530
  content.push({
5464
5531
  type: "source",
5465
5532
  sourceType: "document",
5466
- id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils34.generateId)(),
5533
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
5467
5534
  mediaType: "application/octet-stream",
5468
5535
  title: annotation.file_id,
5469
5536
  filename: annotation.file_id,
@@ -5567,7 +5634,7 @@ var OpenAIResponsesLanguageModel = class {
5567
5634
  }
5568
5635
  case "mcp_approval_request": {
5569
5636
  const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5570
- const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils34.generateId)();
5637
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
5571
5638
  const toolName = `mcp.${part.name}`;
5572
5639
  content.push({
5573
5640
  type: "tool-call",
@@ -5722,18 +5789,18 @@ var OpenAIResponsesLanguageModel = class {
5722
5789
  providerOptionsName,
5723
5790
  isShellProviderExecuted
5724
5791
  } = await this.getArgs(options);
5725
- const { responseHeaders, value: response } = await (0, import_provider_utils34.postJsonToApi)({
5792
+ const { responseHeaders, value: response } = await postJsonToApi6({
5726
5793
  url: this.config.url({
5727
5794
  path: "/responses",
5728
5795
  modelId: this.modelId
5729
5796
  }),
5730
- headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
5797
+ headers: combineHeaders7(this.config.headers(), options.headers),
5731
5798
  body: {
5732
5799
  ...body,
5733
5800
  stream: true
5734
5801
  },
5735
5802
  failedResponseHandler: openaiFailedResponseHandler,
5736
- successfulResponseHandler: (0, import_provider_utils34.createEventSourceResponseHandler)(
5803
+ successfulResponseHandler: createEventSourceResponseHandler3(
5737
5804
  openaiResponsesChunkSchema
5738
5805
  ),
5739
5806
  abortSignal: options.abortSignal,
@@ -6213,7 +6280,7 @@ var OpenAIResponsesLanguageModel = class {
6213
6280
  ongoingToolCalls[value.output_index] = void 0;
6214
6281
  } else if (value.item.type === "mcp_approval_request") {
6215
6282
  ongoingToolCalls[value.output_index] = void 0;
6216
- const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)();
6283
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
6217
6284
  const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
6218
6285
  approvalRequestIdToDummyToolCallIdFromStream.set(
6219
6286
  approvalRequestId,
@@ -6516,7 +6583,7 @@ var OpenAIResponsesLanguageModel = class {
6516
6583
  controller.enqueue({
6517
6584
  type: "source",
6518
6585
  sourceType: "url",
6519
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils34.generateId)(),
6586
+ id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
6520
6587
  url: value.annotation.url,
6521
6588
  title: value.annotation.title
6522
6589
  });
@@ -6524,7 +6591,7 @@ var OpenAIResponsesLanguageModel = class {
6524
6591
  controller.enqueue({
6525
6592
  type: "source",
6526
6593
  sourceType: "document",
6527
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils34.generateId)(),
6594
+ id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
6528
6595
  mediaType: "text/plain",
6529
6596
  title: value.annotation.filename,
6530
6597
  filename: value.annotation.filename,
@@ -6540,7 +6607,7 @@ var OpenAIResponsesLanguageModel = class {
6540
6607
  controller.enqueue({
6541
6608
  type: "source",
6542
6609
  sourceType: "document",
6543
- id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils34.generateId)(),
6610
+ id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : generateId2(),
6544
6611
  mediaType: "text/plain",
6545
6612
  title: value.annotation.filename,
6546
6613
  filename: value.annotation.filename,
@@ -6556,7 +6623,7 @@ var OpenAIResponsesLanguageModel = class {
6556
6623
  controller.enqueue({
6557
6624
  type: "source",
6558
6625
  sourceType: "document",
6559
- id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils34.generateId)(),
6626
+ id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : generateId2(),
6560
6627
  mediaType: "application/octet-stream",
6561
6628
  title: value.annotation.file_id,
6562
6629
  filename: value.annotation.file_id,
@@ -6667,8 +6734,7 @@ function mapWebSearchOutput(action) {
6667
6734
  function escapeJSONDelta(delta) {
6668
6735
  return JSON.stringify(delta).slice(1, -1);
6669
6736
  }
6670
- // Annotate the CommonJS export names for ESM import in node:
6671
- 0 && (module.exports = {
6737
+ export {
6672
6738
  OpenAIChatLanguageModel,
6673
6739
  OpenAICompletionLanguageModel,
6674
6740
  OpenAIEmbeddingModel,
@@ -6702,5 +6768,5 @@ function escapeJSONDelta(delta) {
6702
6768
  webSearchPreview,
6703
6769
  webSearchPreviewArgsSchema,
6704
6770
  webSearchPreviewInputSchema
6705
- });
6771
+ };
6706
6772
  //# sourceMappingURL=index.js.map