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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/dist/index.d.mts +69 -22
  3. package/dist/index.d.ts +69 -22
  4. package/dist/index.js +1169 -873
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1123 -822
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/internal/index.d.mts +56 -28
  9. package/dist/internal/index.d.ts +56 -28
  10. package/dist/internal/index.js +1198 -912
  11. package/dist/internal/index.js.map +1 -1
  12. package/dist/internal/index.mjs +1180 -889
  13. package/dist/internal/index.mjs.map +1 -1
  14. package/docs/03-openai.mdx +142 -3
  15. package/package.json +3 -3
  16. package/src/chat/convert-openai-chat-usage.ts +2 -2
  17. package/src/chat/convert-to-openai-chat-messages.ts +5 -5
  18. package/src/chat/map-openai-finish-reason.ts +2 -2
  19. package/src/chat/openai-chat-language-model.ts +22 -22
  20. package/src/chat/openai-chat-options.ts +1 -0
  21. package/src/chat/openai-chat-prepare-tools.ts +6 -6
  22. package/src/completion/convert-openai-completion-usage.ts +2 -2
  23. package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
  24. package/src/completion/map-openai-finish-reason.ts +2 -2
  25. package/src/completion/openai-completion-language-model.ts +20 -20
  26. package/src/embedding/openai-embedding-model.ts +5 -5
  27. package/src/image/openai-image-model.ts +9 -9
  28. package/src/openai-language-model-capabilities.ts +1 -0
  29. package/src/openai-provider.ts +21 -21
  30. package/src/openai-tools.ts +12 -1
  31. package/src/responses/convert-openai-responses-usage.ts +2 -2
  32. package/src/responses/convert-to-openai-responses-input.ts +116 -12
  33. package/src/responses/map-openai-responses-finish-reason.ts +2 -2
  34. package/src/responses/openai-responses-api.ts +87 -1
  35. package/src/responses/openai-responses-language-model.ts +168 -33
  36. package/src/responses/openai-responses-options.ts +4 -2
  37. package/src/responses/openai-responses-prepare-tools.ts +34 -9
  38. package/src/speech/openai-speech-model.ts +7 -7
  39. package/src/tool/custom.ts +0 -6
  40. package/src/tool/tool-search.ts +98 -0
  41. package/src/transcription/openai-transcription-model.ts +8 -8
@@ -36,7 +36,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
36
36
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
37
37
  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");
38
38
  const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
39
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
39
+ const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
40
40
  const systemMessageMode = isReasoningModel ? "developer" : "system";
