@ai-sdk/openai 4.0.0-beta.0 → 4.0.0-beta.10

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/dist/index.d.mts +69 -22
  3. package/dist/index.d.ts +69 -22
  4. package/dist/index.js +1172 -872
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1126 -821
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/internal/index.d.mts +56 -28
  9. package/dist/internal/index.d.ts +56 -28
  10. package/dist/internal/index.js +1201 -911
  11. package/dist/internal/index.js.map +1 -1
  12. package/dist/internal/index.mjs +1183 -888
  13. package/dist/internal/index.mjs.map +1 -1
  14. package/docs/03-openai.mdx +142 -3
  15. package/package.json +3 -3
  16. package/src/chat/convert-openai-chat-usage.ts +2 -2
  17. package/src/chat/convert-to-openai-chat-messages.ts +5 -5
  18. package/src/chat/map-openai-finish-reason.ts +2 -2
  19. package/src/chat/openai-chat-language-model.ts +22 -22
  20. package/src/chat/openai-chat-options.ts +5 -0
  21. package/src/chat/openai-chat-prepare-tools.ts +6 -6
  22. package/src/completion/convert-openai-completion-usage.ts +2 -2
  23. package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
  24. package/src/completion/map-openai-finish-reason.ts +2 -2
  25. package/src/completion/openai-completion-language-model.ts +20 -20
  26. package/src/embedding/openai-embedding-model.ts +5 -5
  27. package/src/image/openai-image-model.ts +9 -9
  28. package/src/openai-language-model-capabilities.ts +5 -2
  29. package/src/openai-provider.ts +21 -21
  30. package/src/openai-tools.ts +12 -1
  31. package/src/responses/convert-openai-responses-usage.ts +2 -2
  32. package/src/responses/convert-to-openai-responses-input.ts +116 -12
  33. package/src/responses/map-openai-responses-finish-reason.ts +2 -2
  34. package/src/responses/openai-responses-api.ts +87 -1
  35. package/src/responses/openai-responses-language-model.ts +168 -33
  36. package/src/responses/openai-responses-options.ts +10 -0
  37. package/src/responses/openai-responses-prepare-tools.ts +34 -9
  38. package/src/speech/openai-speech-model.ts +7 -7
  39. package/src/tool/custom.ts +0 -6
  40. package/src/tool/tool-search.ts +98 -0
  41. package/src/transcription/openai-transcription-model.ts +8 -8
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/internal/index.ts
21
- var internal_exports = {};
22
- __export(internal_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  OpenAIChatLanguageModel: () => OpenAIChatLanguageModel,
24
24
  OpenAICompletionLanguageModel: () => OpenAICompletionLanguageModel,
25
25
  OpenAIEmbeddingModel: () => OpenAIEmbeddingModel,
@@ -54,7 +54,7 @@ __export(internal_exports, {
54
54
  webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
55
55
  webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
56
56
  });
57
- module.exports = __toCommonJS(internal_exports);
57
+ module.exports = __toCommonJS(index_exports);
58
58
 
59
59
  // src/chat/openai-chat-language-model.ts
60
60
  var import_provider3 = require("@ai-sdk/provider");
@@ -84,7 +84,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
84
84
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
85
85
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
86
86
  const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
87
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
87
+ const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
88
88
  const systemMessageMode = isReasoningModel ? "developer" : "system";
89
89
  return {
90
90
  supportsFlexProcessing,
@@ -675,7 +675,7 @@ function prepareChatTools({
675
675
  // src/chat/openai-chat-language-model.ts
676
676
  var OpenAIChatLanguageModel = class {
677
677
  constructor(modelId, config) {
678
- this.specificationVersion = "v3";
678
+ this.specificationVersion = "v4";
679
679
  this.supportedUrls = {
680
680
  "image/*": [/^https?:\/\/.*$/]
681
681
  };
@@ -1410,7 +1410,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
1410
1410
  // src/completion/openai-completion-language-model.ts
1411
1411
  var OpenAICompletionLanguageModel = class {
1412
1412
  constructor(modelId, config) {
1413
- this.specificationVersion = "v3";
1413
+ this.specificationVersion = "v4";
1414
1414
  this.supportedUrls = {
1415
1415
  // No URLs are supported for completion models.
1416
1416
  };
@@ -1675,7 +1675,7 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
1675
1675
  // src/embedding/openai-embedding-model.ts
1676
1676
  var OpenAIEmbeddingModel = class {
1677
1677
  constructor(modelId, config) {
1678
- this.specificationVersion = "v3";
1678
+ this.specificationVersion = "v4";
1679
1679
  this.maxEmbeddingsPerCall = 2048;
1680
1680
  this.supportsParallelCalls = true;
1681
1681
  this.modelId = modelId;
@@ -1796,7 +1796,7 @@ var OpenAIImageModel = class {
1796
1796
  constructor(modelId, config) {
1797
1797
  this.modelId = modelId;
1798
1798
  this.config = config;
1799
- this.specificationVersion = "v3";
1799
+ this.specificationVersion = "v4";
1800
1800
  }
1801
1801
  get maxImagesPerCall() {
1802
1802
  var _a;
@@ -2117,7 +2117,7 @@ var OpenAITranscriptionModel = class {
2117
2117
  constructor(modelId, config) {
2118
2118
  this.modelId = modelId;
2119
2119
  this.config = config;
2120
- this.specificationVersion = "v3";
2120
+ this.specificationVersion = "v4";
2121
2121
  }
2122
2122
  get provider() {
2123
2123
  return this.config.provider;
@@ -2240,7 +2240,7 @@ var OpenAISpeechModel = class {
2240
2240
  constructor(modelId, config) {
2241
2241
  this.modelId = modelId;
2242
2242
  this.config = config;
2243
- this.specificationVersion = "v3";
2243
+ this.specificationVersion = "v4";
2244
2244
  }
2245
2245
  get provider() {
2246
2246
  return this.config.provider;
@@ -2338,7 +2338,7 @@ var OpenAISpeechModel = class {
2338
2338
 
2339
2339
  // src/responses/openai-responses-language-model.ts
2340
2340
  var import_provider8 = require("@ai-sdk/provider");
2341
- var import_provider_utils33 = require("@ai-sdk/provider-utils");
2341
+ var import_provider_utils34 = require("@ai-sdk/provider-utils");
2342
2342
 
2343
2343
  // src/responses/convert-openai-responses-usage.ts
2344
2344
  function convertOpenAIResponsesUsage(usage) {
@@ -2381,8 +2381,8 @@ function convertOpenAIResponsesUsage(usage) {
2381
2381
 
2382
2382
  // src/responses/convert-to-openai-responses-input.ts
2383
2383
  var import_provider6 = require("@ai-sdk/provider");
2384
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2385
- var import_v415 = require("zod/v4");
2384
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
2385
+ var import_v416 = require("zod/v4");
2386
2386
 
2387
2387
  // src/tool/apply-patch.ts
2388
2388
  var import_provider_utils19 = require("@ai-sdk/provider-utils");
@@ -2549,6 +2549,39 @@ var shell = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchem
2549
2549
  outputSchema: shellOutputSchema
2550
2550
  });
2551
2551
 
2552
+ // src/tool/tool-search.ts
2553
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
2554
+ var import_v415 = require("zod/v4");
2555
+ var toolSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
2556
+ () => (0, import_provider_utils22.zodSchema)(
2557
+ import_v415.z.object({
2558
+ execution: import_v415.z.enum(["server", "client"]).optional(),
2559
+ description: import_v415.z.string().optional(),
2560
+ parameters: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
2561
+ })
2562
+ )
2563
+ );
2564
+ var toolSearchInputSchema = (0, import_provider_utils22.lazySchema)(
2565
+ () => (0, import_provider_utils22.zodSchema)(
2566
+ import_v415.z.object({
2567
+ arguments: import_v415.z.unknown().optional(),
2568
+ call_id: import_v415.z.string().nullish()
2569
+ })
2570
+ )
2571
+ );
2572
+ var toolSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
2573
+ () => (0, import_provider_utils22.zodSchema)(
2574
+ import_v415.z.object({
2575
+ tools: import_v415.z.array(import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()))
2576
+ })
2577
+ )
2578
+ );
2579
+ var toolSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
2580
+ id: "openai.tool_search",
2581
+ inputSchema: toolSearchInputSchema,
2582
+ outputSchema: toolSearchOutputSchema
2583
+ });
2584
+
2552
2585
  // src/responses/convert-to-openai-responses-input.ts
2553
2586
  function isFileId(data, prefixes) {
2554
2587
  if (!prefixes) return false;
@@ -2567,8 +2600,8 @@ async function convertToOpenAIResponsesInput({
2567
2600
  hasApplyPatchTool = false,
2568
2601
  customProviderToolNames
2569
2602
  }) {
2570
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2571
- const input = [];
2603
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2604
+ let input = [];
2572
2605
  const warnings = [];
2573
2606
  const processedApprovalIds = /* @__PURE__ */ new Set();
2574
2607
  for (const { role, content } of prompt) {
@@ -2614,7 +2647,7 @@ async function convertToOpenAIResponsesInput({
2614
2647
  return {
2615
2648
  type: "input_image",
2616
2649
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2617
- image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
2650
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2618
2651
  },
2619
2652
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
2620
2653
  };
@@ -2629,7 +2662,7 @@ async function convertToOpenAIResponsesInput({
2629
2662
  type: "input_file",
2630
2663
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2631
2664
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2632
- file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
2665
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2633
2666
  }
2634
2667
  };
2635
2668
  } else {
@@ -2671,6 +2704,32 @@ async function convertToOpenAIResponsesInput({
2671
2704
  if (hasConversation && id != null) {
2672
2705
  break;
2673
2706
  }
2707
+ const resolvedToolName = toolNameMapping.toProviderToolName(
2708
+ part.toolName
2709
+ );
2710
+ if (resolvedToolName === "tool_search") {
2711
+ if (store && id != null) {
2712
+ input.push({ type: "item_reference", id });
2713
+ break;
2714
+ }
2715
+ const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils23.parseJSON)({
2716
+ text: part.input,
2717
+ schema: toolSearchInputSchema
2718
+ }) : await (0, import_provider_utils23.validateTypes)({
2719
+ value: part.input,
2720
+ schema: toolSearchInputSchema
2721
+ });
2722
+ const execution = parsedInput.call_id != null ? "client" : "server";
2723
+ input.push({
2724
+ type: "tool_search_call",
2725
+ id: id != null ? id : part.toolCallId,
2726
+ execution,
2727
+ call_id: (_g = parsedInput.call_id) != null ? _g : null,
2728
+ status: "completed",
2729
+ arguments: parsedInput.arguments
2730
+ });
2731
+ break;
2732
+ }
2674
2733
  if (part.providerExecuted) {
2675
2734
  if (store && id != null) {
2676
2735
  input.push({ type: "item_reference", id });
@@ -2681,11 +2740,8 @@ async function convertToOpenAIResponsesInput({
2681
2740
  input.push({ type: "item_reference", id });
2682
2741
  break;
2683
2742
  }
2684
- const resolvedToolName = toolNameMapping.toProviderToolName(
2685
- part.toolName
2686
- );
2687
2743
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2688
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2744
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2689
2745
  value: part.input,
2690
2746
  schema: localShellInputSchema
2691
2747
  });
@@ -2705,7 +2761,7 @@ async function convertToOpenAIResponsesInput({
2705
2761
  break;
2706
2762
  }
2707
2763
  if (hasShellTool && resolvedToolName === "shell") {
2708
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2764
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2709
2765
  value: part.input,
2710
2766
  schema: shellInputSchema
2711
2767
  });
@@ -2723,7 +2779,7 @@ async function convertToOpenAIResponsesInput({
2723
2779
  break;
2724
2780
  }
2725
2781
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
2726
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2782
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2727
2783
  value: part.input,
2728
2784
  schema: applyPatchInputSchema
2729
2785
  });
@@ -2766,9 +2822,29 @@ async function convertToOpenAIResponsesInput({
2766
2822
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
2767
2823
  part.toolName
2768
2824
  );
2825
+ if (resolvedResultToolName === "tool_search") {
2826
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2827
+ if (store) {
2828
+ input.push({ type: "item_reference", id: itemId });
2829
+ } else if (part.output.type === "json") {
2830
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2831
+ value: part.output.value,
2832
+ schema: toolSearchOutputSchema
2833
+ });
2834
+ input.push({
2835
+ type: "tool_search_output",
2836
+ id: itemId,
2837
+ execution: "server",
2838
+ call_id: null,
2839
+ status: "completed",
2840
+ tools: parsedOutput.tools
2841
+ });
2842
+ }
2843
+ break;
2844
+ }
2769
2845
  if (hasShellTool && resolvedResultToolName === "shell") {
2770
2846
  if (part.output.type === "json") {
2771
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
2847
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2772
2848
  value: part.output.value,
2773
2849
  schema: shellOutputSchema
2774
2850
  });
@@ -2788,7 +2864,7 @@ async function convertToOpenAIResponsesInput({
2788
2864
  break;
2789
2865
  }
2790
2866
  if (store) {
2791
- const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
2867
+ const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
2792
2868
  input.push({ type: "item_reference", id: itemId });
2793
2869
  } else {
2794
2870
  warnings.push({
@@ -2799,7 +2875,7 @@ async function convertToOpenAIResponsesInput({
2799
2875
  break;
2800
2876
  }
2801
2877
  case "reasoning": {
2802
- const providerOptions = await (0, import_provider_utils22.parseProviderOptions)({
2878
+ const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
2803
2879
  provider: providerOptionsName,
2804
2880
  providerOptions: part.providerOptions,
2805
2881
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2898,7 +2974,7 @@ async function convertToOpenAIResponsesInput({
2898
2974
  }
2899
2975
  const output = part.output;
2900
2976
  if (output.type === "execution-denied") {
2901
- const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
2977
+ const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
2902
2978
  if (approvalId) {
2903
2979
  continue;
2904
2980
  }
@@ -2906,8 +2982,22 @@ async function convertToOpenAIResponsesInput({
2906
2982
  const resolvedToolName = toolNameMapping.toProviderToolName(
2907
2983
  part.toolName
2908
2984
  );
2985
+ if (resolvedToolName === "tool_search" && output.type === "json") {
2986
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2987
+ value: output.value,
2988
+ schema: toolSearchOutputSchema
2989
+ });
2990
+ input.push({
2991
+ type: "tool_search_output",
2992
+ execution: "client",
2993
+ call_id: part.toolCallId,
2994
+ status: "completed",
2995
+ tools: parsedOutput.tools
2996
+ });
2997
+ continue;
2998
+ }
2909
2999
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
2910
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3000
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2911
3001
  value: output.value,
2912
3002
  schema: localShellOutputSchema
2913
3003
  });
@@ -2919,7 +3009,7 @@ async function convertToOpenAIResponsesInput({
2919
3009
  continue;
2920
3010
  }
2921
3011
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
2922
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3012
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2923
3013
  value: output.value,
2924
3014
  schema: shellOutputSchema
2925
3015
  });
@@ -2938,7 +3028,7 @@ async function convertToOpenAIResponsesInput({
2938
3028
  continue;
2939
3029
  }
2940
3030
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
2941
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3031
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2942
3032
  value: output.value,
2943
3033
  schema: applyPatchOutputSchema
2944
3034
  });
@@ -2958,7 +3048,7 @@ async function convertToOpenAIResponsesInput({
2958
3048
  outputValue = output.value;
2959
3049
  break;
2960
3050
  case "execution-denied":
2961
- outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3051
+ outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
2962
3052
  break;
2963
3053
  case "json":
2964
3054
  case "error-json":
@@ -2993,7 +3083,7 @@ async function convertToOpenAIResponsesInput({
2993
3083
  });
2994
3084
  return void 0;
2995
3085
  }
2996
- }).filter(import_provider_utils22.isNonNullable);
3086
+ }).filter(import_provider_utils23.isNonNullable);
2997
3087
  break;
2998
3088
  default:
2999
3089
  outputValue = "";
@@ -3012,7 +3102,7 @@ async function convertToOpenAIResponsesInput({
3012
3102
  contentValue = output.value;
3013
3103
  break;
3014
3104
  case "execution-denied":
3015
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3105
+ contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
3016
3106
  break;
3017
3107
  case "json":
3018
3108
  case "error-json":
@@ -3052,7 +3142,7 @@ async function convertToOpenAIResponsesInput({
3052
3142
  return void 0;
3053
3143
  }
3054
3144
  }
3055
- }).filter(import_provider_utils22.isNonNullable);
3145
+ }).filter(import_provider_utils23.isNonNullable);
3056
3146
  break;
3057
3147
  }
3058
3148
  input.push({
@@ -3069,11 +3159,22 @@ async function convertToOpenAIResponsesInput({
3069
3159
  }
3070
3160
  }
3071
3161
  }
3162
+ if (!store && input.some(
3163
+ (item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
3164
+ )) {
3165
+ warnings.push({
3166
+ type: "other",
3167
+ message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
3168
+ });
3169
+ input = input.filter(
3170
+ (item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
3171
+ );
3172
+ }
3072
3173
  return { input, warnings };
3073
3174
  }
3074
- var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
3075
- itemId: import_v415.z.string().nullish(),
3076
- reasoningEncryptedContent: import_v415.z.string().nullish()
3175
+ var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
3176
+ itemId: import_v416.z.string().nullish(),
3177
+ reasoningEncryptedContent: import_v416.z.string().nullish()
3077
3178
  });
3078
3179
 
3079
3180
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3095,483 +3196,525 @@ function mapOpenAIResponseFinishReason({
3095
3196
  }
3096
3197
 
3097
3198
  // src/responses/openai-responses-api.ts
3098
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
3099
- var import_v416 = require("zod/v4");
3100
- var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3101
- () => (0, import_provider_utils23.zodSchema)(
3102
- import_v416.z.union([
3103
- import_v416.z.object({
3104
- type: import_v416.z.literal("response.output_text.delta"),
3105
- item_id: import_v416.z.string(),
3106
- delta: import_v416.z.string(),
3107
- logprobs: import_v416.z.array(
3108
- import_v416.z.object({
3109
- token: import_v416.z.string(),
3110
- logprob: import_v416.z.number(),
3111
- top_logprobs: import_v416.z.array(
3112
- import_v416.z.object({
3113
- token: import_v416.z.string(),
3114
- logprob: import_v416.z.number()
3199
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
3200
+ var import_v417 = require("zod/v4");
3201
+ var jsonValueSchema = import_v417.z.lazy(
3202
+ () => import_v417.z.union([
3203
+ import_v417.z.string(),
3204
+ import_v417.z.number(),
3205
+ import_v417.z.boolean(),
3206
+ import_v417.z.null(),
3207
+ import_v417.z.array(jsonValueSchema),
3208
+ import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional())
3209
+ ])
3210
+ );
3211
+ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
3212
+ () => (0, import_provider_utils24.zodSchema)(
3213
+ import_v417.z.union([
3214
+ import_v417.z.object({
3215
+ type: import_v417.z.literal("response.output_text.delta"),
3216
+ item_id: import_v417.z.string(),
3217
+ delta: import_v417.z.string(),
3218
+ logprobs: import_v417.z.array(
3219
+ import_v417.z.object({
3220
+ token: import_v417.z.string(),
3221
+ logprob: import_v417.z.number(),
3222
+ top_logprobs: import_v417.z.array(
3223
+ import_v417.z.object({
3224
+ token: import_v417.z.string(),
3225
+ logprob: import_v417.z.number()
3115
3226
  })
3116
3227
  )
3117
3228
  })
3118
3229
  ).nullish()
3119
3230
  }),
3120
- import_v416.z.object({
3121
- type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3122
- response: import_v416.z.object({
3123
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3124
- usage: import_v416.z.object({
3125
- input_tokens: import_v416.z.number(),
3126
- input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3127
- output_tokens: import_v416.z.number(),
3128
- output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3231
+ import_v417.z.object({
3232
+ type: import_v417.z.enum(["response.completed", "response.incomplete"]),
3233
+ response: import_v417.z.object({
3234
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3235
+ usage: import_v417.z.object({
3236
+ input_tokens: import_v417.z.number(),
3237
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3238
+ output_tokens: import_v417.z.number(),
3239
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3129
3240
  }),
3130
- service_tier: import_v416.z.string().nullish()
3241
+ service_tier: import_v417.z.string().nullish()
3131
3242
  })
3132
3243
  }),
3133
- import_v416.z.object({
3134
- type: import_v416.z.literal("response.created"),
3135
- response: import_v416.z.object({
3136
- id: import_v416.z.string(),
3137
- created_at: import_v416.z.number(),
3138
- model: import_v416.z.string(),
3139
- service_tier: import_v416.z.string().nullish()
3244
+ import_v417.z.object({
3245
+ type: import_v417.z.literal("response.created"),
3246
+ response: import_v417.z.object({
3247
+ id: import_v417.z.string(),
3248
+ created_at: import_v417.z.number(),
3249
+ model: import_v417.z.string(),
3250
+ service_tier: import_v417.z.string().nullish()
3140
3251
  })
3141
3252
  }),
3142
- import_v416.z.object({
3143
- type: import_v416.z.literal("response.output_item.added"),
3144
- output_index: import_v416.z.number(),
3145
- item: import_v416.z.discriminatedUnion("type", [
3146
- import_v416.z.object({
3147
- type: import_v416.z.literal("message"),
3148
- id: import_v416.z.string(),
3149
- phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
3253
+ import_v417.z.object({
3254
+ type: import_v417.z.literal("response.output_item.added"),
3255
+ output_index: import_v417.z.number(),
3256
+ item: import_v417.z.discriminatedUnion("type", [
3257
+ import_v417.z.object({
3258
+ type: import_v417.z.literal("message"),
3259
+ id: import_v417.z.string(),
3260
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3150
3261
  }),
3151
- import_v416.z.object({
3152
- type: import_v416.z.literal("reasoning"),
3153
- id: import_v416.z.string(),
3154
- encrypted_content: import_v416.z.string().nullish()
3262
+ import_v417.z.object({
3263
+ type: import_v417.z.literal("reasoning"),
3264
+ id: import_v417.z.string(),
3265
+ encrypted_content: import_v417.z.string().nullish()
3155
3266
  }),
3156
- import_v416.z.object({
3157
- type: import_v416.z.literal("function_call"),
3158
- id: import_v416.z.string(),
3159
- call_id: import_v416.z.string(),
3160
- name: import_v416.z.string(),
3161
- arguments: import_v416.z.string()
3267
+ import_v417.z.object({
3268
+ type: import_v417.z.literal("function_call"),
3269
+ id: import_v417.z.string(),
3270
+ call_id: import_v417.z.string(),
3271
+ name: import_v417.z.string(),
3272
+ arguments: import_v417.z.string()
3162
3273
  }),
3163
- import_v416.z.object({
3164
- type: import_v416.z.literal("web_search_call"),
3165
- id: import_v416.z.string(),
3166
- status: import_v416.z.string()
3274
+ import_v417.z.object({
3275
+ type: import_v417.z.literal("web_search_call"),
3276
+ id: import_v417.z.string(),
3277
+ status: import_v417.z.string()
3167
3278
  }),
3168
- import_v416.z.object({
3169
- type: import_v416.z.literal("computer_call"),
3170
- id: import_v416.z.string(),
3171
- status: import_v416.z.string()
3279
+ import_v417.z.object({
3280
+ type: import_v417.z.literal("computer_call"),
3281
+ id: import_v417.z.string(),
3282
+ status: import_v417.z.string()
3172
3283
  }),
3173
- import_v416.z.object({
3174
- type: import_v416.z.literal("file_search_call"),
3175
- id: import_v416.z.string()
3284
+ import_v417.z.object({
3285
+ type: import_v417.z.literal("file_search_call"),
3286
+ id: import_v417.z.string()
3176
3287
  }),
3177
- import_v416.z.object({
3178
- type: import_v416.z.literal("image_generation_call"),
3179
- id: import_v416.z.string()
3288
+ import_v417.z.object({
3289
+ type: import_v417.z.literal("image_generation_call"),
3290
+ id: import_v417.z.string()
3180
3291
  }),
3181
- import_v416.z.object({
3182
- type: import_v416.z.literal("code_interpreter_call"),
3183
- id: import_v416.z.string(),
3184
- container_id: import_v416.z.string(),
3185
- code: import_v416.z.string().nullable(),
3186
- outputs: import_v416.z.array(
3187
- import_v416.z.discriminatedUnion("type", [
3188
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3189
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3292
+ import_v417.z.object({
3293
+ type: import_v417.z.literal("code_interpreter_call"),
3294
+ id: import_v417.z.string(),
3295
+ container_id: import_v417.z.string(),
3296
+ code: import_v417.z.string().nullable(),
3297
+ outputs: import_v417.z.array(
3298
+ import_v417.z.discriminatedUnion("type", [
3299
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3300
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3190
3301
  ])
3191
3302
  ).nullable(),
3192
- status: import_v416.z.string()
3303
+ status: import_v417.z.string()
3193
3304
  }),
3194
- import_v416.z.object({
3195
- type: import_v416.z.literal("mcp_call"),
3196
- id: import_v416.z.string(),
3197
- status: import_v416.z.string(),
3198
- approval_request_id: import_v416.z.string().nullish()
3305
+ import_v417.z.object({
3306
+ type: import_v417.z.literal("mcp_call"),
3307
+ id: import_v417.z.string(),
3308
+ status: import_v417.z.string(),
3309
+ approval_request_id: import_v417.z.string().nullish()
3199
3310
  }),
3200
- import_v416.z.object({
3201
- type: import_v416.z.literal("mcp_list_tools"),
3202
- id: import_v416.z.string()
3311
+ import_v417.z.object({
3312
+ type: import_v417.z.literal("mcp_list_tools"),
3313
+ id: import_v417.z.string()
3203
3314
  }),
3204
- import_v416.z.object({
3205
- type: import_v416.z.literal("mcp_approval_request"),
3206
- id: import_v416.z.string()
3315
+ import_v417.z.object({
3316
+ type: import_v417.z.literal("mcp_approval_request"),
3317
+ id: import_v417.z.string()
3207
3318
  }),
3208
- import_v416.z.object({
3209
- type: import_v416.z.literal("apply_patch_call"),
3210
- id: import_v416.z.string(),
3211
- call_id: import_v416.z.string(),
3212
- status: import_v416.z.enum(["in_progress", "completed"]),
3213
- operation: import_v416.z.discriminatedUnion("type", [
3214
- import_v416.z.object({
3215
- type: import_v416.z.literal("create_file"),
3216
- path: import_v416.z.string(),
3217
- diff: import_v416.z.string()
3319
+ import_v417.z.object({
3320
+ type: import_v417.z.literal("apply_patch_call"),
3321
+ id: import_v417.z.string(),
3322
+ call_id: import_v417.z.string(),
3323
+ status: import_v417.z.enum(["in_progress", "completed"]),
3324
+ operation: import_v417.z.discriminatedUnion("type", [
3325
+ import_v417.z.object({
3326
+ type: import_v417.z.literal("create_file"),
3327
+ path: import_v417.z.string(),
3328
+ diff: import_v417.z.string()
3218
3329
  }),
3219
- import_v416.z.object({
3220
- type: import_v416.z.literal("delete_file"),
3221
- path: import_v416.z.string()
3330
+ import_v417.z.object({
3331
+ type: import_v417.z.literal("delete_file"),
3332
+ path: import_v417.z.string()
3222
3333
  }),
3223
- import_v416.z.object({
3224
- type: import_v416.z.literal("update_file"),
3225
- path: import_v416.z.string(),
3226
- diff: import_v416.z.string()
3334
+ import_v417.z.object({
3335
+ type: import_v417.z.literal("update_file"),
3336
+ path: import_v417.z.string(),
3337
+ diff: import_v417.z.string()
3227
3338
  })
3228
3339
  ])
3229
3340
  }),
3230
- import_v416.z.object({
3231
- type: import_v416.z.literal("custom_tool_call"),
3232
- id: import_v416.z.string(),
3233
- call_id: import_v416.z.string(),
3234
- name: import_v416.z.string(),
3235
- input: import_v416.z.string()
3341
+ import_v417.z.object({
3342
+ type: import_v417.z.literal("custom_tool_call"),
3343
+ id: import_v417.z.string(),
3344
+ call_id: import_v417.z.string(),
3345
+ name: import_v417.z.string(),
3346
+ input: import_v417.z.string()
3236
3347
  }),
3237
- import_v416.z.object({
3238
- type: import_v416.z.literal("shell_call"),
3239
- id: import_v416.z.string(),
3240
- call_id: import_v416.z.string(),
3241
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3242
- action: import_v416.z.object({
3243
- commands: import_v416.z.array(import_v416.z.string())
3348
+ import_v417.z.object({
3349
+ type: import_v417.z.literal("shell_call"),
3350
+ id: import_v417.z.string(),
3351
+ call_id: import_v417.z.string(),
3352
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3353
+ action: import_v417.z.object({
3354
+ commands: import_v417.z.array(import_v417.z.string())
3244
3355
  })
3245
3356
  }),
3246
- import_v416.z.object({
3247
- type: import_v416.z.literal("shell_call_output"),
3248
- id: import_v416.z.string(),
3249
- call_id: import_v416.z.string(),
3250
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3251
- output: import_v416.z.array(
3252
- import_v416.z.object({
3253
- stdout: import_v416.z.string(),
3254
- stderr: import_v416.z.string(),
3255
- outcome: import_v416.z.discriminatedUnion("type", [
3256
- import_v416.z.object({ type: import_v416.z.literal("timeout") }),
3257
- import_v416.z.object({
3258
- type: import_v416.z.literal("exit"),
3259
- exit_code: import_v416.z.number()
3357
+ import_v417.z.object({
3358
+ type: import_v417.z.literal("shell_call_output"),
3359
+ id: import_v417.z.string(),
3360
+ call_id: import_v417.z.string(),
3361
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3362
+ output: import_v417.z.array(
3363
+ import_v417.z.object({
3364
+ stdout: import_v417.z.string(),
3365
+ stderr: import_v417.z.string(),
3366
+ outcome: import_v417.z.discriminatedUnion("type", [
3367
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3368
+ import_v417.z.object({
3369
+ type: import_v417.z.literal("exit"),
3370
+ exit_code: import_v417.z.number()
3260
3371
  })
3261
3372
  ])
3262
3373
  })
3263
3374
  )
3375
+ }),
3376
+ import_v417.z.object({
3377
+ type: import_v417.z.literal("tool_search_call"),
3378
+ id: import_v417.z.string(),
3379
+ execution: import_v417.z.enum(["server", "client"]),
3380
+ call_id: import_v417.z.string().nullable(),
3381
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3382
+ arguments: import_v417.z.unknown()
3383
+ }),
3384
+ import_v417.z.object({
3385
+ type: import_v417.z.literal("tool_search_output"),
3386
+ id: import_v417.z.string(),
3387
+ execution: import_v417.z.enum(["server", "client"]),
3388
+ call_id: import_v417.z.string().nullable(),
3389
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3390
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3264
3391
  })
3265
3392
  ])
3266
3393
  }),
3267
- import_v416.z.object({
3268
- type: import_v416.z.literal("response.output_item.done"),
3269
- output_index: import_v416.z.number(),
3270
- item: import_v416.z.discriminatedUnion("type", [
3271
- import_v416.z.object({
3272
- type: import_v416.z.literal("message"),
3273
- id: import_v416.z.string(),
3274
- phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
3394
+ import_v417.z.object({
3395
+ type: import_v417.z.literal("response.output_item.done"),
3396
+ output_index: import_v417.z.number(),
3397
+ item: import_v417.z.discriminatedUnion("type", [
3398
+ import_v417.z.object({
3399
+ type: import_v417.z.literal("message"),
3400
+ id: import_v417.z.string(),
3401
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3275
3402
  }),
3276
- import_v416.z.object({
3277
- type: import_v416.z.literal("reasoning"),
3278
- id: import_v416.z.string(),
3279
- encrypted_content: import_v416.z.string().nullish()
3403
+ import_v417.z.object({
3404
+ type: import_v417.z.literal("reasoning"),
3405
+ id: import_v417.z.string(),
3406
+ encrypted_content: import_v417.z.string().nullish()
3280
3407
  }),
3281
- import_v416.z.object({
3282
- type: import_v416.z.literal("function_call"),
3283
- id: import_v416.z.string(),
3284
- call_id: import_v416.z.string(),
3285
- name: import_v416.z.string(),
3286
- arguments: import_v416.z.string(),
3287
- status: import_v416.z.literal("completed")
3408
+ import_v417.z.object({
3409
+ type: import_v417.z.literal("function_call"),
3410
+ id: import_v417.z.string(),
3411
+ call_id: import_v417.z.string(),
3412
+ name: import_v417.z.string(),
3413
+ arguments: import_v417.z.string(),
3414
+ status: import_v417.z.literal("completed")
3288
3415
  }),
3289
- import_v416.z.object({
3290
- type: import_v416.z.literal("custom_tool_call"),
3291
- id: import_v416.z.string(),
3292
- call_id: import_v416.z.string(),
3293
- name: import_v416.z.string(),
3294
- input: import_v416.z.string(),
3295
- status: import_v416.z.literal("completed")
3416
+ import_v417.z.object({
3417
+ type: import_v417.z.literal("custom_tool_call"),
3418
+ id: import_v417.z.string(),
3419
+ call_id: import_v417.z.string(),
3420
+ name: import_v417.z.string(),
3421
+ input: import_v417.z.string(),
3422
+ status: import_v417.z.literal("completed")
3296
3423
  }),
3297
- import_v416.z.object({
3298
- type: import_v416.z.literal("code_interpreter_call"),
3299
- id: import_v416.z.string(),
3300
- code: import_v416.z.string().nullable(),
3301
- container_id: import_v416.z.string(),
3302
- outputs: import_v416.z.array(
3303
- import_v416.z.discriminatedUnion("type", [
3304
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3305
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3424
+ import_v417.z.object({
3425
+ type: import_v417.z.literal("code_interpreter_call"),
3426
+ id: import_v417.z.string(),
3427
+ code: import_v417.z.string().nullable(),
3428
+ container_id: import_v417.z.string(),
3429
+ outputs: import_v417.z.array(
3430
+ import_v417.z.discriminatedUnion("type", [
3431
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3432
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3306
3433
  ])
3307
3434
  ).nullable()
3308
3435
  }),
3309
- import_v416.z.object({
3310
- type: import_v416.z.literal("image_generation_call"),
3311
- id: import_v416.z.string(),
3312
- result: import_v416.z.string()
3436
+ import_v417.z.object({
3437
+ type: import_v417.z.literal("image_generation_call"),
3438
+ id: import_v417.z.string(),
3439
+ result: import_v417.z.string()
3313
3440
  }),
3314
- import_v416.z.object({
3315
- type: import_v416.z.literal("web_search_call"),
3316
- id: import_v416.z.string(),
3317
- status: import_v416.z.string(),
3318
- action: import_v416.z.discriminatedUnion("type", [
3319
- import_v416.z.object({
3320
- type: import_v416.z.literal("search"),
3321
- query: import_v416.z.string().nullish(),
3322
- sources: import_v416.z.array(
3323
- import_v416.z.discriminatedUnion("type", [
3324
- import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
3325
- import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
3441
+ import_v417.z.object({
3442
+ type: import_v417.z.literal("web_search_call"),
3443
+ id: import_v417.z.string(),
3444
+ status: import_v417.z.string(),
3445
+ action: import_v417.z.discriminatedUnion("type", [
3446
+ import_v417.z.object({
3447
+ type: import_v417.z.literal("search"),
3448
+ query: import_v417.z.string().nullish(),
3449
+ sources: import_v417.z.array(
3450
+ import_v417.z.discriminatedUnion("type", [
3451
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3452
+ import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
3326
3453
  ])
3327
3454
  ).nullish()
3328
3455
  }),
3329
- import_v416.z.object({
3330
- type: import_v416.z.literal("open_page"),
3331
- url: import_v416.z.string().nullish()
3456
+ import_v417.z.object({
3457
+ type: import_v417.z.literal("open_page"),
3458
+ url: import_v417.z.string().nullish()
3332
3459
  }),
3333
- import_v416.z.object({
3334
- type: import_v416.z.literal("find_in_page"),
3335
- url: import_v416.z.string().nullish(),
3336
- pattern: import_v416.z.string().nullish()
3460
+ import_v417.z.object({
3461
+ type: import_v417.z.literal("find_in_page"),
3462
+ url: import_v417.z.string().nullish(),
3463
+ pattern: import_v417.z.string().nullish()
3337
3464
  })
3338
3465
  ]).nullish()
3339
3466
  }),
3340
- import_v416.z.object({
3341
- type: import_v416.z.literal("file_search_call"),
3342
- id: import_v416.z.string(),
3343
- queries: import_v416.z.array(import_v416.z.string()),
3344
- results: import_v416.z.array(
3345
- import_v416.z.object({
3346
- attributes: import_v416.z.record(
3347
- import_v416.z.string(),
3348
- import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
3467
+ import_v417.z.object({
3468
+ type: import_v417.z.literal("file_search_call"),
3469
+ id: import_v417.z.string(),
3470
+ queries: import_v417.z.array(import_v417.z.string()),
3471
+ results: import_v417.z.array(
3472
+ import_v417.z.object({
3473
+ attributes: import_v417.z.record(
3474
+ import_v417.z.string(),
3475
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3349
3476
  ),
3350
- file_id: import_v416.z.string(),
3351
- filename: import_v416.z.string(),
3352
- score: import_v416.z.number(),
3353
- text: import_v416.z.string()
3477
+ file_id: import_v417.z.string(),
3478
+ filename: import_v417.z.string(),
3479
+ score: import_v417.z.number(),
3480
+ text: import_v417.z.string()
3354
3481
  })
3355
3482
  ).nullish()
3356
3483
  }),
3357
- import_v416.z.object({
3358
- type: import_v416.z.literal("local_shell_call"),
3359
- id: import_v416.z.string(),
3360
- call_id: import_v416.z.string(),
3361
- action: import_v416.z.object({
3362
- type: import_v416.z.literal("exec"),
3363
- command: import_v416.z.array(import_v416.z.string()),
3364
- timeout_ms: import_v416.z.number().optional(),
3365
- user: import_v416.z.string().optional(),
3366
- working_directory: import_v416.z.string().optional(),
3367
- env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
3484
+ import_v417.z.object({
3485
+ type: import_v417.z.literal("local_shell_call"),
3486
+ id: import_v417.z.string(),
3487
+ call_id: import_v417.z.string(),
3488
+ action: import_v417.z.object({
3489
+ type: import_v417.z.literal("exec"),
3490
+ command: import_v417.z.array(import_v417.z.string()),
3491
+ timeout_ms: import_v417.z.number().optional(),
3492
+ user: import_v417.z.string().optional(),
3493
+ working_directory: import_v417.z.string().optional(),
3494
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3368
3495
  })
3369
3496
  }),
3370
- import_v416.z.object({
3371
- type: import_v416.z.literal("computer_call"),
3372
- id: import_v416.z.string(),
3373
- status: import_v416.z.literal("completed")
3497
+ import_v417.z.object({
3498
+ type: import_v417.z.literal("computer_call"),
3499
+ id: import_v417.z.string(),
3500
+ status: import_v417.z.literal("completed")
3374
3501
  }),
3375
- import_v416.z.object({
3376
- type: import_v416.z.literal("mcp_call"),
3377
- id: import_v416.z.string(),
3378
- status: import_v416.z.string(),
3379
- arguments: import_v416.z.string(),
3380
- name: import_v416.z.string(),
3381
- server_label: import_v416.z.string(),
3382
- output: import_v416.z.string().nullish(),
3383
- error: import_v416.z.union([
3384
- import_v416.z.string(),
3385
- import_v416.z.object({
3386
- type: import_v416.z.string().optional(),
3387
- code: import_v416.z.union([import_v416.z.number(), import_v416.z.string()]).optional(),
3388
- message: import_v416.z.string().optional()
3502
+ import_v417.z.object({
3503
+ type: import_v417.z.literal("mcp_call"),
3504
+ id: import_v417.z.string(),
3505
+ status: import_v417.z.string(),
3506
+ arguments: import_v417.z.string(),
3507
+ name: import_v417.z.string(),
3508
+ server_label: import_v417.z.string(),
3509
+ output: import_v417.z.string().nullish(),
3510
+ error: import_v417.z.union([
3511
+ import_v417.z.string(),
3512
+ import_v417.z.object({
3513
+ type: import_v417.z.string().optional(),
3514
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3515
+ message: import_v417.z.string().optional()
3389
3516
  }).loose()
3390
3517
  ]).nullish(),
3391
- approval_request_id: import_v416.z.string().nullish()
3518
+ approval_request_id: import_v417.z.string().nullish()
3392
3519
  }),
3393
- import_v416.z.object({
3394
- type: import_v416.z.literal("mcp_list_tools"),
3395
- id: import_v416.z.string(),
3396
- server_label: import_v416.z.string(),
3397
- tools: import_v416.z.array(
3398
- import_v416.z.object({
3399
- name: import_v416.z.string(),
3400
- description: import_v416.z.string().optional(),
3401
- input_schema: import_v416.z.any(),
3402
- annotations: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()).optional()
3520
+ import_v417.z.object({
3521
+ type: import_v417.z.literal("mcp_list_tools"),
3522
+ id: import_v417.z.string(),
3523
+ server_label: import_v417.z.string(),
3524
+ tools: import_v417.z.array(
3525
+ import_v417.z.object({
3526
+ name: import_v417.z.string(),
3527
+ description: import_v417.z.string().optional(),
3528
+ input_schema: import_v417.z.any(),
3529
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3403
3530
  })
3404
3531
  ),
3405
- error: import_v416.z.union([
3406
- import_v416.z.string(),
3407
- import_v416.z.object({
3408
- type: import_v416.z.string().optional(),
3409
- code: import_v416.z.union([import_v416.z.number(), import_v416.z.string()]).optional(),
3410
- message: import_v416.z.string().optional()
3532
+ error: import_v417.z.union([
3533
+ import_v417.z.string(),
3534
+ import_v417.z.object({
3535
+ type: import_v417.z.string().optional(),
3536
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3537
+ message: import_v417.z.string().optional()
3411
3538
  }).loose()
3412
3539
  ]).optional()
3413
3540
  }),
3414
- import_v416.z.object({
3415
- type: import_v416.z.literal("mcp_approval_request"),
3416
- id: import_v416.z.string(),
3417
- server_label: import_v416.z.string(),
3418
- name: import_v416.z.string(),
3419
- arguments: import_v416.z.string(),
3420
- approval_request_id: import_v416.z.string().optional()
3541
+ import_v417.z.object({
3542
+ type: import_v417.z.literal("mcp_approval_request"),
3543
+ id: import_v417.z.string(),
3544
+ server_label: import_v417.z.string(),
3545
+ name: import_v417.z.string(),
3546
+ arguments: import_v417.z.string(),
3547
+ approval_request_id: import_v417.z.string().optional()
3421
3548
  }),
3422
- import_v416.z.object({
3423
- type: import_v416.z.literal("apply_patch_call"),
3424
- id: import_v416.z.string(),
3425
- call_id: import_v416.z.string(),
3426
- status: import_v416.z.enum(["in_progress", "completed"]),
3427
- operation: import_v416.z.discriminatedUnion("type", [
3428
- import_v416.z.object({
3429
- type: import_v416.z.literal("create_file"),
3430
- path: import_v416.z.string(),
3431
- diff: import_v416.z.string()
3549
+ import_v417.z.object({
3550
+ type: import_v417.z.literal("apply_patch_call"),
3551
+ id: import_v417.z.string(),
3552
+ call_id: import_v417.z.string(),
3553
+ status: import_v417.z.enum(["in_progress", "completed"]),
3554
+ operation: import_v417.z.discriminatedUnion("type", [
3555
+ import_v417.z.object({
3556
+ type: import_v417.z.literal("create_file"),
3557
+ path: import_v417.z.string(),
3558
+ diff: import_v417.z.string()
3432
3559
  }),
3433
- import_v416.z.object({
3434
- type: import_v416.z.literal("delete_file"),
3435
- path: import_v416.z.string()
3560
+ import_v417.z.object({
3561
+ type: import_v417.z.literal("delete_file"),
3562
+ path: import_v417.z.string()
3436
3563
  }),
3437
- import_v416.z.object({
3438
- type: import_v416.z.literal("update_file"),
3439
- path: import_v416.z.string(),
3440
- diff: import_v416.z.string()
3564
+ import_v417.z.object({
3565
+ type: import_v417.z.literal("update_file"),
3566
+ path: import_v417.z.string(),
3567
+ diff: import_v417.z.string()
3441
3568
  })
3442
3569
  ])
3443
3570
  }),
3444
- import_v416.z.object({
3445
- type: import_v416.z.literal("shell_call"),
3446
- id: import_v416.z.string(),
3447
- call_id: import_v416.z.string(),
3448
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3449
- action: import_v416.z.object({
3450
- commands: import_v416.z.array(import_v416.z.string())
3571
+ import_v417.z.object({
3572
+ type: import_v417.z.literal("shell_call"),
3573
+ id: import_v417.z.string(),
3574
+ call_id: import_v417.z.string(),
3575
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3576
+ action: import_v417.z.object({
3577
+ commands: import_v417.z.array(import_v417.z.string())
3451
3578
  })
3452
3579
  }),
3453
- import_v416.z.object({
3454
- type: import_v416.z.literal("shell_call_output"),
3455
- id: import_v416.z.string(),
3456
- call_id: import_v416.z.string(),
3457
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3458
- output: import_v416.z.array(
3459
- import_v416.z.object({
3460
- stdout: import_v416.z.string(),
3461
- stderr: import_v416.z.string(),
3462
- outcome: import_v416.z.discriminatedUnion("type", [
3463
- import_v416.z.object({ type: import_v416.z.literal("timeout") }),
3464
- import_v416.z.object({
3465
- type: import_v416.z.literal("exit"),
3466
- exit_code: import_v416.z.number()
3580
+ import_v417.z.object({
3581
+ type: import_v417.z.literal("shell_call_output"),
3582
+ id: import_v417.z.string(),
3583
+ call_id: import_v417.z.string(),
3584
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3585
+ output: import_v417.z.array(
3586
+ import_v417.z.object({
3587
+ stdout: import_v417.z.string(),
3588
+ stderr: import_v417.z.string(),
3589
+ outcome: import_v417.z.discriminatedUnion("type", [
3590
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3591
+ import_v417.z.object({
3592
+ type: import_v417.z.literal("exit"),
3593
+ exit_code: import_v417.z.number()
3467
3594
  })
3468
3595
  ])
3469
3596
  })
3470
3597
  )
3598
+ }),
3599
+ import_v417.z.object({
3600
+ type: import_v417.z.literal("tool_search_call"),
3601
+ id: import_v417.z.string(),
3602
+ execution: import_v417.z.enum(["server", "client"]),
3603
+ call_id: import_v417.z.string().nullable(),
3604
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3605
+ arguments: import_v417.z.unknown()
3606
+ }),
3607
+ import_v417.z.object({
3608
+ type: import_v417.z.literal("tool_search_output"),
3609
+ id: import_v417.z.string(),
3610
+ execution: import_v417.z.enum(["server", "client"]),
3611
+ call_id: import_v417.z.string().nullable(),
3612
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3613
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3471
3614
  })
3472
3615
  ])
3473
3616
  }),
3474
- import_v416.z.object({
3475
- type: import_v416.z.literal("response.function_call_arguments.delta"),
3476
- item_id: import_v416.z.string(),
3477
- output_index: import_v416.z.number(),
3478
- delta: import_v416.z.string()
3617
+ import_v417.z.object({
3618
+ type: import_v417.z.literal("response.function_call_arguments.delta"),
3619
+ item_id: import_v417.z.string(),
3620
+ output_index: import_v417.z.number(),
3621
+ delta: import_v417.z.string()
3479
3622
  }),
3480
- import_v416.z.object({
3481
- type: import_v416.z.literal("response.custom_tool_call_input.delta"),
3482
- item_id: import_v416.z.string(),
3483
- output_index: import_v416.z.number(),
3484
- delta: import_v416.z.string()
3623
+ import_v417.z.object({
3624
+ type: import_v417.z.literal("response.custom_tool_call_input.delta"),
3625
+ item_id: import_v417.z.string(),
3626
+ output_index: import_v417.z.number(),
3627
+ delta: import_v417.z.string()
3485
3628
  }),
3486
- import_v416.z.object({
3487
- type: import_v416.z.literal("response.image_generation_call.partial_image"),
3488
- item_id: import_v416.z.string(),
3489
- output_index: import_v416.z.number(),
3490
- partial_image_b64: import_v416.z.string()
3629
+ import_v417.z.object({
3630
+ type: import_v417.z.literal("response.image_generation_call.partial_image"),
3631
+ item_id: import_v417.z.string(),
3632
+ output_index: import_v417.z.number(),
3633
+ partial_image_b64: import_v417.z.string()
3491
3634
  }),
3492
- import_v416.z.object({
3493
- type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
3494
- item_id: import_v416.z.string(),
3495
- output_index: import_v416.z.number(),
3496
- delta: import_v416.z.string()
3635
+ import_v417.z.object({
3636
+ type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
3637
+ item_id: import_v417.z.string(),
3638
+ output_index: import_v417.z.number(),
3639
+ delta: import_v417.z.string()
3497
3640
  }),
3498
- import_v416.z.object({
3499
- type: import_v416.z.literal("response.code_interpreter_call_code.done"),
3500
- item_id: import_v416.z.string(),
3501
- output_index: import_v416.z.number(),
3502
- code: import_v416.z.string()
3641
+ import_v417.z.object({
3642
+ type: import_v417.z.literal("response.code_interpreter_call_code.done"),
3643
+ item_id: import_v417.z.string(),
3644
+ output_index: import_v417.z.number(),
3645
+ code: import_v417.z.string()
3503
3646
  }),
3504
- import_v416.z.object({
3505
- type: import_v416.z.literal("response.output_text.annotation.added"),
3506
- annotation: import_v416.z.discriminatedUnion("type", [
3507
- import_v416.z.object({
3508
- type: import_v416.z.literal("url_citation"),
3509
- start_index: import_v416.z.number(),
3510
- end_index: import_v416.z.number(),
3511
- url: import_v416.z.string(),
3512
- title: import_v416.z.string()
3647
+ import_v417.z.object({
3648
+ type: import_v417.z.literal("response.output_text.annotation.added"),
3649
+ annotation: import_v417.z.discriminatedUnion("type", [
3650
+ import_v417.z.object({
3651
+ type: import_v417.z.literal("url_citation"),
3652
+ start_index: import_v417.z.number(),
3653
+ end_index: import_v417.z.number(),
3654
+ url: import_v417.z.string(),
3655
+ title: import_v417.z.string()
3513
3656
  }),
3514
- import_v416.z.object({
3515
- type: import_v416.z.literal("file_citation"),
3516
- file_id: import_v416.z.string(),
3517
- filename: import_v416.z.string(),
3518
- index: import_v416.z.number()
3657
+ import_v417.z.object({
3658
+ type: import_v417.z.literal("file_citation"),
3659
+ file_id: import_v417.z.string(),
3660
+ filename: import_v417.z.string(),
3661
+ index: import_v417.z.number()
3519
3662
  }),
3520
- import_v416.z.object({
3521
- type: import_v416.z.literal("container_file_citation"),
3522
- container_id: import_v416.z.string(),
3523
- file_id: import_v416.z.string(),
3524
- filename: import_v416.z.string(),
3525
- start_index: import_v416.z.number(),
3526
- end_index: import_v416.z.number()
3663
+ import_v417.z.object({
3664
+ type: import_v417.z.literal("container_file_citation"),
3665
+ container_id: import_v417.z.string(),
3666
+ file_id: import_v417.z.string(),
3667
+ filename: import_v417.z.string(),
3668
+ start_index: import_v417.z.number(),
3669
+ end_index: import_v417.z.number()
3527
3670
  }),
3528
- import_v416.z.object({
3529
- type: import_v416.z.literal("file_path"),
3530
- file_id: import_v416.z.string(),
3531
- index: import_v416.z.number()
3671
+ import_v417.z.object({
3672
+ type: import_v417.z.literal("file_path"),
3673
+ file_id: import_v417.z.string(),
3674
+ index: import_v417.z.number()
3532
3675
  })
3533
3676
  ])
3534
3677
  }),
3535
- import_v416.z.object({
3536
- type: import_v416.z.literal("response.reasoning_summary_part.added"),
3537
- item_id: import_v416.z.string(),
3538
- summary_index: import_v416.z.number()
3678
+ import_v417.z.object({
3679
+ type: import_v417.z.literal("response.reasoning_summary_part.added"),
3680
+ item_id: import_v417.z.string(),
3681
+ summary_index: import_v417.z.number()
3539
3682
  }),
3540
- import_v416.z.object({
3541
- type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3542
- item_id: import_v416.z.string(),
3543
- summary_index: import_v416.z.number(),
3544
- delta: import_v416.z.string()
3683
+ import_v417.z.object({
3684
+ type: import_v417.z.literal("response.reasoning_summary_text.delta"),
3685
+ item_id: import_v417.z.string(),
3686
+ summary_index: import_v417.z.number(),
3687
+ delta: import_v417.z.string()
3545
3688
  }),
3546
- import_v416.z.object({
3547
- type: import_v416.z.literal("response.reasoning_summary_part.done"),
3548
- item_id: import_v416.z.string(),
3549
- summary_index: import_v416.z.number()
3689
+ import_v417.z.object({
3690
+ type: import_v417.z.literal("response.reasoning_summary_part.done"),
3691
+ item_id: import_v417.z.string(),
3692
+ summary_index: import_v417.z.number()
3550
3693
  }),
3551
- import_v416.z.object({
3552
- type: import_v416.z.literal("response.apply_patch_call_operation_diff.delta"),
3553
- item_id: import_v416.z.string(),
3554
- output_index: import_v416.z.number(),
3555
- delta: import_v416.z.string(),
3556
- obfuscation: import_v416.z.string().nullish()
3694
+ import_v417.z.object({
3695
+ type: import_v417.z.literal("response.apply_patch_call_operation_diff.delta"),
3696
+ item_id: import_v417.z.string(),
3697
+ output_index: import_v417.z.number(),
3698
+ delta: import_v417.z.string(),
3699
+ obfuscation: import_v417.z.string().nullish()
3557
3700
  }),
3558
- import_v416.z.object({
3559
- type: import_v416.z.literal("response.apply_patch_call_operation_diff.done"),
3560
- item_id: import_v416.z.string(),
3561
- output_index: import_v416.z.number(),
3562
- diff: import_v416.z.string()
3701
+ import_v417.z.object({
3702
+ type: import_v417.z.literal("response.apply_patch_call_operation_diff.done"),
3703
+ item_id: import_v417.z.string(),
3704
+ output_index: import_v417.z.number(),
3705
+ diff: import_v417.z.string()
3563
3706
  }),
3564
- import_v416.z.object({
3565
- type: import_v416.z.literal("error"),
3566
- sequence_number: import_v416.z.number(),
3567
- error: import_v416.z.object({
3568
- type: import_v416.z.string(),
3569
- code: import_v416.z.string(),
3570
- message: import_v416.z.string(),
3571
- param: import_v416.z.string().nullish()
3707
+ import_v417.z.object({
3708
+ type: import_v417.z.literal("error"),
3709
+ sequence_number: import_v417.z.number(),
3710
+ error: import_v417.z.object({
3711
+ type: import_v417.z.string(),
3712
+ code: import_v417.z.string(),
3713
+ message: import_v417.z.string(),
3714
+ param: import_v417.z.string().nullish()
3572
3715
  })
3573
3716
  }),
3574
- import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
3717
+ import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
3575
3718
  type: "unknown_chunk",
3576
3719
  message: value.type
3577
3720
  }))
@@ -3579,294 +3722,310 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3579
3722
  ])
3580
3723
  )
3581
3724
  );
3582
- var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
3583
- () => (0, import_provider_utils23.zodSchema)(
3584
- import_v416.z.object({
3585
- id: import_v416.z.string().optional(),
3586
- created_at: import_v416.z.number().optional(),
3587
- error: import_v416.z.object({
3588
- message: import_v416.z.string(),
3589
- type: import_v416.z.string(),
3590
- param: import_v416.z.string().nullish(),
3591
- code: import_v416.z.string()
3725
+ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
3726
+ () => (0, import_provider_utils24.zodSchema)(
3727
+ import_v417.z.object({
3728
+ id: import_v417.z.string().optional(),
3729
+ created_at: import_v417.z.number().optional(),
3730
+ error: import_v417.z.object({
3731
+ message: import_v417.z.string(),
3732
+ type: import_v417.z.string(),
3733
+ param: import_v417.z.string().nullish(),
3734
+ code: import_v417.z.string()
3592
3735
  }).nullish(),
3593
- model: import_v416.z.string().optional(),
3594
- output: import_v416.z.array(
3595
- import_v416.z.discriminatedUnion("type", [
3596
- import_v416.z.object({
3597
- type: import_v416.z.literal("message"),
3598
- role: import_v416.z.literal("assistant"),
3599
- id: import_v416.z.string(),
3600
- phase: import_v416.z.enum(["commentary", "final_answer"]).nullish(),
3601
- content: import_v416.z.array(
3602
- import_v416.z.object({
3603
- type: import_v416.z.literal("output_text"),
3604
- text: import_v416.z.string(),
3605
- logprobs: import_v416.z.array(
3606
- import_v416.z.object({
3607
- token: import_v416.z.string(),
3608
- logprob: import_v416.z.number(),
3609
- top_logprobs: import_v416.z.array(
3610
- import_v416.z.object({
3611
- token: import_v416.z.string(),
3612
- logprob: import_v416.z.number()
3736
+ model: import_v417.z.string().optional(),
3737
+ output: import_v417.z.array(
3738
+ import_v417.z.discriminatedUnion("type", [
3739
+ import_v417.z.object({
3740
+ type: import_v417.z.literal("message"),
3741
+ role: import_v417.z.literal("assistant"),
3742
+ id: import_v417.z.string(),
3743
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish(),
3744
+ content: import_v417.z.array(
3745
+ import_v417.z.object({
3746
+ type: import_v417.z.literal("output_text"),
3747
+ text: import_v417.z.string(),
3748
+ logprobs: import_v417.z.array(
3749
+ import_v417.z.object({
3750
+ token: import_v417.z.string(),
3751
+ logprob: import_v417.z.number(),
3752
+ top_logprobs: import_v417.z.array(
3753
+ import_v417.z.object({
3754
+ token: import_v417.z.string(),
3755
+ logprob: import_v417.z.number()
3613
3756
  })
3614
3757
  )
3615
3758
  })
3616
3759
  ).nullish(),
3617
- annotations: import_v416.z.array(
3618
- import_v416.z.discriminatedUnion("type", [
3619
- import_v416.z.object({
3620
- type: import_v416.z.literal("url_citation"),
3621
- start_index: import_v416.z.number(),
3622
- end_index: import_v416.z.number(),
3623
- url: import_v416.z.string(),
3624
- title: import_v416.z.string()
3760
+ annotations: import_v417.z.array(
3761
+ import_v417.z.discriminatedUnion("type", [
3762
+ import_v417.z.object({
3763
+ type: import_v417.z.literal("url_citation"),
3764
+ start_index: import_v417.z.number(),
3765
+ end_index: import_v417.z.number(),
3766
+ url: import_v417.z.string(),
3767
+ title: import_v417.z.string()
3625
3768
  }),
3626
- import_v416.z.object({
3627
- type: import_v416.z.literal("file_citation"),
3628
- file_id: import_v416.z.string(),
3629
- filename: import_v416.z.string(),
3630
- index: import_v416.z.number()
3769
+ import_v417.z.object({
3770
+ type: import_v417.z.literal("file_citation"),
3771
+ file_id: import_v417.z.string(),
3772
+ filename: import_v417.z.string(),
3773
+ index: import_v417.z.number()
3631
3774
  }),
3632
- import_v416.z.object({
3633
- type: import_v416.z.literal("container_file_citation"),
3634
- container_id: import_v416.z.string(),
3635
- file_id: import_v416.z.string(),
3636
- filename: import_v416.z.string(),
3637
- start_index: import_v416.z.number(),
3638
- end_index: import_v416.z.number()
3775
+ import_v417.z.object({
3776
+ type: import_v417.z.literal("container_file_citation"),
3777
+ container_id: import_v417.z.string(),
3778
+ file_id: import_v417.z.string(),
3779
+ filename: import_v417.z.string(),
3780
+ start_index: import_v417.z.number(),
3781
+ end_index: import_v417.z.number()
3639
3782
  }),
3640
- import_v416.z.object({
3641
- type: import_v416.z.literal("file_path"),
3642
- file_id: import_v416.z.string(),
3643
- index: import_v416.z.number()
3783
+ import_v417.z.object({
3784
+ type: import_v417.z.literal("file_path"),
3785
+ file_id: import_v417.z.string(),
3786
+ index: import_v417.z.number()
3644
3787
  })
3645
3788
  ])
3646
3789
  )
3647
3790
  })
3648
3791
  )
3649
3792
  }),
3650
- import_v416.z.object({
3651
- type: import_v416.z.literal("web_search_call"),
3652
- id: import_v416.z.string(),
3653
- status: import_v416.z.string(),
3654
- action: import_v416.z.discriminatedUnion("type", [
3655
- import_v416.z.object({
3656
- type: import_v416.z.literal("search"),
3657
- query: import_v416.z.string().nullish(),
3658
- sources: import_v416.z.array(
3659
- import_v416.z.discriminatedUnion("type", [
3660
- import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
3661
- import_v416.z.object({
3662
- type: import_v416.z.literal("api"),
3663
- name: import_v416.z.string()
3793
+ import_v417.z.object({
3794
+ type: import_v417.z.literal("web_search_call"),
3795
+ id: import_v417.z.string(),
3796
+ status: import_v417.z.string(),
3797
+ action: import_v417.z.discriminatedUnion("type", [
3798
+ import_v417.z.object({
3799
+ type: import_v417.z.literal("search"),
3800
+ query: import_v417.z.string().nullish(),
3801
+ sources: import_v417.z.array(
3802
+ import_v417.z.discriminatedUnion("type", [
3803
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3804
+ import_v417.z.object({
3805
+ type: import_v417.z.literal("api"),
3806
+ name: import_v417.z.string()
3664
3807
  })
3665
3808
  ])
3666
3809
  ).nullish()
3667
3810
  }),
3668
- import_v416.z.object({
3669
- type: import_v416.z.literal("open_page"),
3670
- url: import_v416.z.string().nullish()
3811
+ import_v417.z.object({
3812
+ type: import_v417.z.literal("open_page"),
3813
+ url: import_v417.z.string().nullish()
3671
3814
  }),
3672
- import_v416.z.object({
3673
- type: import_v416.z.literal("find_in_page"),
3674
- url: import_v416.z.string().nullish(),
3675
- pattern: import_v416.z.string().nullish()
3815
+ import_v417.z.object({
3816
+ type: import_v417.z.literal("find_in_page"),
3817
+ url: import_v417.z.string().nullish(),
3818
+ pattern: import_v417.z.string().nullish()
3676
3819
  })
3677
3820
  ]).nullish()
3678
3821
  }),
3679
- import_v416.z.object({
3680
- type: import_v416.z.literal("file_search_call"),
3681
- id: import_v416.z.string(),
3682
- queries: import_v416.z.array(import_v416.z.string()),
3683
- results: import_v416.z.array(
3684
- import_v416.z.object({
3685
- attributes: import_v416.z.record(
3686
- import_v416.z.string(),
3687
- import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
3822
+ import_v417.z.object({
3823
+ type: import_v417.z.literal("file_search_call"),
3824
+ id: import_v417.z.string(),
3825
+ queries: import_v417.z.array(import_v417.z.string()),
3826
+ results: import_v417.z.array(
3827
+ import_v417.z.object({
3828
+ attributes: import_v417.z.record(
3829
+ import_v417.z.string(),
3830
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3688
3831
  ),
3689
- file_id: import_v416.z.string(),
3690
- filename: import_v416.z.string(),
3691
- score: import_v416.z.number(),
3692
- text: import_v416.z.string()
3832
+ file_id: import_v417.z.string(),
3833
+ filename: import_v417.z.string(),
3834
+ score: import_v417.z.number(),
3835
+ text: import_v417.z.string()
3693
3836
  })
3694
3837
  ).nullish()
3695
3838
  }),
3696
- import_v416.z.object({
3697
- type: import_v416.z.literal("code_interpreter_call"),
3698
- id: import_v416.z.string(),
3699
- code: import_v416.z.string().nullable(),
3700
- container_id: import_v416.z.string(),
3701
- outputs: import_v416.z.array(
3702
- import_v416.z.discriminatedUnion("type", [
3703
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3704
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3839
+ import_v417.z.object({
3840
+ type: import_v417.z.literal("code_interpreter_call"),
3841
+ id: import_v417.z.string(),
3842
+ code: import_v417.z.string().nullable(),
3843
+ container_id: import_v417.z.string(),
3844
+ outputs: import_v417.z.array(
3845
+ import_v417.z.discriminatedUnion("type", [
3846
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3847
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3705
3848
  ])
3706
3849
  ).nullable()
3707
3850
  }),
3708
- import_v416.z.object({
3709
- type: import_v416.z.literal("image_generation_call"),
3710
- id: import_v416.z.string(),
3711
- result: import_v416.z.string()
3851
+ import_v417.z.object({
3852
+ type: import_v417.z.literal("image_generation_call"),
3853
+ id: import_v417.z.string(),
3854
+ result: import_v417.z.string()
3712
3855
  }),
3713
- import_v416.z.object({
3714
- type: import_v416.z.literal("local_shell_call"),
3715
- id: import_v416.z.string(),
3716
- call_id: import_v416.z.string(),
3717
- action: import_v416.z.object({
3718
- type: import_v416.z.literal("exec"),
3719
- command: import_v416.z.array(import_v416.z.string()),
3720
- timeout_ms: import_v416.z.number().optional(),
3721
- user: import_v416.z.string().optional(),
3722
- working_directory: import_v416.z.string().optional(),
3723
- env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
3856
+ import_v417.z.object({
3857
+ type: import_v417.z.literal("local_shell_call"),
3858
+ id: import_v417.z.string(),
3859
+ call_id: import_v417.z.string(),
3860
+ action: import_v417.z.object({
3861
+ type: import_v417.z.literal("exec"),
3862
+ command: import_v417.z.array(import_v417.z.string()),
3863
+ timeout_ms: import_v417.z.number().optional(),
3864
+ user: import_v417.z.string().optional(),
3865
+ working_directory: import_v417.z.string().optional(),
3866
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3724
3867
  })
3725
3868
  }),
3726
- import_v416.z.object({
3727
- type: import_v416.z.literal("function_call"),
3728
- call_id: import_v416.z.string(),
3729
- name: import_v416.z.string(),
3730
- arguments: import_v416.z.string(),
3731
- id: import_v416.z.string()
3869
+ import_v417.z.object({
3870
+ type: import_v417.z.literal("function_call"),
3871
+ call_id: import_v417.z.string(),
3872
+ name: import_v417.z.string(),
3873
+ arguments: import_v417.z.string(),
3874
+ id: import_v417.z.string()
3732
3875
  }),
3733
- import_v416.z.object({
3734
- type: import_v416.z.literal("custom_tool_call"),
3735
- call_id: import_v416.z.string(),
3736
- name: import_v416.z.string(),
3737
- input: import_v416.z.string(),
3738
- id: import_v416.z.string()
3876
+ import_v417.z.object({
3877
+ type: import_v417.z.literal("custom_tool_call"),
3878
+ call_id: import_v417.z.string(),
3879
+ name: import_v417.z.string(),
3880
+ input: import_v417.z.string(),
3881
+ id: import_v417.z.string()
3739
3882
  }),
3740
- import_v416.z.object({
3741
- type: import_v416.z.literal("computer_call"),
3742
- id: import_v416.z.string(),
3743
- status: import_v416.z.string().optional()
3883
+ import_v417.z.object({
3884
+ type: import_v417.z.literal("computer_call"),
3885
+ id: import_v417.z.string(),
3886
+ status: import_v417.z.string().optional()
3744
3887
  }),
3745
- import_v416.z.object({
3746
- type: import_v416.z.literal("reasoning"),
3747
- id: import_v416.z.string(),
3748
- encrypted_content: import_v416.z.string().nullish(),
3749
- summary: import_v416.z.array(
3750
- import_v416.z.object({
3751
- type: import_v416.z.literal("summary_text"),
3752
- text: import_v416.z.string()
3888
+ import_v417.z.object({
3889
+ type: import_v417.z.literal("reasoning"),
3890
+ id: import_v417.z.string(),
3891
+ encrypted_content: import_v417.z.string().nullish(),
3892
+ summary: import_v417.z.array(
3893
+ import_v417.z.object({
3894
+ type: import_v417.z.literal("summary_text"),
3895
+ text: import_v417.z.string()
3753
3896
  })
3754
3897
  )
3755
3898
  }),
3756
- import_v416.z.object({
3757
- type: import_v416.z.literal("mcp_call"),
3758
- id: import_v416.z.string(),
3759
- status: import_v416.z.string(),
3760
- arguments: import_v416.z.string(),
3761
- name: import_v416.z.string(),
3762
- server_label: import_v416.z.string(),
3763
- output: import_v416.z.string().nullish(),
3764
- error: import_v416.z.union([
3765
- import_v416.z.string(),
3766
- import_v416.z.object({
3767
- type: import_v416.z.string().optional(),
3768
- code: import_v416.z.union([import_v416.z.number(), import_v416.z.string()]).optional(),
3769
- message: import_v416.z.string().optional()
3899
+ import_v417.z.object({
3900
+ type: import_v417.z.literal("mcp_call"),
3901
+ id: import_v417.z.string(),
3902
+ status: import_v417.z.string(),
3903
+ arguments: import_v417.z.string(),
3904
+ name: import_v417.z.string(),
3905
+ server_label: import_v417.z.string(),
3906
+ output: import_v417.z.string().nullish(),
3907
+ error: import_v417.z.union([
3908
+ import_v417.z.string(),
3909
+ import_v417.z.object({
3910
+ type: import_v417.z.string().optional(),
3911
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3912
+ message: import_v417.z.string().optional()
3770
3913
  }).loose()
3771
3914
  ]).nullish(),
3772
- approval_request_id: import_v416.z.string().nullish()
3915
+ approval_request_id: import_v417.z.string().nullish()
3773
3916
  }),
3774
- import_v416.z.object({
3775
- type: import_v416.z.literal("mcp_list_tools"),
3776
- id: import_v416.z.string(),
3777
- server_label: import_v416.z.string(),
3778
- tools: import_v416.z.array(
3779
- import_v416.z.object({
3780
- name: import_v416.z.string(),
3781
- description: import_v416.z.string().optional(),
3782
- input_schema: import_v416.z.any(),
3783
- annotations: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()).optional()
3917
+ import_v417.z.object({
3918
+ type: import_v417.z.literal("mcp_list_tools"),
3919
+ id: import_v417.z.string(),
3920
+ server_label: import_v417.z.string(),
3921
+ tools: import_v417.z.array(
3922
+ import_v417.z.object({
3923
+ name: import_v417.z.string(),
3924
+ description: import_v417.z.string().optional(),
3925
+ input_schema: import_v417.z.any(),
3926
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3784
3927
  })
3785
3928
  ),
3786
- error: import_v416.z.union([
3787
- import_v416.z.string(),
3788
- import_v416.z.object({
3789
- type: import_v416.z.string().optional(),
3790
- code: import_v416.z.union([import_v416.z.number(), import_v416.z.string()]).optional(),
3791
- message: import_v416.z.string().optional()
3929
+ error: import_v417.z.union([
3930
+ import_v417.z.string(),
3931
+ import_v417.z.object({
3932
+ type: import_v417.z.string().optional(),
3933
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3934
+ message: import_v417.z.string().optional()
3792
3935
  }).loose()
3793
3936
  ]).optional()
3794
3937
  }),
3795
- import_v416.z.object({
3796
- type: import_v416.z.literal("mcp_approval_request"),
3797
- id: import_v416.z.string(),
3798
- server_label: import_v416.z.string(),
3799
- name: import_v416.z.string(),
3800
- arguments: import_v416.z.string(),
3801
- approval_request_id: import_v416.z.string().optional()
3938
+ import_v417.z.object({
3939
+ type: import_v417.z.literal("mcp_approval_request"),
3940
+ id: import_v417.z.string(),
3941
+ server_label: import_v417.z.string(),
3942
+ name: import_v417.z.string(),
3943
+ arguments: import_v417.z.string(),
3944
+ approval_request_id: import_v417.z.string().optional()
3802
3945
  }),
3803
- import_v416.z.object({
3804
- type: import_v416.z.literal("apply_patch_call"),
3805
- id: import_v416.z.string(),
3806
- call_id: import_v416.z.string(),
3807
- status: import_v416.z.enum(["in_progress", "completed"]),
3808
- operation: import_v416.z.discriminatedUnion("type", [
3809
- import_v416.z.object({
3810
- type: import_v416.z.literal("create_file"),
3811
- path: import_v416.z.string(),
3812
- diff: import_v416.z.string()
3946
+ import_v417.z.object({
3947
+ type: import_v417.z.literal("apply_patch_call"),
3948
+ id: import_v417.z.string(),
3949
+ call_id: import_v417.z.string(),
3950
+ status: import_v417.z.enum(["in_progress", "completed"]),
3951
+ operation: import_v417.z.discriminatedUnion("type", [
3952
+ import_v417.z.object({
3953
+ type: import_v417.z.literal("create_file"),
3954
+ path: import_v417.z.string(),
3955
+ diff: import_v417.z.string()
3813
3956
  }),
3814
- import_v416.z.object({
3815
- type: import_v416.z.literal("delete_file"),
3816
- path: import_v416.z.string()
3957
+ import_v417.z.object({
3958
+ type: import_v417.z.literal("delete_file"),
3959
+ path: import_v417.z.string()
3817
3960
  }),
3818
- import_v416.z.object({
3819
- type: import_v416.z.literal("update_file"),
3820
- path: import_v416.z.string(),
3821
- diff: import_v416.z.string()
3961
+ import_v417.z.object({
3962
+ type: import_v417.z.literal("update_file"),
3963
+ path: import_v417.z.string(),
3964
+ diff: import_v417.z.string()
3822
3965
  })
3823
3966
  ])
3824
3967
  }),
3825
- import_v416.z.object({
3826
- type: import_v416.z.literal("shell_call"),
3827
- id: import_v416.z.string(),
3828
- call_id: import_v416.z.string(),
3829
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3830
- action: import_v416.z.object({
3831
- commands: import_v416.z.array(import_v416.z.string())
3968
+ import_v417.z.object({
3969
+ type: import_v417.z.literal("shell_call"),
3970
+ id: import_v417.z.string(),
3971
+ call_id: import_v417.z.string(),
3972
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3973
+ action: import_v417.z.object({
3974
+ commands: import_v417.z.array(import_v417.z.string())
3832
3975
  })
3833
3976
  }),
3834
- import_v416.z.object({
3835
- type: import_v416.z.literal("shell_call_output"),
3836
- id: import_v416.z.string(),
3837
- call_id: import_v416.z.string(),
3838
- status: import_v416.z.enum(["in_progress", "completed", "incomplete"]),
3839
- output: import_v416.z.array(
3840
- import_v416.z.object({
3841
- stdout: import_v416.z.string(),
3842
- stderr: import_v416.z.string(),
3843
- outcome: import_v416.z.discriminatedUnion("type", [
3844
- import_v416.z.object({ type: import_v416.z.literal("timeout") }),
3845
- import_v416.z.object({
3846
- type: import_v416.z.literal("exit"),
3847
- exit_code: import_v416.z.number()
3977
+ import_v417.z.object({
3978
+ type: import_v417.z.literal("shell_call_output"),
3979
+ id: import_v417.z.string(),
3980
+ call_id: import_v417.z.string(),
3981
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3982
+ output: import_v417.z.array(
3983
+ import_v417.z.object({
3984
+ stdout: import_v417.z.string(),
3985
+ stderr: import_v417.z.string(),
3986
+ outcome: import_v417.z.discriminatedUnion("type", [
3987
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3988
+ import_v417.z.object({
3989
+ type: import_v417.z.literal("exit"),
3990
+ exit_code: import_v417.z.number()
3848
3991
  })
3849
3992
  ])
3850
3993
  })
3851
3994
  )
3995
+ }),
3996
+ import_v417.z.object({
3997
+ type: import_v417.z.literal("tool_search_call"),
3998
+ id: import_v417.z.string(),
3999
+ execution: import_v417.z.enum(["server", "client"]),
4000
+ call_id: import_v417.z.string().nullable(),
4001
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4002
+ arguments: import_v417.z.unknown()
4003
+ }),
4004
+ import_v417.z.object({
4005
+ type: import_v417.z.literal("tool_search_output"),
4006
+ id: import_v417.z.string(),
4007
+ execution: import_v417.z.enum(["server", "client"]),
4008
+ call_id: import_v417.z.string().nullable(),
4009
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4010
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3852
4011
  })
3853
4012
  ])
3854
4013
  ).optional(),
3855
- service_tier: import_v416.z.string().nullish(),
3856
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3857
- usage: import_v416.z.object({
3858
- input_tokens: import_v416.z.number(),
3859
- input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3860
- output_tokens: import_v416.z.number(),
3861
- output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
4014
+ service_tier: import_v417.z.string().nullish(),
4015
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
4016
+ usage: import_v417.z.object({
4017
+ input_tokens: import_v417.z.number(),
4018
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
4019
+ output_tokens: import_v417.z.number(),
4020
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3862
4021
  }).optional()
3863
4022
  })
3864
4023
  )
3865
4024
  );
3866
4025
 
3867
4026
  // src/responses/openai-responses-options.ts
3868
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
3869
- var import_v417 = require("zod/v4");
4027
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
4028
+ var import_v418 = require("zod/v4");
3870
4029
  var TOP_LOGPROBS_MAX = 20;
3871
4030
  var openaiResponsesReasoningModelIds = [
3872
4031
  "o1",
@@ -3895,7 +4054,12 @@ var openaiResponsesReasoningModelIds = [
3895
4054
  "gpt-5.2-chat-latest",
3896
4055
  "gpt-5.2-pro",
3897
4056
  "gpt-5.2-codex",
3898
- "gpt-5.3-codex"
4057
+ "gpt-5.3-chat-latest",
4058
+ "gpt-5.3-codex",
4059
+ "gpt-5.4",
4060
+ "gpt-5.4-2026-03-05",
4061
+ "gpt-5.4-pro",
4062
+ "gpt-5.4-pro-2026-03-05"
3899
4063
  ];
3900
4064
  var openaiResponsesModelIds = [
3901
4065
  "gpt-4.1",
@@ -3922,9 +4086,9 @@ var openaiResponsesModelIds = [
3922
4086
  "gpt-5-chat-latest",
3923
4087
  ...openaiResponsesReasoningModelIds
3924
4088
  ];
3925
- var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazySchema)(
3926
- () => (0, import_provider_utils24.zodSchema)(
3927
- import_v417.z.object({
4089
+ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazySchema)(
4090
+ () => (0, import_provider_utils25.zodSchema)(
4091
+ import_v418.z.object({
3928
4092
  /**
3929
4093
  * The ID of the OpenAI Conversation to continue.
3930
4094
  * You must create a conversation first via the OpenAI API.
@@ -3932,13 +4096,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3932
4096
  * Defaults to `undefined`.
3933
4097
  * @see https://platform.openai.com/docs/api-reference/conversations/create
3934
4098
  */
3935
- conversation: import_v417.z.string().nullish(),
4099
+ conversation: import_v418.z.string().nullish(),
3936
4100
  /**
3937
4101
  * The set of extra fields to include in the response (advanced, usually not needed).
3938
4102
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
3939
4103
  */
3940
- include: import_v417.z.array(
3941
- import_v417.z.enum([
4104
+ include: import_v418.z.array(
4105
+ import_v418.z.enum([
3942
4106
  "reasoning.encrypted_content",
3943
4107
  // handled internally by default, only needed for unknown reasoning models
3944
4108
  "file_search_call.results",
@@ -3950,7 +4114,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3950
4114
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
3951
4115
  * Defaults to `undefined`.
3952
4116
  */
3953
- instructions: import_v417.z.string().nullish(),
4117
+ instructions: import_v418.z.string().nullish(),
3954
4118
  /**
3955
4119
  * Return the log probabilities of the tokens. Including logprobs will increase
3956
4120
  * the response size and can slow down response times. However, it can
@@ -3965,30 +4129,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3965
4129
  * @see https://platform.openai.com/docs/api-reference/responses/create
3966
4130
  * @see https://cookbook.openai.com/examples/using_logprobs
3967
4131
  */
3968
- logprobs: import_v417.z.union([import_v417.z.boolean(), import_v417.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4132
+ logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3969
4133
  /**
3970
4134
  * The maximum number of total calls to built-in tools that can be processed in a response.
3971
4135
  * This maximum number applies across all built-in tool calls, not per individual tool.
3972
4136
  * Any further attempts to call a tool by the model will be ignored.
3973
4137
  */
3974
- maxToolCalls: import_v417.z.number().nullish(),
4138
+ maxToolCalls: import_v418.z.number().nullish(),
3975
4139
  /**
3976
4140
  * Additional metadata to store with the generation.
3977
4141
  */
3978
- metadata: import_v417.z.any().nullish(),
4142
+ metadata: import_v418.z.any().nullish(),
3979
4143
  /**
3980
4144
  * Whether to use parallel tool calls. Defaults to `true`.
3981
4145
  */
3982
- parallelToolCalls: import_v417.z.boolean().nullish(),
4146
+ parallelToolCalls: import_v418.z.boolean().nullish(),
3983
4147
  /**
3984
4148
  * The ID of the previous response. You can use it to continue a conversation.
3985
4149
  * Defaults to `undefined`.
3986
4150
  */
3987
- previousResponseId: import_v417.z.string().nullish(),
4151
+ previousResponseId: import_v418.z.string().nullish(),
3988
4152
  /**
3989
4153
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
3990
4154
  */
3991
- promptCacheKey: import_v417.z.string().nullish(),
4155
+ promptCacheKey: import_v418.z.string().nullish(),
3992
4156
  /**
3993
4157
  * The retention policy for the prompt cache.
3994
4158
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -3997,7 +4161,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3997
4161
  *
3998
4162
  * @default 'in_memory'
3999
4163
  */
4000
- promptCacheRetention: import_v417.z.enum(["in_memory", "24h"]).nullish(),
4164
+ promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
4001
4165
  /**
4002
4166
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4003
4167
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4008,17 +4172,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4008
4172
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4009
4173
  * an error.
4010
4174
  */
4011
- reasoningEffort: import_v417.z.string().nullish(),
4175
+ reasoningEffort: import_v418.z.string().nullish(),
4012
4176
  /**
4013
4177
  * Controls reasoning summary output from the model.
4014
4178
  * Set to "auto" to automatically receive the richest level available,
4015
4179
  * or "detailed" for comprehensive summaries.
4016
4180
  */
4017
- reasoningSummary: import_v417.z.string().nullish(),
4181
+ reasoningSummary: import_v418.z.string().nullish(),
4018
4182
  /**
4019
4183
  * The identifier for safety monitoring and tracking.
4020
4184
  */
4021
- safetyIdentifier: import_v417.z.string().nullish(),
4185
+ safetyIdentifier: import_v418.z.string().nullish(),
4022
4186
  /**
4023
4187
  * Service tier for the request.
4024
4188
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4026,34 +4190,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4026
4190
  *
4027
4191
  * Defaults to 'auto'.
4028
4192
  */
4029
- serviceTier: import_v417.z.enum(["auto", "flex", "priority", "default"]).nullish(),
4193
+ serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
4030
4194
  /**
4031
4195
  * Whether to store the generation. Defaults to `true`.
4032
4196
  */
4033
- store: import_v417.z.boolean().nullish(),
4197
+ store: import_v418.z.boolean().nullish(),
4034
4198
  /**
4035
4199
  * Whether to use strict JSON schema validation.
4036
4200
  * Defaults to `true`.
4037
4201
  */
4038
- strictJsonSchema: import_v417.z.boolean().nullish(),
4202
+ strictJsonSchema: import_v418.z.boolean().nullish(),
4039
4203
  /**
4040
4204
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4041
4205
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4042
4206
  * Valid values: 'low', 'medium', 'high'.
4043
4207
  */
4044
- textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
4208
+ textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
4045
4209
  /**
4046
4210
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4047
4211
  * 'disabled' turns truncation off.
4048
4212
  */
4049
- truncation: import_v417.z.enum(["auto", "disabled"]).nullish(),
4213
+ truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
4050
4214
  /**
4051
4215
  * A unique identifier representing your end-user, which can help OpenAI to
4052
4216
  * monitor and detect abuse.
4053
4217
  * Defaults to `undefined`.
4054
4218
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4055
4219
  */
4056
- user: import_v417.z.string().nullish(),
4220
+ user: import_v418.z.string().nullish(),
4057
4221
  /**
4058
4222
  * Override the system message mode for this model.
4059
4223
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4062,7 +4226,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4062
4226
  *
4063
4227
  * If not specified, the mode is automatically determined based on the model.
4064
4228
  */
4065
- systemMessageMode: import_v417.z.enum(["system", "developer", "remove"]).optional(),
4229
+ systemMessageMode: import_v418.z.enum(["system", "developer", "remove"]).optional(),
4066
4230
  /**
4067
4231
  * Force treating this model as a reasoning model.
4068
4232
  *
@@ -4072,51 +4236,51 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4072
4236
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4073
4237
  * and defaults `systemMessageMode` to `developer` unless overridden.
4074
4238
  */
4075
- forceReasoning: import_v417.z.boolean().optional()
4239
+ forceReasoning: import_v418.z.boolean().optional()
4076
4240
  })
4077
4241
  )
4078
4242
  );
4079
4243
 
4080
4244
  // src/responses/openai-responses-prepare-tools.ts
4081
4245
  var import_provider7 = require("@ai-sdk/provider");
4082
- var import_provider_utils32 = require("@ai-sdk/provider-utils");
4246
+ var import_provider_utils33 = require("@ai-sdk/provider-utils");
4083
4247
 
4084
4248
  // src/tool/code-interpreter.ts
4085
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4086
- var import_v418 = require("zod/v4");
4087
- var codeInterpreterInputSchema = (0, import_provider_utils25.lazySchema)(
4088
- () => (0, import_provider_utils25.zodSchema)(
4089
- import_v418.z.object({
4090
- code: import_v418.z.string().nullish(),
4091
- containerId: import_v418.z.string()
4249
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
4250
+ var import_v419 = require("zod/v4");
4251
+ var codeInterpreterInputSchema = (0, import_provider_utils26.lazySchema)(
4252
+ () => (0, import_provider_utils26.zodSchema)(
4253
+ import_v419.z.object({
4254
+ code: import_v419.z.string().nullish(),
4255
+ containerId: import_v419.z.string()
4092
4256
  })
4093
4257
  )
4094
4258
  );
4095
- var codeInterpreterOutputSchema = (0, import_provider_utils25.lazySchema)(
4096
- () => (0, import_provider_utils25.zodSchema)(
4097
- import_v418.z.object({
4098
- outputs: import_v418.z.array(
4099
- import_v418.z.discriminatedUnion("type", [
4100
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
4101
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
4259
+ var codeInterpreterOutputSchema = (0, import_provider_utils26.lazySchema)(
4260
+ () => (0, import_provider_utils26.zodSchema)(
4261
+ import_v419.z.object({
4262
+ outputs: import_v419.z.array(
4263
+ import_v419.z.discriminatedUnion("type", [
4264
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
4265
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4102
4266
  ])
4103
4267
  ).nullish()
4104
4268
  })
4105
4269
  )
4106
4270
  );
4107
- var codeInterpreterArgsSchema = (0, import_provider_utils25.lazySchema)(
4108
- () => (0, import_provider_utils25.zodSchema)(
4109
- import_v418.z.object({
4110
- container: import_v418.z.union([
4111
- import_v418.z.string(),
4112
- import_v418.z.object({
4113
- fileIds: import_v418.z.array(import_v418.z.string()).optional()
4271
+ var codeInterpreterArgsSchema = (0, import_provider_utils26.lazySchema)(
4272
+ () => (0, import_provider_utils26.zodSchema)(
4273
+ import_v419.z.object({
4274
+ container: import_v419.z.union([
4275
+ import_v419.z.string(),
4276
+ import_v419.z.object({
4277
+ fileIds: import_v419.z.array(import_v419.z.string()).optional()
4114
4278
  })
4115
4279
  ]).optional()
4116
4280
  })
4117
4281
  )
4118
4282
  );
4119
- var codeInterpreterToolFactory = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
4283
+ var codeInterpreterToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4120
4284
  id: "openai.code_interpreter",
4121
4285
  inputSchema: codeInterpreterInputSchema,
4122
4286
  outputSchema: codeInterpreterOutputSchema
@@ -4126,81 +4290,81 @@ var codeInterpreter = (args = {}) => {
4126
4290
  };
4127
4291
 
4128
4292
  // src/tool/file-search.ts
4129
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
4130
- var import_v419 = require("zod/v4");
4131
- var comparisonFilterSchema = import_v419.z.object({
4132
- key: import_v419.z.string(),
4133
- type: import_v419.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4134
- value: import_v419.z.union([import_v419.z.string(), import_v419.z.number(), import_v419.z.boolean(), import_v419.z.array(import_v419.z.string())])
4293
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
4294
+ var import_v420 = require("zod/v4");
4295
+ var comparisonFilterSchema = import_v420.z.object({
4296
+ key: import_v420.z.string(),
4297
+ type: import_v420.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4298
+ 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())])
4135
4299
  });
4136
- var compoundFilterSchema = import_v419.z.object({
4137
- type: import_v419.z.enum(["and", "or"]),
4138
- filters: import_v419.z.array(
4139
- import_v419.z.union([comparisonFilterSchema, import_v419.z.lazy(() => compoundFilterSchema)])
4300
+ var compoundFilterSchema = import_v420.z.object({
4301
+ type: import_v420.z.enum(["and", "or"]),
4302
+ filters: import_v420.z.array(
4303
+ import_v420.z.union([comparisonFilterSchema, import_v420.z.lazy(() => compoundFilterSchema)])
4140
4304
  )
4141
4305
  });
4142
- var fileSearchArgsSchema = (0, import_provider_utils26.lazySchema)(
4143
- () => (0, import_provider_utils26.zodSchema)(
4144
- import_v419.z.object({
4145
- vectorStoreIds: import_v419.z.array(import_v419.z.string()),
4146
- maxNumResults: import_v419.z.number().optional(),
4147
- ranking: import_v419.z.object({
4148
- ranker: import_v419.z.string().optional(),
4149
- scoreThreshold: import_v419.z.number().optional()
4306
+ var fileSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
4307
+ () => (0, import_provider_utils27.zodSchema)(
4308
+ import_v420.z.object({
4309
+ vectorStoreIds: import_v420.z.array(import_v420.z.string()),
4310
+ maxNumResults: import_v420.z.number().optional(),
4311
+ ranking: import_v420.z.object({
4312
+ ranker: import_v420.z.string().optional(),
4313
+ scoreThreshold: import_v420.z.number().optional()
4150
4314
  }).optional(),
4151
- filters: import_v419.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4315
+ filters: import_v420.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4152
4316
  })
4153
4317
  )
4154
4318
  );
4155
- var fileSearchOutputSchema = (0, import_provider_utils26.lazySchema)(
4156
- () => (0, import_provider_utils26.zodSchema)(
4157
- import_v419.z.object({
4158
- queries: import_v419.z.array(import_v419.z.string()),
4159
- results: import_v419.z.array(
4160
- import_v419.z.object({
4161
- attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
4162
- fileId: import_v419.z.string(),
4163
- filename: import_v419.z.string(),
4164
- score: import_v419.z.number(),
4165
- text: import_v419.z.string()
4319
+ var fileSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
4320
+ () => (0, import_provider_utils27.zodSchema)(
4321
+ import_v420.z.object({
4322
+ queries: import_v420.z.array(import_v420.z.string()),
4323
+ results: import_v420.z.array(
4324
+ import_v420.z.object({
4325
+ attributes: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()),
4326
+ fileId: import_v420.z.string(),
4327
+ filename: import_v420.z.string(),
4328
+ score: import_v420.z.number(),
4329
+ text: import_v420.z.string()
4166
4330
  })
4167
4331
  ).nullable()
4168
4332
  })
4169
4333
  )
4170
4334
  );
4171
- var fileSearch = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4335
+ var fileSearch = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
4172
4336
  id: "openai.file_search",
4173
- inputSchema: import_v419.z.object({}),
4337
+ inputSchema: import_v420.z.object({}),
4174
4338
  outputSchema: fileSearchOutputSchema
4175
4339
  });
4176
4340
 
4177
4341
  // src/tool/image-generation.ts
4178
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
4179
- var import_v420 = require("zod/v4");
4180
- var imageGenerationArgsSchema = (0, import_provider_utils27.lazySchema)(
4181
- () => (0, import_provider_utils27.zodSchema)(
4182
- import_v420.z.object({
4183
- background: import_v420.z.enum(["auto", "opaque", "transparent"]).optional(),
4184
- inputFidelity: import_v420.z.enum(["low", "high"]).optional(),
4185
- inputImageMask: import_v420.z.object({
4186
- fileId: import_v420.z.string().optional(),
4187
- imageUrl: import_v420.z.string().optional()
4342
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
4343
+ var import_v421 = require("zod/v4");
4344
+ var imageGenerationArgsSchema = (0, import_provider_utils28.lazySchema)(
4345
+ () => (0, import_provider_utils28.zodSchema)(
4346
+ import_v421.z.object({
4347
+ background: import_v421.z.enum(["auto", "opaque", "transparent"]).optional(),
4348
+ inputFidelity: import_v421.z.enum(["low", "high"]).optional(),
4349
+ inputImageMask: import_v421.z.object({
4350
+ fileId: import_v421.z.string().optional(),
4351
+ imageUrl: import_v421.z.string().optional()
4188
4352
  }).optional(),
4189
- model: import_v420.z.string().optional(),
4190
- moderation: import_v420.z.enum(["auto"]).optional(),
4191
- outputCompression: import_v420.z.number().int().min(0).max(100).optional(),
4192
- outputFormat: import_v420.z.enum(["png", "jpeg", "webp"]).optional(),
4193
- partialImages: import_v420.z.number().int().min(0).max(3).optional(),
4194
- quality: import_v420.z.enum(["auto", "low", "medium", "high"]).optional(),
4195
- size: import_v420.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4353
+ model: import_v421.z.string().optional(),
4354
+ moderation: import_v421.z.enum(["auto"]).optional(),
4355
+ outputCompression: import_v421.z.number().int().min(0).max(100).optional(),
4356
+ outputFormat: import_v421.z.enum(["png", "jpeg", "webp"]).optional(),
4357
+ partialImages: import_v421.z.number().int().min(0).max(3).optional(),
4358
+ quality: import_v421.z.enum(["auto", "low", "medium", "high"]).optional(),
4359
+ size: import_v421.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4196
4360
  }).strict()
4197
4361
  )
4198
4362
  );
4199
- var imageGenerationInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({})));
4200
- var imageGenerationOutputSchema = (0, import_provider_utils27.lazySchema)(
4201
- () => (0, import_provider_utils27.zodSchema)(import_v420.z.object({ result: import_v420.z.string() }))
4363
+ var imageGenerationInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
4364
+ var imageGenerationOutputSchema = (0, import_provider_utils28.lazySchema)(
4365
+ () => (0, import_provider_utils28.zodSchema)(import_v421.z.object({ result: import_v421.z.string() }))
4202
4366
  );
4203
- var imageGenerationToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
4367
+ var imageGenerationToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
4204
4368
  id: "openai.image_generation",
4205
4369
  inputSchema: imageGenerationInputSchema,
4206
4370
  outputSchema: imageGenerationOutputSchema
@@ -4210,153 +4374,101 @@ var imageGeneration = (args = {}) => {
4210
4374
  };
4211
4375
 
4212
4376
  // src/tool/custom.ts
4213
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4214
- var import_v421 = require("zod/v4");
4215
- var customArgsSchema = (0, import_provider_utils28.lazySchema)(
4216
- () => (0, import_provider_utils28.zodSchema)(
4217
- import_v421.z.object({
4218
- name: import_v421.z.string(),
4219
- description: import_v421.z.string().optional(),
4220
- format: import_v421.z.union([
4221
- import_v421.z.object({
4222
- type: import_v421.z.literal("grammar"),
4223
- syntax: import_v421.z.enum(["regex", "lark"]),
4224
- definition: import_v421.z.string()
4377
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
4378
+ var import_v422 = require("zod/v4");
4379
+ var customArgsSchema = (0, import_provider_utils29.lazySchema)(
4380
+ () => (0, import_provider_utils29.zodSchema)(
4381
+ import_v422.z.object({
4382
+ description: import_v422.z.string().optional(),
4383
+ format: import_v422.z.union([
4384
+ import_v422.z.object({
4385
+ type: import_v422.z.literal("grammar"),
4386
+ syntax: import_v422.z.enum(["regex", "lark"]),
4387
+ definition: import_v422.z.string()
4225
4388
  }),
4226
- import_v421.z.object({
4227
- type: import_v421.z.literal("text")
4389
+ import_v422.z.object({
4390
+ type: import_v422.z.literal("text")
4228
4391
  })
4229
4392
  ]).optional()
4230
4393
  })
4231
4394
  )
4232
4395
  );
4233
- var customInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.string()));
4234
- var customToolFactory = (0, import_provider_utils28.createProviderToolFactory)({
4396
+ var customInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.string()));
4397
+ var customToolFactory = (0, import_provider_utils29.createProviderToolFactory)({
4235
4398
  id: "openai.custom",
4236
4399
  inputSchema: customInputSchema
4237
4400
  });
4238
4401
 
4239
4402
  // src/tool/mcp.ts
4240
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
4241
- var import_v422 = require("zod/v4");
4242
- var jsonValueSchema = import_v422.z.lazy(
4243
- () => import_v422.z.union([
4244
- import_v422.z.string(),
4245
- import_v422.z.number(),
4246
- import_v422.z.boolean(),
4247
- import_v422.z.null(),
4248
- import_v422.z.array(jsonValueSchema),
4249
- import_v422.z.record(import_v422.z.string(), jsonValueSchema)
4403
+ var import_provider_utils30 = require("@ai-sdk/provider-utils");
4404
+ var import_v423 = require("zod/v4");
4405
+ var jsonValueSchema2 = import_v423.z.lazy(
4406
+ () => import_v423.z.union([
4407
+ import_v423.z.string(),
4408
+ import_v423.z.number(),
4409
+ import_v423.z.boolean(),
4410
+ import_v423.z.null(),
4411
+ import_v423.z.array(jsonValueSchema2),
4412
+ import_v423.z.record(import_v423.z.string(), jsonValueSchema2)
4250
4413
  ])
4251
4414
  );
4252
- var mcpArgsSchema = (0, import_provider_utils29.lazySchema)(
4253
- () => (0, import_provider_utils29.zodSchema)(
4254
- import_v422.z.object({
4255
- serverLabel: import_v422.z.string(),
4256
- allowedTools: import_v422.z.union([
4257
- import_v422.z.array(import_v422.z.string()),
4258
- import_v422.z.object({
4259
- readOnly: import_v422.z.boolean().optional(),
4260
- toolNames: import_v422.z.array(import_v422.z.string()).optional()
4415
+ var mcpArgsSchema = (0, import_provider_utils30.lazySchema)(
4416
+ () => (0, import_provider_utils30.zodSchema)(
4417
+ import_v423.z.object({
4418
+ serverLabel: import_v423.z.string(),
4419
+ allowedTools: import_v423.z.union([
4420
+ import_v423.z.array(import_v423.z.string()),
4421
+ import_v423.z.object({
4422
+ readOnly: import_v423.z.boolean().optional(),
4423
+ toolNames: import_v423.z.array(import_v423.z.string()).optional()
4261
4424
  })
4262
4425
  ]).optional(),
4263
- authorization: import_v422.z.string().optional(),
4264
- connectorId: import_v422.z.string().optional(),
4265
- headers: import_v422.z.record(import_v422.z.string(), import_v422.z.string()).optional(),
4266
- requireApproval: import_v422.z.union([
4267
- import_v422.z.enum(["always", "never"]),
4268
- import_v422.z.object({
4269
- never: import_v422.z.object({
4270
- toolNames: import_v422.z.array(import_v422.z.string()).optional()
4426
+ authorization: import_v423.z.string().optional(),
4427
+ connectorId: import_v423.z.string().optional(),
4428
+ headers: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional(),
4429
+ requireApproval: import_v423.z.union([
4430
+ import_v423.z.enum(["always", "never"]),
4431
+ import_v423.z.object({
4432
+ never: import_v423.z.object({
4433
+ toolNames: import_v423.z.array(import_v423.z.string()).optional()
4271
4434
  }).optional()
4272
4435
  })
4273
4436
  ]).optional(),
4274
- serverDescription: import_v422.z.string().optional(),
4275
- serverUrl: import_v422.z.string().optional()
4437
+ serverDescription: import_v423.z.string().optional(),
4438
+ serverUrl: import_v423.z.string().optional()
4276
4439
  }).refine(
4277
4440
  (v) => v.serverUrl != null || v.connectorId != null,
4278
4441
  "One of serverUrl or connectorId must be provided."
4279
4442
  )
4280
4443
  )
4281
4444
  );
4282
- var mcpInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.object({})));
4283
- var mcpOutputSchema = (0, import_provider_utils29.lazySchema)(
4284
- () => (0, import_provider_utils29.zodSchema)(
4285
- import_v422.z.object({
4286
- type: import_v422.z.literal("call"),
4287
- serverLabel: import_v422.z.string(),
4288
- name: import_v422.z.string(),
4289
- arguments: import_v422.z.string(),
4290
- output: import_v422.z.string().nullish(),
4291
- error: import_v422.z.union([import_v422.z.string(), jsonValueSchema]).optional()
4445
+ var mcpInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
4446
+ var mcpOutputSchema = (0, import_provider_utils30.lazySchema)(
4447
+ () => (0, import_provider_utils30.zodSchema)(
4448
+ import_v423.z.object({
4449
+ type: import_v423.z.literal("call"),
4450
+ serverLabel: import_v423.z.string(),
4451
+ name: import_v423.z.string(),
4452
+ arguments: import_v423.z.string(),
4453
+ output: import_v423.z.string().nullish(),
4454
+ error: import_v423.z.union([import_v423.z.string(), jsonValueSchema2]).optional()
4292
4455
  })
4293
4456
  )
4294
4457
  );
4295
- var mcpToolFactory = (0, import_provider_utils29.createProviderToolFactoryWithOutputSchema)({
4458
+ var mcpToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
4296
4459
  id: "openai.mcp",
4297
4460
  inputSchema: mcpInputSchema,
4298
4461
  outputSchema: mcpOutputSchema
4299
4462
  });
4300
4463
 
4301
4464
  // src/tool/web-search.ts
4302
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
4303
- var import_v423 = require("zod/v4");
4304
- var webSearchArgsSchema = (0, import_provider_utils30.lazySchema)(
4305
- () => (0, import_provider_utils30.zodSchema)(
4306
- import_v423.z.object({
4307
- externalWebAccess: import_v423.z.boolean().optional(),
4308
- filters: import_v423.z.object({ allowedDomains: import_v423.z.array(import_v423.z.string()).optional() }).optional(),
4309
- searchContextSize: import_v423.z.enum(["low", "medium", "high"]).optional(),
4310
- userLocation: import_v423.z.object({
4311
- type: import_v423.z.literal("approximate"),
4312
- country: import_v423.z.string().optional(),
4313
- city: import_v423.z.string().optional(),
4314
- region: import_v423.z.string().optional(),
4315
- timezone: import_v423.z.string().optional()
4316
- }).optional()
4317
- })
4318
- )
4319
- );
4320
- var webSearchInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
4321
- var webSearchOutputSchema = (0, import_provider_utils30.lazySchema)(
4322
- () => (0, import_provider_utils30.zodSchema)(
4323
- import_v423.z.object({
4324
- action: import_v423.z.discriminatedUnion("type", [
4325
- import_v423.z.object({
4326
- type: import_v423.z.literal("search"),
4327
- query: import_v423.z.string().optional()
4328
- }),
4329
- import_v423.z.object({
4330
- type: import_v423.z.literal("openPage"),
4331
- url: import_v423.z.string().nullish()
4332
- }),
4333
- import_v423.z.object({
4334
- type: import_v423.z.literal("findInPage"),
4335
- url: import_v423.z.string().nullish(),
4336
- pattern: import_v423.z.string().nullish()
4337
- })
4338
- ]).optional(),
4339
- sources: import_v423.z.array(
4340
- import_v423.z.discriminatedUnion("type", [
4341
- import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
4342
- import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
4343
- ])
4344
- ).optional()
4345
- })
4346
- )
4347
- );
4348
- var webSearchToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
4349
- id: "openai.web_search",
4350
- inputSchema: webSearchInputSchema,
4351
- outputSchema: webSearchOutputSchema
4352
- });
4353
-
4354
- // src/tool/web-search-preview.ts
4355
4465
  var import_provider_utils31 = require("@ai-sdk/provider-utils");
4356
4466
  var import_v424 = require("zod/v4");
4357
- var webSearchPreviewArgsSchema = (0, import_provider_utils31.lazySchema)(
4467
+ var webSearchArgsSchema = (0, import_provider_utils31.lazySchema)(
4358
4468
  () => (0, import_provider_utils31.zodSchema)(
4359
4469
  import_v424.z.object({
4470
+ externalWebAccess: import_v424.z.boolean().optional(),
4471
+ filters: import_v424.z.object({ allowedDomains: import_v424.z.array(import_v424.z.string()).optional() }).optional(),
4360
4472
  searchContextSize: import_v424.z.enum(["low", "medium", "high"]).optional(),
4361
4473
  userLocation: import_v424.z.object({
4362
4474
  type: import_v424.z.literal("approximate"),
@@ -4368,10 +4480,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils31.lazySchema)(
4368
4480
  })
4369
4481
  )
4370
4482
  );
4371
- var webSearchPreviewInputSchema = (0, import_provider_utils31.lazySchema)(
4372
- () => (0, import_provider_utils31.zodSchema)(import_v424.z.object({}))
4373
- );
4374
- var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
4483
+ var webSearchInputSchema = (0, import_provider_utils31.lazySchema)(() => (0, import_provider_utils31.zodSchema)(import_v424.z.object({})));
4484
+ var webSearchOutputSchema = (0, import_provider_utils31.lazySchema)(
4375
4485
  () => (0, import_provider_utils31.zodSchema)(
4376
4486
  import_v424.z.object({
4377
4487
  action: import_v424.z.discriminatedUnion("type", [
@@ -4388,11 +4498,64 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
4388
4498
  url: import_v424.z.string().nullish(),
4389
4499
  pattern: import_v424.z.string().nullish()
4390
4500
  })
4501
+ ]).optional(),
4502
+ sources: import_v424.z.array(
4503
+ import_v424.z.discriminatedUnion("type", [
4504
+ import_v424.z.object({ type: import_v424.z.literal("url"), url: import_v424.z.string() }),
4505
+ import_v424.z.object({ type: import_v424.z.literal("api"), name: import_v424.z.string() })
4506
+ ])
4507
+ ).optional()
4508
+ })
4509
+ )
4510
+ );
4511
+ var webSearchToolFactory = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
4512
+ id: "openai.web_search",
4513
+ inputSchema: webSearchInputSchema,
4514
+ outputSchema: webSearchOutputSchema
4515
+ });
4516
+
4517
+ // src/tool/web-search-preview.ts
4518
+ var import_provider_utils32 = require("@ai-sdk/provider-utils");
4519
+ var import_v425 = require("zod/v4");
4520
+ var webSearchPreviewArgsSchema = (0, import_provider_utils32.lazySchema)(
4521
+ () => (0, import_provider_utils32.zodSchema)(
4522
+ import_v425.z.object({
4523
+ searchContextSize: import_v425.z.enum(["low", "medium", "high"]).optional(),
4524
+ userLocation: import_v425.z.object({
4525
+ type: import_v425.z.literal("approximate"),
4526
+ country: import_v425.z.string().optional(),
4527
+ city: import_v425.z.string().optional(),
4528
+ region: import_v425.z.string().optional(),
4529
+ timezone: import_v425.z.string().optional()
4530
+ }).optional()
4531
+ })
4532
+ )
4533
+ );
4534
+ var webSearchPreviewInputSchema = (0, import_provider_utils32.lazySchema)(
4535
+ () => (0, import_provider_utils32.zodSchema)(import_v425.z.object({}))
4536
+ );
4537
+ var webSearchPreviewOutputSchema = (0, import_provider_utils32.lazySchema)(
4538
+ () => (0, import_provider_utils32.zodSchema)(
4539
+ import_v425.z.object({
4540
+ action: import_v425.z.discriminatedUnion("type", [
4541
+ import_v425.z.object({
4542
+ type: import_v425.z.literal("search"),
4543
+ query: import_v425.z.string().optional()
4544
+ }),
4545
+ import_v425.z.object({
4546
+ type: import_v425.z.literal("openPage"),
4547
+ url: import_v425.z.string().nullish()
4548
+ }),
4549
+ import_v425.z.object({
4550
+ type: import_v425.z.literal("findInPage"),
4551
+ url: import_v425.z.string().nullish(),
4552
+ pattern: import_v425.z.string().nullish()
4553
+ })
4391
4554
  ]).optional()
4392
4555
  })
4393
4556
  )
4394
4557
  );
4395
- var webSearchPreview = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
4558
+ var webSearchPreview = (0, import_provider_utils32.createProviderToolFactoryWithOutputSchema)({
4396
4559
  id: "openai.web_search_preview",
4397
4560
  inputSchema: webSearchPreviewInputSchema,
4398
4561
  outputSchema: webSearchPreviewOutputSchema
@@ -4405,7 +4568,7 @@ async function prepareResponsesTools({
4405
4568
  toolNameMapping,
4406
4569
  customProviderToolNames
4407
4570
  }) {
4408
- var _a;
4571
+ var _a, _b;
4409
4572
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4410
4573
  const toolWarnings = [];
4411
4574
  if (tools == null) {
@@ -4415,19 +4578,23 @@ async function prepareResponsesTools({
4415
4578
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4416
4579
  for (const tool of tools) {
4417
4580
  switch (tool.type) {
4418
- case "function":
4581
+ case "function": {
4582
+ const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4583
+ const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4419
4584
  openaiTools.push({
4420
4585
  type: "function",
4421
4586
  name: tool.name,
4422
4587
  description: tool.description,
4423
4588
  parameters: tool.inputSchema,
4424
- ...tool.strict != null ? { strict: tool.strict } : {}
4589
+ ...tool.strict != null ? { strict: tool.strict } : {},
4590
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4425
4591
  });
4426
4592
  break;
4593
+ }
4427
4594
  case "provider": {
4428
4595
  switch (tool.id) {
4429
4596
  case "openai.file_search": {
4430
- const args = await (0, import_provider_utils32.validateTypes)({
4597
+ const args = await (0, import_provider_utils33.validateTypes)({
4431
4598
  value: tool.args,
4432
4599
  schema: fileSearchArgsSchema
4433
4600
  });
@@ -4450,7 +4617,7 @@ async function prepareResponsesTools({
4450
4617
  break;
4451
4618
  }
4452
4619
  case "openai.shell": {
4453
- const args = await (0, import_provider_utils32.validateTypes)({
4620
+ const args = await (0, import_provider_utils33.validateTypes)({
4454
4621
  value: tool.args,
4455
4622
  schema: shellArgsSchema
4456
4623
  });
@@ -4469,7 +4636,7 @@ async function prepareResponsesTools({
4469
4636
  break;
4470
4637
  }
4471
4638
  case "openai.web_search_preview": {
4472
- const args = await (0, import_provider_utils32.validateTypes)({
4639
+ const args = await (0, import_provider_utils33.validateTypes)({
4473
4640
  value: tool.args,
4474
4641
  schema: webSearchPreviewArgsSchema
4475
4642
  });
@@ -4481,7 +4648,7 @@ async function prepareResponsesTools({
4481
4648
  break;
4482
4649
  }
4483
4650
  case "openai.web_search": {
4484
- const args = await (0, import_provider_utils32.validateTypes)({
4651
+ const args = await (0, import_provider_utils33.validateTypes)({
4485
4652
  value: tool.args,
4486
4653
  schema: webSearchArgsSchema
4487
4654
  });
@@ -4495,7 +4662,7 @@ async function prepareResponsesTools({
4495
4662
  break;
4496
4663
  }
4497
4664
  case "openai.code_interpreter": {
4498
- const args = await (0, import_provider_utils32.validateTypes)({
4665
+ const args = await (0, import_provider_utils33.validateTypes)({
4499
4666
  value: tool.args,
4500
4667
  schema: codeInterpreterArgsSchema
4501
4668
  });
@@ -4506,7 +4673,7 @@ async function prepareResponsesTools({
4506
4673
  break;
4507
4674
  }
4508
4675
  case "openai.image_generation": {
4509
- const args = await (0, import_provider_utils32.validateTypes)({
4676
+ const args = await (0, import_provider_utils33.validateTypes)({
4510
4677
  value: tool.args,
4511
4678
  schema: imageGenerationArgsSchema
4512
4679
  });
@@ -4529,7 +4696,7 @@ async function prepareResponsesTools({
4529
4696
  break;
4530
4697
  }
4531
4698
  case "openai.mcp": {
4532
- const args = await (0, import_provider_utils32.validateTypes)({
4699
+ const args = await (0, import_provider_utils33.validateTypes)({
4533
4700
  value: tool.args,
4534
4701
  schema: mcpArgsSchema
4535
4702
  });
@@ -4555,17 +4722,30 @@ async function prepareResponsesTools({
4555
4722
  break;
4556
4723
  }
4557
4724
  case "openai.custom": {
4558
- const args = await (0, import_provider_utils32.validateTypes)({
4725
+ const args = await (0, import_provider_utils33.validateTypes)({
4559
4726
  value: tool.args,
4560
4727
  schema: customArgsSchema
4561
4728
  });
4562
4729
  openaiTools.push({
4563
4730
  type: "custom",
4564
- name: args.name,
4731
+ name: tool.name,
4565
4732
  description: args.description,
4566
4733
  format: args.format
4567
4734
  });
4568
- resolvedCustomProviderToolNames.add(args.name);
4735
+ resolvedCustomProviderToolNames.add(tool.name);
4736
+ break;
4737
+ }
4738
+ case "openai.tool_search": {
4739
+ const args = await (0, import_provider_utils33.validateTypes)({
4740
+ value: tool.args,
4741
+ schema: toolSearchArgsSchema
4742
+ });
4743
+ openaiTools.push({
4744
+ type: "tool_search",
4745
+ ...args.execution != null ? { execution: args.execution } : {},
4746
+ ...args.description != null ? { description: args.description } : {},
4747
+ ...args.parameters != null ? { parameters: args.parameters } : {}
4748
+ });
4569
4749
  break;
4570
4750
  }
4571
4751
  }
@@ -4589,7 +4769,7 @@ async function prepareResponsesTools({
4589
4769
  case "required":
4590
4770
  return { tools: openaiTools, toolChoice: type, toolWarnings };
4591
4771
  case "tool": {
4592
- const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4772
+ const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
4593
4773
  return {
4594
4774
  tools: openaiTools,
4595
4775
  toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
@@ -4669,7 +4849,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
4669
4849
  }
4670
4850
  var OpenAIResponsesLanguageModel = class {
4671
4851
  constructor(modelId, config) {
4672
- this.specificationVersion = "v3";
4852
+ this.specificationVersion = "v4";
4673
4853
  this.supportedUrls = {
4674
4854
  "image/*": [/^https?:\/\/.*$/],
4675
4855
  "application/pdf": [/^https?:\/\/.*$/]
@@ -4714,13 +4894,13 @@ var OpenAIResponsesLanguageModel = class {
4714
4894
  warnings.push({ type: "unsupported", feature: "stopSequences" });
4715
4895
  }
4716
4896
  const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
4717
- let openaiOptions = await (0, import_provider_utils33.parseProviderOptions)({
4897
+ let openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
4718
4898
  provider: providerOptionsName,
4719
4899
  providerOptions,
4720
4900
  schema: openaiLanguageModelResponsesOptionsSchema
4721
4901
  });
4722
4902
  if (openaiOptions == null && providerOptionsName !== "openai") {
4723
- openaiOptions = await (0, import_provider_utils33.parseProviderOptions)({
4903
+ openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
4724
4904
  provider: "openai",
4725
4905
  providerOptions,
4726
4906
  schema: openaiLanguageModelResponsesOptionsSchema
@@ -4734,7 +4914,7 @@ var OpenAIResponsesLanguageModel = class {
4734
4914
  details: "conversation and previousResponseId cannot be used together"
4735
4915
  });
4736
4916
  }
4737
- const toolNameMapping = (0, import_provider_utils33.createToolNameMapping)({
4917
+ const toolNameMapping = (0, import_provider_utils34.createToolNameMapping)({
4738
4918
  tools,
4739
4919
  providerToolNames: {
4740
4920
  "openai.code_interpreter": "code_interpreter",
@@ -4745,9 +4925,9 @@ var OpenAIResponsesLanguageModel = class {
4745
4925
  "openai.web_search": "web_search",
4746
4926
  "openai.web_search_preview": "web_search_preview",
4747
4927
  "openai.mcp": "mcp",
4748
- "openai.apply_patch": "apply_patch"
4749
- },
4750
- resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
4928
+ "openai.apply_patch": "apply_patch",
4929
+ "openai.tool_search": "tool_search"
4930
+ }
4751
4931
  });
4752
4932
  const customProviderToolNames = /* @__PURE__ */ new Set();
4753
4933
  const {
@@ -4923,7 +5103,7 @@ var OpenAIResponsesLanguageModel = class {
4923
5103
  };
4924
5104
  }
4925
5105
  async doGenerate(options) {
4926
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
5106
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
4927
5107
  const {
4928
5108
  args: body,
4929
5109
  warnings,
@@ -4941,12 +5121,12 @@ var OpenAIResponsesLanguageModel = class {
4941
5121
  responseHeaders,
4942
5122
  value: response,
4943
5123
  rawValue: rawResponse
4944
- } = await (0, import_provider_utils33.postJsonToApi)({
5124
+ } = await (0, import_provider_utils34.postJsonToApi)({
4945
5125
  url,
4946
- headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
5126
+ headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
4947
5127
  body,
4948
5128
  failedResponseHandler: openaiFailedResponseHandler,
4949
- successfulResponseHandler: (0, import_provider_utils33.createJsonResponseHandler)(
5129
+ successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
4950
5130
  openaiResponsesResponseSchema
4951
5131
  ),
4952
5132
  abortSignal: options.abortSignal,
@@ -4966,6 +5146,7 @@ var OpenAIResponsesLanguageModel = class {
4966
5146
  const content = [];
4967
5147
  const logprobs = [];
4968
5148
  let hasFunctionCall = false;
5149
+ const hostedToolSearchCallIds = [];
4969
5150
  for (const part of response.output) {
4970
5151
  switch (part.type) {
4971
5152
  case "reasoning": {
@@ -5004,6 +5185,46 @@ var OpenAIResponsesLanguageModel = class {
5004
5185
  });
5005
5186
  break;
5006
5187
  }
5188
+ case "tool_search_call": {
5189
+ const toolCallId = (_b = part.call_id) != null ? _b : part.id;
5190
+ const isHosted = part.execution === "server";
5191
+ if (isHosted) {
5192
+ hostedToolSearchCallIds.push(toolCallId);
5193
+ }
5194
+ content.push({
5195
+ type: "tool-call",
5196
+ toolCallId,
5197
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5198
+ input: JSON.stringify({
5199
+ arguments: part.arguments,
5200
+ call_id: part.call_id
5201
+ }),
5202
+ ...isHosted ? { providerExecuted: true } : {},
5203
+ providerMetadata: {
5204
+ [providerOptionsName]: {
5205
+ itemId: part.id
5206
+ }
5207
+ }
5208
+ });
5209
+ break;
5210
+ }
5211
+ case "tool_search_output": {
5212
+ const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
5213
+ content.push({
5214
+ type: "tool-result",
5215
+ toolCallId,
5216
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5217
+ result: {
5218
+ tools: part.tools
5219
+ },
5220
+ providerMetadata: {
5221
+ [providerOptionsName]: {
5222
+ itemId: part.id
5223
+ }
5224
+ }
5225
+ });
5226
+ break;
5227
+ }
5007
5228
  case "local_shell_call": {
5008
5229
  content.push({
5009
5230
  type: "tool-call",
@@ -5059,7 +5280,7 @@ var OpenAIResponsesLanguageModel = class {
5059
5280
  }
5060
5281
  case "message": {
5061
5282
  for (const contentPart of part.content) {
5062
- if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
5283
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
5063
5284
  logprobs.push(contentPart.logprobs);
5064
5285
  }
5065
5286
  const providerMetadata2 = {
@@ -5081,7 +5302,7 @@ var OpenAIResponsesLanguageModel = class {
5081
5302
  content.push({
5082
5303
  type: "source",
5083
5304
  sourceType: "url",
5084
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils33.generateId)(),
5305
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils34.generateId)(),
5085
5306
  url: annotation.url,
5086
5307
  title: annotation.title
5087
5308
  });
@@ -5089,7 +5310,7 @@ var OpenAIResponsesLanguageModel = class {
5089
5310
  content.push({
5090
5311
  type: "source",
5091
5312
  sourceType: "document",
5092
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils33.generateId)(),
5313
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils34.generateId)(),
5093
5314
  mediaType: "text/plain",
5094
5315
  title: annotation.filename,
5095
5316
  filename: annotation.filename,
@@ -5105,7 +5326,7 @@ var OpenAIResponsesLanguageModel = class {
5105
5326
  content.push({
5106
5327
  type: "source",
5107
5328
  sourceType: "document",
5108
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils33.generateId)(),
5329
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)(),
5109
5330
  mediaType: "text/plain",
5110
5331
  title: annotation.filename,
5111
5332
  filename: annotation.filename,
@@ -5121,7 +5342,7 @@ var OpenAIResponsesLanguageModel = class {
5121
5342
  content.push({
5122
5343
  type: "source",
5123
5344
  sourceType: "document",
5124
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils33.generateId)(),
5345
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils34.generateId)(),
5125
5346
  mediaType: "application/octet-stream",
5126
5347
  title: annotation.file_id,
5127
5348
  filename: annotation.file_id,
@@ -5190,7 +5411,7 @@ var OpenAIResponsesLanguageModel = class {
5190
5411
  break;
5191
5412
  }
5192
5413
  case "mcp_call": {
5193
- const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
5414
+ const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
5194
5415
  const toolName = `mcp.${part.name}`;
5195
5416
  content.push({
5196
5417
  type: "tool-call",
@@ -5224,8 +5445,8 @@ var OpenAIResponsesLanguageModel = class {
5224
5445
  break;
5225
5446
  }
5226
5447
  case "mcp_approval_request": {
5227
- const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
5228
- const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils33.generateId)();
5448
+ const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5449
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils34.generateId)();
5229
5450
  const toolName = `mcp.${part.name}`;
5230
5451
  content.push({
5231
5452
  type: "tool-call",
@@ -5275,13 +5496,13 @@ var OpenAIResponsesLanguageModel = class {
5275
5496
  toolName: toolNameMapping.toCustomToolName("file_search"),
5276
5497
  result: {
5277
5498
  queries: part.queries,
5278
- results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
5499
+ results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
5279
5500
  attributes: result.attributes,
5280
5501
  fileId: result.file_id,
5281
5502
  filename: result.filename,
5282
5503
  score: result.score,
5283
5504
  text: result.text
5284
- }))) != null ? _v : null
5505
+ }))) != null ? _y : null
5285
5506
  }
5286
5507
  });
5287
5508
  break;
@@ -5338,10 +5559,10 @@ var OpenAIResponsesLanguageModel = class {
5338
5559
  content,
5339
5560
  finishReason: {
5340
5561
  unified: mapOpenAIResponseFinishReason({
5341
- finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
5562
+ finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
5342
5563
  hasFunctionCall
5343
5564
  }),
5344
- raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
5565
+ raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
5345
5566
  },
5346
5567
  usage: convertOpenAIResponsesUsage(usage),
5347
5568
  request: { body },
@@ -5366,18 +5587,18 @@ var OpenAIResponsesLanguageModel = class {
5366
5587
  providerOptionsName,
5367
5588
  isShellProviderExecuted
5368
5589
  } = await this.getArgs(options);
5369
- const { responseHeaders, value: response } = await (0, import_provider_utils33.postJsonToApi)({
5590
+ const { responseHeaders, value: response } = await (0, import_provider_utils34.postJsonToApi)({
5370
5591
  url: this.config.url({
5371
5592
  path: "/responses",
5372
5593
  modelId: this.modelId
5373
5594
  }),
5374
- headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
5595
+ headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
5375
5596
  body: {
5376
5597
  ...body,
5377
5598
  stream: true
5378
5599
  },
5379
5600
  failedResponseHandler: openaiFailedResponseHandler,
5380
- successfulResponseHandler: (0, import_provider_utils33.createEventSourceResponseHandler)(
5601
+ successfulResponseHandler: (0, import_provider_utils34.createEventSourceResponseHandler)(
5381
5602
  openaiResponsesChunkSchema
5382
5603
  ),
5383
5604
  abortSignal: options.abortSignal,
@@ -5399,6 +5620,7 @@ var OpenAIResponsesLanguageModel = class {
5399
5620
  let hasFunctionCall = false;
5400
5621
  const activeReasoning = {};
5401
5622
  let serviceTier;
5623
+ const hostedToolSearchCallIds = [];
5402
5624
  return {
5403
5625
  stream: response.pipeThrough(
5404
5626
  new TransformStream({
@@ -5406,7 +5628,7 @@ var OpenAIResponsesLanguageModel = class {
5406
5628
  controller.enqueue({ type: "stream-start", warnings });
5407
5629
  },
5408
5630
  transform(chunk, controller) {
5409
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
5631
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
5410
5632
  if (options.includeRawChunks) {
5411
5633
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5412
5634
  }
@@ -5514,6 +5736,24 @@ var OpenAIResponsesLanguageModel = class {
5514
5736
  input: "{}",
5515
5737
  providerExecuted: true
5516
5738
  });
5739
+ } else if (value.item.type === "tool_search_call") {
5740
+ const toolCallId = value.item.id;
5741
+ const toolName = toolNameMapping.toCustomToolName("tool_search");
5742
+ const isHosted = value.item.execution === "server";
5743
+ ongoingToolCalls[value.output_index] = {
5744
+ toolName,
5745
+ toolCallId,
5746
+ toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
5747
+ };
5748
+ if (isHosted) {
5749
+ controller.enqueue({
5750
+ type: "tool-input-start",
5751
+ id: toolCallId,
5752
+ toolName,
5753
+ providerExecuted: true
5754
+ });
5755
+ }
5756
+ } else if (value.item.type === "tool_search_output") {
5517
5757
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
5518
5758
  } else if (value.item.type === "apply_patch_call") {
5519
5759
  const { call_id: callId, operation } = value.item;
@@ -5560,7 +5800,7 @@ var OpenAIResponsesLanguageModel = class {
5560
5800
  } else if (value.item.type === "shell_call_output") {
5561
5801
  } else if (value.item.type === "message") {
5562
5802
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5563
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5803
+ activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
5564
5804
  controller.enqueue({
5565
5805
  type: "text-start",
5566
5806
  id: value.item.id,
@@ -5584,14 +5824,14 @@ var OpenAIResponsesLanguageModel = class {
5584
5824
  providerMetadata: {
5585
5825
  [providerOptionsName]: {
5586
5826
  itemId: value.item.id,
5587
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5827
+ reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
5588
5828
  }
5589
5829
  }
5590
5830
  });
5591
5831
  }
5592
5832
  } else if (isResponseOutputItemDoneChunk(value)) {
5593
5833
  if (value.item.type === "message") {
5594
- const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5834
+ const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
5595
5835
  activeMessagePhase = void 0;
5596
5836
  controller.enqueue({
5597
5837
  type: "text-end",
@@ -5685,13 +5925,13 @@ var OpenAIResponsesLanguageModel = class {
5685
5925
  toolName: toolNameMapping.toCustomToolName("file_search"),
5686
5926
  result: {
5687
5927
  queries: value.item.queries,
5688
- results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
5928
+ results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
5689
5929
  attributes: result.attributes,
5690
5930
  fileId: result.file_id,
5691
5931
  filename: result.filename,
5692
5932
  score: result.score,
5693
5933
  text: result.text
5694
- }))) != null ? _e : null
5934
+ }))) != null ? _f : null
5695
5935
  }
5696
5936
  });
5697
5937
  } else if (value.item.type === "code_interpreter_call") {
@@ -5713,12 +5953,62 @@ var OpenAIResponsesLanguageModel = class {
5713
5953
  result: value.item.result
5714
5954
  }
5715
5955
  });
5956
+ } else if (value.item.type === "tool_search_call") {
5957
+ const toolCall = ongoingToolCalls[value.output_index];
5958
+ const isHosted = value.item.execution === "server";
5959
+ if (toolCall != null) {
5960
+ const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
5961
+ if (isHosted) {
5962
+ hostedToolSearchCallIds.push(toolCallId);
5963
+ } else {
5964
+ controller.enqueue({
5965
+ type: "tool-input-start",
5966
+ id: toolCallId,
5967
+ toolName: toolCall.toolName
5968
+ });
5969
+ }
5970
+ controller.enqueue({
5971
+ type: "tool-input-end",
5972
+ id: toolCallId
5973
+ });
5974
+ controller.enqueue({
5975
+ type: "tool-call",
5976
+ toolCallId,
5977
+ toolName: toolCall.toolName,
5978
+ input: JSON.stringify({
5979
+ arguments: value.item.arguments,
5980
+ call_id: isHosted ? null : toolCallId
5981
+ }),
5982
+ ...isHosted ? { providerExecuted: true } : {},
5983
+ providerMetadata: {
5984
+ [providerOptionsName]: {
5985
+ itemId: value.item.id
5986
+ }
5987
+ }
5988
+ });
5989
+ }
5990
+ ongoingToolCalls[value.output_index] = void 0;
5991
+ } else if (value.item.type === "tool_search_output") {
5992
+ const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
5993
+ controller.enqueue({
5994
+ type: "tool-result",
5995
+ toolCallId,
5996
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5997
+ result: {
5998
+ tools: value.item.tools
5999
+ },
6000
+ providerMetadata: {
6001
+ [providerOptionsName]: {
6002
+ itemId: value.item.id
6003
+ }
6004
+ }
6005
+ });
5716
6006
  } else if (value.item.type === "mcp_call") {
5717
6007
  ongoingToolCalls[value.output_index] = void 0;
5718
- const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5719
- const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
6008
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
6009
+ const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
5720
6010
  approvalRequestId
5721
- )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
6011
+ )) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
5722
6012
  const toolName = `mcp.${value.item.name}`;
5723
6013
  controller.enqueue({
5724
6014
  type: "tool-call",
@@ -5788,8 +6078,8 @@ var OpenAIResponsesLanguageModel = class {
5788
6078
  ongoingToolCalls[value.output_index] = void 0;
5789
6079
  } else if (value.item.type === "mcp_approval_request") {
5790
6080
  ongoingToolCalls[value.output_index] = void 0;
5791
- const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0, import_provider_utils33.generateId)();
5792
- const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
6081
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)();
6082
+ const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
5793
6083
  approvalRequestIdToDummyToolCallIdFromStream.set(
5794
6084
  approvalRequestId,
5795
6085
  dummyToolCallId
@@ -5878,7 +6168,7 @@ var OpenAIResponsesLanguageModel = class {
5878
6168
  providerMetadata: {
5879
6169
  [providerOptionsName]: {
5880
6170
  itemId: value.item.id,
5881
- reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
6171
+ reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
5882
6172
  }
5883
6173
  }
5884
6174
  });
@@ -5991,7 +6281,7 @@ var OpenAIResponsesLanguageModel = class {
5991
6281
  id: value.item_id,
5992
6282
  delta: value.delta
5993
6283
  });
5994
- if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
6284
+ if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
5995
6285
  logprobs.push(value.logprobs);
5996
6286
  }
5997
6287
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -6020,7 +6310,7 @@ var OpenAIResponsesLanguageModel = class {
6020
6310
  providerMetadata: {
6021
6311
  [providerOptionsName]: {
6022
6312
  itemId: value.item_id,
6023
- reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
6313
+ reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
6024
6314
  }
6025
6315
  }
6026
6316
  });
@@ -6054,10 +6344,10 @@ var OpenAIResponsesLanguageModel = class {
6054
6344
  } else if (isResponseFinishedChunk(value)) {
6055
6345
  finishReason = {
6056
6346
  unified: mapOpenAIResponseFinishReason({
6057
- finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
6347
+ finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
6058
6348
  hasFunctionCall
6059
6349
  }),
6060
- raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
6350
+ raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
6061
6351
  };
6062
6352
  usage = value.response.usage;
6063
6353
  if (typeof value.response.service_tier === "string") {
@@ -6069,7 +6359,7 @@ var OpenAIResponsesLanguageModel = class {
6069
6359
  controller.enqueue({
6070
6360
  type: "source",
6071
6361
  sourceType: "url",
6072
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils33.generateId)(),
6362
+ id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils34.generateId)(),
6073
6363
  url: value.annotation.url,
6074
6364
  title: value.annotation.title
6075
6365
  });
@@ -6077,7 +6367,7 @@ var OpenAIResponsesLanguageModel = class {
6077
6367
  controller.enqueue({
6078
6368
  type: "source",
6079
6369
  sourceType: "document",
6080
- id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils33.generateId)(),
6370
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils34.generateId)(),
6081
6371
  mediaType: "text/plain",
6082
6372
  title: value.annotation.filename,
6083
6373
  filename: value.annotation.filename,
@@ -6093,7 +6383,7 @@ var OpenAIResponsesLanguageModel = class {
6093
6383
  controller.enqueue({
6094
6384
  type: "source",
6095
6385
  sourceType: "document",
6096
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils33.generateId)(),
6386
+ id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : (0, import_provider_utils34.generateId)(),
6097
6387
  mediaType: "text/plain",
6098
6388
  title: value.annotation.filename,
6099
6389
  filename: value.annotation.filename,
@@ -6109,7 +6399,7 @@ var OpenAIResponsesLanguageModel = class {
6109
6399
  controller.enqueue({
6110
6400
  type: "source",
6111
6401
  sourceType: "document",
6112
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils33.generateId)(),
6402
+ id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : (0, import_provider_utils34.generateId)(),
6113
6403
  mediaType: "application/octet-stream",
6114
6404
  title: value.annotation.file_id,
6115
6405
  filename: value.annotation.file_id,