@ai-sdk/openai 4.0.0-beta.2 → 4.0.0-beta.20

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 (44) hide show
  1. package/CHANGELOG.md +225 -22
  2. package/README.md +2 -0
  3. package/dist/index.d.mts +124 -35
  4. package/dist/index.d.ts +124 -35
  5. package/dist/index.js +1319 -895
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1275 -844
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/internal/index.d.mts +102 -36
  10. package/dist/internal/index.d.ts +102 -36
  11. package/dist/internal/index.js +1348 -934
  12. package/dist/internal/index.js.map +1 -1
  13. package/dist/internal/index.mjs +1332 -911
  14. package/dist/internal/index.mjs.map +1 -1
  15. package/docs/03-openai.mdx +274 -9
  16. package/package.json +3 -5
  17. package/src/chat/convert-openai-chat-usage.ts +2 -2
  18. package/src/chat/convert-to-openai-chat-messages.ts +5 -5
  19. package/src/chat/map-openai-finish-reason.ts +2 -2
  20. package/src/chat/openai-chat-language-model.ts +32 -24
  21. package/src/chat/openai-chat-options.ts +5 -0
  22. package/src/chat/openai-chat-prepare-tools.ts +6 -6
  23. package/src/completion/convert-openai-completion-usage.ts +2 -2
  24. package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
  25. package/src/completion/map-openai-finish-reason.ts +2 -2
  26. package/src/completion/openai-completion-language-model.ts +20 -20
  27. package/src/embedding/openai-embedding-model.ts +5 -5
  28. package/src/image/openai-image-model.ts +9 -9
  29. package/src/index.ts +1 -0
  30. package/src/openai-language-model-capabilities.ts +3 -2
  31. package/src/openai-provider.ts +21 -21
  32. package/src/openai-tools.ts +12 -1
  33. package/src/responses/convert-openai-responses-usage.ts +2 -2
  34. package/src/responses/convert-to-openai-responses-input.ts +159 -12
  35. package/src/responses/map-openai-responses-finish-reason.ts +2 -2
  36. package/src/responses/openai-responses-api.ts +136 -2
  37. package/src/responses/openai-responses-language-model.ts +233 -37
  38. package/src/responses/openai-responses-options.ts +24 -2
  39. package/src/responses/openai-responses-prepare-tools.ts +34 -9
  40. package/src/responses/openai-responses-provider-metadata.ts +10 -0
  41. package/src/speech/openai-speech-model.ts +7 -7
  42. package/src/tool/custom.ts +0 -6
  43. package/src/tool/tool-search.ts +98 -0
  44. 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");
@@ -82,9 +82,9 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
82
82
  // src/openai-language-model-capabilities.ts
83
83
  function getOpenAILanguageModelCapabilities(modelId) {
84
84
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
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");
85
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || 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") || modelId.startsWith("gpt-5.4");
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
  };
@@ -698,9 +698,10 @@ var OpenAIChatLanguageModel = class {
698
698
  seed,
699
699
  tools,
700
700
  toolChoice,
701
+ reasoning,
701
702
  providerOptions
702
703
  }) {
703
- var _a, _b, _c, _d, _e;
704
+ var _a, _b, _c, _d, _e, _f;
704
705
  const warnings = [];
705
706
  const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
706
707
  provider: "openai",
@@ -708,18 +709,19 @@ var OpenAIChatLanguageModel = class {
708
709
  schema: openaiLanguageModelChatOptions
709
710
  })) != null ? _a : {};