41
41
  return {
42
42
  supportsFlexProcessing,
@@ -631,7 +631,7 @@ function prepareChatTools({
631
631
  // src/chat/openai-chat-language-model.ts
632
632
  var OpenAIChatLanguageModel = class {
633
633
  constructor(modelId, config) {
634
- this.specificationVersion = "v3";
634
+ this.specificationVersion = "v4";
635
635
  this.supportedUrls = {
636
636
  "image/*": [/^https?:\/\/.*$/]
637
637
  };
@@ -1375,7 +1375,7 @@ var openaiLanguageModelCompletionOptions = lazySchema4(
1375
1375
  // src/completion/openai-completion-language-model.ts
1376
1376
  var OpenAICompletionLanguageModel = class {
1377
1377
  constructor(modelId, config) {
1378
- this.specificationVersion = "v3";
1378
+ this.specificationVersion = "v4";
1379
1379
  this.supportedUrls = {
1380
1380
  // No URLs are supported for completion models.
1381
1381
  };
@@ -1647,7 +1647,7 @@ var openaiTextEmbeddingResponseSchema = lazySchema6(
1647
1647
  // src/embedding/openai-embedding-model.ts
1648
1648
  var OpenAIEmbeddingModel = class {
1649
1649
  constructor(modelId, config) {
1650
- this.specificationVersion = "v3";
1650
+ this.specificationVersion = "v4";
1651
1651
  this.maxEmbeddingsPerCall = 2048;
1652
1652
  this.supportsParallelCalls = true;
1653
1653
  this.modelId = modelId;
@@ -1776,7 +1776,7 @@ var OpenAIImageModel = class {
1776
1776
  constructor(modelId, config) {
1777
1777
  this.modelId = modelId;
1778
1778
  this.config = config;
1779
- this.specificationVersion = "v3";
1779
+ this.specificationVersion = "v4";
1780
1780
  }
1781
1781
  get maxImagesPerCall() {
1782
1782
  var _a;
@@ -2104,7 +2104,7 @@ var OpenAITranscriptionModel = class {
2104
2104
  constructor(modelId, config) {
2105
2105
  this.modelId = modelId;
2106
2106
  this.config = config;
2107
- this.specificationVersion = "v3";
2107
+ this.specificationVersion = "v4";
2108
2108
  }
2109
2109
  get provider() {
2110
2110
  return this.config.provider;
@@ -2232,7 +2232,7 @@ var OpenAISpeechModel = class {
2232
2232
  constructor(modelId, config) {
2233
2233
  this.modelId = modelId;
2234
2234
  this.config = config;
2235
- this.specificationVersion = "v3";
2235
+ this.specificationVersion = "v4";
2236
2236
  }
2237
2237
  get provider() {
2238
2238
  return this.config.provider;
@@ -2388,10 +2388,11 @@ import {
2388
2388
  import {
2389
2389
  convertToBase64 as convertToBase642,
2390
2390
  isNonNullable,
2391
+ parseJSON,
2391
2392
  parseProviderOptions as parseProviderOptions6,
2392
2393
  validateTypes
2393
2394
  } from "@ai-sdk/provider-utils";
2394
- import { z as z15 } from "zod/v4";
2395
+ import { z as z16 } from "zod/v4";
2395
2396
 
2396
2397
  // src/tool/apply-patch.ts
2397
2398
  import {
@@ -2570,6 +2571,43 @@ var shell = createProviderToolFactoryWithOutputSchema3({
2570
2571
  outputSchema: shellOutputSchema
2571
2572
  });
2572
2573
 
2574
+ // src/tool/tool-search.ts
2575
+ import {
2576
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2577
+ lazySchema as lazySchema14,
2578
+ zodSchema as zodSchema14
2579
+ } from "@ai-sdk/provider-utils";
2580
+ import { z as z15 } from "zod/v4";
2581
+ var toolSearchArgsSchema = lazySchema14(
2582
+ () => zodSchema14(
2583
+ z15.object({
2584
+ execution: z15.enum(["server", "client"]).optional(),
2585
+ description: z15.string().optional(),
2586
+ parameters: z15.record(z15.string(), z15.unknown()).optional()
2587
+ })
2588
+ )
2589
+ );
2590
+ var toolSearchInputSchema = lazySchema14(
2591
+ () => zodSchema14(
2592
+ z15.object({
2593
+ arguments: z15.unknown().optional(),
2594
+ call_id: z15.string().nullish()
2595
+ })
2596
+ )
2597
+ );
2598
+ var toolSearchOutputSchema = lazySchema14(
2599
+ () => zodSchema14(
2600
+ z15.object({
2601
+ tools: z15.array(z15.record(z15.string(), z15.unknown()))
2602
+ })
2603
+ )
2604
+ );
2605
+ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
2606
+ id: "openai.tool_search",
2607
+ inputSchema: toolSearchInputSchema,
2608
+ outputSchema: toolSearchOutputSchema
2609
+ });
2610
+
2573
2611
  // src/responses/convert-to-openai-responses-input.ts
2574
2612
  function isFileId(data, prefixes) {
2575
2613
  if (!prefixes) return false;
@@ -2588,8 +2626,8 @@ async function convertToOpenAIResponsesInput({
2588
2626
  hasApplyPatchTool = false,
2589
2627
  customProviderToolNames
2590
2628
  }) {
2591
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2592
- const input = [];
2629
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2630
+ let input = [];
2593
2631
  const warnings = [];
2594
2632
  const processedApprovalIds = /* @__PURE__ */ new Set();
2595
2633
  for (const { role, content } of prompt) {
@@ -2692,6 +2730,32 @@ async function convertToOpenAIResponsesInput({
2692
2730
  if (hasConversation && id != null) {
2693
2731
  break;
2694
2732
  }
2733
+ const resolvedToolName = toolNameMapping.toProviderToolName(
2734
+ part.toolName
2735
+ );
2736
+ if (resolvedToolName === "tool_search") {
2737
+ if (store && id != null) {
2738
+ input.push({ type: "item_reference", id });
2739
+ break;
2740
+ }
2741
+ const parsedInput = typeof part.input === "string" ? await parseJSON({
2742
+ text: part.input,
2743
+ schema: toolSearchInputSchema
2744
+ }) : await validateTypes({
2745
+ value: part.input,
2746
+ schema: toolSearchInputSchema
2747
+ });
2748
+ const execution = parsedInput.call_id != null ? "client" : "server";
2749
+ input.push({
2750
+ type: "tool_search_call",
2751
+ id: id != null ? id : part.toolCallId,
2752
+ execution,
2753
+ call_id: (_g = parsedInput.call_id) != null ? _g : null,
2754
+ status: "completed",
2755
+ arguments: parsedInput.arguments
2756
+ });
2757
+ break;
2758
+ }
2695
2759
  if (part.providerExecuted) {
2696
2760
  if (store && id != null) {
2697
2761
  input.push({ type: "item_reference", id });
@@ -2702,9 +2766,6 @@ async function convertToOpenAIResponsesInput({
2702
2766
  input.push({ type: "item_reference", id });
2703
2767
  break;
2704
2768
  }
2705
- const resolvedToolName = toolNameMapping.toProviderToolName(
2706
- part.toolName
2707
- );
2708
2769
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2709
2770
  const parsedInput = await validateTypes({
2710
2771
  value: part.input,
@@ -2787,6 +2848,26 @@ async function convertToOpenAIResponsesInput({
2787
2848
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
2788
2849
  part.toolName
2789
2850
  );
2851
+ if (resolvedResultToolName === "tool_search") {
2852
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2853
+ if (store) {
2854
+ input.push({ type: "item_reference", id: itemId });
2855
+ } else if (part.output.type === "json") {
2856
+ const parsedOutput = await validateTypes({
2857
+ value: part.output.value,
2858
+ schema: toolSearchOutputSchema
2859
+ });
2860
+ input.push({
2861
+ type: "tool_search_output",
2862
+ id: itemId,
2863
+ execution: "server",
2864
+ call_id: null,
2865
+ status: "completed",
2866
+ tools: parsedOutput.tools
2867
+ });
2868
+ }
2869
+ break;
2870
+ }
2790
2871
  if (hasShellTool && resolvedResultToolName === "shell") {
2791
2872
  if (part.output.type === "json") {
2792
2873
  const parsedOutput = await validateTypes({
@@ -2809,7 +2890,7 @@ async function convertToOpenAIResponsesInput({
2809
2890
  break;
2810
2891
  }
2811
2892
  if (store) {
2812
- const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
2893
+ const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
2813
2894
  input.push({ type: "item_reference", id: itemId });
2814
2895
  } else {
2815
2896
  warnings.push({
@@ -2919,7 +3000,7 @@ async function convertToOpenAIResponsesInput({
2919
3000
  }
2920
3001
  const output = part.output;
2921
3002
  if (output.type === "execution-denied") {
2922
- const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
3003
+ const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
2923
3004
  if (approvalId) {
2924
3005
  continue;
2925
3006
  }
@@ -2927,6 +3008,20 @@ async function convertToOpenAIResponsesInput({
2927
3008
  const resolvedToolName = toolNameMapping.toProviderToolName(
2928
3009
  part.toolName
2929
3010
  );
3011
+ if (resolvedToolName === "tool_search" && output.type === "json") {
3012
+ const parsedOutput = await validateTypes({
3013
+ value: output.value,
3014
+ schema: toolSearchOutputSchema
3015
+ });
3016
+ input.push({
3017
+ type: "tool_search_output",
3018
+ execution: "client",
3019
+ call_id: part.toolCallId,
3020
+ status: "completed",
3021
+ tools: parsedOutput.tools
3022
+ });
3023
+ continue;
3024
+ }
2930
3025
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
2931
3026
  const parsedOutput = await validateTypes({
2932
3027
  value: output.value,
@@ -2979,7 +3074,7 @@ async function convertToOpenAIResponsesInput({
2979
3074
  outputValue = output.value;
2980
3075
  break;
2981
3076
  case "execution-denied":
2982
- outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3077
+ outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
2983
3078
  break;
2984
3079
  case "json":
2985
3080
  case "error-json":
@@ -3033,7 +3128,7 @@ async function convertToOpenAIResponsesInput({
3033
3128
  contentValue = output.value;
3034
3129
  break;
3035
3130
  case "execution-denied":
3036
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3131
+ contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
3037
3132
  break;
3038
3133
  case "json":
3039
3134
  case "error-json":
@@ -3090,11 +3185,22 @@ async function convertToOpenAIResponsesInput({
3090
3185
  }
3091
3186
  }
3092
3187
  }
3188
+ if (!store && input.some(
3189
+ (item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
3190
+ )) {
3191
+ warnings.push({
3192
+ type: "other",
3193
+ message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
3194
+ });
3195
+ input = input.filter(
3196
+ (item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
3197
+ );
3198
+ }
3093
3199
  return { input, warnings };
3094
3200
  }
3095
- var openaiResponsesReasoningProviderOptionsSchema = z15.object({
3096
- itemId: z15.string().nullish(),
3097
- reasoningEncryptedContent: z15.string().nullish()
3201
+ var openaiResponsesReasoningProviderOptionsSchema = z16.object({
3202
+ itemId: z16.string().nullish(),
3203
+ reasoningEncryptedContent: z16.string().nullish()
3098
3204
  });
3099
3205
 
3100
3206
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3116,483 +3222,525 @@ function mapOpenAIResponseFinishReason({
3116
3222
  }
3117
3223
 
3118
3224
  // src/responses/openai-responses-api.ts
3119
- import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
3120
- import { z as z16 } from "zod/v4";
3121
- var openaiResponsesChunkSchema = lazySchema14(
3122
- () => zodSchema14(
3123
- z16.union([
3124
- z16.object({
3125
- type: z16.literal("response.output_text.delta"),
3126
- item_id: z16.string(),
3127
- delta: z16.string(),
3128
- logprobs: z16.array(
3129
- z16.object({
3130
- token: z16.string(),
3131
- logprob: z16.number(),
3132
- top_logprobs: z16.array(
3133
- z16.object({
3134
- token: z16.string(),
3135
- logprob: z16.number()
3225
+ import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
3226
+ import { z as z17 } from "zod/v4";
3227
+ var jsonValueSchema = z17.lazy(
3228
+ () => z17.union([
3229
+ z17.string(),
3230
+ z17.number(),
3231
+ z17.boolean(),
3232
+ z17.null(),
3233
+ z17.array(jsonValueSchema),
3234
+ z17.record(z17.string(), jsonValueSchema.optional())
3235
+ ])
3236
+ );
3237
+ var openaiResponsesChunkSchema = lazySchema15(
3238
+ () => zodSchema15(
3239
+ z17.union([
3240
+ z17.object({
3241
+ type: z17.literal("response.output_text.delta"),
3242
+ item_id: z17.string(),
3243
+ delta: z17.string(),
3244
+ logprobs: z17.array(
3245
+ z17.object({
3246
+ token: z17.string(),
3247
+ logprob: z17.number(),
3248
+ top_logprobs: z17.array(
3249
+ z17.object({
3250
+ token: z17.string(),
3251
+ logprob: z17.number()
3136
3252
  })
3137
3253
  )
3138
3254
  })
3139
3255
  ).nullish()
3140
3256
  }),
3141
- z16.object({
3142
- type: z16.enum(["response.completed", "response.incomplete"]),
3143
- response: z16.object({
3144
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3145
- usage: z16.object({
3146
- input_tokens: z16.number(),
3147
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
3148
- output_tokens: z16.number(),
3149
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
3257
+ z17.object({
3258
+ type: z17.enum(["response.completed", "response.incomplete"]),
3259
+ response: z17.object({
3260
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3261
+ usage: z17.object({
3262
+ input_tokens: z17.number(),
3263
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3264
+ output_tokens: z17.number(),
3265
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3150
3266
  }),
3151
- service_tier: z16.string().nullish()
3267
+ service_tier: z17.string().nullish()
3152
3268
  })
3153
3269
  }),
3154
- z16.object({
3155
- type: z16.literal("response.created"),
3156
- response: z16.object({
3157
- id: z16.string(),
3158
- created_at: z16.number(),
3159
- model: z16.string(),
3160
- service_tier: z16.string().nullish()
3270
+ z17.object({
3271
+ type: z17.literal("response.created"),
3272
+ response: z17.object({
3273
+ id: z17.string(),
3274
+ created_at: z17.number(),
3275
+ model: z17.string(),
3276
+ service_tier: z17.string().nullish()
3161
3277
  })
3162
3278
  }),
3163
- z16.object({
3164
- type: z16.literal("response.output_item.added"),
3165
- output_index: z16.number(),
3166
- item: z16.discriminatedUnion("type", [
3167
- z16.object({
3168
- type: z16.literal("message"),
3169
- id: z16.string(),
3170
- phase: z16.enum(["commentary", "final_answer"]).nullish()
3279
+ z17.object({
3280
+ type: z17.literal("response.output_item.added"),
3281
+ output_index: z17.number(),
3282
+ item: z17.discriminatedUnion("type", [
3283
+ z17.object({
3284
+ type: z17.literal("message"),
3285
+ id: z17.string(),
3286
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3171
3287
  }),
3172
- z16.object({
3173
- type: z16.literal("reasoning"),
3174
- id: z16.string(),
3175
- encrypted_content: z16.string().nullish()
3288
+ z17.object({
3289
+ type: z17.literal("reasoning"),
3290
+ id: z17.string(),
3291
+ encrypted_content: z17.string().nullish()
3176
3292
  }),
3177
- z16.object({
3178
- type: z16.literal("function_call"),
3179
- id: z16.string(),
3180
- call_id: z16.string(),
3181
- name: z16.string(),
3182
- arguments: z16.string()
3293
+ z17.object({
3294
+ type: z17.literal("function_call"),
3295
+ id: z17.string(),
3296
+ call_id: z17.string(),
3297
+ name: z17.string(),
3298
+ arguments: z17.string()
3183
3299
  }),
3184
- z16.object({
3185
- type: z16.literal("web_search_call"),
3186
- id: z16.string(),
3187
- status: z16.string()
3300
+ z17.object({
3301
+ type: z17.literal("web_search_call"),
3302
+ id: z17.string(),
3303
+ status: z17.string()
3188
3304
  }),
3189
- z16.object({
3190
- type: z16.literal("computer_call"),
3191
- id: z16.string(),
3192
- status: z16.string()
3305
+ z17.object({
3306
+ type: z17.literal("computer_call"),
3307
+ id: z17.string(),
3308
+ status: z17.string()
3193
3309
  }),
3194
- z16.object({
3195
- type: z16.literal("file_search_call"),
3196
- id: z16.string()
3310
+ z17.object({
3311
+ type: z17.literal("file_search_call"),
3312
+ id: z17.string()
3197
3313
  }),
3198
- z16.object({
3199
- type: z16.literal("image_generation_call"),
3200
- id: z16.string()
3314
+ z17.object({
3315
+ type: z17.literal("image_generation_call"),
3316
+ id: z17.string()
3201
3317
  }),
3202
- z16.object({
3203
- type: z16.literal("code_interpreter_call"),
3204
- id: z16.string(),
3205
- container_id: z16.string(),
3206
- code: z16.string().nullable(),
3207
- outputs: z16.array(
3208
- z16.discriminatedUnion("type", [
3209
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3210
- z16.object({ type: z16.literal("image"), url: z16.string() })
3318
+ z17.object({
3319
+ type: z17.literal("code_interpreter_call"),
3320
+ id: z17.string(),
3321
+ container_id: z17.string(),
3322
+ code: z17.string().nullable(),
3323
+ outputs: z17.array(
3324
+ z17.discriminatedUnion("type", [
3325
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3326
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3211
3327
  ])
3212
3328
  ).nullable(),
3213
- status: z16.string()
3329
+ status: z17.string()
3214
3330
  }),
3215
- z16.object({
3216
- type: z16.literal("mcp_call"),
3217
- id: z16.string(),
3218
- status: z16.string(),
3219
- approval_request_id: z16.string().nullish()
3331
+ z17.object({
3332
+ type: z17.literal("mcp_call"),
3333
+ id: z17.string(),
3334
+ status: z17.string(),
3335
+ approval_request_id: z17.string().nullish()
3220
3336
  }),
3221
- z16.object({
3222
- type: z16.literal("mcp_list_tools"),
3223
- id: z16.string()
3337
+ z17.object({
3338
+ type: z17.literal("mcp_list_tools"),
3339
+ id: z17.string()
3224
3340
  }),
3225
- z16.object({
3226
- type: z16.literal("mcp_approval_request"),
3227
- id: z16.string()
3341
+ z17.object({
3342
+ type: z17.literal("mcp_approval_request"),
3343
+ id: z17.string()
3228
3344
  }),
3229
- z16.object({
3230
- type: z16.literal("apply_patch_call"),
3231
- id: z16.string(),
3232
- call_id: z16.string(),
3233
- status: z16.enum(["in_progress", "completed"]),
3234
- operation: z16.discriminatedUnion("type", [
3235
- z16.object({
3236
- type: z16.literal("create_file"),
3237
- path: z16.string(),
3238
- diff: z16.string()
3345
+ z17.object({
3346
+ type: z17.literal("apply_patch_call"),
3347
+ id: z17.string(),
3348
+ call_id: z17.string(),
3349
+ status: z17.enum(["in_progress", "completed"]),
3350
+ operation: z17.discriminatedUnion("type", [
3351
+ z17.object({
3352
+ type: z17.literal("create_file"),
3353
+ path: z17.string(),
3354
+ diff: z17.string()
3239
3355
  }),
3240
- z16.object({
3241
- type: z16.literal("delete_file"),
3242
- path: z16.string()
3356
+ z17.object({
3357
+ type: z17.literal("delete_file"),
3358
+ path: z17.string()
3243
3359
  }),
3244
- z16.object({
3245
- type: z16.literal("update_file"),
3246
- path: z16.string(),
3247
- diff: z16.string()
3360
+ z17.object({
3361
+ type: z17.literal("update_file"),
3362
+ path: z17.string(),
3363
+ diff: z17.string()
3248
3364
  })
3249
3365
  ])
3250
3366
  }),
3251
- z16.object({
3252
- type: z16.literal("custom_tool_call"),
3253
- id: z16.string(),
3254
- call_id: z16.string(),
3255
- name: z16.string(),
3256
- input: z16.string()
3367
+ z17.object({
3368
+ type: z17.literal("custom_tool_call"),
3369
+ id: z17.string(),
3370
+ call_id: z17.string(),
3371
+ name: z17.string(),
3372
+ input: z17.string()
3257
3373
  }),
3258
- z16.object({
3259
- type: z16.literal("shell_call"),
3260
- id: z16.string(),
3261
- call_id: z16.string(),
3262
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3263
- action: z16.object({
3264
- commands: z16.array(z16.string())
3374
+ z17.object({
3375
+ type: z17.literal("shell_call"),
3376
+ id: z17.string(),
3377
+ call_id: z17.string(),
3378
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3379
+ action: z17.object({
3380
+ commands: z17.array(z17.string())
3265
3381
  })
3266
3382
  }),
3267
- z16.object({
3268
- type: z16.literal("shell_call_output"),
3269
- id: z16.string(),
3270
- call_id: z16.string(),
3271
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3272
- output: z16.array(
3273
- z16.object({
3274
- stdout: z16.string(),
3275
- stderr: z16.string(),
3276
- outcome: z16.discriminatedUnion("type", [
3277
- z16.object({ type: z16.literal("timeout") }),
3278
- z16.object({
3279
- type: z16.literal("exit"),
3280
- exit_code: z16.number()
3383
+ z17.object({
3384
+ type: z17.literal("shell_call_output"),
3385
+ id: z17.string(),
3386
+ call_id: z17.string(),
3387
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3388
+ output: z17.array(
3389
+ z17.object({
3390
+ stdout: z17.string(),
3391
+ stderr: z17.string(),
3392
+ outcome: z17.discriminatedUnion("type", [
3393
+ z17.object({ type: z17.literal("timeout") }),
3394
+ z17.object({
3395
+ type: z17.literal("exit"),
3396
+ exit_code: z17.number()
3281
3397
  })
3282
3398
  ])
3283
3399
  })
3284
3400
  )
3401
+ }),
3402
+ z17.object({
3403
+ type: z17.literal("tool_search_call"),
3404
+ id: z17.string(),
3405
+ execution: z17.enum(["server", "client"]),
3406
+ call_id: z17.string().nullable(),
3407
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3408
+ arguments: z17.unknown()
3409
+ }),
3410
+ z17.object({
3411
+ type: z17.literal("tool_search_output"),
3412
+ id: z17.string(),
3413
+ execution: z17.enum(["server", "client"]),
3414
+ call_id: z17.string().nullable(),
3415
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3416
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
3285
3417
  })
3286
3418
  ])
3287
3419
  }),
3288
- z16.object({
3289
- type: z16.literal("response.output_item.done"),
3290
- output_index: z16.number(),
3291
- item: z16.discriminatedUnion("type", [
3292
- z16.object({
3293
- type: z16.literal("message"),
3294
- id: z16.string(),
3295
- phase: z16.enum(["commentary", "final_answer"]).nullish()
3420
+ z17.object({
3421
+ type: z17.literal("response.output_item.done"),
3422
+ output_index: z17.number(),
3423
+ item: z17.discriminatedUnion("type", [
3424
+ z17.object({
3425
+ type: z17.literal("message"),
3426
+ id: z17.string(),
3427
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3296
3428
  }),
3297
- z16.object({
3298
- type: z16.literal("reasoning"),
3299
- id: z16.string(),
3300
- encrypted_content: z16.string().nullish()
3429
+ z17.object({
3430
+ type: z17.literal("reasoning"),
3431
+ id: z17.string(),
3432
+ encrypted_content: z17.string().nullish()
3301
3433
  }),
3302
- z16.object({
3303
- type: z16.literal("function_call"),
3304
- id: z16.string(),
3305
- call_id: z16.string(),
3306
- name: z16.string(),
3307
- arguments: z16.string(),
3308
- status: z16.literal("completed")
3434
+ z17.object({
3435
+ type: z17.literal("function_call"),
3436
+ id: z17.string(),
3437
+ call_id: z17.string(),
3438
+ name: z17.string(),
3439
+ arguments: z17.string(),
3440
+ status: z17.literal("completed")
3309
3441
  }),
3310
- z16.object({
3311
- type: z16.literal("custom_tool_call"),
3312
- id: z16.string(),
3313
- call_id: z16.string(),
3314
- name: z16.string(),
3315
- input: z16.string(),
3316
- status: z16.literal("completed")
3442
+ z17.object({
3443
+ type: z17.literal("custom_tool_call"),
3444
+ id: z17.string(),
3445
+ call_id: z17.string(),
3446
+ name: z17.string(),
3447
+ input: z17.string(),
3448
+ status: z17.literal("completed")
3317
3449
  }),
3318
- z16.object({
3319
- type: z16.literal("code_interpreter_call"),
3320
- id: z16.string(),
3321
- code: z16.string().nullable(),
3322
- container_id: z16.string(),
3323
- outputs: z16.array(
3324
- z16.discriminatedUnion("type", [
3325
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3326
- z16.object({ type: z16.literal("image"), url: z16.string() })
3450
+ z17.object({
3451
+ type: z17.literal("code_interpreter_call"),
3452
+ id: z17.string(),
3453
+ code: z17.string().nullable(),
3454
+ container_id: z17.string(),
3455
+ outputs: z17.array(
3456
+ z17.discriminatedUnion("type", [
3457
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3458
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3327
3459
  ])
3328
3460
  ).nullable()
3329
3461
  }),
3330
- z16.object({
3331
- type: z16.literal("image_generation_call"),
3332
- id: z16.string(),
3333
- result: z16.string()
3462
+ z17.object({
3463
+ type: z17.literal("image_generation_call"),
3464
+ id: z17.string(),
3465
+ result: z17.string()
3334
3466
  }),
3335
- z16.object({
3336
- type: z16.literal("web_search_call"),
3337
- id: z16.string(),
3338
- status: z16.string(),
3339
- action: z16.discriminatedUnion("type", [
3340
- z16.object({
3341
- type: z16.literal("search"),
3342
- query: z16.string().nullish(),
3343
- sources: z16.array(
3344
- z16.discriminatedUnion("type", [
3345
- z16.object({ type: z16.literal("url"), url: z16.string() }),
3346
- z16.object({ type: z16.literal("api"), name: z16.string() })
3467
+ z17.object({
3468
+ type: z17.literal("web_search_call"),
3469
+ id: z17.string(),
3470
+ status: z17.string(),
3471
+ action: z17.discriminatedUnion("type", [
3472
+ z17.object({
3473
+ type: z17.literal("search"),
3474
+ query: z17.string().nullish(),
3475
+ sources: z17.array(
3476
+ z17.discriminatedUnion("type", [
3477
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3478
+ z17.object({ type: z17.literal("api"), name: z17.string() })
3347
3479
  ])
3348
3480
  ).nullish()
3349
3481
  }),
3350
- z16.object({
3351
- type: z16.literal("open_page"),
3352
- url: z16.string().nullish()
3482
+ z17.object({
3483
+ type: z17.literal("open_page"),
3484
+ url: z17.string().nullish()
3353
3485
  }),
3354
- z16.object({
3355
- type: z16.literal("find_in_page"),
3356
- url: z16.string().nullish(),
3357
- pattern: z16.string().nullish()
3486
+ z17.object({
3487
+ type: z17.literal("find_in_page"),
3488
+ url: z17.string().nullish(),
3489
+ pattern: z17.string().nullish()
3358
3490
  })
3359
3491
  ]).nullish()
3360
3492
  }),
3361
- z16.object({
3362
- type: z16.literal("file_search_call"),
3363
- id: z16.string(),
3364
- queries: z16.array(z16.string()),
3365
- results: z16.array(
3366
- z16.object({
3367
- attributes: z16.record(
3368
- z16.string(),
3369
- z16.union([z16.string(), z16.number(), z16.boolean()])
3493
+ z17.object({
3494
+ type: z17.literal("file_search_call"),
3495
+ id: z17.string(),
3496
+ queries: z17.array(z17.string()),
3497
+ results: z17.array(
3498
+ z17.object({
3499
+ attributes: z17.record(
3500
+ z17.string(),
3501
+ z17.union([z17.string(), z17.number(), z17.boolean()])
3370
3502
  ),
3371
- file_id: z16.string(),
3372
- filename: z16.string(),
3373
- score: z16.number(),
3374
- text: z16.string()
3503
+ file_id: z17.string(),
3504
+ filename: z17.string(),
3505
+ score: z17.number(),
3506
+ text: z17.string()
3375
3507
  })
3376
3508
  ).nullish()
3377
3509
  }),
3378
- z16.object({
3379
- type: z16.literal("local_shell_call"),
3380
- id: z16.string(),
3381
- call_id: z16.string(),
3382
- action: z16.object({
3383
- type: z16.literal("exec"),
3384
- command: z16.array(z16.string()),
3385
- timeout_ms: z16.number().optional(),
3386
- user: z16.string().optional(),
3387
- working_directory: z16.string().optional(),
3388
- env: z16.record(z16.string(), z16.string()).optional()
3510
+ z17.object({
3511
+ type: z17.literal("local_shell_call"),
3512
+ id: z17.string(),
3513
+ call_id: z17.string(),
3514
+ action: z17.object({
3515
+ type: z17.literal("exec"),
3516
+ command: z17.array(z17.string()),
3517
+ timeout_ms: z17.number().optional(),
3518
+ user: z17.string().optional(),
3519
+ working_directory: z17.string().optional(),
3520
+ env: z17.record(z17.string(), z17.string()).optional()
3389
3521
  })
3390
3522
  }),
3391
- z16.object({
3392
- type: z16.literal("computer_call"),
3393
- id: z16.string(),
3394
- status: z16.literal("completed")
3523
+ z17.object({
3524
+ type: z17.literal("computer_call"),
3525
+ id: z17.string(),
3526
+ status: z17.literal("completed")
3395
3527
  }),
3396
- z16.object({
3397
- type: z16.literal("mcp_call"),
3398
- id: z16.string(),
3399
- status: z16.string(),
3400
- arguments: z16.string(),
3401
- name: z16.string(),
3402
- server_label: z16.string(),
3403
- output: z16.string().nullish(),
3404
- error: z16.union([
3405
- z16.string(),
3406
- z16.object({
3407
- type: z16.string().optional(),
3408
- code: z16.union([z16.number(), z16.string()]).optional(),
3409
- message: z16.string().optional()
3528
+ z17.object({
3529
+ type: z17.literal("mcp_call"),
3530
+ id: z17.string(),
3531
+ status: z17.string(),
3532
+ arguments: z17.string(),
3533
+ name: z17.string(),
3534
+ server_label: z17.string(),
3535
+ output: z17.string().nullish(),
3536
+ error: z17.union([
3537
+ z17.string(),
3538
+ z17.object({
3539
+ type: z17.string().optional(),
3540
+ code: z17.union([z17.number(), z17.string()]).optional(),
3541
+ message: z17.string().optional()
3410
3542
  }).loose()
3411
3543
  ]).nullish(),
3412
- approval_request_id: z16.string().nullish()
3544
+ approval_request_id: z17.string().nullish()
3413
3545
  }),
3414
- z16.object({
3415
- type: z16.literal("mcp_list_tools"),
3416
- id: z16.string(),
3417
- server_label: z16.string(),
3418
- tools: z16.array(
3419
- z16.object({
3420
- name: z16.string(),
3421
- description: z16.string().optional(),
3422
- input_schema: z16.any(),
3423
- annotations: z16.record(z16.string(), z16.unknown()).optional()
3546
+ z17.object({
3547
+ type: z17.literal("mcp_list_tools"),
3548
+ id: z17.string(),
3549
+ server_label: z17.string(),
3550
+ tools: z17.array(
3551
+ z17.object({
3552
+ name: z17.string(),
3553
+ description: z17.string().optional(),
3554
+ input_schema: z17.any(),
3555
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
3424
3556
  })
3425
3557
  ),
3426
- error: z16.union([
3427
- z16.string(),
3428
- z16.object({
3429
- type: z16.string().optional(),
3430
- code: z16.union([z16.number(), z16.string()]).optional(),
3431
- message: z16.string().optional()
3558
+ error: z17.union([
3559
+ z17.string(),
3560
+ z17.object({
3561
+ type: z17.string().optional(),
3562
+ code: z17.union([z17.number(), z17.string()]).optional(),
3563
+ message: z17.string().optional()
3432
3564
  }).loose()
3433
3565
  ]).optional()
3434
3566
  }),
3435
- z16.object({
3436
- type: z16.literal("mcp_approval_request"),
3437
- id: z16.string(),
3438
- server_label: z16.string(),
3439
- name: z16.string(),
3440
- arguments: z16.string(),
3441
- approval_request_id: z16.string().optional()
3567
+ z17.object({
3568
+ type: z17.literal("mcp_approval_request"),
3569
+ id: z17.string(),
3570
+ server_label: z17.string(),
3571
+ name: z17.string(),
3572
+ arguments: z17.string(),
3573
+ approval_request_id: z17.string().optional()
3442
3574
  }),
3443
- z16.object({
3444
- type: z16.literal("apply_patch_call"),
3445
- id: z16.string(),
3446
- call_id: z16.string(),
3447
- status: z16.enum(["in_progress", "completed"]),
3448
- operation: z16.discriminatedUnion("type", [
3449
- z16.object({
3450
- type: z16.literal("create_file"),
3451
- path: z16.string(),
3452
- diff: z16.string()
3575
+ z17.object({
3576
+ type: z17.literal("apply_patch_call"),
3577
+ id: z17.string(),
3578
+ call_id: z17.string(),
3579
+ status: z17.enum(["in_progress", "completed"]),
3580
+ operation: z17.discriminatedUnion("type", [
3581
+ z17.object({
3582
+ type: z17.literal("create_file"),
3583
+ path: z17.string(),
3584
+ diff: z17.string()
3453
3585
  }),
3454
- z16.object({
3455
- type: z16.literal("delete_file"),
3456
- path: z16.string()
3586
+ z17.object({
3587
+ type: z17.literal("delete_file"),
3588
+ path: z17.string()
3457
3589
  }),
3458
- z16.object({
3459
- type: z16.literal("update_file"),
3460
- path: z16.string(),
3461
- diff: z16.string()
3590
+ z17.object({
3591
+ type: z17.literal("update_file"),
3592
+ path: z17.string(),
3593
+ diff: z17.string()
3462
3594
  })
3463
3595
  ])
3464
3596
  }),
3465
- z16.object({
3466
- type: z16.literal("shell_call"),
3467
- id: z16.string(),
3468
- call_id: z16.string(),
3469
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3470
- action: z16.object({
3471
- commands: z16.array(z16.string())
3597
+ z17.object({
3598
+ type: z17.literal("shell_call"),
3599
+ id: z17.string(),
3600
+ call_id: z17.string(),
3601
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3602
+ action: z17.object({
3603
+ commands: z17.array(z17.string())
3472
3604
  })
3473
3605
  }),
3474
- z16.object({
3475
- type: z16.literal("shell_call_output"),
3476
- id: z16.string(),
3477
- call_id: z16.string(),
3478
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3479
- output: z16.array(
3480
- z16.object({
3481
- stdout: z16.string(),
3482
- stderr: z16.string(),
3483
- outcome: z16.discriminatedUnion("type", [
3484
- z16.object({ type: z16.literal("timeout") }),
3485
- z16.object({
3486
- type: z16.literal("exit"),
3487
- exit_code: z16.number()
3606
+ z17.object({
3607
+ type: z17.literal("shell_call_output"),
3608
+ id: z17.string(),
3609
+ call_id: z17.string(),
3610
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3611
+ output: z17.array(
3612
+ z17.object({
3613
+ stdout: z17.string(),
3614
+ stderr: z17.string(),
3615
+ outcome: z17.discriminatedUnion("type", [
3616
+ z17.object({ type: z17.literal("timeout") }),
3617
+ z17.object({
3618
+ type: z17.literal("exit"),
3619
+ exit_code: z17.number()
3488
3620
  })
3489
3621
  ])
3490
3622
  })
3491
3623
  )
3624
+ }),
3625
+ z17.object({
3626
+ type: z17.literal("tool_search_call"),
3627
+ id: z17.string(),
3628
+ execution: z17.enum(["server", "client"]),
3629
+ call_id: z17.string().nullable(),
3630
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3631
+ arguments: z17.unknown()
3632
+ }),
3633
+ z17.object({
3634
+ type: z17.literal("tool_search_output"),
3635
+ id: z17.string(),
3636
+ execution: z17.enum(["server", "client"]),
3637
+ call_id: z17.string().nullable(),
3638
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3639
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
3492
3640
  })
3493
3641
  ])
3494
3642
  }),
3495
- z16.object({
3496
- type: z16.literal("response.function_call_arguments.delta"),
3497
- item_id: z16.string(),
3498
- output_index: z16.number(),
3499
- delta: z16.string()
3643
+ z17.object({
3644
+ type: z17.literal("response.function_call_arguments.delta"),
3645
+ item_id: z17.string(),
3646
+ output_index: z17.number(),
3647
+ delta: z17.string()
3500
3648
  }),
3501
- z16.object({
3502
- type: z16.literal("response.custom_tool_call_input.delta"),
3503
- item_id: z16.string(),
3504
- output_index: z16.number(),
3505
- delta: z16.string()
3649
+ z17.object({
3650
+ type: z17.literal("response.custom_tool_call_input.delta"),
3651
+ item_id: z17.string(),
3652
+ output_index: z17.number(),
3653
+ delta: z17.string()
3506
3654
  }),
3507
- z16.object({
3508
- type: z16.literal("response.image_generation_call.partial_image"),
3509
- item_id: z16.string(),
3510
- output_index: z16.number(),
3511
- partial_image_b64: z16.string()
3655
+ z17.object({
3656
+ type: z17.literal("response.image_generation_call.partial_image"),
3657
+ item_id: z17.string(),
3658
+ output_index: z17.number(),
3659
+ partial_image_b64: z17.string()
3512
3660
  }),
3513
- z16.object({
3514
- type: z16.literal("response.code_interpreter_call_code.delta"),
3515
- item_id: z16.string(),
3516
- output_index: z16.number(),
3517
- delta: z16.string()
3661
+ z17.object({
3662
+ type: z17.literal("response.code_interpreter_call_code.delta"),
3663
+ item_id: z17.string(),
3664
+ output_index: z17.number(),
3665
+ delta: z17.string()
3518
3666
  }),
3519
- z16.object({
3520
- type: z16.literal("response.code_interpreter_call_code.done"),
3521
- item_id: z16.string(),
3522
- output_index: z16.number(),
3523
- code: z16.string()
3667
+ z17.object({
3668
+ type: z17.literal("response.code_interpreter_call_code.done"),
3669
+ item_id: z17.string(),
3670
+ output_index: z17.number(),
3671
+ code: z17.string()
3524
3672
  }),
3525
- z16.object({
3526
- type: z16.literal("response.output_text.annotation.added"),
3527
- annotation: z16.discriminatedUnion("type", [
3528
- z16.object({
3529
- type: z16.literal("url_citation"),
3530
- start_index: z16.number(),
3531
- end_index: z16.number(),
3532
- url: z16.string(),
3533
- title: z16.string()
3673
+ z17.object({
3674
+ type: z17.literal("response.output_text.annotation.added"),
3675
+ annotation: z17.discriminatedUnion("type", [
3676
+ z17.object({
3677
+ type: z17.literal("url_citation"),
3678
+ start_index: z17.number(),
3679
+ end_index: z17.number(),
3680
+ url: z17.string(),
3681
+ title: z17.string()
3534
3682
  }),
3535
- z16.object({
3536
- type: z16.literal("file_citation"),
3537
- file_id: z16.string(),
3538
- filename: z16.string(),
3539
- index: z16.number()
3683
+ z17.object({
3684
+ type: z17.literal("file_citation"),
3685
+ file_id: z17.string(),
3686
+ filename: z17.string(),
3687
+ index: z17.number()
3540
3688
  }),
3541
- z16.object({
3542
- type: z16.literal("container_file_citation"),
3543
- container_id: z16.string(),
3544
- file_id: z16.string(),
3545
- filename: z16.string(),
3546
- start_index: z16.number(),
3547
- end_index: z16.number()
3689
+ z17.object({
3690
+ type: z17.literal("container_file_citation"),
3691
+ container_id: z17.string(),
3692
+ file_id: z17.string(),
3693
+ filename: z17.string(),
3694
+ start_index: z17.number(),
3695
+ end_index: z17.number()
3548
3696
  }),
3549
- z16.object({
3550
- type: z16.literal("file_path"),
3551
- file_id: z16.string(),
3552
- index: z16.number()
3697
+ z17.object({
3698
+ type: z17.literal("file_path"),
3699
+ file_id: z17.string(),
3700
+ index: z17.number()
3553
3701
  })
3554
3702
  ])
3555
3703
  }),
3556
- z16.object({
3557
- type: z16.literal("response.reasoning_summary_part.added"),
3558
- item_id: z16.string(),
3559
- summary_index: z16.number()
3704
+ z17.object({
3705
+ type: z17.literal("response.reasoning_summary_part.added"),
3706
+ item_id: z17.string(),
3707
+ summary_index: z17.number()
3560
3708
  }),
3561
- z16.object({
3562
- type: z16.literal("response.reasoning_summary_text.delta"),
3563
- item_id: z16.string(),
3564
- summary_index: z16.number(),
3565
- delta: z16.string()
3709
+ z17.object({
3710
+ type: z17.literal("response.reasoning_summary_text.delta"),
3711
+ item_id: z17.string(),
3712
+ summary_index: z17.number(),
3713
+ delta: z17.string()
3566
3714
  }),
3567
- z16.object({
3568
- type: z16.literal("response.reasoning_summary_part.done"),
3569
- item_id: z16.string(),
3570
- summary_index: z16.number()
3715
+ z17.object({
3716
+ type: z17.literal("response.reasoning_summary_part.done"),
3717
+ item_id: z17.string(),
3718
+ summary_index: z17.number()
3571
3719
  }),
3572
- z16.object({
3573
- type: z16.literal("response.apply_patch_call_operation_diff.delta"),
3574
- item_id: z16.string(),
3575
- output_index: z16.number(),
3576
- delta: z16.string(),
3577
- obfuscation: z16.string().nullish()
3720
+ z17.object({
3721
+ type: z17.literal("response.apply_patch_call_operation_diff.delta"),
3722
+ item_id: z17.string(),
3723
+ output_index: z17.number(),
3724
+ delta: z17.string(),
3725
+ obfuscation: z17.string().nullish()
3578
3726
  }),
3579
- z16.object({
3580
- type: z16.literal("response.apply_patch_call_operation_diff.done"),
3581
- item_id: z16.string(),
3582
- output_index: z16.number(),
3583
- diff: z16.string()
3727
+ z17.object({
3728
+ type: z17.literal("response.apply_patch_call_operation_diff.done"),
3729
+ item_id: z17.string(),
3730
+ output_index: z17.number(),
3731
+ diff: z17.string()
3584
3732
  }),
3585
- z16.object({
3586
- type: z16.literal("error"),
3587
- sequence_number: z16.number(),
3588
- error: z16.object({
3589
- type: z16.string(),
3590
- code: z16.string(),
3591
- message: z16.string(),
3592
- param: z16.string().nullish()
3733
+ z17.object({
3734
+ type: z17.literal("error"),
3735
+ sequence_number: z17.number(),
3736
+ error: z17.object({
3737
+ type: z17.string(),
3738
+ code: z17.string(),
3739
+ message: z17.string(),
3740
+ param: z17.string().nullish()
3593
3741
  })
3594
3742
  }),
3595
- z16.object({ type: z16.string() }).loose().transform((value) => ({
3743
+ z17.object({ type: z17.string() }).loose().transform((value) => ({
3596
3744
  type: "unknown_chunk",
3597
3745
  message: value.type
3598
3746
  }))
@@ -3600,294 +3748,310 @@ var openaiResponsesChunkSchema = lazySchema14(
3600
3748
  ])
3601
3749
  )
3602
3750
  );
3603
- var openaiResponsesResponseSchema = lazySchema14(
3604
- () => zodSchema14(
3605
- z16.object({
3606
- id: z16.string().optional(),
3607
- created_at: z16.number().optional(),
3608
- error: z16.object({
3609
- message: z16.string(),
3610
- type: z16.string(),
3611
- param: z16.string().nullish(),
3612
- code: z16.string()
3751
+ var openaiResponsesResponseSchema = lazySchema15(
3752
+ () => zodSchema15(
3753
+ z17.object({
3754
+ id: z17.string().optional(),
3755
+ created_at: z17.number().optional(),
3756
+ error: z17.object({
3757
+ message: z17.string(),
3758
+ type: z17.string(),
3759
+ param: z17.string().nullish(),
3760
+ code: z17.string()
3613
3761
  }).nullish(),
3614
- model: z16.string().optional(),
3615
- output: z16.array(
3616
- z16.discriminatedUnion("type", [
3617
- z16.object({
3618
- type: z16.literal("message"),
3619
- role: z16.literal("assistant"),
3620
- id: z16.string(),
3621
- phase: z16.enum(["commentary", "final_answer"]).nullish(),
3622
- content: z16.array(
3623
- z16.object({
3624
- type: z16.literal("output_text"),
3625
- text: z16.string(),
3626
- logprobs: z16.array(
3627
- z16.object({
3628
- token: z16.string(),
3629
- logprob: z16.number(),
3630
- top_logprobs: z16.array(
3631
- z16.object({
3632
- token: z16.string(),
3633
- logprob: z16.number()
3762
+ model: z17.string().optional(),
3763
+ output: z17.array(
3764
+ z17.discriminatedUnion("type", [
3765
+ z17.object({
3766
+ type: z17.literal("message"),
3767
+ role: z17.literal("assistant"),
3768
+ id: z17.string(),
3769
+ phase: z17.enum(["commentary", "final_answer"]).nullish(),
3770
+ content: z17.array(
3771
+ z17.object({
3772
+ type: z17.literal("output_text"),
3773
+ text: z17.string(),
3774
+ logprobs: z17.array(
3775
+ z17.object({
3776
+ token: z17.string(),
3777
+ logprob: z17.number(),
3778
+ top_logprobs: z17.array(
3779
+ z17.object({
3780
+ token: z17.string(),
3781
+ logprob: z17.number()
3634
3782
  })
3635
3783
  )
3636
3784
  })
3637
3785
  ).nullish(),
3638
- annotations: z16.array(
3639
- z16.discriminatedUnion("type", [
3640
- z16.object({
3641
- type: z16.literal("url_citation"),
3642
- start_index: z16.number(),
3643
- end_index: z16.number(),
3644
- url: z16.string(),
3645
- title: z16.string()
3786
+ annotations: z17.array(
3787
+ z17.discriminatedUnion("type", [
3788
+ z17.object({
3789
+ type: z17.literal("url_citation"),
3790
+ start_index: z17.number(),
3791
+ end_index: z17.number(),
3792
+ url: z17.string(),
3793
+ title: z17.string()
3646
3794
  }),
3647
- z16.object({
3648
- type: z16.literal("file_citation"),
3649
- file_id: z16.string(),
3650
- filename: z16.string(),
3651
- index: z16.number()
3795
+ z17.object({
3796
+ type: z17.literal("file_citation"),
3797
+ file_id: z17.string(),
3798
+ filename: z17.string(),
3799
+ index: z17.number()
3652
3800
  }),
3653
- z16.object({
3654
- type: z16.literal("container_file_citation"),
3655
- container_id: z16.string(),
3656
- file_id: z16.string(),
3657
- filename: z16.string(),
3658
- start_index: z16.number(),
3659
- end_index: z16.number()
3801
+ z17.object({
3802
+ type: z17.literal("container_file_citation"),
3803
+ container_id: z17.string(),
3804
+ file_id: z17.string(),
3805
+ filename: z17.string(),
3806
+ start_index: z17.number(),
3807
+ end_index: z17.number()
3660
3808
  }),
3661
- z16.object({
3662
- type: z16.literal("file_path"),
3663
- file_id: z16.string(),
3664
- index: z16.number()
3809
+ z17.object({
3810
+ type: z17.literal("file_path"),
3811
+ file_id: z17.string(),
3812
+ index: z17.number()
3665
3813
  })
3666
3814
  ])
3667
3815
  )
3668
3816
  })
3669
3817
  )
3670
3818
  }),
3671
- z16.object({
3672
- type: z16.literal("web_search_call"),
3673
- id: z16.string(),
3674
- status: z16.string(),
3675
- action: z16.discriminatedUnion("type", [
3676
- z16.object({
3677
- type: z16.literal("search"),
3678
- query: z16.string().nullish(),
3679
- sources: z16.array(
3680
- z16.discriminatedUnion("type", [
3681
- z16.object({ type: z16.literal("url"), url: z16.string() }),
3682
- z16.object({
3683
- type: z16.literal("api"),
3684
- name: z16.string()
3819
+ z17.object({
3820
+ type: z17.literal("web_search_call"),
3821
+ id: z17.string(),
3822
+ status: z17.string(),
3823
+ action: z17.discriminatedUnion("type", [
3824
+ z17.object({
3825
+ type: z17.literal("search"),
3826
+ query: z17.string().nullish(),
3827
+ sources: z17.array(
3828
+ z17.discriminatedUnion("type", [
3829
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3830
+ z17.object({
3831
+ type: z17.literal("api"),
3832
+ name: z17.string()
3685
3833
  })
3686
3834
  ])
3687
3835
  ).nullish()
3688
3836
  }),
3689
- z16.object({
3690
- type: z16.literal("open_page"),
3691
- url: z16.string().nullish()
3837
+ z17.object({
3838
+ type: z17.literal("open_page"),
3839
+ url: z17.string().nullish()
3692
3840
  }),
3693
- z16.object({
3694
- type: z16.literal("find_in_page"),
3695
- url: z16.string().nullish(),
3696
- pattern: z16.string().nullish()
3841
+ z17.object({
3842
+ type: z17.literal("find_in_page"),
3843
+ url: z17.string().nullish(),
3844
+ pattern: z17.string().nullish()
3697
3845
  })
3698
3846
  ]).nullish()
3699
3847
  }),
3700
- z16.object({
3701
- type: z16.literal("file_search_call"),
3702
- id: z16.string(),
3703
- queries: z16.array(z16.string()),
3704
- results: z16.array(
3705
- z16.object({
3706
- attributes: z16.record(
3707
- z16.string(),
3708
- z16.union([z16.string(), z16.number(), z16.boolean()])
3848
+ z17.object({
3849
+ type: z17.literal("file_search_call"),
3850
+ id: z17.string(),
3851
+ queries: z17.array(z17.string()),
3852
+ results: z17.array(
3853
+ z17.object({
3854
+ attributes: z17.record(
3855
+ z17.string(),
3856
+ z17.union([z17.string(), z17.number(), z17.boolean()])
3709
3857
  ),
3710
- file_id: z16.string(),
3711
- filename: z16.string(),
3712
- score: z16.number(),
3713
- text: z16.string()
3858
+ file_id: z17.string(),
3859
+ filename: z17.string(),
3860
+ score: z17.number(),
3861
+ text: z17.string()
3714
3862
  })
3715
3863
  ).nullish()
3716
3864
  }),
3717
- z16.object({
3718
- type: z16.literal("code_interpreter_call"),
3719
- id: z16.string(),
3720
- code: z16.string().nullable(),
3721
- container_id: z16.string(),
3722
- outputs: z16.array(
3723
- z16.discriminatedUnion("type", [
3724
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3725
- z16.object({ type: z16.literal("image"), url: z16.string() })
3865
+ z17.object({
3866
+ type: z17.literal("code_interpreter_call"),
3867
+ id: z17.string(),
3868
+ code: z17.string().nullable(),
3869
+ container_id: z17.string(),
3870
+ outputs: z17.array(
3871
+ z17.discriminatedUnion("type", [
3872
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3873
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3726
3874
  ])
3727
3875
  ).nullable()
3728
3876
  }),
3729
- z16.object({
3730
- type: z16.literal("image_generation_call"),
3731
- id: z16.string(),
3732
- result: z16.string()
3877
+ z17.object({
3878
+ type: z17.literal("image_generation_call"),
3879
+ id: z17.string(),
3880
+ result: z17.string()
3733
3881
  }),
3734
- z16.object({
3735
- type: z16.literal("local_shell_call"),
3736
- id: z16.string(),
3737
- call_id: z16.string(),
3738
- action: z16.object({
3739
- type: z16.literal("exec"),
3740
- command: z16.array(z16.string()),
3741
- timeout_ms: z16.number().optional(),
3742
- user: z16.string().optional(),
3743
- working_directory: z16.string().optional(),
3744
- env: z16.record(z16.string(), z16.string()).optional()
3882
+ z17.object({
3883
+ type: z17.literal("local_shell_call"),
3884
+ id: z17.string(),
3885
+ call_id: z17.string(),
3886
+ action: z17.object({
3887
+ type: z17.literal("exec"),
3888
+ command: z17.array(z17.string()),
3889
+ timeout_ms: z17.number().optional(),
3890
+ user: z17.string().optional(),
3891
+ working_directory: z17.string().optional(),
3892
+ env: z17.record(z17.string(), z17.string()).optional()
3745
3893
  })
3746
3894
  }),
3747
- z16.object({
3748
- type: z16.literal("function_call"),
3749
- call_id: z16.string(),
3750
- name: z16.string(),
3751
- arguments: z16.string(),
3752
- id: z16.string()
3895
+ z17.object({
3896
+ type: z17.literal("function_call"),
3897
+ call_id: z17.string(),
3898
+ name: z17.string(),
3899
+ arguments: z17.string(),
3900
+ id: z17.string()
3753
3901
  }),
3754
- z16.object({
3755
- type: z16.literal("custom_tool_call"),
3756
- call_id: z16.string(),
3757
- name: z16.string(),
3758
- input: z16.string(),
3759
- id: z16.string()
3902
+ z17.object({
3903
+ type: z17.literal("custom_tool_call"),
3904
+ call_id: z17.string(),
3905
+ name: z17.string(),
3906
+ input: z17.string(),
3907
+ id: z17.string()
3760
3908
  }),
3761
- z16.object({
3762
- type: z16.literal("computer_call"),
3763
- id: z16.string(),
3764
- status: z16.string().optional()
3909
+ z17.object({
3910
+ type: z17.literal("computer_call"),
3911
+ id: z17.string(),
3912
+ status: z17.string().optional()
3765
3913
  }),
3766
- z16.object({
3767
- type: z16.literal("reasoning"),
3768
- id: z16.string(),
3769
- encrypted_content: z16.string().nullish(),
3770
- summary: z16.array(
3771
- z16.object({
3772
- type: z16.literal("summary_text"),
3773
- text: z16.string()
3914
+ z17.object({
3915
+ type: z17.literal("reasoning"),
3916
+ id: z17.string(),
3917
+ encrypted_content: z17.string().nullish(),
3918
+ summary: z17.array(
3919
+ z17.object({
3920
+ type: z17.literal("summary_text"),
3921
+ text: z17.string()
3774
3922
  })
3775
3923
  )
3776
3924
  }),
3777
- z16.object({
3778
- type: z16.literal("mcp_call"),
3779
- id: z16.string(),
3780
- status: z16.string(),
3781
- arguments: z16.string(),
3782
- name: z16.string(),
3783
- server_label: z16.string(),
3784
- output: z16.string().nullish(),
3785
- error: z16.union([
3786
- z16.string(),
3787
- z16.object({
3788
- type: z16.string().optional(),
3789
- code: z16.union([z16.number(), z16.string()]).optional(),
3790
- message: z16.string().optional()
3925
+ z17.object({
3926
+ type: z17.literal("mcp_call"),
3927
+ id: z17.string(),
3928
+ status: z17.string(),
3929
+ arguments: z17.string(),
3930
+ name: z17.string(),
3931
+ server_label: z17.string(),
3932
+ output: z17.string().nullish(),
3933
+ error: z17.union([
3934
+ z17.string(),
3935
+ z17.object({
3936
+ type: z17.string().optional(),
3937
+ code: z17.union([z17.number(), z17.string()]).optional(),
3938
+ message: z17.string().optional()
3791
3939
  }).loose()
3792
3940
  ]).nullish(),
3793
- approval_request_id: z16.string().nullish()
3941
+ approval_request_id: z17.string().nullish()
3794
3942
  }),
3795
- z16.object({
3796
- type: z16.literal("mcp_list_tools"),
3797
- id: z16.string(),
3798
- server_label: z16.string(),
3799
- tools: z16.array(
3800
- z16.object({
3801
- name: z16.string(),
3802
- description: z16.string().optional(),
3803
- input_schema: z16.any(),
3804
- annotations: z16.record(z16.string(), z16.unknown()).optional()
3943
+ z17.object({
3944
+ type: z17.literal("mcp_list_tools"),
3945
+ id: z17.string(),
3946
+ server_label: z17.string(),
3947
+ tools: z17.array(
3948
+ z17.object({
3949
+ name: z17.string(),
3950
+ description: z17.string().optional(),
3951
+ input_schema: z17.any(),
3952
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
3805
3953
  })
3806
3954
  ),
3807
- error: z16.union([
3808
- z16.string(),
3809
- z16.object({
3810
- type: z16.string().optional(),
3811
- code: z16.union([z16.number(), z16.string()]).optional(),
3812
- message: z16.string().optional()
3955
+ error: z17.union([
3956
+ z17.string(),
3957
+ z17.object({
3958
+ type: z17.string().optional(),
3959
+ code: z17.union([z17.number(), z17.string()]).optional(),
3960
+ message: z17.string().optional()
3813
3961
  }).loose()
3814
3962
  ]).optional()
3815
3963
  }),
3816
- z16.object({
3817
- type: z16.literal("mcp_approval_request"),
3818
- id: z16.string(),
3819
- server_label: z16.string(),
3820
- name: z16.string(),
3821
- arguments: z16.string(),
3822
- approval_request_id: z16.string().optional()
3964
+ z17.object({
3965
+ type: z17.literal("mcp_approval_request"),
3966
+ id: z17.string(),
3967
+ server_label: z17.string(),
3968
+ name: z17.string(),
3969
+ arguments: z17.string(),
3970
+ approval_request_id: z17.string().optional()
3823
3971
  }),
3824
- z16.object({
3825
- type: z16.literal("apply_patch_call"),
3826
- id: z16.string(),
3827
- call_id: z16.string(),
3828
- status: z16.enum(["in_progress", "completed"]),
3829
- operation: z16.discriminatedUnion("type", [
3830
- z16.object({
3831
- type: z16.literal("create_file"),
3832
- path: z16.string(),
3833
- diff: z16.string()
3972
+ z17.object({
3973
+ type: z17.literal("apply_patch_call"),
3974
+ id: z17.string(),
3975
+ call_id: z17.string(),
3976
+ status: z17.enum(["in_progress", "completed"]),
3977
+ operation: z17.discriminatedUnion("type", [
3978
+ z17.object({
3979
+ type: z17.literal("create_file"),
3980
+ path: z17.string(),
3981
+ diff: z17.string()
3834
3982
  }),
3835
- z16.object({
3836
- type: z16.literal("delete_file"),
3837
- path: z16.string()
3983
+ z17.object({
3984
+ type: z17.literal("delete_file"),
3985
+ path: z17.string()
3838
3986
  }),
3839
- z16.object({
3840
- type: z16.literal("update_file"),
3841
- path: z16.string(),
3842
- diff: z16.string()
3987
+ z17.object({
3988
+ type: z17.literal("update_file"),
3989
+ path: z17.string(),
3990
+ diff: z17.string()
3843
3991
  })
3844
3992
  ])
3845
3993
  }),
3846
- z16.object({
3847
- type: z16.literal("shell_call"),
3848
- id: z16.string(),
3849
- call_id: z16.string(),
3850
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3851
- action: z16.object({
3852
- commands: z16.array(z16.string())
3994
+ z17.object({
3995
+ type: z17.literal("shell_call"),
3996
+ id: z17.string(),
3997
+ call_id: z17.string(),
3998
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
3999
+ action: z17.object({
4000
+ commands: z17.array(z17.string())
3853
4001
  })
3854
4002
  }),
3855
- z16.object({
3856
- type: z16.literal("shell_call_output"),
3857
- id: z16.string(),
3858
- call_id: z16.string(),
3859
- status: z16.enum(["in_progress", "completed", "incomplete"]),
3860
- output: z16.array(
3861
- z16.object({
3862
- stdout: z16.string(),
3863
- stderr: z16.string(),
3864
- outcome: z16.discriminatedUnion("type", [
3865
- z16.object({ type: z16.literal("timeout") }),
3866
- z16.object({
3867
- type: z16.literal("exit"),
3868
- exit_code: z16.number()
4003
+ z17.object({
4004
+ type: z17.literal("shell_call_output"),
4005
+ id: z17.string(),
4006
+ call_id: z17.string(),
4007
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4008
+ output: z17.array(
4009
+ z17.object({
4010
+ stdout: z17.string(),
4011
+ stderr: z17.string(),
4012
+ outcome: z17.discriminatedUnion("type", [
4013
+ z17.object({ type: z17.literal("timeout") }),
4014
+ z17.object({
4015
+ type: z17.literal("exit"),
4016
+ exit_code: z17.number()
3869
4017
  })
3870
4018
  ])
3871
4019
  })
3872
4020
  )
4021
+ }),
4022
+ z17.object({
4023
+ type: z17.literal("tool_search_call"),
4024
+ id: z17.string(),
4025
+ execution: z17.enum(["server", "client"]),
4026
+ call_id: z17.string().nullable(),
4027
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4028
+ arguments: z17.unknown()
4029
+ }),
4030
+ z17.object({
4031
+ type: z17.literal("tool_search_output"),
4032
+ id: z17.string(),
4033
+ execution: z17.enum(["server", "client"]),
4034
+ call_id: z17.string().nullable(),
4035
+ status: z17.enum(["in_progress", "completed", "incomplete"]),
4036
+ tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
3873
4037
  })
3874
4038
  ])
3875
4039
  ).optional(),
3876
- service_tier: z16.string().nullish(),
3877
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3878
- usage: z16.object({
3879
- input_tokens: z16.number(),
3880
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
3881
- output_tokens: z16.number(),
3882
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
4040
+ service_tier: z17.string().nullish(),
4041
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
4042
+ usage: z17.object({
4043
+ input_tokens: z17.number(),
4044
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
4045
+ output_tokens: z17.number(),
4046
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3883
4047
  }).optional()
3884
4048
  })
3885
4049
  )
3886
4050
  );
3887
4051
 
3888
4052
  // src/responses/openai-responses-options.ts
3889
- import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
3890
- import { z as z17 } from "zod/v4";
4053
+ import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
4054
+ import { z as z18 } from "zod/v4";
3891
4055
  var TOP_LOGPROBS_MAX = 20;
3892
4056
  var openaiResponsesReasoningModelIds = [
3893
4057
  "o1",
@@ -3916,11 +4080,12 @@ var openaiResponsesReasoningModelIds = [
3916
4080
  "gpt-5.2-chat-latest",
3917
4081
  "gpt-5.2-pro",
3918
4082
  "gpt-5.2-codex",
4083
+ "gpt-5.3-chat-latest",
4084
+ "gpt-5.3-codex",
3919
4085
  "gpt-5.4",
3920
4086
  "gpt-5.4-2026-03-05",
3921
4087
  "gpt-5.4-pro",
3922
- "gpt-5.4-pro-2026-03-05",
3923
- "gpt-5.3-codex"
4088
+ "gpt-5.4-pro-2026-03-05"
3924
4089
  ];
3925
4090
  var openaiResponsesModelIds = [
3926
4091
  "gpt-4.1",
@@ -3947,9 +4112,9 @@ var openaiResponsesModelIds = [
3947
4112
  "gpt-5-chat-latest",
3948
4113
  ...openaiResponsesReasoningModelIds
3949
4114
  ];
3950
- var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
3951
- () => zodSchema15(
3952
- z17.object({
4115
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema16(
4116
+ () => zodSchema16(
4117
+ z18.object({
3953
4118
  /**
3954
4119
  * The ID of the OpenAI Conversation to continue.
3955
4120
  * You must create a conversation first via the OpenAI API.
@@ -3957,13 +4122,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
3957
4122
  * Defaults to `undefined`.
3958
4123
  * @see https://platform.openai.com/docs/api-reference/conversations/create
3959
4124
  */
3960
- conversation: z17.string().nullish(),
4125
+ conversation: z18.string().nullish(),
3961
4126
  /**
3962
4127
  * The set of extra fields to include in the response (advanced, usually not needed).
3963
4128
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
3964
4129
  */
3965
- include: z17.array(
3966
- z17.enum([
4130
+ include: z18.array(
4131
+ z18.enum([
3967
4132
  "reasoning.encrypted_content",
3968
4133
  // handled internally by default, only needed for unknown reasoning models
3969
4134
  "file_search_call.results",
@@ -3975,7 +4140,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
3975
4140
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
3976
4141
  * Defaults to `undefined`.
3977
4142
  */
3978
- instructions: z17.string().nullish(),
4143
+ instructions: z18.string().nullish(),
3979
4144
  /**
3980
4145
  * Return the log probabilities of the tokens. Including logprobs will increase
3981
4146
  * the response size and can slow down response times. However, it can
@@ -3990,30 +4155,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
3990
4155
  * @see https://platform.openai.com/docs/api-reference/responses/create
3991
4156
  * @see https://cookbook.openai.com/examples/using_logprobs
3992
4157
  */
3993
- logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4158
+ logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3994
4159
  /**
3995
4160
  * The maximum number of total calls to built-in tools that can be processed in a response.
3996
4161
  * This maximum number applies across all built-in tool calls, not per individual tool.
3997
4162
  * Any further attempts to call a tool by the model will be ignored.
3998
4163
  */
3999
- maxToolCalls: z17.number().nullish(),
4164
+ maxToolCalls: z18.number().nullish(),
4000
4165
  /**
4001
4166
  * Additional metadata to store with the generation.
4002
4167
  */
4003
- metadata: z17.any().nullish(),
4168
+ metadata: z18.any().nullish(),
4004
4169
  /**
4005
4170
  * Whether to use parallel tool calls. Defaults to `true`.
4006
4171
  */
4007
- parallelToolCalls: z17.boolean().nullish(),
4172
+ parallelToolCalls: z18.boolean().nullish(),
4008
4173
  /**
4009
4174
  * The ID of the previous response. You can use it to continue a conversation.
4010
4175
  * Defaults to `undefined`.
4011
4176
  */
4012
- previousResponseId: z17.string().nullish(),
4177
+ previousResponseId: z18.string().nullish(),
4013
4178
  /**
4014
4179
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
4015
4180
  */
4016
- promptCacheKey: z17.string().nullish(),
4181
+ promptCacheKey: z18.string().nullish(),
4017
4182
  /**
4018
4183
  * The retention policy for the prompt cache.
4019
4184
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4022,7 +4187,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
4022
4187
  *
4023
4188
  * @default 'in_memory'
4024
4189
  */
4025
- promptCacheRetention: z17.enum(["in_memory", "24h"]).nullish(),
4190
+ promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
4026
4191
  /**
4027
4192
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4028
4193
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4033,17 +4198,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
4033
4198
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4034
4199
  * an error.
4035
4200
  */
4036
- reasoningEffort: z17.string().nullish(),
4201
+ reasoningEffort: z18.string().nullish(),
4037
4202
  /**
4038
4203
  * Controls reasoning summary output from the model.
4039
4204
  * Set to "auto" to automatically receive the richest level available,
4040
4205
  * or "detailed" for comprehensive summaries.
4041
4206
  */
4042
- reasoningSummary: z17.string().nullish(),
4207
+ reasoningSummary: z18.string().nullish(),
4043
4208
  /**
4044
4209
  * The identifier for safety monitoring and tracking.
4045
4210
  */
4046
- safetyIdentifier: z17.string().nullish(),
4211
+ safetyIdentifier: z18.string().nullish(),
4047
4212
  /**
4048
4213
  * Service tier for the request.
4049
4214
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4051,34 +4216,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
4051
4216
  *
4052
4217
  * Defaults to 'auto'.
4053
4218
  */
4054
- serviceTier: z17.enum(["auto", "flex", "priority", "default"]).nullish(),
4219
+ serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
4055
4220
  /**
4056
4221
  * Whether to store the generation. Defaults to `true`.
4057
4222
  */
4058
- store: z17.boolean().nullish(),
4223
+ store: z18.boolean().nullish(),
4059
4224
  /**
4060
4225
  * Whether to use strict JSON schema validation.
4061
4226
  * Defaults to `true`.
4062
4227
  */
4063
- strictJsonSchema: z17.boolean().nullish(),
4228
+ strictJsonSchema: z18.boolean().nullish(),
4064
4229
  /**
4065
4230
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4066
4231
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4067
4232
  * Valid values: 'low', 'medium', 'high'.
4068
4233
  */
4069
- textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
4234
+ textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
4070
4235
  /**
4071
4236
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4072
4237
  * 'disabled' turns truncation off.
4073
4238
  */
4074
- truncation: z17.enum(["auto", "disabled"]).nullish(),
4239
+ truncation: z18.enum(["auto", "disabled"]).nullish(),
4075
4240
  /**
4076
4241
  * A unique identifier representing your end-user, which can help OpenAI to
4077
4242
  * monitor and detect abuse.
4078
4243
  * Defaults to `undefined`.
4079
4244
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4080
4245
  */
4081
- user: z17.string().nullish(),
4246
+ user: z18.string().nullish(),
4082
4247
  /**
4083
4248
  * Override the system message mode for this model.
4084
4249
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4087,7 +4252,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
4087
4252
  *
4088
4253
  * If not specified, the mode is automatically determined based on the model.
4089
4254
  */
4090
- systemMessageMode: z17.enum(["system", "developer", "remove"]).optional(),
4255
+ systemMessageMode: z18.enum(["system", "developer", "remove"]).optional(),
4091
4256
  /**
4092
4257
  * Force treating this model as a reasoning model.
4093
4258
  *
@@ -4097,7 +4262,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
4097
4262
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4098
4263
  * and defaults `systemMessageMode` to `developer` unless overridden.
4099
4264
  */
4100
- forceReasoning: z17.boolean().optional()
4265
+ forceReasoning: z18.boolean().optional()
4101
4266
  })
4102
4267
  )
4103
4268
  );
@@ -4110,44 +4275,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
4110
4275
 
4111
4276
  // src/tool/code-interpreter.ts
4112
4277
  import {
4113
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
4114
- lazySchema as lazySchema16,
4115
- zodSchema as zodSchema16
4278
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
4279
+ lazySchema as lazySchema17,
4280
+ zodSchema as zodSchema17
4116
4281
  } from "@ai-sdk/provider-utils";
4117
- import { z as z18 } from "zod/v4";
4118
- var codeInterpreterInputSchema = lazySchema16(
4119
- () => zodSchema16(
4120
- z18.object({
4121
- code: z18.string().nullish(),
4122
- containerId: z18.string()
4282
+ import { z as z19 } from "zod/v4";
4283
+ var codeInterpreterInputSchema = lazySchema17(
4284
+ () => zodSchema17(
4285
+ z19.object({
4286
+ code: z19.string().nullish(),
4287
+ containerId: z19.string()
4123
4288
  })
4124
4289
  )
4125
4290
  );
4126
- var codeInterpreterOutputSchema = lazySchema16(
4127
- () => zodSchema16(
4128
- z18.object({
4129
- outputs: z18.array(
4130
- z18.discriminatedUnion("type", [
4131
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
4132
- z18.object({ type: z18.literal("image"), url: z18.string() })
4291
+ var codeInterpreterOutputSchema = lazySchema17(
4292
+ () => zodSchema17(
4293
+ z19.object({
4294
+ outputs: z19.array(
4295
+ z19.discriminatedUnion("type", [
4296
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4297
+ z19.object({ type: z19.literal("image"), url: z19.string() })
4133
4298
  ])
4134
4299
  ).nullish()
4135
4300
  })
4136
4301
  )
4137
4302
  );
4138
- var codeInterpreterArgsSchema = lazySchema16(
4139
- () => zodSchema16(
4140
- z18.object({
4141
- container: z18.union([
4142
- z18.string(),
4143
- z18.object({
4144
- fileIds: z18.array(z18.string()).optional()
4303
+ var codeInterpreterArgsSchema = lazySchema17(
4304
+ () => zodSchema17(
4305
+ z19.object({
4306
+ container: z19.union([
4307
+ z19.string(),
4308
+ z19.object({
4309
+ fileIds: z19.array(z19.string()).optional()
4145
4310
  })
4146
4311
  ]).optional()
4147
4312
  })
4148
4313
  )
4149
4314
  );
4150
- var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema4({
4315
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema5({
4151
4316
  id: "openai.code_interpreter",
4152
4317
  inputSchema: codeInterpreterInputSchema,
4153
4318
  outputSchema: codeInterpreterOutputSchema
@@ -4158,88 +4323,88 @@ var codeInterpreter = (args = {}) => {
4158
4323
 
4159
4324
  // src/tool/file-search.ts
4160
4325
  import {
4161
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
4162
- lazySchema as lazySchema17,
4163
- zodSchema as zodSchema17
4326
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
4327
+ lazySchema as lazySchema18,
4328
+ zodSchema as zodSchema18
4164
4329
  } from "@ai-sdk/provider-utils";
4165
- import { z as z19 } from "zod/v4";
4166
- var comparisonFilterSchema = z19.object({
4167
- key: z19.string(),
4168
- type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4169
- value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
4330
+ import { z as z20 } from "zod/v4";
4331
+ var comparisonFilterSchema = z20.object({
4332
+ key: z20.string(),
4333
+ type: z20.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
4334
+ value: z20.union([z20.string(), z20.number(), z20.boolean(), z20.array(z20.string())])
4170
4335
  });
4171
- var compoundFilterSchema = z19.object({
4172
- type: z19.enum(["and", "or"]),
4173
- filters: z19.array(
4174
- z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
4336
+ var compoundFilterSchema = z20.object({
4337
+ type: z20.enum(["and", "or"]),
4338
+ filters: z20.array(
4339
+ z20.union([comparisonFilterSchema, z20.lazy(() => compoundFilterSchema)])
4175
4340
  )
4176
4341
  });
4177
- var fileSearchArgsSchema = lazySchema17(
4178
- () => zodSchema17(
4179
- z19.object({
4180
- vectorStoreIds: z19.array(z19.string()),
4181
- maxNumResults: z19.number().optional(),
4182
- ranking: z19.object({
4183
- ranker: z19.string().optional(),
4184
- scoreThreshold: z19.number().optional()
4342
+ var fileSearchArgsSchema = lazySchema18(
4343
+ () => zodSchema18(
4344
+ z20.object({
4345
+ vectorStoreIds: z20.array(z20.string()),
4346
+ maxNumResults: z20.number().optional(),
4347
+ ranking: z20.object({
4348
+ ranker: z20.string().optional(),
4349
+ scoreThreshold: z20.number().optional()
4185
4350
  }).optional(),
4186
- filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4351
+ filters: z20.union([comparisonFilterSchema, compoundFilterSchema]).optional()
4187
4352
  })
4188
4353
  )
4189
4354
  );
4190
- var fileSearchOutputSchema = lazySchema17(
4191
- () => zodSchema17(
4192
- z19.object({
4193
- queries: z19.array(z19.string()),
4194
- results: z19.array(
4195
- z19.object({
4196
- attributes: z19.record(z19.string(), z19.unknown()),
4197
- fileId: z19.string(),
4198
- filename: z19.string(),
4199
- score: z19.number(),
4200
- text: z19.string()
4355
+ var fileSearchOutputSchema = lazySchema18(
4356
+ () => zodSchema18(
4357
+ z20.object({
4358
+ queries: z20.array(z20.string()),
4359
+ results: z20.array(
4360
+ z20.object({
4361
+ attributes: z20.record(z20.string(), z20.unknown()),
4362
+ fileId: z20.string(),
4363
+ filename: z20.string(),
4364
+ score: z20.number(),
4365
+ text: z20.string()
4201
4366
  })
4202
4367
  ).nullable()
4203
4368
  })
4204
4369
  )
4205
4370
  );
4206
- var fileSearch = createProviderToolFactoryWithOutputSchema5({
4371
+ var fileSearch = createProviderToolFactoryWithOutputSchema6({
4207
4372
  id: "openai.file_search",
4208
- inputSchema: z19.object({}),
4373
+ inputSchema: z20.object({}),
4209
4374
  outputSchema: fileSearchOutputSchema
4210
4375
  });
4211
4376
 
4212
4377
  // src/tool/image-generation.ts
4213
4378
  import {
4214
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
4215
- lazySchema as lazySchema18,
4216
- zodSchema as zodSchema18
4379
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
4380
+ lazySchema as lazySchema19,
4381
+ zodSchema as zodSchema19
4217
4382
  } from "@ai-sdk/provider-utils";
4218
- import { z as z20 } from "zod/v4";
4219
- var imageGenerationArgsSchema = lazySchema18(
4220
- () => zodSchema18(
4221
- z20.object({
4222
- background: z20.enum(["auto", "opaque", "transparent"]).optional(),
4223
- inputFidelity: z20.enum(["low", "high"]).optional(),
4224
- inputImageMask: z20.object({
4225
- fileId: z20.string().optional(),
4226
- imageUrl: z20.string().optional()
4383
+ import { z as z21 } from "zod/v4";
4384
+ var imageGenerationArgsSchema = lazySchema19(
4385
+ () => zodSchema19(
4386
+ z21.object({
4387
+ background: z21.enum(["auto", "opaque", "transparent"]).optional(),
4388
+ inputFidelity: z21.enum(["low", "high"]).optional(),
4389
+ inputImageMask: z21.object({
4390
+ fileId: z21.string().optional(),
4391
+ imageUrl: z21.string().optional()
4227
4392
  }).optional(),
4228
- model: z20.string().optional(),
4229
- moderation: z20.enum(["auto"]).optional(),
4230
- outputCompression: z20.number().int().min(0).max(100).optional(),
4231
- outputFormat: z20.enum(["png", "jpeg", "webp"]).optional(),
4232
- partialImages: z20.number().int().min(0).max(3).optional(),
4233
- quality: z20.enum(["auto", "low", "medium", "high"]).optional(),
4234
- size: z20.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4393
+ model: z21.string().optional(),
4394
+ moderation: z21.enum(["auto"]).optional(),
4395
+ outputCompression: z21.number().int().min(0).max(100).optional(),
4396
+ outputFormat: z21.enum(["png", "jpeg", "webp"]).optional(),
4397
+ partialImages: z21.number().int().min(0).max(3).optional(),
4398
+ quality: z21.enum(["auto", "low", "medium", "high"]).optional(),
4399
+ size: z21.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
4235
4400
  }).strict()
4236
4401
  )
4237
4402
  );
4238
- var imageGenerationInputSchema = lazySchema18(() => zodSchema18(z20.object({})));
4239
- var imageGenerationOutputSchema = lazySchema18(
4240
- () => zodSchema18(z20.object({ result: z20.string() }))
4403
+ var imageGenerationInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
4404
+ var imageGenerationOutputSchema = lazySchema19(
4405
+ () => zodSchema19(z21.object({ result: z21.string() }))
4241
4406
  );
4242
- var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema6({
4407
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema7({
4243
4408
  id: "openai.image_generation",
4244
4409
  inputSchema: imageGenerationInputSchema,
4245
4410
  outputSchema: imageGenerationOutputSchema
@@ -4251,29 +4416,28 @@ var imageGeneration = (args = {}) => {
4251
4416
  // src/tool/custom.ts
4252
4417
  import {
4253
4418
  createProviderToolFactory,
4254
- lazySchema as lazySchema19,
4255
- zodSchema as zodSchema19
4419
+ lazySchema as lazySchema20,
4420
+ zodSchema as zodSchema20
4256
4421
  } from "@ai-sdk/provider-utils";
4257
- import { z as z21 } from "zod/v4";
4258
- var customArgsSchema = lazySchema19(
4259
- () => zodSchema19(
4260
- z21.object({
4261
- name: z21.string(),
4262
- description: z21.string().optional(),
4263
- format: z21.union([
4264
- z21.object({
4265
- type: z21.literal("grammar"),
4266
- syntax: z21.enum(["regex", "lark"]),
4267
- definition: z21.string()
4422
+ import { z as z22 } from "zod/v4";
4423
+ var customArgsSchema = lazySchema20(
4424
+ () => zodSchema20(
4425
+ z22.object({
4426
+ description: z22.string().optional(),
4427
+ format: z22.union([
4428
+ z22.object({
4429
+ type: z22.literal("grammar"),
4430
+ syntax: z22.enum(["regex", "lark"]),
4431
+ definition: z22.string()
4268
4432
  }),
4269
- z21.object({
4270
- type: z21.literal("text")
4433
+ z22.object({
4434
+ type: z22.literal("text")
4271
4435
  })
4272
4436
  ]).optional()
4273
4437
  })
4274
4438
  )
4275
4439
  );
4276
- var customInputSchema = lazySchema19(() => zodSchema19(z21.string()));
4440
+ var customInputSchema = lazySchema20(() => zodSchema20(z22.string()));
4277
4441
  var customToolFactory = createProviderToolFactory({
4278
4442
  id: "openai.custom",
4279
4443
  inputSchema: customInputSchema
@@ -4281,137 +4445,82 @@ var customToolFactory = createProviderToolFactory({
4281
4445
 
4282
4446
  // src/tool/mcp.ts
4283
4447
  import {
4284
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
4285
- lazySchema as lazySchema20,
4286
- zodSchema as zodSchema20
4448
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
4449
+ lazySchema as lazySchema21,
4450
+ zodSchema as zodSchema21
4287
4451
  } from "@ai-sdk/provider-utils";
4288
- import { z as z22 } from "zod/v4";
4289
- var jsonValueSchema = z22.lazy(
4290
- () => z22.union([
4291
- z22.string(),
4292
- z22.number(),
4293
- z22.boolean(),
4294
- z22.null(),
4295
- z22.array(jsonValueSchema),
4296
- z22.record(z22.string(), jsonValueSchema)
4452
+ import { z as z23 } from "zod/v4";
4453
+ var jsonValueSchema2 = z23.lazy(
4454
+ () => z23.union([
4455
+ z23.string(),
4456
+ z23.number(),
4457
+ z23.boolean(),
4458
+ z23.null(),
4459
+ z23.array(jsonValueSchema2),
4460
+ z23.record(z23.string(), jsonValueSchema2)
4297
4461
  ])
4298
4462
  );
4299
- var mcpArgsSchema = lazySchema20(
4300
- () => zodSchema20(
4301
- z22.object({
4302
- serverLabel: z22.string(),
4303
- allowedTools: z22.union([
4304
- z22.array(z22.string()),
4305
- z22.object({
4306
- readOnly: z22.boolean().optional(),
4307
- toolNames: z22.array(z22.string()).optional()
4463
+ var mcpArgsSchema = lazySchema21(
4464
+ () => zodSchema21(
4465
+ z23.object({
4466
+ serverLabel: z23.string(),
4467
+ allowedTools: z23.union([
4468
+ z23.array(z23.string()),
4469
+ z23.object({
4470
+ readOnly: z23.boolean().optional(),
4471
+ toolNames: z23.array(z23.string()).optional()
4308
4472
  })
4309
4473
  ]).optional(),
4310
- authorization: z22.string().optional(),
4311
- connectorId: z22.string().optional(),
4312
- headers: z22.record(z22.string(), z22.string()).optional(),
4313
- requireApproval: z22.union([
4314
- z22.enum(["always", "never"]),
4315
- z22.object({
4316
- never: z22.object({
4317
- toolNames: z22.array(z22.string()).optional()
4474
+ authorization: z23.string().optional(),
4475
+ connectorId: z23.string().optional(),
4476
+ headers: z23.record(z23.string(), z23.string()).optional(),
4477
+ requireApproval: z23.union([
4478
+ z23.enum(["always", "never"]),
4479
+ z23.object({
4480
+ never: z23.object({
4481
+ toolNames: z23.array(z23.string()).optional()
4318
4482
  }).optional()
4319
4483
  })
4320
4484
  ]).optional(),
4321
- serverDescription: z22.string().optional(),
4322
- serverUrl: z22.string().optional()
4485
+ serverDescription: z23.string().optional(),
4486
+ serverUrl: z23.string().optional()
4323
4487
  }).refine(
4324
4488
  (v) => v.serverUrl != null || v.connectorId != null,
4325
4489
  "One of serverUrl or connectorId must be provided."
4326
4490
  )
4327
4491
  )
4328
4492
  );
4329
- var mcpInputSchema = lazySchema20(() => zodSchema20(z22.object({})));
4330
- var mcpOutputSchema = lazySchema20(
4331
- () => zodSchema20(
4332
- z22.object({
4333
- type: z22.literal("call"),
4334
- serverLabel: z22.string(),
4335
- name: z22.string(),
4336
- arguments: z22.string(),
4337
- output: z22.string().nullish(),
4338
- error: z22.union([z22.string(), jsonValueSchema]).optional()
4493
+ var mcpInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
4494
+ var mcpOutputSchema = lazySchema21(
4495
+ () => zodSchema21(
4496
+ z23.object({
4497
+ type: z23.literal("call"),
4498
+ serverLabel: z23.string(),
4499
+ name: z23.string(),
4500
+ arguments: z23.string(),
4501
+ output: z23.string().nullish(),
4502
+ error: z23.union([z23.string(), jsonValueSchema2]).optional()
4339
4503
  })
4340
4504
  )
4341
4505
  );
4342
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema7({
4506
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
4343
4507
  id: "openai.mcp",
4344
4508
  inputSchema: mcpInputSchema,
4345
4509
  outputSchema: mcpOutputSchema
4346
4510
  });
4347
4511
 
4348
4512
  // src/tool/web-search.ts
4349
- import {
4350
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
4351
- lazySchema as lazySchema21,
4352
- zodSchema as zodSchema21
4353
- } from "@ai-sdk/provider-utils";
4354
- import { z as z23 } from "zod/v4";
4355
- var webSearchArgsSchema = lazySchema21(
4356
- () => zodSchema21(
4357
- z23.object({
4358
- externalWebAccess: z23.boolean().optional(),
4359
- filters: z23.object({ allowedDomains: z23.array(z23.string()).optional() }).optional(),
4360
- searchContextSize: z23.enum(["low", "medium", "high"]).optional(),
4361
- userLocation: z23.object({
4362
- type: z23.literal("approximate"),
4363
- country: z23.string().optional(),
4364
- city: z23.string().optional(),
4365
- region: z23.string().optional(),
4366
- timezone: z23.string().optional()
4367
- }).optional()
4368
- })
4369
- )
4370
- );
4371
- var webSearchInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
4372
- var webSearchOutputSchema = lazySchema21(
4373
- () => zodSchema21(
4374
- z23.object({
4375
- action: z23.discriminatedUnion("type", [
4376
- z23.object({
4377
- type: z23.literal("search"),
4378
- query: z23.string().optional()
4379
- }),
4380
- z23.object({
4381
- type: z23.literal("openPage"),
4382
- url: z23.string().nullish()
4383
- }),
4384
- z23.object({
4385
- type: z23.literal("findInPage"),
4386
- url: z23.string().nullish(),
4387
- pattern: z23.string().nullish()
4388
- })
4389
- ]).optional(),
4390
- sources: z23.array(
4391
- z23.discriminatedUnion("type", [
4392
- z23.object({ type: z23.literal("url"), url: z23.string() }),
4393
- z23.object({ type: z23.literal("api"), name: z23.string() })
4394
- ])
4395
- ).optional()
4396
- })
4397
- )
4398
- );
4399
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
4400
- id: "openai.web_search",
4401
- inputSchema: webSearchInputSchema,
4402
- outputSchema: webSearchOutputSchema
4403
- });
4404
-
4405
- // src/tool/web-search-preview.ts
4406
4513
  import {
4407
4514
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
4408
4515
  lazySchema as lazySchema22,
4409
4516
  zodSchema as zodSchema22
4410
4517
  } from "@ai-sdk/provider-utils";
4411
4518
  import { z as z24 } from "zod/v4";
4412
- var webSearchPreviewArgsSchema = lazySchema22(
4519
+ var webSearchArgsSchema = lazySchema22(
4413
4520
  () => zodSchema22(
4414
4521
  z24.object({
4522
+ externalWebAccess: z24.boolean().optional(),
4523
+ filters: z24.object({ allowedDomains: z24.array(z24.string()).optional() }).optional(),
4415
4524
  searchContextSize: z24.enum(["low", "medium", "high"]).optional(),
4416
4525
  userLocation: z24.object({
4417
4526
  type: z24.literal("approximate"),
@@ -4423,10 +4532,8 @@ var webSearchPreviewArgsSchema = lazySchema22(
4423
4532
  })
4424
4533
  )
4425
4534
  );
4426
- var webSearchPreviewInputSchema = lazySchema22(
4427
- () => zodSchema22(z24.object({}))
4428
- );
4429
- var webSearchPreviewOutputSchema = lazySchema22(
4535
+ var webSearchInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
4536
+ var webSearchOutputSchema = lazySchema22(
4430
4537
  () => zodSchema22(
4431
4538
  z24.object({
4432
4539
  action: z24.discriminatedUnion("type", [
@@ -4443,11 +4550,68 @@ var webSearchPreviewOutputSchema = lazySchema22(
4443
4550
  url: z24.string().nullish(),
4444
4551
  pattern: z24.string().nullish()
4445
4552
  })
4553
+ ]).optional(),
4554
+ sources: z24.array(
4555
+ z24.discriminatedUnion("type", [
4556
+ z24.object({ type: z24.literal("url"), url: z24.string() }),
4557
+ z24.object({ type: z24.literal("api"), name: z24.string() })
4558
+ ])
4559
+ ).optional()
4560
+ })
4561
+ )
4562
+ );
4563
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema9({
4564
+ id: "openai.web_search",
4565
+ inputSchema: webSearchInputSchema,
4566
+ outputSchema: webSearchOutputSchema
4567
+ });
4568
+
4569
+ // src/tool/web-search-preview.ts
4570
+ import {
4571
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
4572
+ lazySchema as lazySchema23,
4573
+ zodSchema as zodSchema23
4574
+ } from "@ai-sdk/provider-utils";
4575
+ import { z as z25 } from "zod/v4";
4576
+ var webSearchPreviewArgsSchema = lazySchema23(
4577
+ () => zodSchema23(
4578
+ z25.object({
4579
+ searchContextSize: z25.enum(["low", "medium", "high"]).optional(),
4580
+ userLocation: z25.object({
4581
+ type: z25.literal("approximate"),
4582
+ country: z25.string().optional(),
4583
+ city: z25.string().optional(),
4584
+ region: z25.string().optional(),
4585
+ timezone: z25.string().optional()
4586
+ }).optional()
4587
+ })
4588
+ )
4589
+ );
4590
+ var webSearchPreviewInputSchema = lazySchema23(
4591
+ () => zodSchema23(z25.object({}))
4592
+ );
4593
+ var webSearchPreviewOutputSchema = lazySchema23(
4594
+ () => zodSchema23(
4595
+ z25.object({
4596
+ action: z25.discriminatedUnion("type", [
4597
+ z25.object({
4598
+ type: z25.literal("search"),
4599
+ query: z25.string().optional()
4600
+ }),
4601
+ z25.object({
4602
+ type: z25.literal("openPage"),
4603
+ url: z25.string().nullish()
4604
+ }),
4605
+ z25.object({
4606
+ type: z25.literal("findInPage"),
4607
+ url: z25.string().nullish(),
4608
+ pattern: z25.string().nullish()
4609
+ })
4446
4610
  ]).optional()
4447
4611
  })
4448
4612
  )
4449
4613
  );
4450
- var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
4614
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema10({
4451
4615
  id: "openai.web_search_preview",
4452
4616
  inputSchema: webSearchPreviewInputSchema,
4453
4617
  outputSchema: webSearchPreviewOutputSchema
@@ -4460,7 +4624,7 @@ async function prepareResponsesTools({
4460
4624
  toolNameMapping,
4461
4625
  customProviderToolNames
4462
4626
  }) {
4463
- var _a;
4627
+ var _a, _b;
4464
4628
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4465
4629
  const toolWarnings = [];
4466
4630
  if (tools == null) {
@@ -4470,15 +4634,19 @@ async function prepareResponsesTools({
4470
4634
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4471
4635
  for (const tool of tools) {
4472
4636
  switch (tool.type) {
4473
- case "function":
4637
+ case "function": {
4638
+ const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4639
+ const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4474
4640
  openaiTools.push({
4475
4641
  type: "function",
4476
4642
  name: tool.name,
4477
4643
  description: tool.description,
4478
4644
  parameters: tool.inputSchema,
4479
- ...tool.strict != null ? { strict: tool.strict } : {}
4645
+ ...tool.strict != null ? { strict: tool.strict } : {},
4646
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4480
4647
  });
4481
4648
  break;
4649
+ }
4482
4650
  case "provider": {
4483
4651
  switch (tool.id) {
4484
4652
  case "openai.file_search": {
@@ -4616,11 +4784,24 @@ async function prepareResponsesTools({
4616
4784
  });
4617
4785
  openaiTools.push({
4618
4786
  type: "custom",
4619
- name: args.name,
4787
+ name: tool.name,
4620
4788
  description: args.description,
4621
4789
  format: args.format
4622
4790
  });
4623
- resolvedCustomProviderToolNames.add(args.name);
4791
+ resolvedCustomProviderToolNames.add(tool.name);
4792
+ break;
4793
+ }
4794
+ case "openai.tool_search": {
4795
+ const args = await validateTypes2({
4796
+ value: tool.args,
4797
+ schema: toolSearchArgsSchema
4798
+ });
4799
+ openaiTools.push({
4800
+ type: "tool_search",
4801
+ ...args.execution != null ? { execution: args.execution } : {},
4802
+ ...args.description != null ? { description: args.description } : {},
4803
+ ...args.parameters != null ? { parameters: args.parameters } : {}
4804
+ });
4624
4805
  break;
4625
4806
  }
4626
4807
  }
@@ -4644,7 +4825,7 @@ async function prepareResponsesTools({
4644
4825
  case "required":
4645
4826
  return { tools: openaiTools, toolChoice: type, toolWarnings };
4646
4827
  case "tool": {
4647
- const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4828
+ const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
4648
4829
  return {
4649
4830
  tools: openaiTools,
4650
4831
  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 },
@@ -4724,7 +4905,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
4724
4905
  }
4725
4906
  var OpenAIResponsesLanguageModel = class {
4726
4907
  constructor(modelId, config) {
4727
- this.specificationVersion = "v3";
4908
+ this.specificationVersion = "v4";
4728
4909
  this.supportedUrls = {
4729
4910
  "image/*": [/^https?:\/\/.*$/],
4730
4911
  "application/pdf": [/^https?:\/\/.*$/]
@@ -4800,9 +4981,9 @@ var OpenAIResponsesLanguageModel = class {
4800
4981
  "openai.web_search": "web_search",
4801
4982
  "openai.web_search_preview": "web_search_preview",
4802
4983
  "openai.mcp": "mcp",
4803
- "openai.apply_patch": "apply_patch"
4804
- },
4805
- resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
4984
+ "openai.apply_patch": "apply_patch",
4985
+ "openai.tool_search": "tool_search"
4986
+ }
4806
4987
  });
4807
4988
  const customProviderToolNames = /* @__PURE__ */ new Set();
4808
4989
  const {
@@ -4978,7 +5159,7 @@ var OpenAIResponsesLanguageModel = class {
4978
5159
  };
4979
5160
  }
4980
5161
  async doGenerate(options) {
4981
- 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;
5162
+ 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;
4982
5163
  const {
4983
5164
  args: body,
4984
5165
  warnings,
@@ -5021,6 +5202,7 @@ var OpenAIResponsesLanguageModel = class {
5021
5202
  const content = [];
5022
5203
  const logprobs = [];
5023
5204
  let hasFunctionCall = false;
5205
+ const hostedToolSearchCallIds = [];
5024
5206
  for (const part of response.output) {
5025
5207
  switch (part.type) {
5026
5208
  case "reasoning": {
@@ -5059,6 +5241,46 @@ var OpenAIResponsesLanguageModel = class {
5059
5241
  });
5060
5242
  break;
5061
5243
  }
5244
+ case "tool_search_call": {
5245
+ const toolCallId = (_b = part.call_id) != null ? _b : part.id;
5246
+ const isHosted = part.execution === "server";
5247
+ if (isHosted) {
5248
+ hostedToolSearchCallIds.push(toolCallId);
5249
+ }
5250
+ content.push({
5251
+ type: "tool-call",
5252
+ toolCallId,
5253
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5254
+ input: JSON.stringify({
5255
+ arguments: part.arguments,
5256
+ call_id: part.call_id
5257
+ }),
5258
+ ...isHosted ? { providerExecuted: true } : {},
5259
+ providerMetadata: {
5260
+ [providerOptionsName]: {
5261
+ itemId: part.id
5262
+ }
5263
+ }
5264
+ });
5265
+ break;
5266
+ }
5267
+ case "tool_search_output": {
5268
+ const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
5269
+ content.push({
5270
+ type: "tool-result",
5271
+ toolCallId,
5272
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5273
+ result: {
5274
+ tools: part.tools
5275
+ },
5276
+ providerMetadata: {
5277
+ [providerOptionsName]: {
5278
+ itemId: part.id
5279
+ }
5280
+ }
5281
+ });
5282
+ break;
5283
+ }
5062
5284
  case "local_shell_call": {
5063
5285
  content.push({
5064
5286
  type: "tool-call",
@@ -5114,7 +5336,7 @@ var OpenAIResponsesLanguageModel = class {
5114
5336
  }
5115
5337
  case "message": {
5116
5338
  for (const contentPart of part.content) {
5117
- if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
5339
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
5118
5340
  logprobs.push(contentPart.logprobs);
5119
5341
  }
5120
5342
  const providerMetadata2 = {
@@ -5136,7 +5358,7 @@ var OpenAIResponsesLanguageModel = class {
5136
5358
  content.push({
5137
5359
  type: "source",
5138
5360
  sourceType: "url",
5139
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : generateId2(),
5361
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
5140
5362
  url: annotation.url,
5141
5363
  title: annotation.title
5142
5364
  });
@@ -5144,7 +5366,7 @@ var OpenAIResponsesLanguageModel = class {
5144
5366
  content.push({
5145
5367
  type: "source",
5146
5368
  sourceType: "document",
5147
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
5369
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
5148
5370
  mediaType: "text/plain",
5149
5371
  title: annotation.filename,
5150
5372
  filename: annotation.filename,
@@ -5160,7 +5382,7 @@ var OpenAIResponsesLanguageModel = class {
5160
5382
  content.push({
5161
5383
  type: "source",
5162
5384
  sourceType: "document",
5163
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
5385
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
5164
5386
  mediaType: "text/plain",
5165
5387
  title: annotation.filename,
5166
5388
  filename: annotation.filename,
@@ -5176,7 +5398,7 @@ var OpenAIResponsesLanguageModel = class {
5176
5398
  content.push({
5177
5399
  type: "source",
5178
5400
  sourceType: "document",
5179
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
5401
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
5180
5402
  mediaType: "application/octet-stream",
5181
5403
  title: annotation.file_id,
5182
5404
  filename: annotation.file_id,
@@ -5245,7 +5467,7 @@ var OpenAIResponsesLanguageModel = class {
5245
5467
  break;
5246
5468
  }
5247
5469
  case "mcp_call": {
5248
- const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
5470
+ const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
5249
5471
  const toolName = `mcp.${part.name}`;
5250
5472
  content.push({
5251
5473
  type: "tool-call",
@@ -5279,8 +5501,8 @@ var OpenAIResponsesLanguageModel = class {
5279
5501
  break;
5280
5502
  }
5281
5503
  case "mcp_approval_request": {
5282
- const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
5283
- const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2();
5504
+ const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5505
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
5284
5506
  const toolName = `mcp.${part.name}`;
5285
5507
  content.push({
5286
5508
  type: "tool-call",
@@ -5330,13 +5552,13 @@ var OpenAIResponsesLanguageModel = class {
5330
5552
  toolName: toolNameMapping.toCustomToolName("file_search"),
5331
5553
  result: {
5332
5554
  queries: part.queries,
5333
- results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
5555
+ results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
5334
5556
  attributes: result.attributes,
5335
5557
  fileId: result.file_id,
5336
5558
  filename: result.filename,
5337
5559
  score: result.score,
5338
5560
  text: result.text
5339
- }))) != null ? _v : null
5561
+ }))) != null ? _y : null
5340
5562
  }
5341
5563
  });
5342
5564
  break;
@@ -5393,10 +5615,10 @@ var OpenAIResponsesLanguageModel = class {
5393
5615
  content,
5394
5616
  finishReason: {
5395
5617
  unified: mapOpenAIResponseFinishReason({
5396
- finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
5618
+ finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
5397
5619
  hasFunctionCall
5398
5620
  }),
5399
- raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
5621
+ raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
5400
5622
  },
5401
5623
  usage: convertOpenAIResponsesUsage(usage),
5402
5624
  request: { body },
@@ -5454,6 +5676,7 @@ var OpenAIResponsesLanguageModel = class {
5454
5676
  let hasFunctionCall = false;
5455
5677
  const activeReasoning = {};
5456
5678
  let serviceTier;
5679
+ const hostedToolSearchCallIds = [];
5457
5680
  return {
5458
5681
  stream: response.pipeThrough(
5459
5682
  new TransformStream({
@@ -5461,7 +5684,7 @@ var OpenAIResponsesLanguageModel = class {
5461
5684
  controller.enqueue({ type: "stream-start", warnings });
5462
5685
  },
5463
5686
  transform(chunk, controller) {
5464
- 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;
5687
+ 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;
5465
5688
  if (options.includeRawChunks) {
5466
5689
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5467
5690
  }
@@ -5569,6 +5792,24 @@ var OpenAIResponsesLanguageModel = class {
5569
5792
  input: "{}",
5570
5793
  providerExecuted: true
5571
5794
  });
5795
+ } else if (value.item.type === "tool_search_call") {
5796
+ const toolCallId = value.item.id;
5797
+ const toolName = toolNameMapping.toCustomToolName("tool_search");
5798
+ const isHosted = value.item.execution === "server";
5799
+ ongoingToolCalls[value.output_index] = {
5800
+ toolName,
5801
+ toolCallId,
5802
+ toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
5803
+ };
5804
+ if (isHosted) {
5805
+ controller.enqueue({
5806
+ type: "tool-input-start",
5807
+ id: toolCallId,
5808
+ toolName,
5809
+ providerExecuted: true
5810
+ });
5811
+ }
5812
+ } else if (value.item.type === "tool_search_output") {
5572
5813
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
5573
5814
  } else if (value.item.type === "apply_patch_call") {
5574
5815
  const { call_id: callId, operation } = value.item;
@@ -5615,7 +5856,7 @@ var OpenAIResponsesLanguageModel = class {
5615
5856
  } else if (value.item.type === "shell_call_output") {
5616
5857
  } else if (value.item.type === "message") {
5617
5858
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5618
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5859
+ activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
5619
5860
  controller.enqueue({
5620
5861
  type: "text-start",
5621
5862
  id: value.item.id,
@@ -5639,14 +5880,14 @@ var OpenAIResponsesLanguageModel = class {
5639
5880
  providerMetadata: {
5640
5881
  [providerOptionsName]: {
5641
5882
  itemId: value.item.id,
5642
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5883
+ reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
5643
5884
  }
5644
5885
  }
5645
5886
  });
5646
5887
  }
5647
5888
  } else if (isResponseOutputItemDoneChunk(value)) {
5648
5889
  if (value.item.type === "message") {
5649
- const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5890
+ const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
5650
5891
  activeMessagePhase = void 0;
5651
5892
  controller.enqueue({
5652
5893
  type: "text-end",
@@ -5740,13 +5981,13 @@ var OpenAIResponsesLanguageModel = class {
5740
5981
  toolName: toolNameMapping.toCustomToolName("file_search"),
5741
5982
  result: {
5742
5983
  queries: value.item.queries,
5743
- results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
5984
+ results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
5744
5985
  attributes: result.attributes,
5745
5986
  fileId: result.file_id,
5746
5987
  filename: result.filename,
5747
5988
  score: result.score,
5748
5989
  text: result.text
5749
- }))) != null ? _e : null
5990
+ }))) != null ? _f : null
5750
5991
  }
5751
5992
  });
5752
5993
  } else if (value.item.type === "code_interpreter_call") {
@@ -5768,12 +6009,62 @@ var OpenAIResponsesLanguageModel = class {
5768
6009
  result: value.item.result
5769
6010
  }
5770
6011
  });
6012
+ } else if (value.item.type === "tool_search_call") {
6013
+ const toolCall = ongoingToolCalls[value.output_index];
6014
+ const isHosted = value.item.execution === "server";
6015
+ if (toolCall != null) {
6016
+ const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
6017
+ if (isHosted) {
6018
+ hostedToolSearchCallIds.push(toolCallId);
6019
+ } else {
6020
+ controller.enqueue({
6021
+ type: "tool-input-start",
6022
+ id: toolCallId,
6023
+ toolName: toolCall.toolName
6024
+ });
6025
+ }
6026
+ controller.enqueue({
6027
+ type: "tool-input-end",
6028
+ id: toolCallId
6029
+ });
6030
+ controller.enqueue({
6031
+ type: "tool-call",
6032
+ toolCallId,
6033
+ toolName: toolCall.toolName,
6034
+ input: JSON.stringify({
6035
+ arguments: value.item.arguments,
6036
+ call_id: isHosted ? null : toolCallId
6037
+ }),
6038
+ ...isHosted ? { providerExecuted: true } : {},
6039
+ providerMetadata: {
6040
+ [providerOptionsName]: {
6041
+ itemId: value.item.id
6042
+ }
6043
+ }
6044
+ });
6045
+ }
6046
+ ongoingToolCalls[value.output_index] = void 0;
6047
+ } else if (value.item.type === "tool_search_output") {
6048
+ const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
6049
+ controller.enqueue({
6050
+ type: "tool-result",
6051
+ toolCallId,
6052
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
6053
+ result: {
6054
+ tools: value.item.tools
6055
+ },
6056
+ providerMetadata: {
6057
+ [providerOptionsName]: {
6058
+ itemId: value.item.id
6059
+ }
6060
+ }
6061
+ });
5771
6062
  } else if (value.item.type === "mcp_call") {
5772
6063
  ongoingToolCalls[value.output_index] = void 0;
5773
- const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5774
- const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
6064
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
6065
+ const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
5775
6066
  approvalRequestId
5776
- )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
6067
+ )) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
5777
6068
  const toolName = `mcp.${value.item.name}`;
5778
6069
  controller.enqueue({
5779
6070
  type: "tool-call",
@@ -5843,8 +6134,8 @@ var OpenAIResponsesLanguageModel = class {
5843
6134
  ongoingToolCalls[value.output_index] = void 0;
5844
6135
  } else if (value.item.type === "mcp_approval_request") {
5845
6136
  ongoingToolCalls[value.output_index] = void 0;
5846
- const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId2();
5847
- const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
6137
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
6138
+ const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
5848
6139
  approvalRequestIdToDummyToolCallIdFromStream.set(
5849
6140
  approvalRequestId,
5850
6141
  dummyToolCallId
@@ -5933,7 +6224,7 @@ var OpenAIResponsesLanguageModel = class {
5933
6224
  providerMetadata: {
5934
6225
  [providerOptionsName]: {
5935
6226
  itemId: value.item.id,
5936
- reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
6227
+ reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
5937
6228
  }
5938
6229
  }
5939
6230
  });
@@ -6046,7 +6337,7 @@ var OpenAIResponsesLanguageModel = class {
6046
6337
  id: value.item_id,
6047
6338
  delta: value.delta
6048
6339
  });
6049
- if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
6340
+ if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
6050
6341
  logprobs.push(value.logprobs);
6051
6342
  }
6052
6343
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -6075,7 +6366,7 @@ var OpenAIResponsesLanguageModel = class {
6075
6366
  providerMetadata: {
6076
6367
  [providerOptionsName]: {
6077
6368
  itemId: value.item_id,
6078
- reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
6369
+ reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
6079
6370
  }
6080
6371
  }
6081
6372
  });
@@ -6109,10 +6400,10 @@ var OpenAIResponsesLanguageModel = class {
6109
6400
  } else if (isResponseFinishedChunk(value)) {
6110
6401
  finishReason = {
6111
6402
  unified: mapOpenAIResponseFinishReason({
6112
- finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
6403
+ finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
6113
6404
  hasFunctionCall
6114
6405
  }),
6115
- raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
6406
+ raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
6116
6407
  };
6117
6408
  usage = value.response.usage;
6118
6409
  if (typeof value.response.service_tier === "string") {
@@ -6124,7 +6415,7 @@ var OpenAIResponsesLanguageModel = class {
6124
6415
  controller.enqueue({
6125
6416
  type: "source",
6126
6417
  sourceType: "url",
6127
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2(),
6418
+ id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
6128
6419
  url: value.annotation.url,
6129
6420
  title: value.annotation.title
6130
6421
  });
@@ -6132,7 +6423,7 @@ var OpenAIResponsesLanguageModel = class {
6132
6423
  controller.enqueue({
6133
6424
  type: "source",
6134
6425
  sourceType: "document",
6135
- id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId2(),
6426
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
6136
6427
  mediaType: "text/plain",
6137
6428
  title: value.annotation.filename,
6138
6429
  filename: value.annotation.filename,
@@ -6148,7 +6439,7 @@ var OpenAIResponsesLanguageModel = class {
6148
6439
  controller.enqueue({
6149
6440
  type: "source",
6150
6441
  sourceType: "document",
6151
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
6442
+ id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
6152
6443
  mediaType: "text/plain",
6153
6444
  title: value.annotation.filename,
6154
6445
  filename: value.annotation.filename,
@@ -6164,7 +6455,7 @@ var OpenAIResponsesLanguageModel = class {
6164
6455
  controller.enqueue({
6165
6456
  type: "source",
6166
6457
  sourceType: "document",
6167
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
6458
+ id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
6168
6459
  mediaType: "application/octet-stream",
6169
6460
  title: value.annotation.file_id,
6170
6461
  filename: value.annotation.file_id,