710
711
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
711
- const isReasoningModel = (_b = openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
712
+ const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : (0, import_provider_utils5.isCustomReasoning)(reasoning) ? reasoning : void 0;
713
+ const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
712
714
  if (topK != null) {
713
715
  warnings.push({ type: "unsupported", feature: "topK" });
714
716
  }
715
717
  const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
716
718
  {
717
719
  prompt,
718
- systemMessageMode: (_c = openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
720
+ systemMessageMode: (_d = openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
719
721
  }
720
722
  );
721
723
  warnings.push(...messageWarnings);
722
- const strictJsonSchema = (_d = openaiOptions.strictJsonSchema) != null ? _d : true;
724
+ const strictJsonSchema = (_e = openaiOptions.strictJsonSchema) != null ? _e : true;
723
725
  const baseArgs = {
724
726
  // model id:
725
727
  model: this.modelId,
@@ -740,7 +742,7 @@ var OpenAIChatLanguageModel = class {
740
742
  json_schema: {
741
743
  schema: responseFormat.schema,
742
744
  strict: strictJsonSchema,
743
- name: (_e = responseFormat.name) != null ? _e : "response",
745
+ name: (_f = responseFormat.name) != null ? _f : "response",
744
746
  description: responseFormat.description
745
747
  }
746
748
  } : { type: "json_object" } : void 0,
@@ -753,7 +755,7 @@ var OpenAIChatLanguageModel = class {
753
755
  store: openaiOptions.store,
754
756
  metadata: openaiOptions.metadata,
755
757
  prediction: openaiOptions.prediction,
756
- reasoning_effort: openaiOptions.reasoningEffort,
758
+ reasoning_effort: resolvedReasoningEffort,
757
759
  service_tier: openaiOptions.serviceTier,
758
760
  prompt_cache_key: openaiOptions.promptCacheKey,
759
761
  prompt_cache_retention: openaiOptions.promptCacheRetention,
@@ -762,7 +764,7 @@ var OpenAIChatLanguageModel = class {
762
764
  messages
763
765
  };
764
766
  if (isReasoningModel) {
765
- if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
767
+ if (resolvedReasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
766
768
  if (baseArgs.temperature != null) {
767
769
  baseArgs.temperature = void 0;
768
770
  warnings.push({
@@ -1410,7 +1412,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
1410
1412
  // src/completion/openai-completion-language-model.ts
1411
1413
  var OpenAICompletionLanguageModel = class {
1412
1414
  constructor(modelId, config) {
1413
- this.specificationVersion = "v3";
1415
+ this.specificationVersion = "v4";
1414
1416
  this.supportedUrls = {
1415
1417
  // No URLs are supported for completion models.
1416
1418
  };
@@ -1675,7 +1677,7 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
1675
1677
  // src/embedding/openai-embedding-model.ts
1676
1678
  var OpenAIEmbeddingModel = class {
1677
1679
  constructor(modelId, config) {
1678
- this.specificationVersion = "v3";
1680
+ this.specificationVersion = "v4";
1679
1681
  this.maxEmbeddingsPerCall = 2048;
1680
1682
  this.supportsParallelCalls = true;
1681
1683
  this.modelId = modelId;
@@ -1796,7 +1798,7 @@ var OpenAIImageModel = class {
1796
1798
  constructor(modelId, config) {
1797
1799
  this.modelId = modelId;
1798
1800
  this.config = config;
1799
- this.specificationVersion = "v3";
1801
+ this.specificationVersion = "v4";
1800
1802
  }
1801
1803
  get maxImagesPerCall() {
1802
1804
  var _a;
@@ -2117,7 +2119,7 @@ var OpenAITranscriptionModel = class {
2117
2119
  constructor(modelId, config) {
2118
2120
  this.modelId = modelId;
2119
2121
  this.config = config;
2120
- this.specificationVersion = "v3";
2122
+ this.specificationVersion = "v4";
2121
2123
  }
2122
2124
  get provider() {
2123
2125
  return this.config.provider;
@@ -2240,7 +2242,7 @@ var OpenAISpeechModel = class {
2240
2242
  constructor(modelId, config) {
2241
2243
  this.modelId = modelId;
2242
2244
  this.config = config;
2243
- this.specificationVersion = "v3";
2245
+ this.specificationVersion = "v4";
2244
2246
  }
2245
2247
  get provider() {
2246
2248
  return this.config.provider;
@@ -2338,7 +2340,7 @@ var OpenAISpeechModel = class {
2338
2340
 
2339
2341
  // src/responses/openai-responses-language-model.ts
2340
2342
  var import_provider8 = require("@ai-sdk/provider");
2341
- var import_provider_utils33 = require("@ai-sdk/provider-utils");
2343
+ var import_provider_utils34 = require("@ai-sdk/provider-utils");
2342
2344
 
2343
2345
  // src/responses/convert-openai-responses-usage.ts
2344
2346
  function convertOpenAIResponsesUsage(usage) {
@@ -2381,8 +2383,8 @@ function convertOpenAIResponsesUsage(usage) {
2381
2383
 
2382
2384
  // src/responses/convert-to-openai-responses-input.ts
2383
2385
  var import_provider6 = require("@ai-sdk/provider");
2384
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2385
- var import_v415 = require("zod/v4");
2386
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
2387
+ var import_v416 = require("zod/v4");
2386
2388
 
2387
2389
  // src/tool/apply-patch.ts
2388
2390
  var import_provider_utils19 = require("@ai-sdk/provider-utils");
@@ -2549,6 +2551,39 @@ var shell = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchem
2549
2551
  outputSchema: shellOutputSchema
2550
2552
  });
2551
2553
 
2554
+ // src/tool/tool-search.ts
2555
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
2556
+ var import_v415 = require("zod/v4");
2557
+ var toolSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
2558
+ () => (0, import_provider_utils22.zodSchema)(
2559
+ import_v415.z.object({
2560
+ execution: import_v415.z.enum(["server", "client"]).optional(),
2561
+ description: import_v415.z.string().optional(),
2562
+ parameters: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
2563
+ })
2564
+ )
2565
+ );
2566
+ var toolSearchInputSchema = (0, import_provider_utils22.lazySchema)(
2567
+ () => (0, import_provider_utils22.zodSchema)(
2568
+ import_v415.z.object({
2569
+ arguments: import_v415.z.unknown().optional(),
2570
+ call_id: import_v415.z.string().nullish()
2571
+ })
2572
+ )
2573
+ );
2574
+ var toolSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
2575
+ () => (0, import_provider_utils22.zodSchema)(
2576
+ import_v415.z.object({
2577
+ tools: import_v415.z.array(import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()))
2578
+ })
2579
+ )
2580
+ );
2581
+ var toolSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
2582
+ id: "openai.tool_search",
2583
+ inputSchema: toolSearchInputSchema,
2584
+ outputSchema: toolSearchOutputSchema
2585
+ });
2586
+
2552
2587
  // src/responses/convert-to-openai-responses-input.ts
2553
2588
  function isFileId(data, prefixes) {
2554
2589
  if (!prefixes) return false;
@@ -2567,8 +2602,8 @@ async function convertToOpenAIResponsesInput({
2567
2602
  hasApplyPatchTool = false,
2568
2603
  customProviderToolNames
2569
2604
  }) {
2570
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2571
- const input = [];
2605
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2606
+ let input = [];
2572
2607
  const warnings = [];
2573
2608
  const processedApprovalIds = /* @__PURE__ */ new Set();
2574
2609
  for (const { role, content } of prompt) {
@@ -2614,7 +2649,7 @@ async function convertToOpenAIResponsesInput({
2614
2649
  return {
2615
2650
  type: "input_image",
2616
2651
  ...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)}`
2652
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2618
2653
  },
2619
2654
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
2620
2655
  };
@@ -2629,7 +2664,7 @@ async function convertToOpenAIResponsesInput({
2629
2664
  type: "input_file",
2630
2665
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2631
2666
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2632
- file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
2667
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
2633
2668
  }
2634
2669
  };
2635
2670
  } else {
@@ -2671,6 +2706,32 @@ async function convertToOpenAIResponsesInput({
2671
2706
  if (hasConversation && id != null) {
2672
2707
  break;
2673
2708
  }
2709
+ const resolvedToolName = toolNameMapping.toProviderToolName(
2710
+ part.toolName
2711
+ );
2712
+ if (resolvedToolName === "tool_search") {
2713
+ if (store && id != null) {
2714
+ input.push({ type: "item_reference", id });
2715
+ break;
2716
+ }
2717
+ const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils23.parseJSON)({
2718
+ text: part.input,
2719
+ schema: toolSearchInputSchema
2720
+ }) : await (0, import_provider_utils23.validateTypes)({
2721
+ value: part.input,
2722
+ schema: toolSearchInputSchema
2723
+ });
2724
+ const execution = parsedInput.call_id != null ? "client" : "server";
2725
+ input.push({
2726
+ type: "tool_search_call",
2727
+ id: id != null ? id : part.toolCallId,
2728
+ execution,
2729
+ call_id: (_g = parsedInput.call_id) != null ? _g : null,
2730
+ status: "completed",
2731
+ arguments: parsedInput.arguments
2732
+ });
2733
+ break;
2734
+ }
2674
2735
  if (part.providerExecuted) {
2675
2736
  if (store && id != null) {
2676
2737
  input.push({ type: "item_reference", id });
@@ -2681,11 +2742,8 @@ async function convertToOpenAIResponsesInput({
2681
2742
  input.push({ type: "item_reference", id });
2682
2743
  break;
2683
2744
  }
2684
- const resolvedToolName = toolNameMapping.toProviderToolName(
2685
- part.toolName
2686
- );
2687
2745
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2688
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2746
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2689
2747
  value: part.input,
2690
2748
  schema: localShellInputSchema
2691
2749
  });
@@ -2705,7 +2763,7 @@ async function convertToOpenAIResponsesInput({
2705
2763
  break;
2706
2764
  }
2707
2765
  if (hasShellTool && resolvedToolName === "shell") {
2708
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2766
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2709
2767
  value: part.input,
2710
2768
  schema: shellInputSchema
2711
2769
  });
@@ -2723,7 +2781,7 @@ async function convertToOpenAIResponsesInput({
2723
2781
  break;
2724
2782
  }
2725
2783
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
2726
- const parsedInput = await (0, import_provider_utils22.validateTypes)({
2784
+ const parsedInput = await (0, import_provider_utils23.validateTypes)({
2727
2785
  value: part.input,
2728
2786
  schema: applyPatchInputSchema
2729
2787
  });
@@ -2766,9 +2824,29 @@ async function convertToOpenAIResponsesInput({
2766
2824
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
2767
2825
  part.toolName
2768
2826
  );
2827
+ if (resolvedResultToolName === "tool_search") {
2828
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2829
+ if (store) {
2830
+ input.push({ type: "item_reference", id: itemId });
2831
+ } else if (part.output.type === "json") {
2832
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2833
+ value: part.output.value,
2834
+ schema: toolSearchOutputSchema
2835
+ });
2836
+ input.push({
2837
+ type: "tool_search_output",
2838
+ id: itemId,
2839
+ execution: "server",
2840
+ call_id: null,
2841
+ status: "completed",
2842
+ tools: parsedOutput.tools
2843
+ });
2844
+ }
2845
+ break;
2846
+ }
2769
2847
  if (hasShellTool && resolvedResultToolName === "shell") {
2770
2848
  if (part.output.type === "json") {
2771
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
2849
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2772
2850
  value: part.output.value,
2773
2851
  schema: shellOutputSchema
2774
2852
  });
@@ -2788,7 +2866,7 @@ async function convertToOpenAIResponsesInput({
2788
2866
  break;
2789
2867
  }
2790
2868
  if (store) {
2791
- const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
2869
+ const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
2792
2870
  input.push({ type: "item_reference", id: itemId });
2793
2871
  } else {
2794
2872
  warnings.push({
@@ -2799,7 +2877,7 @@ async function convertToOpenAIResponsesInput({
2799
2877
  break;
2800
2878
  }
2801
2879
  case "reasoning": {
2802
- const providerOptions = await (0, import_provider_utils22.parseProviderOptions)({
2880
+ const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
2803
2881
  provider: providerOptionsName,
2804
2882
  providerOptions: part.providerOptions,
2805
2883
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2871,6 +2949,28 @@ async function convertToOpenAIResponsesInput({
2871
2949
  }
2872
2950
  break;
2873
2951
  }
2952
+ case "custom": {
2953
+ if (part.kind === "openai.compaction") {
2954
+ const providerOpts = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName];
2955
+ const id = providerOpts == null ? void 0 : providerOpts.itemId;
2956
+ if (hasConversation && id != null) {
2957
+ break;
2958
+ }
2959
+ if (store && id != null) {
2960
+ input.push({ type: "item_reference", id });
2961
+ break;
2962
+ }
2963
+ const encryptedContent = providerOpts == null ? void 0 : providerOpts.encryptedContent;
2964
+ if (id != null) {
2965
+ input.push({
2966
+ type: "compaction",
2967
+ id,
2968
+ encrypted_content: encryptedContent
2969
+ });
2970
+ }
2971
+ }
2972
+ break;
2973
+ }
2874
2974
  }
2875
2975
  }
2876
2976
  break;
@@ -2898,7 +2998,7 @@ async function convertToOpenAIResponsesInput({
2898
2998
  }
2899
2999
  const output = part.output;
2900
3000
  if (output.type === "execution-denied") {
2901
- const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
3001
+ const approvalId = (_p = (_o = output.providerOptions) == null ? void 0 : _o.openai) == null ? void 0 : _p.approvalId;
2902
3002
  if (approvalId) {
2903
3003
  continue;
2904
3004
  }
@@ -2906,8 +3006,22 @@ async function convertToOpenAIResponsesInput({
2906
3006
  const resolvedToolName = toolNameMapping.toProviderToolName(
2907
3007
  part.toolName
2908
3008
  );
3009
+ if (resolvedToolName === "tool_search" && output.type === "json") {
3010
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
3011
+ value: output.value,
3012
+ schema: toolSearchOutputSchema
3013
+ });
3014
+ input.push({
3015
+ type: "tool_search_output",
3016
+ execution: "client",
3017
+ call_id: part.toolCallId,
3018
+ status: "completed",
3019
+ tools: parsedOutput.tools
3020
+ });
3021
+ continue;
3022
+ }
2909
3023
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
2910
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3024
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2911
3025
  value: output.value,
2912
3026
  schema: localShellOutputSchema
2913
3027
  });
@@ -2919,7 +3033,7 @@ async function convertToOpenAIResponsesInput({
2919
3033
  continue;
2920
3034
  }
2921
3035
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
2922
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3036
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2923
3037
  value: output.value,
2924
3038
  schema: shellOutputSchema
2925
3039
  });
@@ -2938,7 +3052,7 @@ async function convertToOpenAIResponsesInput({
2938
3052
  continue;
2939
3053
  }
2940
3054
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
2941
- const parsedOutput = await (0, import_provider_utils22.validateTypes)({
3055
+ const parsedOutput = await (0, import_provider_utils23.validateTypes)({
2942
3056
  value: output.value,
2943
3057
  schema: applyPatchOutputSchema
2944
3058
  });
@@ -2958,7 +3072,7 @@ async function convertToOpenAIResponsesInput({
2958
3072
  outputValue = output.value;
2959
3073
  break;
2960
3074
  case "execution-denied":
2961
- outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3075
+ outputValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
2962
3076
  break;
2963
3077
  case "json":
2964
3078
  case "error-json":
@@ -2986,6 +3100,11 @@ async function convertToOpenAIResponsesInput({
2986
3100
  filename: (_a2 = item.filename) != null ? _a2 : "data",
2987
3101
  file_data: `data:${item.mediaType};base64,${item.data}`
2988
3102
  };
3103
+ case "file-url":
3104
+ return {
3105
+ type: "input_file",
3106
+ file_url: item.url
3107
+ };
2989
3108
  default:
2990
3109
  warnings.push({
2991
3110
  type: "other",
@@ -2993,7 +3112,7 @@ async function convertToOpenAIResponsesInput({
2993
3112
  });
2994
3113
  return void 0;
2995
3114
  }
2996
- }).filter(import_provider_utils22.isNonNullable);
3115
+ }).filter(import_provider_utils23.isNonNullable);
2997
3116
  break;
2998
3117
  default:
2999
3118
  outputValue = "";
@@ -3012,7 +3131,7 @@ async function convertToOpenAIResponsesInput({
3012
3131
  contentValue = output.value;
3013
3132
  break;
3014
3133
  case "execution-denied":
3015
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3134
+ contentValue = (_r = output.reason) != null ? _r : "Tool execution denied.";
3016
3135
  break;
3017
3136
  case "json":
3018
3137
  case "error-json":
@@ -3044,6 +3163,12 @@ async function convertToOpenAIResponsesInput({
3044
3163
  file_data: `data:${item.mediaType};base64,${item.data}`
3045
3164
  };
3046
3165
  }
3166
+ case "file-url": {
3167
+ return {
3168
+ type: "input_file",
3169
+ file_url: item.url
3170
+ };
3171
+ }
3047
3172
  default: {
3048
3173
  warnings.push({
3049
3174
  type: "other",
@@ -3052,7 +3177,7 @@ async function convertToOpenAIResponsesInput({
3052
3177
  return void 0;
3053
3178
  }
3054
3179
  }
3055
- }).filter(import_provider_utils22.isNonNullable);
3180
+ }).filter(import_provider_utils23.isNonNullable);
3056
3181
  break;
3057
3182
  }
3058
3183
  input.push({
@@ -3069,11 +3194,22 @@ async function convertToOpenAIResponsesInput({
3069
3194
  }
3070
3195
  }
3071
3196
  }
3197
+ if (!store && input.some(
3198
+ (item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
3199
+ )) {
3200
+ warnings.push({
3201
+ type: "other",
3202
+ message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
3203
+ });
3204
+ input = input.filter(
3205
+ (item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
3206
+ );
3207
+ }
3072
3208
  return { input, warnings };
3073
3209
  }
3074
- var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
3075
- itemId: import_v415.z.string().nullish(),
3076
- reasoningEncryptedContent: import_v415.z.string().nullish()
3210
+ var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
3211
+ itemId: import_v416.z.string().nullish(),
3212
+ reasoningEncryptedContent: import_v416.z.string().nullish()
3077
3213
  });
3078
3214
 
3079
3215
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3095,483 +3231,552 @@ function mapOpenAIResponseFinishReason({
3095
3231
  }
3096
3232
 
3097
3233
  // 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()
3234
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
3235
+ var import_v417 = require("zod/v4");
3236
+ var jsonValueSchema = import_v417.z.lazy(
3237
+ () => import_v417.z.union([
3238
+ import_v417.z.string(),
3239
+ import_v417.z.number(),
3240
+ import_v417.z.boolean(),
3241
+ import_v417.z.null(),
3242
+ import_v417.z.array(jsonValueSchema),
3243
+ import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional())
3244
+ ])
3245
+ );
3246
+ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
3247
+ () => (0, import_provider_utils24.zodSchema)(
3248
+ import_v417.z.union([
3249
+ import_v417.z.object({
3250
+ type: import_v417.z.literal("response.output_text.delta"),
3251
+ item_id: import_v417.z.string(),
3252
+ delta: import_v417.z.string(),
3253
+ logprobs: import_v417.z.array(
3254
+ import_v417.z.object({
3255
+ token: import_v417.z.string(),
3256
+ logprob: import_v417.z.number(),
3257
+ top_logprobs: import_v417.z.array(
3258
+ import_v417.z.object({
3259
+ token: import_v417.z.string(),
3260
+ logprob: import_v417.z.number()
3115
3261
  })
3116
3262
  )
3117
3263
  })
3118
3264
  ).nullish()
3119
3265
  }),
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()
3266
+ import_v417.z.object({
3267
+ type: import_v417.z.enum(["response.completed", "response.incomplete"]),
3268
+ response: import_v417.z.object({
3269
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3270
+ usage: import_v417.z.object({
3271
+ input_tokens: import_v417.z.number(),
3272
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3273
+ output_tokens: import_v417.z.number(),
3274
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3129
3275
  }),
3130
- service_tier: import_v416.z.string().nullish()
3276
+ service_tier: import_v417.z.string().nullish()
3277
+ })
3278
+ }),
3279
+ import_v417.z.object({
3280
+ type: import_v417.z.literal("response.failed"),
3281
+ response: import_v417.z.object({
3282
+ error: import_v417.z.object({
3283
+ code: import_v417.z.string().nullish(),
3284
+ message: import_v417.z.string()
3285
+ }).nullish(),
3286
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3287
+ usage: import_v417.z.object({
3288
+ input_tokens: import_v417.z.number(),
3289
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3290
+ output_tokens: import_v417.z.number(),
3291
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3292
+ }).nullish(),
3293
+ service_tier: import_v417.z.string().nullish()
3131
3294
  })
3132
3295
  }),
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()
3296
+ import_v417.z.object({
3297
+ type: import_v417.z.literal("response.created"),
3298
+ response: import_v417.z.object({
3299
+ id: import_v417.z.string(),
3300
+ created_at: import_v417.z.number(),
3301
+ model: import_v417.z.string(),
3302
+ service_tier: import_v417.z.string().nullish()
3140
3303
  })
3141
3304
  }),
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()
3305
+ import_v417.z.object({
3306
+ type: import_v417.z.literal("response.output_item.added"),
3307
+ output_index: import_v417.z.number(),
3308
+ item: import_v417.z.discriminatedUnion("type", [
3309
+ import_v417.z.object({
3310
+ type: import_v417.z.literal("message"),
3311
+ id: import_v417.z.string(),
3312
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3150
3313
  }),
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()
3314
+ import_v417.z.object({
3315
+ type: import_v417.z.literal("reasoning"),
3316
+ id: import_v417.z.string(),
3317
+ encrypted_content: import_v417.z.string().nullish()
3155
3318
  }),
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()
3319
+ import_v417.z.object({
3320
+ type: import_v417.z.literal("function_call"),
3321
+ id: import_v417.z.string(),
3322
+ call_id: import_v417.z.string(),
3323
+ name: import_v417.z.string(),
3324
+ arguments: import_v417.z.string()
3162
3325
  }),
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()
3326
+ import_v417.z.object({
3327
+ type: import_v417.z.literal("web_search_call"),
3328
+ id: import_v417.z.string(),
3329
+ status: import_v417.z.string()
3167
3330
  }),
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()
3331
+ import_v417.z.object({
3332
+ type: import_v417.z.literal("computer_call"),
3333
+ id: import_v417.z.string(),
3334
+ status: import_v417.z.string()
3172
3335
  }),
3173
- import_v416.z.object({
3174
- type: import_v416.z.literal("file_search_call"),
3175
- id: import_v416.z.string()
3336
+ import_v417.z.object({
3337
+ type: import_v417.z.literal("file_search_call"),
3338
+ id: import_v417.z.string()
3176
3339
  }),
3177
- import_v416.z.object({
3178
- type: import_v416.z.literal("image_generation_call"),
3179
- id: import_v416.z.string()
3340
+ import_v417.z.object({
3341
+ type: import_v417.z.literal("image_generation_call"),
3342
+ id: import_v417.z.string()
3180
3343
  }),
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() })
3344
+ import_v417.z.object({
3345
+ type: import_v417.z.literal("code_interpreter_call"),
3346
+ id: import_v417.z.string(),
3347
+ container_id: import_v417.z.string(),
3348
+ code: import_v417.z.string().nullable(),
3349
+ outputs: import_v417.z.array(
3350
+ import_v417.z.discriminatedUnion("type", [
3351
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3352
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3190
3353
  ])
3191
3354
  ).nullable(),
3192
- status: import_v416.z.string()
3355
+ status: import_v417.z.string()
3193
3356
  }),
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()
3357
+ import_v417.z.object({
3358
+ type: import_v417.z.literal("mcp_call"),
3359
+ id: import_v417.z.string(),
3360
+ status: import_v417.z.string(),
3361
+ approval_request_id: import_v417.z.string().nullish()
3199
3362
  }),
3200
- import_v416.z.object({
3201
- type: import_v416.z.literal("mcp_list_tools"),
3202
- id: import_v416.z.string()
3363
+ import_v417.z.object({
3364
+ type: import_v417.z.literal("mcp_list_tools"),
3365
+ id: import_v417.z.string()
3203
3366
  }),
3204
- import_v416.z.object({
3205
- type: import_v416.z.literal("mcp_approval_request"),
3206
- id: import_v416.z.string()
3367
+ import_v417.z.object({
3368
+ type: import_v417.z.literal("mcp_approval_request"),
3369
+ id: import_v417.z.string()
3207
3370
  }),
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()
3371
+ import_v417.z.object({
3372
+ type: import_v417.z.literal("apply_patch_call"),
3373
+ id: import_v417.z.string(),
3374
+ call_id: import_v417.z.string(),
3375
+ status: import_v417.z.enum(["in_progress", "completed"]),
3376
+ operation: import_v417.z.discriminatedUnion("type", [
3377
+ import_v417.z.object({
3378
+ type: import_v417.z.literal("create_file"),
3379
+ path: import_v417.z.string(),
3380
+ diff: import_v417.z.string()
3218
3381
  }),
3219
- import_v416.z.object({
3220
- type: import_v416.z.literal("delete_file"),
3221
- path: import_v416.z.string()
3382
+ import_v417.z.object({
3383
+ type: import_v417.z.literal("delete_file"),
3384
+ path: import_v417.z.string()
3222
3385
  }),
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()
3386
+ import_v417.z.object({
3387
+ type: import_v417.z.literal("update_file"),
3388
+ path: import_v417.z.string(),
3389
+ diff: import_v417.z.string()
3227
3390
  })
3228
3391
  ])
3229
3392
  }),
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()
3393
+ import_v417.z.object({
3394
+ type: import_v417.z.literal("custom_tool_call"),
3395
+ id: import_v417.z.string(),
3396
+ call_id: import_v417.z.string(),
3397
+ name: import_v417.z.string(),
3398
+ input: import_v417.z.string()
3236
3399
  }),
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())
3400
+ import_v417.z.object({
3401
+ type: import_v417.z.literal("shell_call"),
3402
+ id: import_v417.z.string(),
3403
+ call_id: import_v417.z.string(),
3404
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3405
+ action: import_v417.z.object({
3406
+ commands: import_v417.z.array(import_v417.z.string())
3244
3407
  })
3245
3408
  }),
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()
3409
+ import_v417.z.object({
3410
+ type: import_v417.z.literal("compaction"),
3411
+ id: import_v417.z.string(),
3412
+ encrypted_content: import_v417.z.string().nullish()
3413
+ }),
3414
+ import_v417.z.object({
3415
+ type: import_v417.z.literal("shell_call_output"),
3416
+ id: import_v417.z.string(),
3417
+ call_id: import_v417.z.string(),
3418
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3419
+ output: import_v417.z.array(
3420
+ import_v417.z.object({
3421
+ stdout: import_v417.z.string(),
3422
+ stderr: import_v417.z.string(),
3423
+ outcome: import_v417.z.discriminatedUnion("type", [
3424
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3425
+ import_v417.z.object({
3426
+ type: import_v417.z.literal("exit"),
3427
+ exit_code: import_v417.z.number()
3260
3428
  })
3261
3429
  ])
3262
3430
  })
3263
3431
  )
3432
+ }),
3433
+ import_v417.z.object({
3434
+ type: import_v417.z.literal("tool_search_call"),
3435
+ id: import_v417.z.string(),
3436
+ execution: import_v417.z.enum(["server", "client"]),
3437
+ call_id: import_v417.z.string().nullable(),
3438
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3439
+ arguments: import_v417.z.unknown()
3440
+ }),
3441
+ import_v417.z.object({
3442
+ type: import_v417.z.literal("tool_search_output"),
3443
+ id: import_v417.z.string(),
3444
+ execution: import_v417.z.enum(["server", "client"]),
3445
+ call_id: import_v417.z.string().nullable(),
3446
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3447
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3264
3448
  })
3265
3449
  ])
3266
3450
  }),
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()
3451
+ import_v417.z.object({
3452
+ type: import_v417.z.literal("response.output_item.done"),
3453
+ output_index: import_v417.z.number(),
3454
+ item: import_v417.z.discriminatedUnion("type", [
3455
+ import_v417.z.object({
3456
+ type: import_v417.z.literal("message"),
3457
+ id: import_v417.z.string(),
3458
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
3275
3459
  }),
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()
3460
+ import_v417.z.object({
3461
+ type: import_v417.z.literal("reasoning"),
3462
+ id: import_v417.z.string(),
3463
+ encrypted_content: import_v417.z.string().nullish()
3280
3464
  }),
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")
3465
+ import_v417.z.object({
3466
+ type: import_v417.z.literal("function_call"),
3467
+ id: import_v417.z.string(),
3468
+ call_id: import_v417.z.string(),
3469
+ name: import_v417.z.string(),
3470
+ arguments: import_v417.z.string(),
3471
+ status: import_v417.z.literal("completed")
3288
3472
  }),
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")
3473
+ import_v417.z.object({
3474
+ type: import_v417.z.literal("custom_tool_call"),
3475
+ id: import_v417.z.string(),
3476
+ call_id: import_v417.z.string(),
3477
+ name: import_v417.z.string(),
3478
+ input: import_v417.z.string(),
3479
+ status: import_v417.z.literal("completed")
3296
3480
  }),
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() })
3481
+ import_v417.z.object({
3482
+ type: import_v417.z.literal("code_interpreter_call"),
3483
+ id: import_v417.z.string(),
3484
+ code: import_v417.z.string().nullable(),
3485
+ container_id: import_v417.z.string(),
3486
+ outputs: import_v417.z.array(
3487
+ import_v417.z.discriminatedUnion("type", [
3488
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3489
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3306
3490
  ])
3307
3491
  ).nullable()
3308
3492
  }),
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()
3493
+ import_v417.z.object({
3494
+ type: import_v417.z.literal("image_generation_call"),
3495
+ id: import_v417.z.string(),
3496
+ result: import_v417.z.string()
3313
3497
  }),
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() })
3498
+ import_v417.z.object({
3499
+ type: import_v417.z.literal("web_search_call"),
3500
+ id: import_v417.z.string(),
3501
+ status: import_v417.z.string(),
3502
+ action: import_v417.z.discriminatedUnion("type", [
3503
+ import_v417.z.object({
3504
+ type: import_v417.z.literal("search"),
3505
+ query: import_v417.z.string().nullish(),
3506
+ sources: import_v417.z.array(
3507
+ import_v417.z.discriminatedUnion("type", [
3508
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3509
+ import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
3326
3510
  ])
3327
3511
  ).nullish()
3328
3512
  }),
3329
- import_v416.z.object({
3330
- type: import_v416.z.literal("open_page"),
3331
- url: import_v416.z.string().nullish()
3513
+ import_v417.z.object({
3514
+ type: import_v417.z.literal("open_page"),
3515
+ url: import_v417.z.string().nullish()
3332
3516
  }),
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()
3517
+ import_v417.z.object({
3518
+ type: import_v417.z.literal("find_in_page"),
3519
+ url: import_v417.z.string().nullish(),
3520
+ pattern: import_v417.z.string().nullish()
3337
3521
  })
3338
3522
  ]).nullish()
3339
3523
  }),
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()])
3524
+ import_v417.z.object({
3525
+ type: import_v417.z.literal("file_search_call"),
3526
+ id: import_v417.z.string(),
3527
+ queries: import_v417.z.array(import_v417.z.string()),
3528
+ results: import_v417.z.array(
3529
+ import_v417.z.object({
3530
+ attributes: import_v417.z.record(
3531
+ import_v417.z.string(),
3532
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3349
3533
  ),
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()
3534
+ file_id: import_v417.z.string(),
3535
+ filename: import_v417.z.string(),
3536
+ score: import_v417.z.number(),
3537
+ text: import_v417.z.string()
3354
3538
  })
3355
3539
  ).nullish()
3356
3540
  }),
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()
3541
+ import_v417.z.object({
3542
+ type: import_v417.z.literal("local_shell_call"),
3543
+ id: import_v417.z.string(),
3544
+ call_id: import_v417.z.string(),
3545
+ action: import_v417.z.object({
3546
+ type: import_v417.z.literal("exec"),
3547
+ command: import_v417.z.array(import_v417.z.string()),
3548
+ timeout_ms: import_v417.z.number().optional(),
3549
+ user: import_v417.z.string().optional(),
3550
+ working_directory: import_v417.z.string().optional(),
3551
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3368
3552
  })
3369
3553
  }),
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")
3554
+ import_v417.z.object({
3555
+ type: import_v417.z.literal("computer_call"),
3556
+ id: import_v417.z.string(),
3557
+ status: import_v417.z.literal("completed")
3374
3558
  }),
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()
3559
+ import_v417.z.object({
3560
+ type: import_v417.z.literal("mcp_call"),
3561
+ id: import_v417.z.string(),
3562
+ status: import_v417.z.string(),
3563
+ arguments: import_v417.z.string(),
3564
+ name: import_v417.z.string(),
3565
+ server_label: import_v417.z.string(),
3566
+ output: import_v417.z.string().nullish(),
3567
+ error: import_v417.z.union([
3568
+ import_v417.z.string(),
3569
+ import_v417.z.object({
3570
+ type: import_v417.z.string().optional(),
3571
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3572
+ message: import_v417.z.string().optional()
3389
3573
  }).loose()
3390
3574
  ]).nullish(),
3391
- approval_request_id: import_v416.z.string().nullish()
3575
+ approval_request_id: import_v417.z.string().nullish()
3392
3576
  }),
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()
3577
+ import_v417.z.object({
3578
+ type: import_v417.z.literal("mcp_list_tools"),
3579
+ id: import_v417.z.string(),
3580
+ server_label: import_v417.z.string(),
3581
+ tools: import_v417.z.array(
3582
+ import_v417.z.object({
3583
+ name: import_v417.z.string(),
3584
+ description: import_v417.z.string().optional(),
3585
+ input_schema: import_v417.z.any(),
3586
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3403
3587
  })
3404
3588
  ),
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()
3589
+ error: import_v417.z.union([
3590
+ import_v417.z.string(),
3591
+ import_v417.z.object({
3592
+ type: import_v417.z.string().optional(),
3593
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3594
+ message: import_v417.z.string().optional()
3411
3595
  }).loose()
3412
3596
  ]).optional()
3413
3597
  }),
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()
3598
+ import_v417.z.object({
3599
+ type: import_v417.z.literal("mcp_approval_request"),
3600
+ id: import_v417.z.string(),
3601
+ server_label: import_v417.z.string(),
3602
+ name: import_v417.z.string(),
3603
+ arguments: import_v417.z.string(),
3604
+ approval_request_id: import_v417.z.string().optional()
3421
3605
  }),
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()
3606
+ import_v417.z.object({
3607
+ type: import_v417.z.literal("apply_patch_call"),
3608
+ id: import_v417.z.string(),
3609
+ call_id: import_v417.z.string(),
3610
+ status: import_v417.z.enum(["in_progress", "completed"]),
3611
+ operation: import_v417.z.discriminatedUnion("type", [
3612
+ import_v417.z.object({
3613
+ type: import_v417.z.literal("create_file"),
3614
+ path: import_v417.z.string(),
3615
+ diff: import_v417.z.string()
3432
3616
  }),
3433
- import_v416.z.object({
3434
- type: import_v416.z.literal("delete_file"),
3435
- path: import_v416.z.string()
3617
+ import_v417.z.object({
3618
+ type: import_v417.z.literal("delete_file"),
3619
+ path: import_v417.z.string()
3436
3620
  }),
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()
3621
+ import_v417.z.object({
3622
+ type: import_v417.z.literal("update_file"),
3623
+ path: import_v417.z.string(),
3624
+ diff: import_v417.z.string()
3441
3625
  })
3442
3626
  ])
3443
3627
  }),
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())
3628
+ import_v417.z.object({
3629
+ type: import_v417.z.literal("shell_call"),
3630
+ id: import_v417.z.string(),
3631
+ call_id: import_v417.z.string(),
3632
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3633
+ action: import_v417.z.object({
3634
+ commands: import_v417.z.array(import_v417.z.string())
3451
3635
  })
3452
3636
  }),
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()
3637
+ import_v417.z.object({
3638
+ type: import_v417.z.literal("compaction"),
3639
+ id: import_v417.z.string(),
3640
+ encrypted_content: import_v417.z.string()
3641
+ }),
3642
+ import_v417.z.object({
3643
+ type: import_v417.z.literal("shell_call_output"),
3644
+ id: import_v417.z.string(),
3645
+ call_id: import_v417.z.string(),
3646
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3647
+ output: import_v417.z.array(
3648
+ import_v417.z.object({
3649
+ stdout: import_v417.z.string(),
3650
+ stderr: import_v417.z.string(),
3651
+ outcome: import_v417.z.discriminatedUnion("type", [
3652
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
3653
+ import_v417.z.object({
3654
+ type: import_v417.z.literal("exit"),
3655
+ exit_code: import_v417.z.number()
3467
3656
  })
3468
3657
  ])
3469
3658
  })
3470
3659
  )
3660
+ }),
3661
+ import_v417.z.object({
3662
+ type: import_v417.z.literal("tool_search_call"),
3663
+ id: import_v417.z.string(),
3664
+ execution: import_v417.z.enum(["server", "client"]),
3665
+ call_id: import_v417.z.string().nullable(),
3666
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3667
+ arguments: import_v417.z.unknown()
3668
+ }),
3669
+ import_v417.z.object({
3670
+ type: import_v417.z.literal("tool_search_output"),
3671
+ id: import_v417.z.string(),
3672
+ execution: import_v417.z.enum(["server", "client"]),
3673
+ call_id: import_v417.z.string().nullable(),
3674
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
3675
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3471
3676
  })
3472
3677
  ])
3473
3678
  }),
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()
3679
+ import_v417.z.object({
3680
+ type: import_v417.z.literal("response.function_call_arguments.delta"),
3681
+ item_id: import_v417.z.string(),
3682
+ output_index: import_v417.z.number(),
3683
+ delta: import_v417.z.string()
3479
3684
  }),
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()
3685
+ import_v417.z.object({
3686
+ type: import_v417.z.literal("response.custom_tool_call_input.delta"),
3687
+ item_id: import_v417.z.string(),
3688
+ output_index: import_v417.z.number(),
3689
+ delta: import_v417.z.string()
3485
3690
  }),
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()
3691
+ import_v417.z.object({
3692
+ type: import_v417.z.literal("response.image_generation_call.partial_image"),
3693
+ item_id: import_v417.z.string(),
3694
+ output_index: import_v417.z.number(),
3695
+ partial_image_b64: import_v417.z.string()
3491
3696
  }),
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()
3697
+ import_v417.z.object({
3698
+ type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
3699
+ item_id: import_v417.z.string(),
3700
+ output_index: import_v417.z.number(),
3701
+ delta: import_v417.z.string()
3497
3702
  }),
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()
3703
+ import_v417.z.object({
3704
+ type: import_v417.z.literal("response.code_interpreter_call_code.done"),
3705
+ item_id: import_v417.z.string(),
3706
+ output_index: import_v417.z.number(),
3707
+ code: import_v417.z.string()
3503
3708
  }),
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()
3709
+ import_v417.z.object({
3710
+ type: import_v417.z.literal("response.output_text.annotation.added"),
3711
+ annotation: import_v417.z.discriminatedUnion("type", [
3712
+ import_v417.z.object({
3713
+ type: import_v417.z.literal("url_citation"),
3714
+ start_index: import_v417.z.number(),
3715
+ end_index: import_v417.z.number(),
3716
+ url: import_v417.z.string(),
3717
+ title: import_v417.z.string()
3513
3718
  }),
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()
3719
+ import_v417.z.object({
3720
+ type: import_v417.z.literal("file_citation"),
3721
+ file_id: import_v417.z.string(),
3722
+ filename: import_v417.z.string(),
3723
+ index: import_v417.z.number()
3519
3724
  }),
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()
3725
+ import_v417.z.object({
3726
+ type: import_v417.z.literal("container_file_citation"),
3727
+ container_id: import_v417.z.string(),
3728
+ file_id: import_v417.z.string(),
3729
+ filename: import_v417.z.string(),
3730
+ start_index: import_v417.z.number(),
3731
+ end_index: import_v417.z.number()
3527
3732
  }),
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()
3733
+ import_v417.z.object({
3734
+ type: import_v417.z.literal("file_path"),
3735
+ file_id: import_v417.z.string(),
3736
+ index: import_v417.z.number()
3532
3737
  })
3533
3738
  ])
3534
3739
  }),
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()
3740
+ import_v417.z.object({
3741
+ type: import_v417.z.literal("response.reasoning_summary_part.added"),
3742
+ item_id: import_v417.z.string(),
3743
+ summary_index: import_v417.z.number()
3539
3744
  }),
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()
3745
+ import_v417.z.object({
3746
+ type: import_v417.z.literal("response.reasoning_summary_text.delta"),
3747
+ item_id: import_v417.z.string(),
3748
+ summary_index: import_v417.z.number(),
3749
+ delta: import_v417.z.string()
3545
3750
  }),
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()
3751
+ import_v417.z.object({
3752
+ type: import_v417.z.literal("response.reasoning_summary_part.done"),
3753
+ item_id: import_v417.z.string(),
3754
+ summary_index: import_v417.z.number()
3550
3755
  }),
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()
3756
+ import_v417.z.object({
3757
+ type: import_v417.z.literal("response.apply_patch_call_operation_diff.delta"),
3758
+ item_id: import_v417.z.string(),
3759
+ output_index: import_v417.z.number(),
3760
+ delta: import_v417.z.string(),
3761
+ obfuscation: import_v417.z.string().nullish()
3557
3762
  }),
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()
3763
+ import_v417.z.object({
3764
+ type: import_v417.z.literal("response.apply_patch_call_operation_diff.done"),
3765
+ item_id: import_v417.z.string(),
3766
+ output_index: import_v417.z.number(),
3767
+ diff: import_v417.z.string()
3563
3768
  }),
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()
3769
+ import_v417.z.object({
3770
+ type: import_v417.z.literal("error"),
3771
+ sequence_number: import_v417.z.number(),
3772
+ error: import_v417.z.object({
3773
+ type: import_v417.z.string(),
3774
+ code: import_v417.z.string(),
3775
+ message: import_v417.z.string(),
3776
+ param: import_v417.z.string().nullish()
3572
3777
  })
3573
3778
  }),
3574
- import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
3779
+ import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
3575
3780
  type: "unknown_chunk",
3576
3781
  message: value.type
3577
3782
  }))
@@ -3579,294 +3784,315 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3579
3784
  ])
3580
3785
  )
3581
3786
  );
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()
3787
+ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
3788
+ () => (0, import_provider_utils24.zodSchema)(
3789
+ import_v417.z.object({
3790
+ id: import_v417.z.string().optional(),
3791
+ created_at: import_v417.z.number().optional(),
3792
+ error: import_v417.z.object({
3793
+ message: import_v417.z.string(),
3794
+ type: import_v417.z.string(),
3795
+ param: import_v417.z.string().nullish(),
3796
+ code: import_v417.z.string()
3592
3797
  }).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()
3798
+ model: import_v417.z.string().optional(),
3799
+ output: import_v417.z.array(
3800
+ import_v417.z.discriminatedUnion("type", [
3801
+ import_v417.z.object({
3802
+ type: import_v417.z.literal("message"),
3803
+ role: import_v417.z.literal("assistant"),
3804
+ id: import_v417.z.string(),
3805
+ phase: import_v417.z.enum(["commentary", "final_answer"]).nullish(),
3806
+ content: import_v417.z.array(
3807
+ import_v417.z.object({
3808
+ type: import_v417.z.literal("output_text"),
3809
+ text: import_v417.z.string(),
3810
+ logprobs: import_v417.z.array(
3811
+ import_v417.z.object({
3812
+ token: import_v417.z.string(),
3813
+ logprob: import_v417.z.number(),
3814
+ top_logprobs: import_v417.z.array(
3815
+ import_v417.z.object({
3816
+ token: import_v417.z.string(),
3817
+ logprob: import_v417.z.number()
3613
3818
  })
3614
3819
  )
3615
3820
  })
3616
3821
  ).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()
3822
+ annotations: import_v417.z.array(
3823
+ import_v417.z.discriminatedUnion("type", [
3824
+ import_v417.z.object({
3825
+ type: import_v417.z.literal("url_citation"),
3826
+ start_index: import_v417.z.number(),
3827
+ end_index: import_v417.z.number(),
3828
+ url: import_v417.z.string(),
3829
+ title: import_v417.z.string()
3625
3830
  }),
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()
3831
+ import_v417.z.object({
3832
+ type: import_v417.z.literal("file_citation"),
3833
+ file_id: import_v417.z.string(),
3834
+ filename: import_v417.z.string(),
3835
+ index: import_v417.z.number()
3631
3836
  }),
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()
3837
+ import_v417.z.object({
3838
+ type: import_v417.z.literal("container_file_citation"),
3839
+ container_id: import_v417.z.string(),
3840
+ file_id: import_v417.z.string(),
3841
+ filename: import_v417.z.string(),
3842
+ start_index: import_v417.z.number(),
3843
+ end_index: import_v417.z.number()
3639
3844
  }),
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()
3845
+ import_v417.z.object({
3846
+ type: import_v417.z.literal("file_path"),
3847
+ file_id: import_v417.z.string(),
3848
+ index: import_v417.z.number()
3644
3849
  })
3645
3850
  ])
3646
3851
  )
3647
3852
  })
3648
3853
  )
3649
3854
  }),
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()
3855
+ import_v417.z.object({
3856
+ type: import_v417.z.literal("web_search_call"),
3857
+ id: import_v417.z.string(),
3858
+ status: import_v417.z.string(),
3859
+ action: import_v417.z.discriminatedUnion("type", [
3860
+ import_v417.z.object({
3861
+ type: import_v417.z.literal("search"),
3862
+ query: import_v417.z.string().nullish(),
3863
+ sources: import_v417.z.array(
3864
+ import_v417.z.discriminatedUnion("type", [
3865
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
3866
+ import_v417.z.object({
3867
+ type: import_v417.z.literal("api"),
3868
+ name: import_v417.z.string()
3664
3869
  })
3665
3870
  ])
3666
3871
  ).nullish()
3667
3872
  }),
3668
- import_v416.z.object({
3669
- type: import_v416.z.literal("open_page"),
3670
- url: import_v416.z.string().nullish()
3873
+ import_v417.z.object({
3874
+ type: import_v417.z.literal("open_page"),
3875
+ url: import_v417.z.string().nullish()
3671
3876
  }),
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()
3877
+ import_v417.z.object({
3878
+ type: import_v417.z.literal("find_in_page"),
3879
+ url: import_v417.z.string().nullish(),
3880
+ pattern: import_v417.z.string().nullish()
3676
3881
  })
3677
3882
  ]).nullish()
3678
3883
  }),
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()])
3884
+ import_v417.z.object({
3885
+ type: import_v417.z.literal("file_search_call"),
3886
+ id: import_v417.z.string(),
3887
+ queries: import_v417.z.array(import_v417.z.string()),
3888
+ results: import_v417.z.array(
3889
+ import_v417.z.object({
3890
+ attributes: import_v417.z.record(
3891
+ import_v417.z.string(),
3892
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
3688
3893
  ),
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()
3894
+ file_id: import_v417.z.string(),
3895
+ filename: import_v417.z.string(),
3896
+ score: import_v417.z.number(),
3897
+ text: import_v417.z.string()
3693
3898
  })
3694
3899
  ).nullish()
3695
3900
  }),
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() })
3901
+ import_v417.z.object({
3902
+ type: import_v417.z.literal("code_interpreter_call"),
3903
+ id: import_v417.z.string(),
3904
+ code: import_v417.z.string().nullable(),
3905
+ container_id: import_v417.z.string(),
3906
+ outputs: import_v417.z.array(
3907
+ import_v417.z.discriminatedUnion("type", [
3908
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
3909
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
3705
3910
  ])
3706
3911
  ).nullable()
3707
3912
  }),
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()
3913
+ import_v417.z.object({
3914
+ type: import_v417.z.literal("image_generation_call"),
3915
+ id: import_v417.z.string(),
3916
+ result: import_v417.z.string()
3712
3917
  }),
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()
3918
+ import_v417.z.object({
3919
+ type: import_v417.z.literal("local_shell_call"),
3920
+ id: import_v417.z.string(),
3921
+ call_id: import_v417.z.string(),
3922
+ action: import_v417.z.object({
3923
+ type: import_v417.z.literal("exec"),
3924
+ command: import_v417.z.array(import_v417.z.string()),
3925
+ timeout_ms: import_v417.z.number().optional(),
3926
+ user: import_v417.z.string().optional(),
3927
+ working_directory: import_v417.z.string().optional(),
3928
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
3724
3929
  })
3725
3930
  }),
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()
3931
+ import_v417.z.object({
3932
+ type: import_v417.z.literal("function_call"),
3933
+ call_id: import_v417.z.string(),
3934
+ name: import_v417.z.string(),
3935
+ arguments: import_v417.z.string(),
3936
+ id: import_v417.z.string()
3732
3937
  }),
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()
3938
+ import_v417.z.object({
3939
+ type: import_v417.z.literal("custom_tool_call"),
3940
+ call_id: import_v417.z.string(),
3941
+ name: import_v417.z.string(),
3942
+ input: import_v417.z.string(),
3943
+ id: import_v417.z.string()
3739
3944
  }),
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()
3945
+ import_v417.z.object({
3946
+ type: import_v417.z.literal("computer_call"),
3947
+ id: import_v417.z.string(),
3948
+ status: import_v417.z.string().optional()
3744
3949
  }),
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()
3950
+ import_v417.z.object({
3951
+ type: import_v417.z.literal("reasoning"),
3952
+ id: import_v417.z.string(),
3953
+ encrypted_content: import_v417.z.string().nullish(),
3954
+ summary: import_v417.z.array(
3955
+ import_v417.z.object({
3956
+ type: import_v417.z.literal("summary_text"),
3957
+ text: import_v417.z.string()
3753
3958
  })
3754
3959
  )
3755
3960
  }),
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()
3961
+ import_v417.z.object({
3962
+ type: import_v417.z.literal("mcp_call"),
3963
+ id: import_v417.z.string(),
3964
+ status: import_v417.z.string(),
3965
+ arguments: import_v417.z.string(),
3966
+ name: import_v417.z.string(),
3967
+ server_label: import_v417.z.string(),
3968
+ output: import_v417.z.string().nullish(),
3969
+ error: import_v417.z.union([
3970
+ import_v417.z.string(),
3971
+ import_v417.z.object({
3972
+ type: import_v417.z.string().optional(),
3973
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3974
+ message: import_v417.z.string().optional()
3770
3975
  }).loose()
3771
3976
  ]).nullish(),
3772
- approval_request_id: import_v416.z.string().nullish()
3977
+ approval_request_id: import_v417.z.string().nullish()
3773
3978
  }),
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()
3979
+ import_v417.z.object({
3980
+ type: import_v417.z.literal("mcp_list_tools"),
3981
+ id: import_v417.z.string(),
3982
+ server_label: import_v417.z.string(),
3983
+ tools: import_v417.z.array(
3984
+ import_v417.z.object({
3985
+ name: import_v417.z.string(),
3986
+ description: import_v417.z.string().optional(),
3987
+ input_schema: import_v417.z.any(),
3988
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3784
3989
  })
3785
3990
  ),
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()
3991
+ error: import_v417.z.union([
3992
+ import_v417.z.string(),
3993
+ import_v417.z.object({
3994
+ type: import_v417.z.string().optional(),
3995
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3996
+ message: import_v417.z.string().optional()
3792
3997
  }).loose()
3793
3998
  ]).optional()
3794
3999
  }),
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()
4000
+ import_v417.z.object({
4001
+ type: import_v417.z.literal("mcp_approval_request"),
4002
+ id: import_v417.z.string(),
4003
+ server_label: import_v417.z.string(),
4004
+ name: import_v417.z.string(),
4005
+ arguments: import_v417.z.string(),
4006
+ approval_request_id: import_v417.z.string().optional()
3802
4007
  }),
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()
4008
+ import_v417.z.object({
4009
+ type: import_v417.z.literal("apply_patch_call"),
4010
+ id: import_v417.z.string(),
4011
+ call_id: import_v417.z.string(),
4012
+ status: import_v417.z.enum(["in_progress", "completed"]),
4013
+ operation: import_v417.z.discriminatedUnion("type", [
4014
+ import_v417.z.object({
4015
+ type: import_v417.z.literal("create_file"),
4016
+ path: import_v417.z.string(),
4017
+ diff: import_v417.z.string()
3813
4018
  }),
3814
- import_v416.z.object({
3815
- type: import_v416.z.literal("delete_file"),
3816
- path: import_v416.z.string()
4019
+ import_v417.z.object({
4020
+ type: import_v417.z.literal("delete_file"),
4021
+ path: import_v417.z.string()
3817
4022
  }),
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()
4023
+ import_v417.z.object({
4024
+ type: import_v417.z.literal("update_file"),
4025
+ path: import_v417.z.string(),
4026
+ diff: import_v417.z.string()
3822
4027
  })
3823
4028
  ])
3824
4029
  }),
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())
4030
+ import_v417.z.object({
4031
+ type: import_v417.z.literal("shell_call"),
4032
+ id: import_v417.z.string(),
4033
+ call_id: import_v417.z.string(),
4034
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4035
+ action: import_v417.z.object({
4036
+ commands: import_v417.z.array(import_v417.z.string())
3832
4037
  })
3833
4038
  }),
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()
4039
+ import_v417.z.object({
4040
+ type: import_v417.z.literal("compaction"),
4041
+ id: import_v417.z.string(),
4042
+ encrypted_content: import_v417.z.string()
4043
+ }),
4044
+ import_v417.z.object({
4045
+ type: import_v417.z.literal("shell_call_output"),
4046
+ id: import_v417.z.string(),
4047
+ call_id: import_v417.z.string(),
4048
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4049
+ output: import_v417.z.array(
4050
+ import_v417.z.object({
4051
+ stdout: import_v417.z.string(),
4052
+ stderr: import_v417.z.string(),
4053
+ outcome: import_v417.z.discriminatedUnion("type", [
4054
+ import_v417.z.object({ type: import_v417.z.literal("timeout") }),
4055
+ import_v417.z.object({
4056
+ type: import_v417.z.literal("exit"),
4057
+ exit_code: import_v417.z.number()
3848
4058
  })
3849
4059
  ])
3850
4060
  })
3851
4061
  )
4062
+ }),
4063
+ import_v417.z.object({
4064
+ type: import_v417.z.literal("tool_search_call"),
4065
+ id: import_v417.z.string(),
4066
+ execution: import_v417.z.enum(["server", "client"]),
4067
+ call_id: import_v417.z.string().nullable(),
4068
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4069
+ arguments: import_v417.z.unknown()
4070
+ }),
4071
+ import_v417.z.object({
4072
+ type: import_v417.z.literal("tool_search_output"),
4073
+ id: import_v417.z.string(),
4074
+ execution: import_v417.z.enum(["server", "client"]),
4075
+ call_id: import_v417.z.string().nullable(),
4076
+ status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
4077
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
3852
4078
  })
3853
4079
  ])
3854
4080
  ).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()
4081
+ service_tier: import_v417.z.string().nullish(),
4082
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
4083
+ usage: import_v417.z.object({
4084
+ input_tokens: import_v417.z.number(),
4085
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
4086
+ output_tokens: import_v417.z.number(),
4087
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3862
4088
  }).optional()
3863
4089
  })
3864
4090
  )
3865
4091
  );
3866
4092
 
3867
4093
  // src/responses/openai-responses-options.ts
3868
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
3869
- var import_v417 = require("zod/v4");
4094
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
4095
+ var import_v418 = require("zod/v4");
3870
4096
  var TOP_LOGPROBS_MAX = 20;
3871
4097
  var openaiResponsesReasoningModelIds = [
3872
4098
  "o1",
@@ -3895,11 +4121,16 @@ var openaiResponsesReasoningModelIds = [
3895
4121
  "gpt-5.2-chat-latest",
3896
4122
  "gpt-5.2-pro",
3897
4123
  "gpt-5.2-codex",
4124
+ "gpt-5.3-chat-latest",
4125
+ "gpt-5.3-codex",
3898
4126
  "gpt-5.4",
3899
4127
  "gpt-5.4-2026-03-05",
4128
+ "gpt-5.4-mini",
4129
+ "gpt-5.4-mini-2026-03-17",
4130
+ "gpt-5.4-nano",
4131
+ "gpt-5.4-nano-2026-03-17",
3900
4132
  "gpt-5.4-pro",
3901
- "gpt-5.4-pro-2026-03-05",
3902
- "gpt-5.3-codex"
4133
+ "gpt-5.4-pro-2026-03-05"
3903
4134
  ];
3904
4135
  var openaiResponsesModelIds = [
3905
4136
  "gpt-4.1",
@@ -3926,9 +4157,9 @@ var openaiResponsesModelIds = [
3926
4157
  "gpt-5-chat-latest",
3927
4158
  ...openaiResponsesReasoningModelIds
3928
4159
  ];
3929
- var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazySchema)(
3930
- () => (0, import_provider_utils24.zodSchema)(
3931
- import_v417.z.object({
4160
+ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazySchema)(
4161
+ () => (0, import_provider_utils25.zodSchema)(
4162
+ import_v418.z.object({
3932
4163
  /**
3933
4164
  * The ID of the OpenAI Conversation to continue.
3934
4165
  * You must create a conversation first via the OpenAI API.
@@ -3936,13 +4167,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3936
4167
  * Defaults to `undefined`.
3937
4168
  * @see https://platform.openai.com/docs/api-reference/conversations/create
3938
4169
  */
3939
- conversation: import_v417.z.string().nullish(),
4170
+ conversation: import_v418.z.string().nullish(),
3940
4171
  /**
3941
4172
  * The set of extra fields to include in the response (advanced, usually not needed).
3942
4173
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
3943
4174
  */
3944
- include: import_v417.z.array(
3945
- import_v417.z.enum([
4175
+ include: import_v418.z.array(
4176
+ import_v418.z.enum([
3946
4177
  "reasoning.encrypted_content",
3947
4178
  // handled internally by default, only needed for unknown reasoning models
3948
4179
  "file_search_call.results",
@@ -3954,7 +4185,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3954
4185
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
3955
4186
  * Defaults to `undefined`.
3956
4187
  */
3957
- instructions: import_v417.z.string().nullish(),
4188
+ instructions: import_v418.z.string().nullish(),
3958
4189
  /**
3959
4190
  * Return the log probabilities of the tokens. Including logprobs will increase
3960
4191
  * the response size and can slow down response times. However, it can
@@ -3969,30 +4200,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
3969
4200
  * @see https://platform.openai.com/docs/api-reference/responses/create
3970
4201
  * @see https://cookbook.openai.com/examples/using_logprobs
3971
4202
  */
3972
- logprobs: import_v417.z.union([import_v417.z.boolean(), import_v417.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4203
+ logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3973
4204
  /**
3974
4205
  * The maximum number of total calls to built-in tools that can be processed in a response.
3975
4206
  * This maximum number applies across all built-in tool calls, not per individual tool.
3976
4207
  * Any further attempts to call a tool by the model will be ignored.
3977
4208
  */
3978
- maxToolCalls: import_v417.z.number().nullish(),
4209
+ maxToolCalls: import_v418.z.number().nullish(),
3979
4210
  /**
3980
4211
  * Additional metadata to store with the generation.
3981
4212
  */
3982
- metadata: import_v417.z.any().nullish(),
4213
+ metadata: import_v418.z.any().nullish(),
3983
4214
  /**
3984
4215
  * Whether to use parallel tool calls. Defaults to `true`.
3985
4216
  */
3986
- parallelToolCalls: import_v417.z.boolean().nullish(),
4217
+ parallelToolCalls: import_v418.z.boolean().nullish(),
3987
4218
  /**
3988
4219
  * The ID of the previous response. You can use it to continue a conversation.
3989
4220
  * Defaults to `undefined`.
3990
4221
  */
3991
- previousResponseId: import_v417.z.string().nullish(),
4222
+ previousResponseId: import_v418.z.string().nullish(),
3992
4223
  /**
3993
4224
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
3994
4225
  */
3995
- promptCacheKey: import_v417.z.string().nullish(),
4226
+ promptCacheKey: import_v418.z.string().nullish(),
3996
4227
  /**
3997
4228
  * The retention policy for the prompt cache.
3998
4229
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4001,7 +4232,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4001
4232
  *
4002
4233
  * @default 'in_memory'
4003
4234
  */
4004
- promptCacheRetention: import_v417.z.enum(["in_memory", "24h"]).nullish(),
4235
+ promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
4005
4236
  /**
4006
4237
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4007
4238
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4012,17 +4243,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4012
4243
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4013
4244
  * an error.
4014
4245
  */
4015
- reasoningEffort: import_v417.z.string().nullish(),
4246
+ reasoningEffort: import_v418.z.string().nullish(),
4016
4247
  /**
4017
4248
  * Controls reasoning summary output from the model.
4018
4249
  * Set to "auto" to automatically receive the richest level available,
4019
4250
  * or "detailed" for comprehensive summaries.
4020
4251
  */
4021
- reasoningSummary: import_v417.z.string().nullish(),
4252
+ reasoningSummary: import_v418.z.string().nullish(),
4022
4253
  /**
4023
4254
  * The identifier for safety monitoring and tracking.
4024
4255
  */
4025
- safetyIdentifier: import_v417.z.string().nullish(),
4256
+ safetyIdentifier: import_v418.z.string().nullish(),
4026
4257
  /**
4027
4258
  * Service tier for the request.
4028
4259
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4030,34 +4261,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4030
4261
  *
4031
4262
  * Defaults to 'auto'.
4032
4263
  */
4033
- serviceTier: import_v417.z.enum(["auto", "flex", "priority", "default"]).nullish(),
4264
+ serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
4034
4265
  /**
4035
4266
  * Whether to store the generation. Defaults to `true`.
4036
4267
  */
4037
- store: import_v417.z.boolean().nullish(),
4268
+ store: import_v418.z.boolean().nullish(),
4038
4269
  /**
4039
4270
  * Whether to use strict JSON schema validation.
4040
4271
  * Defaults to `true`.
4041
4272
  */
4042
- strictJsonSchema: import_v417.z.boolean().nullish(),
4273
+ strictJsonSchema: import_v418.z.boolean().nullish(),
4043
4274
  /**
4044
4275
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4045
4276
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4046
4277
  * Valid values: 'low', 'medium', 'high'.
4047
4278
  */
4048
- textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
4279
+ textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
4049
4280
  /**
4050
4281
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4051
4282
  * 'disabled' turns truncation off.
4052
4283
  */
4053
- truncation: import_v417.z.enum(["auto", "disabled"]).nullish(),
4284
+ truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
4054
4285
  /**
4055
4286
  * A unique identifier representing your end-user, which can help OpenAI to
4056
4287
  * monitor and detect abuse.
4057
4288
  * Defaults to `undefined`.
4058
4289
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4059
4290
  */
4060
- user: import_v417.z.string().nullish(),
4291
+ user: import_v418.z.string().nullish(),
4061
4292
  /**
4062
4293
  * Override the system message mode for this model.
4063
4294
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4066,7 +4297,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4066
4297
  *
4067
4298
  * If not specified, the mode is automatically determined based on the model.
4068
4299
  */
4069
- systemMessageMode: import_v417.z.enum(["system", "developer", "remove"]).optional(),
4300
+ systemMessageMode: import_v418.z.enum(["system", "developer", "remove"]).optional(),
4070
4301
  /**
4071
4302
  * Force treating this model as a reasoning model.
4072
4303
  *
@@ -4076,51 +4307,60 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
4076
4307
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4077
4308
  * and defaults `systemMessageMode` to `developer` unless overridden.
4078
4309
  */
4079
- forceReasoning: import_v417.z.boolean().optional()
4310
+ forceReasoning: import_v418.z.boolean().optional(),
4311
+ /**
4312
+ * Enable server-side context management (compaction).
4313
+ */
4314
+ contextManagement: import_v418.z.array(
4315
+ import_v418.z.object({
4316
+ type: import_v418.z.literal("compaction"),
4317
+ compactThreshold: import_v418.z.number()
4318
+ })
4319
+ ).nullish()
4080
4320
  })
4081
4321
  )
4082
4322
  );
4083
4323
 
4084
4324
  // src/responses/openai-responses-prepare-tools.ts
4085
4325
  var import_provider7 = require("@ai-sdk/provider");
4086
- var import_provider_utils32 = require("@ai-sdk/provider-utils");
4326
+ var import_provider_utils33 = require("@ai-sdk/provider-utils");
4087
4327
 
4088
4328
  // src/tool/code-interpreter.ts
4089
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4090
- var import_v418 = require("zod/v4");
4091
- var codeInterpreterInputSchema = (0, import_provider_utils25.lazySchema)(
4092
- () => (0, import_provider_utils25.zodSchema)(
4093
- import_v418.z.object({
4094
- code: import_v418.z.string().nullish(),
4095
- containerId: import_v418.z.string()
4329
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
4330
+ var import_v419 = require("zod/v4");
4331
+ var codeInterpreterInputSchema = (0, import_provider_utils26.lazySchema)(
4332
+ () => (0, import_provider_utils26.zodSchema)(
4333
+ import_v419.z.object({
4334
+ code: import_v419.z.string().nullish(),
4335
+ containerId: import_v419.z.string()
4096
4336
  })
4097
4337
  )
4098
4338
  );
4099
- var codeInterpreterOutputSchema = (0, import_provider_utils25.lazySchema)(
4100
- () => (0, import_provider_utils25.zodSchema)(
4101
- import_v418.z.object({
4102
- outputs: import_v418.z.array(
4103
- import_v418.z.discriminatedUnion("type", [
4104
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
4105
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
4339
+ var codeInterpreterOutputSchema = (0, import_provider_utils26.lazySchema)(
4340
+ () => (0, import_provider_utils26.zodSchema)(
4341
+ import_v419.z.object({
4342
+ outputs: import_v419.z.array(
4343
+ import_v419.z.discriminatedUnion("type", [
4344
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
4345
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4106
4346
  ])
4107
4347
  ).nullish()
4108
4348
  })
4109
4349
  )
4110
4350
  );
4111
- var codeInterpreterArgsSchema = (0, import_provider_utils25.lazySchema)(
4112
- () => (0, import_provider_utils25.zodSchema)(
4113
- import_v418.z.object({
4114
- container: import_v418.z.union([
4115
- import_v418.z.string(),
4116
- import_v418.z.object({
4117
- fileIds: import_v418.z.array(import_v418.z.string()).optional()
4351
+ var codeInterpreterArgsSchema = (0, import_provider_utils26.lazySchema)(
4352
+ () => (0, import_provider_utils26.zodSchema)(
4353
+ import_v419.z.object({
4354
+ container: import_v419.z.union([
4355
+ import_v419.z.string(),
4356
+ import_v419.z.object({
4357
+ fileIds: import_v419.z.array(import_v419.z.string()).optional()
4118
4358
  })
4119
4359
  ]).optional()
4120
4360
  })
4121
4361
  )
4122
4362
  );
4123
- var codeInterpreterToolFactory = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
4363
+ var codeInterpreterToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4124
4364
  id: "openai.code_interpreter",
4125
4365
  inputSchema: codeInterpreterInputSchema,
4126
4366
  outputSchema: codeInterpreterOutputSchema
@@ -4130,81 +4370,81 @@ var codeInterpreter = (args = {}) => {
4130
4370
  };
4131
4371
 
4132
4372
  // src/tool/file-search.ts
4133
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
4134
- var import_v419 = require("zod/v4");
4135
- var comparisonFilterSchema = import_v419.z.object({
4136
- key: import_v419.z.string(),
4137
- type: import_v419.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4138
- 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())])
4373
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
4374
+ var import_v420 = require("zod/v4");
4375
+ var comparisonFilterSchema = import_v420.z.object({
4376
+ key: import_v420.z.string(),
4377
+ type: import_v420.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4378
+ 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())])
4139
4379
  });
4140
- var compoundFilterSchema = import_v419.z.object({
4141
- type: import_v419.z.enum(["and", "or"]),
4142
- filters: import_v419.z.array(
4143
- import_v419.z.union([comparisonFilterSchema, import_v419.z.lazy(() => compoundFilterSchema)])
4380
+ var compoundFilterSchema = import_v420.z.object({
4381
+ type: import_v420.z.enum(["and", "or"]),
4382
+ filters: import_v420.z.array(
4383
+ import_v420.z.union([comparisonFilterSchema, import_v420.z.lazy(() => compoundFilterSchema)])
4144
4384
  )
4145
4385
  });
4146
- var fileSearchArgsSchema = (0, import_provider_utils26.lazySchema)(
4147
- () => (0, import_provider_utils26.zodSchema)(
4148
- import_v419.z.object({
4149
- vectorStoreIds: import_v419.z.array(import_v419.z.string()),
4150
- maxNumResults: import_v419.z.number().optional(),
4151
- ranking: import_v419.z.object({
4152
- ranker: import_v419.z.string().optional(),
4153
- scoreThreshold: import_v419.z.number().optional()
4386
+ var fileSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
4387
+ () => (0, import_provider_utils27.zodSchema)(
4388
+ import_v420.z.object({
4389
+ vectorStoreIds: import_v420.z.array(import_v420.z.string()),
4390
+ maxNumResults: import_v420.z.number().optional(),
4391
+ ranking: import_v420.z.object({
4392
+ ranker: import_v420.z.string().optional(),
4393
+ scoreThreshold: import_v420.z.number().optional()
4154
4394
  }).optional(),
4155
- filters: import_v419.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4395
+ filters: import_v420.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4156
4396
  })
4157
4397
  )
4158
4398
  );
4159
- var fileSearchOutputSchema = (0, import_provider_utils26.lazySchema)(
4160
- () => (0, import_provider_utils26.zodSchema)(
4161
- import_v419.z.object({
4162
- queries: import_v419.z.array(import_v419.z.string()),
4163
- results: import_v419.z.array(
4164
- import_v419.z.object({
4165
- attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
4166
- fileId: import_v419.z.string(),
4167
- filename: import_v419.z.string(),
4168
- score: import_v419.z.number(),
4169
- text: import_v419.z.string()
4399
+ var fileSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
4400
+ () => (0, import_provider_utils27.zodSchema)(
4401
+ import_v420.z.object({
4402
+ queries: import_v420.z.array(import_v420.z.string()),
4403
+ results: import_v420.z.array(
4404
+ import_v420.z.object({
4405
+ attributes: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()),
4406
+ fileId: import_v420.z.string(),
4407
+ filename: import_v420.z.string(),
4408
+ score: import_v420.z.number(),
4409
+ text: import_v420.z.string()
4170
4410
  })
4171
4411
  ).nullable()
4172
4412
  })
4173
4413
  )
4174
4414
  );
4175
- var fileSearch = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4415
+ var fileSearch = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
4176
4416
  id: "openai.file_search",
4177
- inputSchema: import_v419.z.object({}),
4417
+ inputSchema: import_v420.z.object({}),
4178
4418
  outputSchema: fileSearchOutputSchema
4179
4419
  });
4180
4420
 
4181
4421
  // src/tool/image-generation.ts
4182
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
4183
- var import_v420 = require("zod/v4");
4184
- var imageGenerationArgsSchema = (0, import_provider_utils27.lazySchema)(
4185
- () => (0, import_provider_utils27.zodSchema)(
4186
- import_v420.z.object({
4187
- background: import_v420.z.enum(["auto", "opaque", "transparent"]).optional(),
4188
- inputFidelity: import_v420.z.enum(["low", "high"]).optional(),
4189
- inputImageMask: import_v420.z.object({
4190
- fileId: import_v420.z.string().optional(),
4191
- imageUrl: import_v420.z.string().optional()
4422
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
4423
+ var import_v421 = require("zod/v4");
4424
+ var imageGenerationArgsSchema = (0, import_provider_utils28.lazySchema)(
4425
+ () => (0, import_provider_utils28.zodSchema)(
4426
+ import_v421.z.object({
4427
+ background: import_v421.z.enum(["auto", "opaque", "transparent"]).optional(),
4428
+ inputFidelity: import_v421.z.enum(["low", "high"]).optional(),
4429
+ inputImageMask: import_v421.z.object({
4430
+ fileId: import_v421.z.string().optional(),
4431
+ imageUrl: import_v421.z.string().optional()
4192
4432
  }).optional(),
4193
- model: import_v420.z.string().optional(),
4194
- moderation: import_v420.z.enum(["auto"]).optional(),
4195
- outputCompression: import_v420.z.number().int().min(0).max(100).optional(),
4196
- outputFormat: import_v420.z.enum(["png", "jpeg", "webp"]).optional(),
4197
- partialImages: import_v420.z.number().int().min(0).max(3).optional(),
4198
- quality: import_v420.z.enum(["auto", "low", "medium", "high"]).optional(),
4199
- size: import_v420.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4433
+ model: import_v421.z.string().optional(),
4434
+ moderation: import_v421.z.enum(["auto"]).optional(),
4435
+ outputCompression: import_v421.z.number().int().min(0).max(100).optional(),
4436
+ outputFormat: import_v421.z.enum(["png", "jpeg", "webp"]).optional(),
4437
+ partialImages: import_v421.z.number().int().min(0).max(3).optional(),
4438
+ quality: import_v421.z.enum(["auto", "low", "medium", "high"]).optional(),
4439
+ size: import_v421.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4200
4440
  }).strict()
4201
4441
  )
4202
4442
  );
4203
- var imageGenerationInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({})));
4204
- var imageGenerationOutputSchema = (0, import_provider_utils27.lazySchema)(
4205
- () => (0, import_provider_utils27.zodSchema)(import_v420.z.object({ result: import_v420.z.string() }))
4443
+ var imageGenerationInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
4444
+ var imageGenerationOutputSchema = (0, import_provider_utils28.lazySchema)(
4445
+ () => (0, import_provider_utils28.zodSchema)(import_v421.z.object({ result: import_v421.z.string() }))
4206
4446
  );
4207
- var imageGenerationToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
4447
+ var imageGenerationToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
4208
4448
  id: "openai.image_generation",
4209
4449
  inputSchema: imageGenerationInputSchema,
4210
4450
  outputSchema: imageGenerationOutputSchema
@@ -4214,153 +4454,101 @@ var imageGeneration = (args = {}) => {
4214
4454
  };
4215
4455
 
4216
4456
  // src/tool/custom.ts
4217
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4218
- var import_v421 = require("zod/v4");
4219
- var customArgsSchema = (0, import_provider_utils28.lazySchema)(
4220
- () => (0, import_provider_utils28.zodSchema)(
4221
- import_v421.z.object({
4222
- name: import_v421.z.string(),
4223
- description: import_v421.z.string().optional(),
4224
- format: import_v421.z.union([
4225
- import_v421.z.object({
4226
- type: import_v421.z.literal("grammar"),
4227
- syntax: import_v421.z.enum(["regex", "lark"]),
4228
- definition: import_v421.z.string()
4457
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
4458
+ var import_v422 = require("zod/v4");
4459
+ var customArgsSchema = (0, import_provider_utils29.lazySchema)(
4460
+ () => (0, import_provider_utils29.zodSchema)(
4461
+ import_v422.z.object({
4462
+ description: import_v422.z.string().optional(),
4463
+ format: import_v422.z.union([
4464
+ import_v422.z.object({
4465
+ type: import_v422.z.literal("grammar"),
4466
+ syntax: import_v422.z.enum(["regex", "lark"]),
4467
+ definition: import_v422.z.string()
4229
4468
  }),
4230
- import_v421.z.object({
4231
- type: import_v421.z.literal("text")
4469
+ import_v422.z.object({
4470
+ type: import_v422.z.literal("text")
4232
4471
  })
4233
4472
  ]).optional()
4234
4473
  })
4235
4474
  )
4236
4475
  );
4237
- var customInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.string()));
4238
- var customToolFactory = (0, import_provider_utils28.createProviderToolFactory)({
4476
+ var customInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.string()));
4477
+ var customToolFactory = (0, import_provider_utils29.createProviderToolFactory)({
4239
4478
  id: "openai.custom",
4240
4479
  inputSchema: customInputSchema
4241
4480
  });
4242
4481
 
4243
4482
  // src/tool/mcp.ts
4244
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
4245
- var import_v422 = require("zod/v4");
4246
- var jsonValueSchema = import_v422.z.lazy(
4247
- () => import_v422.z.union([
4248
- import_v422.z.string(),
4249
- import_v422.z.number(),
4250
- import_v422.z.boolean(),
4251
- import_v422.z.null(),
4252
- import_v422.z.array(jsonValueSchema),
4253
- import_v422.z.record(import_v422.z.string(), jsonValueSchema)
4483
+ var import_provider_utils30 = require("@ai-sdk/provider-utils");
4484
+ var import_v423 = require("zod/v4");
4485
+ var jsonValueSchema2 = import_v423.z.lazy(
4486
+ () => import_v423.z.union([
4487
+ import_v423.z.string(),
4488
+ import_v423.z.number(),
4489
+ import_v423.z.boolean(),
4490
+ import_v423.z.null(),
4491
+ import_v423.z.array(jsonValueSchema2),
4492
+ import_v423.z.record(import_v423.z.string(), jsonValueSchema2)
4254
4493
  ])
4255
4494
  );
4256
- var mcpArgsSchema = (0, import_provider_utils29.lazySchema)(
4257
- () => (0, import_provider_utils29.zodSchema)(
4258
- import_v422.z.object({
4259
- serverLabel: import_v422.z.string(),
4260
- allowedTools: import_v422.z.union([
4261
- import_v422.z.array(import_v422.z.string()),
4262
- import_v422.z.object({
4263
- readOnly: import_v422.z.boolean().optional(),
4264
- toolNames: import_v422.z.array(import_v422.z.string()).optional()
4495
+ var mcpArgsSchema = (0, import_provider_utils30.lazySchema)(
4496
+ () => (0, import_provider_utils30.zodSchema)(
4497
+ import_v423.z.object({
4498
+ serverLabel: import_v423.z.string(),
4499
+ allowedTools: import_v423.z.union([
4500
+ import_v423.z.array(import_v423.z.string()),
4501
+ import_v423.z.object({
4502
+ readOnly: import_v423.z.boolean().optional(),
4503
+ toolNames: import_v423.z.array(import_v423.z.string()).optional()
4265
4504
  })
4266
4505
  ]).optional(),
4267
- authorization: import_v422.z.string().optional(),
4268
- connectorId: import_v422.z.string().optional(),
4269
- headers: import_v422.z.record(import_v422.z.string(), import_v422.z.string()).optional(),
4270
- requireApproval: import_v422.z.union([
4271
- import_v422.z.enum(["always", "never"]),
4272
- import_v422.z.object({
4273
- never: import_v422.z.object({
4274
- toolNames: import_v422.z.array(import_v422.z.string()).optional()
4506
+ authorization: import_v423.z.string().optional(),
4507
+ connectorId: import_v423.z.string().optional(),
4508
+ headers: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional(),
4509
+ requireApproval: import_v423.z.union([
4510
+ import_v423.z.enum(["always", "never"]),
4511
+ import_v423.z.object({
4512
+ never: import_v423.z.object({
4513
+ toolNames: import_v423.z.array(import_v423.z.string()).optional()
4275
4514
  }).optional()
4276
4515
  })
4277
4516
  ]).optional(),
4278
- serverDescription: import_v422.z.string().optional(),
4279
- serverUrl: import_v422.z.string().optional()
4517
+ serverDescription: import_v423.z.string().optional(),
4518
+ serverUrl: import_v423.z.string().optional()
4280
4519
  }).refine(
4281
4520
  (v) => v.serverUrl != null || v.connectorId != null,
4282
4521
  "One of serverUrl or connectorId must be provided."
4283
4522
  )
4284
4523
  )
4285
4524
  );
4286
- var mcpInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.object({})));
4287
- var mcpOutputSchema = (0, import_provider_utils29.lazySchema)(
4288
- () => (0, import_provider_utils29.zodSchema)(
4289
- import_v422.z.object({
4290
- type: import_v422.z.literal("call"),
4291
- serverLabel: import_v422.z.string(),
4292
- name: import_v422.z.string(),
4293
- arguments: import_v422.z.string(),
4294
- output: import_v422.z.string().nullish(),
4295
- error: import_v422.z.union([import_v422.z.string(), jsonValueSchema]).optional()
4525
+ var mcpInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
4526
+ var mcpOutputSchema = (0, import_provider_utils30.lazySchema)(
4527
+ () => (0, import_provider_utils30.zodSchema)(
4528
+ import_v423.z.object({
4529
+ type: import_v423.z.literal("call"),
4530
+ serverLabel: import_v423.z.string(),
4531
+ name: import_v423.z.string(),
4532
+ arguments: import_v423.z.string(),
4533
+ output: import_v423.z.string().nullish(),
4534
+ error: import_v423.z.union([import_v423.z.string(), jsonValueSchema2]).optional()
4296
4535
  })
4297
4536
  )
4298
4537
  );
4299
- var mcpToolFactory = (0, import_provider_utils29.createProviderToolFactoryWithOutputSchema)({
4538
+ var mcpToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
4300
4539
  id: "openai.mcp",
4301
4540
  inputSchema: mcpInputSchema,
4302
4541
  outputSchema: mcpOutputSchema
4303
4542
  });
4304
4543
 
4305
4544
  // src/tool/web-search.ts
4306
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
4307
- var import_v423 = require("zod/v4");
4308
- var webSearchArgsSchema = (0, import_provider_utils30.lazySchema)(
4309
- () => (0, import_provider_utils30.zodSchema)(
4310
- import_v423.z.object({
4311
- externalWebAccess: import_v423.z.boolean().optional(),
4312
- filters: import_v423.z.object({ allowedDomains: import_v423.z.array(import_v423.z.string()).optional() }).optional(),
4313
- searchContextSize: import_v423.z.enum(["low", "medium", "high"]).optional(),
4314
- userLocation: import_v423.z.object({
4315
- type: import_v423.z.literal("approximate"),
4316
- country: import_v423.z.string().optional(),
4317
- city: import_v423.z.string().optional(),
4318
- region: import_v423.z.string().optional(),
4319
- timezone: import_v423.z.string().optional()
4320
- }).optional()
4321
- })
4322
- )
4323
- );
4324
- var webSearchInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
4325
- var webSearchOutputSchema = (0, import_provider_utils30.lazySchema)(
4326
- () => (0, import_provider_utils30.zodSchema)(
4327
- import_v423.z.object({
4328
- action: import_v423.z.discriminatedUnion("type", [
4329
- import_v423.z.object({
4330
- type: import_v423.z.literal("search"),
4331
- query: import_v423.z.string().optional()
4332
- }),
4333
- import_v423.z.object({
4334
- type: import_v423.z.literal("openPage"),
4335
- url: import_v423.z.string().nullish()
4336
- }),
4337
- import_v423.z.object({
4338
- type: import_v423.z.literal("findInPage"),
4339
- url: import_v423.z.string().nullish(),
4340
- pattern: import_v423.z.string().nullish()
4341
- })
4342
- ]).optional(),
4343
- sources: import_v423.z.array(
4344
- import_v423.z.discriminatedUnion("type", [
4345
- import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
4346
- import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
4347
- ])
4348
- ).optional()
4349
- })
4350
- )
4351
- );
4352
- var webSearchToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
4353
- id: "openai.web_search",
4354
- inputSchema: webSearchInputSchema,
4355
- outputSchema: webSearchOutputSchema
4356
- });
4357
-
4358
- // src/tool/web-search-preview.ts
4359
4545
  var import_provider_utils31 = require("@ai-sdk/provider-utils");
4360
4546
  var import_v424 = require("zod/v4");
4361
- var webSearchPreviewArgsSchema = (0, import_provider_utils31.lazySchema)(
4547
+ var webSearchArgsSchema = (0, import_provider_utils31.lazySchema)(
4362
4548
  () => (0, import_provider_utils31.zodSchema)(
4363
4549
  import_v424.z.object({
4550
+ externalWebAccess: import_v424.z.boolean().optional(),
4551
+ filters: import_v424.z.object({ allowedDomains: import_v424.z.array(import_v424.z.string()).optional() }).optional(),
4364
4552
  searchContextSize: import_v424.z.enum(["low", "medium", "high"]).optional(),
4365
4553
  userLocation: import_v424.z.object({
4366
4554
  type: import_v424.z.literal("approximate"),
@@ -4372,10 +4560,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils31.lazySchema)(
4372
4560
  })
4373
4561
  )
4374
4562
  );
4375
- var webSearchPreviewInputSchema = (0, import_provider_utils31.lazySchema)(
4376
- () => (0, import_provider_utils31.zodSchema)(import_v424.z.object({}))
4377
- );
4378
- var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
4563
+ var webSearchInputSchema = (0, import_provider_utils31.lazySchema)(() => (0, import_provider_utils31.zodSchema)(import_v424.z.object({})));
4564
+ var webSearchOutputSchema = (0, import_provider_utils31.lazySchema)(
4379
4565
  () => (0, import_provider_utils31.zodSchema)(
4380
4566
  import_v424.z.object({
4381
4567
  action: import_v424.z.discriminatedUnion("type", [
@@ -4392,11 +4578,64 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
4392
4578
  url: import_v424.z.string().nullish(),
4393
4579
  pattern: import_v424.z.string().nullish()
4394
4580
  })
4581
+ ]).optional(),
4582
+ sources: import_v424.z.array(
4583
+ import_v424.z.discriminatedUnion("type", [
4584
+ import_v424.z.object({ type: import_v424.z.literal("url"), url: import_v424.z.string() }),
4585
+ import_v424.z.object({ type: import_v424.z.literal("api"), name: import_v424.z.string() })
4586
+ ])
4587
+ ).optional()
4588
+ })
4589
+ )
4590
+ );
4591
+ var webSearchToolFactory = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
4592
+ id: "openai.web_search",
4593
+ inputSchema: webSearchInputSchema,
4594
+ outputSchema: webSearchOutputSchema
4595
+ });
4596
+
4597
+ // src/tool/web-search-preview.ts
4598
+ var import_provider_utils32 = require("@ai-sdk/provider-utils");
4599
+ var import_v425 = require("zod/v4");
4600
+ var webSearchPreviewArgsSchema = (0, import_provider_utils32.lazySchema)(
4601
+ () => (0, import_provider_utils32.zodSchema)(
4602
+ import_v425.z.object({
4603
+ searchContextSize: import_v425.z.enum(["low", "medium", "high"]).optional(),
4604
+ userLocation: import_v425.z.object({
4605
+ type: import_v425.z.literal("approximate"),
4606
+ country: import_v425.z.string().optional(),
4607
+ city: import_v425.z.string().optional(),
4608
+ region: import_v425.z.string().optional(),
4609
+ timezone: import_v425.z.string().optional()
4610
+ }).optional()
4611
+ })
4612
+ )
4613
+ );
4614
+ var webSearchPreviewInputSchema = (0, import_provider_utils32.lazySchema)(
4615
+ () => (0, import_provider_utils32.zodSchema)(import_v425.z.object({}))
4616
+ );
4617
+ var webSearchPreviewOutputSchema = (0, import_provider_utils32.lazySchema)(
4618
+ () => (0, import_provider_utils32.zodSchema)(
4619
+ import_v425.z.object({
4620
+ action: import_v425.z.discriminatedUnion("type", [
4621
+ import_v425.z.object({
4622
+ type: import_v425.z.literal("search"),
4623
+ query: import_v425.z.string().optional()
4624
+ }),
4625
+ import_v425.z.object({
4626
+ type: import_v425.z.literal("openPage"),
4627
+ url: import_v425.z.string().nullish()
4628
+ }),
4629
+ import_v425.z.object({
4630
+ type: import_v425.z.literal("findInPage"),
4631
+ url: import_v425.z.string().nullish(),
4632
+ pattern: import_v425.z.string().nullish()
4633
+ })
4395
4634
  ]).optional()
4396
4635
  })
4397
4636
  )
4398
4637
  );
4399
- var webSearchPreview = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
4638
+ var webSearchPreview = (0, import_provider_utils32.createProviderToolFactoryWithOutputSchema)({
4400
4639
  id: "openai.web_search_preview",
4401
4640
  inputSchema: webSearchPreviewInputSchema,
4402
4641
  outputSchema: webSearchPreviewOutputSchema
@@ -4409,7 +4648,7 @@ async function prepareResponsesTools({
4409
4648
  toolNameMapping,
4410
4649
  customProviderToolNames
4411
4650
  }) {
4412
- var _a;
4651
+ var _a, _b;
4413
4652
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4414
4653
  const toolWarnings = [];
4415
4654
  if (tools == null) {
@@ -4419,19 +4658,23 @@ async function prepareResponsesTools({
4419
4658
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4420
4659
  for (const tool of tools) {
4421
4660
  switch (tool.type) {
4422
- case "function":
4661
+ case "function": {
4662
+ const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4663
+ const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4423
4664
  openaiTools.push({
4424
4665
  type: "function",
4425
4666
  name: tool.name,
4426
4667
  description: tool.description,
4427
4668
  parameters: tool.inputSchema,
4428
- ...tool.strict != null ? { strict: tool.strict } : {}
4669
+ ...tool.strict != null ? { strict: tool.strict } : {},
4670
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4429
4671
  });
4430
4672
  break;
4673
+ }
4431
4674
  case "provider": {
4432
4675
  switch (tool.id) {
4433
4676
  case "openai.file_search": {
4434
- const args = await (0, import_provider_utils32.validateTypes)({
4677
+ const args = await (0, import_provider_utils33.validateTypes)({
4435
4678
  value: tool.args,
4436
4679
  schema: fileSearchArgsSchema
4437
4680
  });
@@ -4454,7 +4697,7 @@ async function prepareResponsesTools({
4454
4697
  break;
4455
4698
  }
4456
4699
  case "openai.shell": {
4457
- const args = await (0, import_provider_utils32.validateTypes)({
4700
+ const args = await (0, import_provider_utils33.validateTypes)({
4458
4701
  value: tool.args,
4459
4702
  schema: shellArgsSchema
4460
4703
  });
@@ -4473,7 +4716,7 @@ async function prepareResponsesTools({
4473
4716
  break;
4474
4717
  }
4475
4718
  case "openai.web_search_preview": {
4476
- const args = await (0, import_provider_utils32.validateTypes)({
4719
+ const args = await (0, import_provider_utils33.validateTypes)({
4477
4720
  value: tool.args,
4478
4721
  schema: webSearchPreviewArgsSchema
4479
4722
  });
@@ -4485,7 +4728,7 @@ async function prepareResponsesTools({
4485
4728
  break;
4486
4729
  }
4487
4730
  case "openai.web_search": {
4488
- const args = await (0, import_provider_utils32.validateTypes)({
4731
+ const args = await (0, import_provider_utils33.validateTypes)({
4489
4732
  value: tool.args,
4490
4733
  schema: webSearchArgsSchema
4491
4734
  });
@@ -4499,7 +4742,7 @@ async function prepareResponsesTools({
4499
4742
  break;
4500
4743
  }
4501
4744
  case "openai.code_interpreter": {
4502
- const args = await (0, import_provider_utils32.validateTypes)({
4745
+ const args = await (0, import_provider_utils33.validateTypes)({
4503
4746
  value: tool.args,
4504
4747
  schema: codeInterpreterArgsSchema
4505
4748
  });
@@ -4510,7 +4753,7 @@ async function prepareResponsesTools({
4510
4753
  break;
4511
4754
  }
4512
4755
  case "openai.image_generation": {
4513
- const args = await (0, import_provider_utils32.validateTypes)({
4756
+ const args = await (0, import_provider_utils33.validateTypes)({
4514
4757
  value: tool.args,
4515
4758
  schema: imageGenerationArgsSchema
4516
4759
  });
@@ -4533,7 +4776,7 @@ async function prepareResponsesTools({
4533
4776
  break;
4534
4777
  }
4535
4778
  case "openai.mcp": {
4536
- const args = await (0, import_provider_utils32.validateTypes)({
4779
+ const args = await (0, import_provider_utils33.validateTypes)({
4537
4780
  value: tool.args,
4538
4781
  schema: mcpArgsSchema
4539
4782
  });
@@ -4559,17 +4802,30 @@ async function prepareResponsesTools({
4559
4802
  break;
4560
4803
  }
4561
4804
  case "openai.custom": {
4562
- const args = await (0, import_provider_utils32.validateTypes)({
4805
+ const args = await (0, import_provider_utils33.validateTypes)({
4563
4806
  value: tool.args,
4564
4807
  schema: customArgsSchema
4565
4808
  });
4566
4809
  openaiTools.push({
4567
4810
  type: "custom",
4568
- name: args.name,
4811
+ name: tool.name,
4569
4812
  description: args.description,
4570
4813
  format: args.format
4571
4814
  });
4572
- resolvedCustomProviderToolNames.add(args.name);
4815
+ resolvedCustomProviderToolNames.add(tool.name);
4816
+ break;
4817
+ }
4818
+ case "openai.tool_search": {
4819
+ const args = await (0, import_provider_utils33.validateTypes)({
4820
+ value: tool.args,
4821
+ schema: toolSearchArgsSchema
4822
+ });
4823
+ openaiTools.push({
4824
+ type: "tool_search",
4825
+ ...args.execution != null ? { execution: args.execution } : {},
4826
+ ...args.description != null ? { description: args.description } : {},
4827
+ ...args.parameters != null ? { parameters: args.parameters } : {}
4828
+ });
4573
4829
  break;
4574
4830
  }
4575
4831
  }
@@ -4593,7 +4849,7 @@ async function prepareResponsesTools({
4593
4849
  case "required":
4594
4850
  return { tools: openaiTools, toolChoice: type, toolWarnings };
4595
4851
  case "tool": {
4596
- const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4852
+ const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
4597
4853
  return {
4598
4854
  tools: openaiTools,
4599
4855
  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 },
@@ -4673,7 +4929,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
4673
4929
  }
4674
4930
  var OpenAIResponsesLanguageModel = class {
4675
4931
  constructor(modelId, config) {
4676
- this.specificationVersion = "v3";
4932
+ this.specificationVersion = "v4";
4677
4933
  this.supportedUrls = {
4678
4934
  "image/*": [/^https?:\/\/.*$/],
4679
4935
  "application/pdf": [/^https?:\/\/.*$/]
@@ -4694,12 +4950,13 @@ var OpenAIResponsesLanguageModel = class {
4694
4950
  frequencyPenalty,
4695
4951
  seed,
4696
4952
  prompt,
4953
+ reasoning,
4697
4954
  providerOptions,
4698
4955
  tools,
4699
4956
  toolChoice,
4700
4957
  responseFormat
4701
4958
  }) {
4702
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4959
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4703
4960
  const warnings = [];
4704
4961
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
4705
4962
  if (topK != null) {
@@ -4718,19 +4975,20 @@ var OpenAIResponsesLanguageModel = class {
4718
4975
  warnings.push({ type: "unsupported", feature: "stopSequences" });
4719
4976
  }
4720
4977
  const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
4721
- let openaiOptions = await (0, import_provider_utils33.parseProviderOptions)({
4978
+ let openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
4722
4979
  provider: providerOptionsName,
4723
4980
  providerOptions,
4724
4981
  schema: openaiLanguageModelResponsesOptionsSchema
4725
4982
  });
4726
4983
  if (openaiOptions == null && providerOptionsName !== "openai") {
4727
- openaiOptions = await (0, import_provider_utils33.parseProviderOptions)({
4984
+ openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
4728
4985
  provider: "openai",
4729
4986
  providerOptions,
4730
4987
  schema: openaiLanguageModelResponsesOptionsSchema
4731
4988
  });
4732
4989
  }
4733
- const isReasoningModel = (_a = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _a : modelCapabilities.isReasoningModel;
4990
+ const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : (0, import_provider_utils34.isCustomReasoning)(reasoning) ? reasoning : void 0;
4991
+ const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
4734
4992
  if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
4735
4993
  warnings.push({
4736
4994
  type: "unsupported",
@@ -4738,7 +4996,7 @@ var OpenAIResponsesLanguageModel = class {
4738
4996
  details: "conversation and previousResponseId cannot be used together"
4739
4997
  });
4740
4998
  }
4741
- const toolNameMapping = (0, import_provider_utils33.createToolNameMapping)({
4999
+ const toolNameMapping = (0, import_provider_utils34.createToolNameMapping)({
4742
5000
  tools,
4743
5001
  providerToolNames: {
4744
5002
  "openai.code_interpreter": "code_interpreter",
@@ -4749,9 +5007,9 @@ var OpenAIResponsesLanguageModel = class {
4749
5007
  "openai.web_search": "web_search",
4750
5008
  "openai.web_search_preview": "web_search_preview",
4751
5009
  "openai.mcp": "mcp",
4752
- "openai.apply_patch": "apply_patch"
4753
- },
4754
- resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
5010
+ "openai.apply_patch": "apply_patch",
5011
+ "openai.tool_search": "tool_search"
5012
+ }
4755
5013
  });
4756
5014
  const customProviderToolNames = /* @__PURE__ */ new Set();
4757
5015
  const {
@@ -4767,10 +5025,10 @@ var OpenAIResponsesLanguageModel = class {
4767
5025
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
4768
5026
  prompt,
4769
5027
  toolNameMapping,
4770
- systemMessageMode: (_b = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _b : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
5028
+ systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
4771
5029
  providerOptionsName,
4772
5030
  fileIdPrefixes: this.config.fileIdPrefixes,
4773
- store: (_c = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _c : true,
5031
+ store: (_d = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _d : true,
4774
5032
  hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
4775
5033
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
4776
5034
  hasShellTool: hasOpenAITool("openai.shell"),
@@ -4778,7 +5036,7 @@ var OpenAIResponsesLanguageModel = class {
4778
5036
  customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
4779
5037
  });
4780
5038
  warnings.push(...inputWarnings);
4781
- const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;
5039
+ const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
4782
5040
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
4783
5041
  function addInclude(key) {
4784
5042
  if (include == null) {
@@ -4794,9 +5052,9 @@ var OpenAIResponsesLanguageModel = class {
4794
5052
  if (topLogprobs) {
4795
5053
  addInclude("message.output_text.logprobs");
4796
5054
  }
4797
- const webSearchToolName = (_e = tools == null ? void 0 : tools.find(
5055
+ const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
4798
5056
  (tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4799
- )) == null ? void 0 : _e.name;
5057
+ )) == null ? void 0 : _f.name;
4800
5058
  if (webSearchToolName) {
4801
5059
  addInclude("web_search_call.action.sources");
4802
5060
  }
@@ -4819,7 +5077,7 @@ var OpenAIResponsesLanguageModel = class {
4819
5077
  format: responseFormat.schema != null ? {
4820
5078
  type: "json_schema",
4821
5079
  strict: strictJsonSchema,
4822
- name: (_f = responseFormat.name) != null ? _f : "response",
5080
+ name: (_g = responseFormat.name) != null ? _g : "response",
4823
5081
  description: responseFormat.description,
4824
5082
  schema: responseFormat.schema
4825
5083
  } : { type: "json_object" }
@@ -4845,11 +5103,18 @@ var OpenAIResponsesLanguageModel = class {
4845
5103
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
4846
5104
  top_logprobs: topLogprobs,
4847
5105
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
5106
+ // context management (server-side compaction):
5107
+ ...(openaiOptions == null ? void 0 : openaiOptions.contextManagement) && {
5108
+ context_management: openaiOptions.contextManagement.map((cm) => ({
5109
+ type: cm.type,
5110
+ compact_threshold: cm.compactThreshold
5111
+ }))
5112
+ },
4848
5113
  // model-specific settings:
4849
- ...isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
5114
+ ...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
4850
5115
  reasoning: {
4851
- ...(openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null && {
4852
- effort: openaiOptions.reasoningEffort
5116
+ ...resolvedReasoningEffort != null && {
5117
+ effort: resolvedReasoningEffort
4853
5118
  },
4854
5119
  ...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
4855
5120
  summary: openaiOptions.reasoningSummary
@@ -4858,7 +5123,7 @@ var OpenAIResponsesLanguageModel = class {
4858
5123
  }
4859
5124
  };
4860
5125
  if (isReasoningModel) {
4861
- if (!((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
5126
+ if (!(resolvedReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
4862
5127
  if (baseArgs.temperature != null) {
4863
5128
  baseArgs.temperature = void 0;
4864
5129
  warnings.push({
@@ -4908,9 +5173,9 @@ var OpenAIResponsesLanguageModel = class {
4908
5173
  });
4909
5174
  delete baseArgs.service_tier;
4910
5175
  }
4911
- const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
5176
+ const shellToolEnvType = (_j = (_i = (_h = tools == null ? void 0 : tools.find(
4912
5177
  (tool) => tool.type === "provider" && tool.id === "openai.shell"
4913
- )) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
5178
+ )) == null ? void 0 : _h.args) == null ? void 0 : _i.environment) == null ? void 0 : _j.type;
4914
5179
  const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
4915
5180
  return {
4916
5181
  webSearchToolName,
@@ -4927,7 +5192,7 @@ var OpenAIResponsesLanguageModel = class {
4927
5192
  };
4928
5193
  }
4929
5194
  async doGenerate(options) {
4930
- 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;
5195
+ 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;
4931
5196
  const {
4932
5197
  args: body,
4933
5198
  warnings,
@@ -4945,12 +5210,12 @@ var OpenAIResponsesLanguageModel = class {
4945
5210
  responseHeaders,
4946
5211
  value: response,
4947
5212
  rawValue: rawResponse
4948
- } = await (0, import_provider_utils33.postJsonToApi)({
5213
+ } = await (0, import_provider_utils34.postJsonToApi)({
4949
5214
  url,
4950
- headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
5215
+ headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
4951
5216
  body,
4952
5217
  failedResponseHandler: openaiFailedResponseHandler,
4953
- successfulResponseHandler: (0, import_provider_utils33.createJsonResponseHandler)(
5218
+ successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
4954
5219
  openaiResponsesResponseSchema
4955
5220
  ),
4956
5221
  abortSignal: options.abortSignal,
@@ -4970,6 +5235,7 @@ var OpenAIResponsesLanguageModel = class {
4970
5235
  const content = [];
4971
5236
  const logprobs = [];
4972
5237
  let hasFunctionCall = false;
5238
+ const hostedToolSearchCallIds = [];
4973
5239
  for (const part of response.output) {
4974
5240
  switch (part.type) {
4975
5241
  case "reasoning": {
@@ -5008,6 +5274,46 @@ var OpenAIResponsesLanguageModel = class {
5008
5274
  });
5009
5275
  break;
5010
5276
  }
5277
+ case "tool_search_call": {
5278
+ const toolCallId = (_b = part.call_id) != null ? _b : part.id;
5279
+ const isHosted = part.execution === "server";
5280
+ if (isHosted) {
5281
+ hostedToolSearchCallIds.push(toolCallId);
5282
+ }
5283
+ content.push({
5284
+ type: "tool-call",
5285
+ toolCallId,
5286
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5287
+ input: JSON.stringify({
5288
+ arguments: part.arguments,
5289
+ call_id: part.call_id
5290
+ }),
5291
+ ...isHosted ? { providerExecuted: true } : {},
5292
+ providerMetadata: {
5293
+ [providerOptionsName]: {
5294
+ itemId: part.id
5295
+ }
5296
+ }
5297
+ });
5298
+ break;
5299
+ }
5300
+ case "tool_search_output": {
5301
+ const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
5302
+ content.push({
5303
+ type: "tool-result",
5304
+ toolCallId,
5305
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5306
+ result: {
5307
+ tools: part.tools
5308
+ },
5309
+ providerMetadata: {
5310
+ [providerOptionsName]: {
5311
+ itemId: part.id
5312
+ }
5313
+ }
5314
+ });
5315
+ break;
5316
+ }
5011
5317
  case "local_shell_call": {
5012
5318
  content.push({
5013
5319
  type: "tool-call",
@@ -5063,7 +5369,7 @@ var OpenAIResponsesLanguageModel = class {
5063
5369
  }
5064
5370
  case "message": {
5065
5371
  for (const contentPart of part.content) {
5066
- if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
5372
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
5067
5373
  logprobs.push(contentPart.logprobs);
5068
5374
  }
5069
5375
  const providerMetadata2 = {
@@ -5085,7 +5391,7 @@ var OpenAIResponsesLanguageModel = class {
5085
5391
  content.push({
5086
5392
  type: "source",
5087
5393
  sourceType: "url",
5088
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils33.generateId)(),
5394
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils34.generateId)(),
5089
5395
  url: annotation.url,
5090
5396
  title: annotation.title
5091
5397
  });
@@ -5093,7 +5399,7 @@ var OpenAIResponsesLanguageModel = class {
5093
5399
  content.push({
5094
5400
  type: "source",
5095
5401
  sourceType: "document",
5096
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils33.generateId)(),
5402
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils34.generateId)(),
5097
5403
  mediaType: "text/plain",
5098
5404
  title: annotation.filename,
5099
5405
  filename: annotation.filename,
@@ -5109,7 +5415,7 @@ var OpenAIResponsesLanguageModel = class {
5109
5415
  content.push({
5110
5416
  type: "source",
5111
5417
  sourceType: "document",
5112
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils33.generateId)(),
5418
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)(),
5113
5419
  mediaType: "text/plain",
5114
5420
  title: annotation.filename,
5115
5421
  filename: annotation.filename,
@@ -5125,7 +5431,7 @@ var OpenAIResponsesLanguageModel = class {
5125
5431
  content.push({
5126
5432
  type: "source",
5127
5433
  sourceType: "document",
5128
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils33.generateId)(),
5434
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils34.generateId)(),
5129
5435
  mediaType: "application/octet-stream",
5130
5436
  title: annotation.file_id,
5131
5437
  filename: annotation.file_id,
@@ -5194,7 +5500,7 @@ var OpenAIResponsesLanguageModel = class {
5194
5500
  break;
5195
5501
  }
5196
5502
  case "mcp_call": {
5197
- const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
5503
+ const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
5198
5504
  const toolName = `mcp.${part.name}`;
5199
5505
  content.push({
5200
5506
  type: "tool-call",
@@ -5228,8 +5534,8 @@ var OpenAIResponsesLanguageModel = class {
5228
5534
  break;
5229
5535
  }
5230
5536
  case "mcp_approval_request": {
5231
- const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
5232
- const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils33.generateId)();
5537
+ const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5538
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils34.generateId)();
5233
5539
  const toolName = `mcp.${part.name}`;
5234
5540
  content.push({
5235
5541
  type: "tool-call",
@@ -5279,13 +5585,13 @@ var OpenAIResponsesLanguageModel = class {
5279
5585
  toolName: toolNameMapping.toCustomToolName("file_search"),
5280
5586
  result: {
5281
5587
  queries: part.queries,
5282
- results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
5588
+ results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
5283
5589
  attributes: result.attributes,
5284
5590
  fileId: result.file_id,
5285
5591
  filename: result.filename,
5286
5592
  score: result.score,
5287
5593
  text: result.text
5288
- }))) != null ? _v : null
5594
+ }))) != null ? _y : null
5289
5595
  }
5290
5596
  });
5291
5597
  break;
@@ -5328,6 +5634,20 @@ var OpenAIResponsesLanguageModel = class {
5328
5634
  });
5329
5635
  break;
5330
5636
  }
5637
+ case "compaction": {
5638
+ content.push({
5639
+ type: "custom",
5640
+ kind: "openai.compaction",
5641
+ providerMetadata: {
5642
+ [providerOptionsName]: {
5643
+ type: "compaction",
5644
+ itemId: part.id,
5645
+ encryptedContent: part.encrypted_content
5646
+ }
5647
+ }
5648
+ });
5649
+ break;
5650
+ }
5331
5651
  }
5332
5652
  }
5333
5653
  const providerMetadata = {
@@ -5342,10 +5662,10 @@ var OpenAIResponsesLanguageModel = class {
5342
5662
  content,
5343
5663
  finishReason: {
5344
5664
  unified: mapOpenAIResponseFinishReason({
5345
- finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
5665
+ finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
5346
5666
  hasFunctionCall
5347
5667
  }),
5348
- raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
5668
+ raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
5349
5669
  },
5350
5670
  usage: convertOpenAIResponsesUsage(usage),
5351
5671
  request: { body },
@@ -5370,18 +5690,18 @@ var OpenAIResponsesLanguageModel = class {
5370
5690
  providerOptionsName,
5371
5691
  isShellProviderExecuted
5372
5692
  } = await this.getArgs(options);
5373
- const { responseHeaders, value: response } = await (0, import_provider_utils33.postJsonToApi)({
5693
+ const { responseHeaders, value: response } = await (0, import_provider_utils34.postJsonToApi)({
5374
5694
  url: this.config.url({
5375
5695
  path: "/responses",
5376
5696
  modelId: this.modelId
5377
5697
  }),
5378
- headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
5698
+ headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
5379
5699
  body: {
5380
5700
  ...body,
5381
5701
  stream: true
5382
5702
  },
5383
5703
  failedResponseHandler: openaiFailedResponseHandler,
5384
- successfulResponseHandler: (0, import_provider_utils33.createEventSourceResponseHandler)(
5704
+ successfulResponseHandler: (0, import_provider_utils34.createEventSourceResponseHandler)(
5385
5705
  openaiResponsesChunkSchema
5386
5706
  ),
5387
5707
  abortSignal: options.abortSignal,
@@ -5403,6 +5723,7 @@ var OpenAIResponsesLanguageModel = class {
5403
5723
  let hasFunctionCall = false;
5404
5724
  const activeReasoning = {};
5405
5725
  let serviceTier;
5726
+ const hostedToolSearchCallIds = [];
5406
5727
  return {
5407
5728
  stream: response.pipeThrough(
5408
5729
  new TransformStream({
@@ -5410,7 +5731,7 @@ var OpenAIResponsesLanguageModel = class {
5410
5731
  controller.enqueue({ type: "stream-start", warnings });
5411
5732
  },
5412
5733
  transform(chunk, controller) {
5413
- 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;
5734
+ 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, _K, _L;
5414
5735
  if (options.includeRawChunks) {
5415
5736
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5416
5737
  }
@@ -5518,6 +5839,24 @@ var OpenAIResponsesLanguageModel = class {
5518
5839
  input: "{}",
5519
5840
  providerExecuted: true
5520
5841
  });
5842
+ } else if (value.item.type === "tool_search_call") {
5843
+ const toolCallId = value.item.id;
5844
+ const toolName = toolNameMapping.toCustomToolName("tool_search");
5845
+ const isHosted = value.item.execution === "server";
5846
+ ongoingToolCalls[value.output_index] = {
5847
+ toolName,
5848
+ toolCallId,
5849
+ toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
5850
+ };
5851
+ if (isHosted) {
5852
+ controller.enqueue({
5853
+ type: "tool-input-start",
5854
+ id: toolCallId,
5855
+ toolName,
5856
+ providerExecuted: true
5857
+ });
5858
+ }
5859
+ } else if (value.item.type === "tool_search_output") {
5521
5860
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
5522
5861
  } else if (value.item.type === "apply_patch_call") {
5523
5862
  const { call_id: callId, operation } = value.item;
@@ -5564,7 +5903,7 @@ var OpenAIResponsesLanguageModel = class {
5564
5903
  } else if (value.item.type === "shell_call_output") {
5565
5904
  } else if (value.item.type === "message") {
5566
5905
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5567
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5906
+ activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
5568
5907
  controller.enqueue({
5569
5908
  type: "text-start",
5570
5909
  id: value.item.id,
@@ -5588,14 +5927,14 @@ var OpenAIResponsesLanguageModel = class {
5588
5927
  providerMetadata: {
5589
5928
  [providerOptionsName]: {
5590
5929
  itemId: value.item.id,
5591
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5930
+ reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
5592
5931
  }
5593
5932
  }
5594
5933
  });
5595
5934
  }
5596
5935
  } else if (isResponseOutputItemDoneChunk(value)) {
5597
5936
  if (value.item.type === "message") {
5598
- const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5937
+ const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
5599
5938
  activeMessagePhase = void 0;
5600
5939
  controller.enqueue({
5601
5940
  type: "text-end",
@@ -5689,13 +6028,13 @@ var OpenAIResponsesLanguageModel = class {
5689
6028
  toolName: toolNameMapping.toCustomToolName("file_search"),
5690
6029
  result: {
5691
6030
  queries: value.item.queries,
5692
- results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
6031
+ results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
5693
6032
  attributes: result.attributes,
5694
6033
  fileId: result.file_id,
5695
6034
  filename: result.filename,
5696
6035
  score: result.score,
5697
6036
  text: result.text
5698
- }))) != null ? _e : null
6037
+ }))) != null ? _f : null
5699
6038
  }
5700
6039
  });
5701
6040
  } else if (value.item.type === "code_interpreter_call") {
@@ -5717,12 +6056,62 @@ var OpenAIResponsesLanguageModel = class {
5717
6056
  result: value.item.result
5718
6057
  }
5719
6058
  });
6059
+ } else if (value.item.type === "tool_search_call") {
6060
+ const toolCall = ongoingToolCalls[value.output_index];
6061
+ const isHosted = value.item.execution === "server";
6062
+ if (toolCall != null) {
6063
+ const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
6064
+ if (isHosted) {
6065
+ hostedToolSearchCallIds.push(toolCallId);
6066
+ } else {
6067
+ controller.enqueue({
6068
+ type: "tool-input-start",
6069
+ id: toolCallId,
6070
+ toolName: toolCall.toolName
6071
+ });
6072
+ }
6073
+ controller.enqueue({
6074
+ type: "tool-input-end",
6075
+ id: toolCallId
6076
+ });
6077
+ controller.enqueue({
6078
+ type: "tool-call",
6079
+ toolCallId,
6080
+ toolName: toolCall.toolName,
6081
+ input: JSON.stringify({
6082
+ arguments: value.item.arguments,
6083
+ call_id: isHosted ? null : toolCallId
6084
+ }),
6085
+ ...isHosted ? { providerExecuted: true } : {},
6086
+ providerMetadata: {
6087
+ [providerOptionsName]: {
6088
+ itemId: value.item.id
6089
+ }
6090
+ }
6091
+ });
6092
+ }
6093
+ ongoingToolCalls[value.output_index] = void 0;
6094
+ } else if (value.item.type === "tool_search_output") {
6095
+ const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
6096
+ controller.enqueue({
6097
+ type: "tool-result",
6098
+ toolCallId,
6099
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
6100
+ result: {
6101
+ tools: value.item.tools
6102
+ },
6103
+ providerMetadata: {
6104
+ [providerOptionsName]: {
6105
+ itemId: value.item.id
6106
+ }
6107
+ }
6108
+ });
5720
6109
  } else if (value.item.type === "mcp_call") {
5721
6110
  ongoingToolCalls[value.output_index] = void 0;
5722
- const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5723
- const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
6111
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
6112
+ const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
5724
6113
  approvalRequestId
5725
- )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
6114
+ )) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
5726
6115
  const toolName = `mcp.${value.item.name}`;
5727
6116
  controller.enqueue({
5728
6117
  type: "tool-call",
@@ -5792,8 +6181,8 @@ var OpenAIResponsesLanguageModel = class {
5792
6181
  ongoingToolCalls[value.output_index] = void 0;
5793
6182
  } else if (value.item.type === "mcp_approval_request") {
5794
6183
  ongoingToolCalls[value.output_index] = void 0;
5795
- const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0, import_provider_utils33.generateId)();
5796
- const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
6184
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)();
6185
+ const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
5797
6186
  approvalRequestIdToDummyToolCallIdFromStream.set(
5798
6187
  approvalRequestId,
5799
6188
  dummyToolCallId
@@ -5882,12 +6271,24 @@ var OpenAIResponsesLanguageModel = class {
5882
6271
  providerMetadata: {
5883
6272
  [providerOptionsName]: {
5884
6273
  itemId: value.item.id,
5885
- reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
6274
+ reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
5886
6275
  }
5887
6276
  }
5888
6277
  });
5889
6278
  }
5890
6279
  delete activeReasoning[value.item.id];
6280
+ } else if (value.item.type === "compaction") {
6281
+ controller.enqueue({
6282
+ type: "custom",
6283
+ kind: "openai.compaction",
6284
+ providerMetadata: {
6285
+ [providerOptionsName]: {
6286
+ type: "compaction",
6287
+ itemId: value.item.id,
6288
+ encryptedContent: value.item.encrypted_content
6289
+ }
6290
+ }
6291
+ });
5891
6292
  }
5892
6293
  } else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
5893
6294
  const toolCall = ongoingToolCalls[value.output_index];
@@ -5995,7 +6396,7 @@ var OpenAIResponsesLanguageModel = class {
5995
6396
  id: value.item_id,
5996
6397
  delta: value.delta
5997
6398
  });
5998
- if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
6399
+ if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
5999
6400
  logprobs.push(value.logprobs);
6000
6401
  }
6001
6402
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -6024,7 +6425,7 @@ var OpenAIResponsesLanguageModel = class {
6024
6425
  providerMetadata: {
6025
6426
  [providerOptionsName]: {
6026
6427
  itemId: value.item_id,
6027
- reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
6428
+ reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
6028
6429
  }
6029
6430
  }
6030
6431
  });
@@ -6058,22 +6459,32 @@ var OpenAIResponsesLanguageModel = class {
6058
6459
  } else if (isResponseFinishedChunk(value)) {
6059
6460
  finishReason = {
6060
6461
  unified: mapOpenAIResponseFinishReason({
6061
- finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
6462
+ finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
6062
6463
  hasFunctionCall
6063
6464
  }),
6064
- raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
6465
+ raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
6065
6466
  };
6066
6467
  usage = value.response.usage;
6067
6468
  if (typeof value.response.service_tier === "string") {
6068
6469
  serviceTier = value.response.service_tier;
6069
6470
  }
6471
+ } else if (isResponseFailedChunk(value)) {
6472
+ const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
6473
+ finishReason = {
6474
+ unified: incompleteReason ? mapOpenAIResponseFinishReason({
6475
+ finishReason: incompleteReason,
6476
+ hasFunctionCall
6477
+ }) : "error",
6478
+ raw: incompleteReason != null ? incompleteReason : "error"
6479
+ };
6480
+ usage = (_z = value.response.usage) != null ? _z : void 0;
6070
6481
  } else if (isResponseAnnotationAddedChunk(value)) {
6071
6482
  ongoingAnnotations.push(value.annotation);
6072
6483
  if (value.annotation.type === "url_citation") {
6073
6484
  controller.enqueue({
6074
6485
  type: "source",
6075
6486
  sourceType: "url",
6076
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils33.generateId)(),
6487
+ id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils34.generateId)(),
6077
6488
  url: value.annotation.url,
6078
6489
  title: value.annotation.title
6079
6490
  });
@@ -6081,7 +6492,7 @@ var OpenAIResponsesLanguageModel = class {
6081
6492
  controller.enqueue({
6082
6493
  type: "source",
6083
6494
  sourceType: "document",
6084
- id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils33.generateId)(),
6495
+ id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils34.generateId)(),
6085
6496
  mediaType: "text/plain",
6086
6497
  title: value.annotation.filename,
6087
6498
  filename: value.annotation.filename,
@@ -6097,7 +6508,7 @@ var OpenAIResponsesLanguageModel = class {
6097
6508
  controller.enqueue({
6098
6509
  type: "source",
6099
6510
  sourceType: "document",
6100
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils33.generateId)(),
6511
+ id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils34.generateId)(),
6101
6512
  mediaType: "text/plain",
6102
6513
  title: value.annotation.filename,
6103
6514
  filename: value.annotation.filename,
@@ -6113,7 +6524,7 @@ var OpenAIResponsesLanguageModel = class {
6113
6524
  controller.enqueue({
6114
6525
  type: "source",
6115
6526
  sourceType: "document",
6116
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils33.generateId)(),
6527
+ id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils34.generateId)(),
6117
6528
  mediaType: "application/octet-stream",
6118
6529
  title: value.annotation.file_id,
6119
6530
  filename: value.annotation.file_id,
@@ -6161,6 +6572,9 @@ function isResponseOutputItemDoneChunk(chunk) {
6161
6572
  function isResponseFinishedChunk(chunk) {
6162
6573
  return chunk.type === "response.completed" || chunk.type === "response.incomplete";
6163
6574
  }
6575
+ function isResponseFailedChunk(chunk) {
6576
+ return chunk.type === "response.failed";
6577
+ }
6164
6578
  function isResponseCreatedChunk(chunk) {
6165
6579
  return chunk.type === "response.created";
6166
6580
  }