@ai-sdk/openai 3.0.116 → 3.0.118

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.
package/dist/index.js CHANGED
@@ -167,7 +167,8 @@ function createOpenAIStreamError({
167
167
  statusCode: streamError == null ? 500 : getStatusCode(streamError),
168
168
  responseHeaders,
169
169
  responseBody: JSON.stringify(frame),
170
- data: frame
170
+ data: frame,
171
+ isRetryable: streamError == null ? true : isRetryableStreamError(streamError, getStatusCode(streamError))
171
172
  });
172
173
  }
173
174
  function parseStreamError(frame) {
@@ -581,6 +582,9 @@ var openaiChatResponseSchema = (0, import_provider_utils3.lazySchema)(
581
582
  message: import_v42.z.object({
582
583
  role: import_v42.z.literal("assistant").nullish(),
583
584
  content: import_v42.z.string().nullish(),
585
+ audio: import_v42.z.object({
586
+ transcript: import_v42.z.string().nullish()
587
+ }).nullish(),
584
588
  tool_calls: import_v42.z.array(
585
589
  import_v42.z.object({
586
590
  id: import_v42.z.string().nullish(),
@@ -1120,7 +1124,7 @@ var OpenAIChatLanguageModel = class {
1120
1124
  };
1121
1125
  }
1122
1126
  async doGenerate(options) {
1123
- var _a2, _b, _c, _d, _e, _f, _g;
1127
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1124
1128
  const { args: body, warnings } = await this.getArgs(options);
1125
1129
  const {
1126
1130
  responseHeaders,
@@ -1148,19 +1152,19 @@ var OpenAIChatLanguageModel = class {
1148
1152
  });
1149
1153
  }
1150
1154
  const content = [];
1151
- const text = choice.message.content;
1155
+ const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
1152
1156
  if (text != null && text.length > 0) {
1153
1157
  content.push({ type: "text", text });
1154
1158
  }
1155
- for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
1159
+ for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
1156
1160
  content.push({
1157
1161
  type: "tool-call",
1158
- toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils5.generateId)(),
1162
+ toolCallId: (_c = toolCall.id) != null ? _c : (0, import_provider_utils5.generateId)(),
1159
1163
  toolName: toolCall.function.name,
1160
1164
  input: toolCall.function.arguments
1161
1165
  });
1162
1166
  }
1163
- for (const annotation of (_c = choice.message.annotations) != null ? _c : []) {
1167
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
1164
1168
  content.push({
1165
1169
  type: "source",
1166
1170
  sourceType: "url",
@@ -1169,8 +1173,8 @@ var OpenAIChatLanguageModel = class {
1169
1173
  title: annotation.url_citation.title
1170
1174
  });
1171
1175
  }
1172
- const completionTokenDetails = (_d = response.usage) == null ? void 0 : _d.completion_tokens_details;
1173
- const promptTokenDetails = (_e = response.usage) == null ? void 0 : _e.prompt_tokens_details;
1176
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
1177
+ const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
1174
1178
  const providerMetadata = { openai: {} };
1175
1179
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
1176
1180
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -1178,14 +1182,14 @@ var OpenAIChatLanguageModel = class {
1178
1182
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
1179
1183
  providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
1180
1184
  }
1181
- if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
1185
+ if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
1182
1186
  providerMetadata.openai.logprobs = choice.logprobs.content;
1183
1187
  }
1184
1188
  return {
1185
1189
  content,
1186
1190
  finishReason: {
1187
1191
  unified: mapOpenAIFinishReason(choice.finish_reason),
1188
- raw: (_g = choice.finish_reason) != null ? _g : void 0
1192
+ raw: (_h = choice.finish_reason) != null ? _h : void 0
1189
1193
  },
1190
1194
  usage: convertOpenAIChatUsage(response.usage),
1191
1195
  request: { body },
@@ -3043,261 +3047,559 @@ function convertOpenAIResponsesUsage(usage) {
3043
3047
 
3044
3048
  // src/responses/convert-to-openai-responses-input.ts
3045
3049
  var import_provider8 = require("@ai-sdk/provider");
3046
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
3047
- var import_v421 = require("zod/v4");
3050
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
3051
+ var import_v422 = require("zod/v4");
3048
3052
 
3049
- // src/responses/expand-parallel-tool-call.ts
3050
- var import_provider7 = require("@ai-sdk/provider");
3053
+ // src/responses/openai-responses-options.ts
3051
3054
  var import_provider_utils26 = require("@ai-sdk/provider-utils");
3052
- var parallelToolName = "parallel";
3053
- var recipientNamePrefix = "functions.";
3054
- function getParallelToolCallMetadata({
3055
- providerOptions,
3056
- providerOptionsName
3057
- }) {
3058
- var _a2;
3059
- const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
3060
- if (!(0, import_provider7.isJSONObject)(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
3061
- return void 0;
3062
- }
3063
- return metadata;
3064
- }
3065
- function isUndeclaredParallelToolCall({
3066
- toolName,
3067
- tools
3068
- }) {
3069
- return toolName === parallelToolName && !tools.some((tool) => tool.name === parallelToolName);
3070
- }
3071
- async function expandParallelToolCall({
3072
- toolCall,
3073
- tools,
3074
- providerOptionsName,
3075
- itemId
3076
- }) {
3077
- if (!isUndeclaredParallelToolCall({ toolName: toolCall.toolName, tools })) {
3078
- return void 0;
3079
- }
3080
- const parsedInput = await (0, import_provider_utils26.safeParseJSON)({ text: toolCall.input });
3081
- if (!parsedInput.success || !(0, import_provider7.isJSONObject)(parsedInput.value)) {
3082
- return void 0;
3083
- }
3084
- const toolUses = parsedInput.value.tool_uses;
3085
- if (!Array.isArray(toolUses) || toolUses.length === 0) {
3086
- return void 0;
3087
- }
3088
- const availableToolNames = new Set(tools.map((tool) => tool.name));
3089
- const expandedToolCalls = [];
3090
- for (const [index, toolUse] of toolUses.entries()) {
3091
- if (!(0, import_provider7.isJSONObject)(toolUse)) {
3092
- return void 0;
3093
- }
3094
- const recipientName = toolUse.recipient_name;
3095
- const parameters = toolUse.parameters;
3096
- if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0, import_provider7.isJSONObject)(parameters)) {
3097
- return void 0;
3098
- }
3099
- const toolName = recipientName.slice(recipientNamePrefix.length);
3100
- if (toolName.length === 0 || !availableToolNames.has(toolName)) {
3101
- return void 0;
3102
- }
3103
- expandedToolCalls.push({
3104
- type: "tool-call",
3105
- toolCallId: `${toolCall.toolCallId}_${index}`,
3106
- toolName,
3107
- input: JSON.stringify(parameters),
3108
- providerMetadata: {
3109
- [providerOptionsName]: {
3110
- parallelToolCall: {
3111
- itemId,
3112
- toolCallId: toolCall.toolCallId,
3113
- toolName: toolCall.toolName,
3114
- input: toolCall.input,
3115
- index,
3116
- count: toolUses.length
3117
- }
3118
- }
3119
- }
3120
- });
3121
- }
3122
- return expandedToolCalls;
3123
- }
3124
-
3125
- // src/responses/convert-to-openai-responses-input.ts
3126
- function serializeToolCallArguments2(input) {
3127
- return JSON.stringify(input === void 0 ? {} : input);
3128
- }
3129
- async function convertFunctionToolResultOutput({
3130
- output,
3131
- promptCacheBreakpoint,
3132
- providerOptionsName,
3133
- warnings
3134
- }) {
3135
- var _a2;
3136
- const convertScalarOutput = (value) => promptCacheBreakpoint == null ? value : [
3137
- {
3138
- type: "input_text",
3139
- text: value,
3140
- prompt_cache_breakpoint: promptCacheBreakpoint
3141
- }
3142
- ];
3143
- switch (output.type) {
3144
- case "text":
3145
- case "error-text":
3146
- return convertScalarOutput(output.value);
3147
- case "execution-denied": {
3148
- return convertScalarOutput(
3149
- (_a2 = output.reason) != null ? _a2 : "Tool call execution denied."
3150
- );
3151
- }
3152
- case "json":
3153
- case "error-json":
3154
- return convertScalarOutput(JSON.stringify(output.value));
3155
- case "content":
3156
- return output.value.map((item) => {
3157
- var _a3, _b, _c, _d, _e, _f, _g;
3158
- const promptCacheBreakpoint2 = getPromptCacheBreakpoint2(
3159
- item.providerOptions,
3160
- providerOptionsName
3161
- );
3162
- switch (item.type) {
3163
- case "text": {
3164
- return {
3165
- type: "input_text",
3166
- text: item.text,
3167
- ...promptCacheBreakpoint2 != null && {
3168
- prompt_cache_breakpoint: promptCacheBreakpoint2
3169
- }
3170
- };
3171
- }
3172
- case "image-data": {
3173
- return {
3174
- type: "input_image",
3175
- image_url: `data:${item.mediaType};base64,${item.data}`,
3176
- detail: (_b = (_a3 = item.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b.imageDetail,
3177
- ...promptCacheBreakpoint2 != null && {
3178
- prompt_cache_breakpoint: promptCacheBreakpoint2
3179
- }
3180
- };
3181
- }
3182
- case "image-url": {
3183
- return {
3184
- type: "input_image",
3185
- image_url: item.url,
3186
- detail: (_d = (_c = item.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.imageDetail,
3187
- ...promptCacheBreakpoint2 != null && {
3188
- prompt_cache_breakpoint: promptCacheBreakpoint2
3189
- }
3190
- };
3191
- }
3192
- case "file-id": {
3193
- return {
3194
- type: "input_file",
3195
- file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
3196
- ...promptCacheBreakpoint2 != null && {
3197
- prompt_cache_breakpoint: promptCacheBreakpoint2
3198
- }
3199
- };
3200
- }
3201
- case "image-file-id": {
3202
- return {
3203
- type: "input_image",
3204
- file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
3205
- detail: (_f = (_e = item.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.imageDetail,
3206
- ...promptCacheBreakpoint2 != null && {
3207
- prompt_cache_breakpoint: promptCacheBreakpoint2
3208
- }
3209
- };
3210
- }
3211
- case "file-data": {
3212
- return {
3213
- type: "input_file",
3214
- filename: (_g = item.filename) != null ? _g : "data",
3215
- file_data: `data:${item.mediaType};base64,${item.data}`,
3216
- ...promptCacheBreakpoint2 != null && {
3217
- prompt_cache_breakpoint: promptCacheBreakpoint2
3218
- }
3219
- };
3220
- }
3221
- case "file-url": {
3222
- return {
3223
- type: "input_file",
3224
- file_url: item.url,
3225
- ...promptCacheBreakpoint2 != null && {
3226
- prompt_cache_breakpoint: promptCacheBreakpoint2
3227
- }
3228
- };
3229
- }
3230
- default: {
3231
- warnings.push({
3232
- type: "other",
3233
- message: `unsupported tool content part type: ${item.type}`
3234
- });
3235
- return void 0;
3236
- }
3237
- }
3238
- }).filter(import_provider_utils27.isNonNullable);
3239
- }
3240
- }
3241
- function hasSameParallelToolCall(first, second) {
3242
- return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
3243
- }
3244
- function collectCompleteParallelToolResultGroups({
3245
- prompt,
3246
- providerOptionsName
3247
- }) {
3248
- const pendingGroups = /* @__PURE__ */ new Map();
3249
- for (const message of prompt) {
3250
- if (message.role !== "tool") {
3251
- continue;
3252
- }
3253
- for (const part of message.content) {
3254
- if (part.type !== "tool-result") {
3255
- continue;
3256
- }
3257
- const metadata = getParallelToolCallMetadata({
3258
- providerOptions: part.providerOptions,
3259
- providerOptionsName
3260
- });
3261
- if (metadata == null) {
3262
- continue;
3263
- }
3264
- const existing = pendingGroups.get(metadata.toolCallId);
3265
- if (existing == null) {
3266
- pendingGroups.set(metadata.toolCallId, {
3267
- metadata,
3268
- results: /* @__PURE__ */ new Map([[metadata.index, part]]),
3269
- invalid: false
3270
- });
3271
- continue;
3272
- }
3273
- if (!hasSameParallelToolCall(existing.metadata, metadata) || existing.results.has(metadata.index)) {
3274
- existing.invalid = true;
3275
- continue;
3276
- }
3277
- existing.results.set(metadata.index, part);
3278
- }
3279
- }
3280
- const completeGroups = /* @__PURE__ */ new Map();
3281
- for (const [toolCallId, group] of pendingGroups) {
3282
- if (group.invalid || group.results.size !== group.metadata.count) {
3283
- continue;
3284
- }
3285
- const results = Array.from(
3286
- { length: group.metadata.count },
3287
- (_, index) => group.results.get(index)
3288
- );
3289
- if (results.every(import_provider_utils27.isNonNullable)) {
3290
- completeGroups.set(toolCallId, {
3291
- metadata: group.metadata,
3292
- results
3293
- });
3294
- }
3295
- }
3296
- return completeGroups;
3297
- }
3298
- function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
3299
- var _a2;
3300
- return (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.promptCacheBreakpoint;
3055
+ var import_v421 = require("zod/v4");
3056
+ var TOP_LOGPROBS_MAX = 20;
3057
+ var openaiResponsesReasoningModelIds = [
3058
+ "o1",
3059
+ "o1-2024-12-17",
3060
+ "o3",
3061
+ "o3-2025-04-16",
3062
+ "o3-mini",
3063
+ "o3-mini-2025-01-31",
3064
+ "o4-mini",
3065
+ "o4-mini-2025-04-16",
3066
+ "gpt-5",
3067
+ "gpt-5-2025-08-07",
3068
+ "gpt-5-codex",
3069
+ "gpt-5-mini",
3070
+ "gpt-5-mini-2025-08-07",
3071
+ "gpt-5-nano",
3072
+ "gpt-5-nano-2025-08-07",
3073
+ "gpt-5-pro",
3074
+ "gpt-5-pro-2025-10-06",
3075
+ "gpt-5.1",
3076
+ "gpt-5.1-chat-latest",
3077
+ "gpt-5.1-codex-mini",
3078
+ "gpt-5.1-codex",
3079
+ "gpt-5.1-codex-max",
3080
+ "gpt-5.2",
3081
+ "gpt-5.2-chat-latest",
3082
+ "gpt-5.2-pro",
3083
+ "gpt-5.2-codex",
3084
+ "gpt-5.3-chat-latest",
3085
+ "gpt-5.3-codex",
3086
+ "gpt-5.4",
3087
+ "gpt-5.4-2026-03-05",
3088
+ "gpt-5.4-mini",
3089
+ "gpt-5.4-mini-2026-03-17",
3090
+ "gpt-5.4-nano",
3091
+ "gpt-5.4-nano-2026-03-17",
3092
+ "gpt-5.4-pro",
3093
+ "gpt-5.4-pro-2026-03-05",
3094
+ "gpt-5.5",
3095
+ "gpt-5.5-2026-04-23",
3096
+ "gpt-5.6",
3097
+ "gpt-5.6-luna",
3098
+ "gpt-5.6-sol",
3099
+ "gpt-5.6-terra",
3100
+ "gpt-6-astra",
3101
+ "gpt-6-luna",
3102
+ "gpt-6-sol"
3103
+ ];
3104
+ var openaiResponsesModelIds = [
3105
+ "gpt-4.1",
3106
+ "gpt-4.1-2025-04-14",
3107
+ "gpt-4.1-mini",
3108
+ "gpt-4.1-mini-2025-04-14",
3109
+ "gpt-4.1-nano",
3110
+ "gpt-4.1-nano-2025-04-14",
3111
+ "gpt-4o",
3112
+ "gpt-4o-2024-05-13",
3113
+ "gpt-4o-2024-08-06",
3114
+ "gpt-4o-2024-11-20",
3115
+ "gpt-4o-audio-preview",
3116
+ "gpt-4o-audio-preview-2024-12-17",
3117
+ "gpt-4o-search-preview",
3118
+ "gpt-4o-search-preview-2025-03-11",
3119
+ "gpt-4o-mini-search-preview",
3120
+ "gpt-4o-mini-search-preview-2025-03-11",
3121
+ "gpt-4o-mini",
3122
+ "gpt-4o-mini-2024-07-18",
3123
+ "gpt-3.5-turbo-0125",
3124
+ "gpt-3.5-turbo",
3125
+ "gpt-3.5-turbo-1106",
3126
+ "gpt-5-chat-latest",
3127
+ ...openaiResponsesReasoningModelIds
3128
+ ];
3129
+ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazySchema)(
3130
+ () => (0, import_provider_utils26.zodSchema)(
3131
+ import_v421.z.object({
3132
+ /**
3133
+ * The ID of the OpenAI Conversation to continue.
3134
+ * You must create a conversation first via the OpenAI API.
3135
+ * Cannot be used in conjunction with `previousResponseId`.
3136
+ * Defaults to `undefined`.
3137
+ * @see https://platform.openai.com/docs/api-reference/conversations/create
3138
+ */
3139
+ conversation: import_v421.z.string().nullish(),
3140
+ /**
3141
+ * The set of extra fields to include in the response (advanced, usually not needed).
3142
+ * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
3143
+ */
3144
+ include: import_v421.z.array(
3145
+ import_v421.z.enum([
3146
+ "reasoning.encrypted_content",
3147
+ // handled internally by default, only needed for unknown reasoning models
3148
+ "file_search_call.results",
3149
+ "web_search_call.results",
3150
+ "message.output_text.logprobs"
3151
+ ])
3152
+ ).nullish(),
3153
+ /**
3154
+ * Instructions for the model.
3155
+ * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
3156
+ * Defaults to `undefined`.
3157
+ */
3158
+ instructions: import_v421.z.string().nullish(),
3159
+ /**
3160
+ * Return the log probabilities of the tokens. Including logprobs will increase
3161
+ * the response size and can slow down response times. However, it can
3162
+ * be useful to better understand how the model is behaving.
3163
+ *
3164
+ * Setting to true will return the log probabilities of the tokens that
3165
+ * were generated.
3166
+ *
3167
+ * Setting to a number will return the log probabilities of the top n
3168
+ * tokens that were generated.
3169
+ *
3170
+ * @see https://platform.openai.com/docs/api-reference/responses/create
3171
+ * @see https://cookbook.openai.com/examples/using_logprobs
3172
+ */
3173
+ logprobs: import_v421.z.union([import_v421.z.boolean(), import_v421.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3174
+ /**
3175
+ * The maximum number of total calls to built-in tools that can be processed in a response.
3176
+ * This maximum number applies across all built-in tool calls, not per individual tool.
3177
+ * Any further attempts to call a tool by the model will be ignored.
3178
+ */
3179
+ maxToolCalls: import_v421.z.number().nullish(),
3180
+ /**
3181
+ * Additional metadata to store with the generation.
3182
+ */
3183
+ metadata: import_v421.z.any().nullish(),
3184
+ /**
3185
+ * Whether to use parallel tool calls. Defaults to `true`.
3186
+ */
3187
+ parallelToolCalls: import_v421.z.boolean().nullish(),
3188
+ /**
3189
+ * The ID of the previous response. You can use it to continue a conversation.
3190
+ * Defaults to `undefined`.
3191
+ */
3192
+ previousResponseId: import_v421.z.string().nullish(),
3193
+ /**
3194
+ * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
3195
+ */
3196
+ promptCacheKey: import_v421.z.string().nullish(),
3197
+ /**
3198
+ * Prompt cache behavior for GPT-5.6 and later models.
3199
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
3200
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3201
+ */
3202
+ promptCacheOptions: import_v421.z.object({
3203
+ mode: import_v421.z.enum(["implicit", "explicit"]).optional(),
3204
+ ttl: import_v421.z.literal("30m").optional()
3205
+ }).optional(),
3206
+ /**
3207
+ * The retention policy for the prompt cache.
3208
+ * - 'in_memory': Default. Standard prompt caching behavior.
3209
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
3210
+ * Available for models before GPT-5.6 that support extended caching.
3211
+ *
3212
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
3213
+ *
3214
+ * @default 'in_memory'
3215
+ */
3216
+ promptCacheRetention: import_v421.z.enum(["in_memory", "24h"]).nullish(),
3217
+ /**
3218
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
3219
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
3220
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
3221
+ * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
3222
+ * Supported values vary by model.
3223
+ */
3224
+ reasoningEffort: import_v421.z.string().nullish(),
3225
+ /**
3226
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
3227
+ * without changing the request-level reasoning effort. This preserves the
3228
+ * request prefix for prompt caching.
3229
+ *
3230
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3231
+ * combined with automatic truncation.
3232
+ */
3233
+ reasoningEffortUpdate: import_v421.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3234
+ /**
3235
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
3236
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
3237
+ */
3238
+ reasoningMode: import_v421.z.enum(["standard", "pro"]).optional(),
3239
+ /**
3240
+ * Controls which available reasoning items GPT-5.6 can use.
3241
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
3242
+ * turns, and `all_turns` makes compatible earlier reasoning available.
3243
+ */
3244
+ reasoningContext: import_v421.z.enum(["auto", "current_turn", "all_turns"]).optional(),
3245
+ /**
3246
+ * Controls reasoning summary output from the model.
3247
+ * Set to "auto" to automatically receive the richest level available,
3248
+ * or "detailed" for comprehensive summaries.
3249
+ */
3250
+ reasoningSummary: import_v421.z.string().nullish(),
3251
+ /**
3252
+ * The identifier for safety monitoring and tracking.
3253
+ */
3254
+ safetyIdentifier: import_v421.z.string().nullish(),
3255
+ /**
3256
+ * Service tier for the request.
3257
+ * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
3258
+ * Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
3259
+ * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
3260
+ *
3261
+ * Defaults to 'auto'.
3262
+ */
3263
+ serviceTier: import_v421.z.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
3264
+ /**
3265
+ * Whether to store the generation. Defaults to `true`.
3266
+ */
3267
+ store: import_v421.z.boolean().nullish(),
3268
+ /**
3269
+ * Whether to pass through non-image file types as generic input files.
3270
+ *
3271
+ * By default, inline file inputs are restricted to images and PDFs.
3272
+ * Enable this when the target OpenAI Responses model supports additional
3273
+ * file media types, such as text/csv.
3274
+ */
3275
+ passThroughUnsupportedFiles: import_v421.z.boolean().optional(),
3276
+ /**
3277
+ * Whether to use strict JSON schema validation.
3278
+ * Defaults to `true`.
3279
+ */
3280
+ strictJsonSchema: import_v421.z.boolean().nullish(),
3281
+ /**
3282
+ * Controls the verbosity of the model's responses. Lower values ('low') will result
3283
+ * in more concise responses, while higher values ('high') will result in more verbose responses.
3284
+ * Valid values: 'low', 'medium', 'high'.
3285
+ */
3286
+ textVerbosity: import_v421.z.enum(["low", "medium", "high"]).nullish(),
3287
+ /**
3288
+ * Controls output truncation. 'auto' (default) performs truncation automatically;
3289
+ * 'disabled' turns truncation off.
3290
+ */
3291
+ truncation: import_v421.z.enum(["auto", "disabled"]).nullish(),
3292
+ /**
3293
+ * A unique identifier representing your end-user, which can help OpenAI to
3294
+ * monitor and detect abuse.
3295
+ * Defaults to `undefined`.
3296
+ * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
3297
+ */
3298
+ user: import_v421.z.string().nullish(),
3299
+ /**
3300
+ * Override the system message mode for this model.
3301
+ * - 'system': Use the 'system' role for system messages (default for most models)
3302
+ * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
3303
+ * - 'remove': Remove system messages entirely
3304
+ *
3305
+ * If not specified, the mode is automatically determined based on the model.
3306
+ */
3307
+ systemMessageMode: import_v421.z.enum(["system", "developer", "remove"]).optional(),
3308
+ /**
3309
+ * Force treating this model as a reasoning model.
3310
+ *
3311
+ * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
3312
+ * where the model ID is not recognized by the SDK's allowlist.
3313
+ *
3314
+ * When enabled, the SDK applies reasoning-model parameter compatibility rules
3315
+ * and defaults `systemMessageMode` to `developer` unless overridden.
3316
+ */
3317
+ forceReasoning: import_v421.z.boolean().optional(),
3318
+ /**
3319
+ * Restrict the callable tools to a subset while keeping the full tools
3320
+ * list intact, so prompt caching is preserved across requests with
3321
+ * different allowlists.
3322
+ *
3323
+ * When set, this overrides the request-level `toolChoice` and emits
3324
+ * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
3325
+ *
3326
+ * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
3327
+ */
3328
+ allowedTools: import_v421.z.object({
3329
+ toolNames: import_v421.z.array(import_v421.z.string()).min(1),
3330
+ mode: import_v421.z.enum(["auto", "required"]).optional()
3331
+ }).optional()
3332
+ })
3333
+ )
3334
+ );
3335
+ var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils26.lazySchema)(
3336
+ () => (0, import_provider_utils26.zodSchema)(
3337
+ import_v421.z.object({
3338
+ /**
3339
+ * Emit a configuration update at this position in Responses history.
3340
+ * Requires empty system message content and the same supported
3341
+ * configuration as the request-level reasoningEffortUpdate option.
3342
+ * Unsupported historical updates throw instead of being omitted.
3343
+ *
3344
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
3345
+ */
3346
+ reasoningEffortUpdate: import_v421.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
3347
+ })
3348
+ )
3349
+ );
3350
+
3351
+ // src/responses/expand-parallel-tool-call.ts
3352
+ var import_provider7 = require("@ai-sdk/provider");
3353
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
3354
+ var parallelToolName = "parallel";
3355
+ var recipientNamePrefix = "functions.";
3356
+ function getParallelToolCallMetadata({
3357
+ providerOptions,
3358
+ providerOptionsName
3359
+ }) {
3360
+ var _a2;
3361
+ const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
3362
+ if (!(0, import_provider7.isJSONObject)(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
3363
+ return void 0;
3364
+ }
3365
+ return metadata;
3366
+ }
3367
+ function isUndeclaredParallelToolCall({
3368
+ toolName,
3369
+ tools
3370
+ }) {
3371
+ return toolName === parallelToolName && !tools.some((tool) => tool.name === parallelToolName);
3372
+ }
3373
+ async function expandParallelToolCall({
3374
+ toolCall,
3375
+ tools,
3376
+ providerOptionsName,
3377
+ itemId
3378
+ }) {
3379
+ if (!isUndeclaredParallelToolCall({ toolName: toolCall.toolName, tools })) {
3380
+ return void 0;
3381
+ }
3382
+ const parsedInput = await (0, import_provider_utils27.safeParseJSON)({ text: toolCall.input });
3383
+ if (!parsedInput.success || !(0, import_provider7.isJSONObject)(parsedInput.value)) {
3384
+ return void 0;
3385
+ }
3386
+ const toolUses = parsedInput.value.tool_uses;
3387
+ if (!Array.isArray(toolUses) || toolUses.length === 0) {
3388
+ return void 0;
3389
+ }
3390
+ const availableToolNames = new Set(tools.map((tool) => tool.name));
3391
+ const expandedToolCalls = [];
3392
+ for (const [index, toolUse] of toolUses.entries()) {
3393
+ if (!(0, import_provider7.isJSONObject)(toolUse)) {
3394
+ return void 0;
3395
+ }
3396
+ const recipientName = toolUse.recipient_name;
3397
+ const parameters = toolUse.parameters;
3398
+ if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0, import_provider7.isJSONObject)(parameters)) {
3399
+ return void 0;
3400
+ }
3401
+ const toolName = recipientName.slice(recipientNamePrefix.length);
3402
+ if (toolName.length === 0 || !availableToolNames.has(toolName)) {
3403
+ return void 0;
3404
+ }
3405
+ expandedToolCalls.push({
3406
+ type: "tool-call",
3407
+ toolCallId: `${toolCall.toolCallId}_${index}`,
3408
+ toolName,
3409
+ input: JSON.stringify(parameters),
3410
+ providerMetadata: {
3411
+ [providerOptionsName]: {
3412
+ parallelToolCall: {
3413
+ itemId,
3414
+ toolCallId: toolCall.toolCallId,
3415
+ toolName: toolCall.toolName,
3416
+ input: toolCall.input,
3417
+ index,
3418
+ count: toolUses.length
3419
+ }
3420
+ }
3421
+ }
3422
+ });
3423
+ }
3424
+ return expandedToolCalls;
3425
+ }
3426
+
3427
+ // src/responses/convert-to-openai-responses-input.ts
3428
+ function serializeToolCallArguments2(input) {
3429
+ return JSON.stringify(input === void 0 ? {} : input);
3430
+ }
3431
+ async function convertFunctionToolResultOutput({
3432
+ output,
3433
+ promptCacheBreakpoint,
3434
+ providerOptionsName,
3435
+ warnings
3436
+ }) {
3437
+ var _a2;
3438
+ const convertScalarOutput = (value) => promptCacheBreakpoint == null ? value : [
3439
+ {
3440
+ type: "input_text",
3441
+ text: value,
3442
+ prompt_cache_breakpoint: promptCacheBreakpoint
3443
+ }
3444
+ ];
3445
+ switch (output.type) {
3446
+ case "text":
3447
+ case "error-text":
3448
+ return convertScalarOutput(output.value);
3449
+ case "execution-denied": {
3450
+ return convertScalarOutput(
3451
+ (_a2 = output.reason) != null ? _a2 : "Tool call execution denied."
3452
+ );
3453
+ }
3454
+ case "json":
3455
+ case "error-json":
3456
+ return convertScalarOutput(JSON.stringify(output.value));
3457
+ case "content":
3458
+ return output.value.map((item) => {
3459
+ var _a3, _b, _c, _d, _e, _f, _g;
3460
+ const promptCacheBreakpoint2 = getPromptCacheBreakpoint2(
3461
+ item.providerOptions,
3462
+ providerOptionsName
3463
+ );
3464
+ switch (item.type) {
3465
+ case "text": {
3466
+ return {
3467
+ type: "input_text",
3468
+ text: item.text,
3469
+ ...promptCacheBreakpoint2 != null && {
3470
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3471
+ }
3472
+ };
3473
+ }
3474
+ case "image-data": {
3475
+ return {
3476
+ type: "input_image",
3477
+ image_url: `data:${item.mediaType};base64,${item.data}`,
3478
+ detail: (_b = (_a3 = item.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b.imageDetail,
3479
+ ...promptCacheBreakpoint2 != null && {
3480
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3481
+ }
3482
+ };
3483
+ }
3484
+ case "image-url": {
3485
+ return {
3486
+ type: "input_image",
3487
+ image_url: item.url,
3488
+ detail: (_d = (_c = item.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.imageDetail,
3489
+ ...promptCacheBreakpoint2 != null && {
3490
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3491
+ }
3492
+ };
3493
+ }
3494
+ case "file-id": {
3495
+ return {
3496
+ type: "input_file",
3497
+ file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
3498
+ ...promptCacheBreakpoint2 != null && {
3499
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3500
+ }
3501
+ };
3502
+ }
3503
+ case "image-file-id": {
3504
+ return {
3505
+ type: "input_image",
3506
+ file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
3507
+ detail: (_f = (_e = item.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.imageDetail,
3508
+ ...promptCacheBreakpoint2 != null && {
3509
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3510
+ }
3511
+ };
3512
+ }
3513
+ case "file-data": {
3514
+ return {
3515
+ type: "input_file",
3516
+ filename: (_g = item.filename) != null ? _g : "data",
3517
+ file_data: `data:${item.mediaType};base64,${item.data}`,
3518
+ ...promptCacheBreakpoint2 != null && {
3519
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3520
+ }
3521
+ };
3522
+ }
3523
+ case "file-url": {
3524
+ return {
3525
+ type: "input_file",
3526
+ file_url: item.url,
3527
+ ...promptCacheBreakpoint2 != null && {
3528
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3529
+ }
3530
+ };
3531
+ }
3532
+ default: {
3533
+ warnings.push({
3534
+ type: "other",
3535
+ message: `unsupported tool content part type: ${item.type}`
3536
+ });
3537
+ return void 0;
3538
+ }
3539
+ }
3540
+ }).filter(import_provider_utils28.isNonNullable);
3541
+ }
3542
+ }
3543
+ function hasSameParallelToolCall(first, second) {
3544
+ return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
3545
+ }
3546
+ function collectCompleteParallelToolResultGroups({
3547
+ prompt,
3548
+ providerOptionsName
3549
+ }) {
3550
+ const pendingGroups = /* @__PURE__ */ new Map();
3551
+ for (const message of prompt) {
3552
+ if (message.role !== "tool") {
3553
+ continue;
3554
+ }
3555
+ for (const part of message.content) {
3556
+ if (part.type !== "tool-result") {
3557
+ continue;
3558
+ }
3559
+ const metadata = getParallelToolCallMetadata({
3560
+ providerOptions: part.providerOptions,
3561
+ providerOptionsName
3562
+ });
3563
+ if (metadata == null) {
3564
+ continue;
3565
+ }
3566
+ const existing = pendingGroups.get(metadata.toolCallId);
3567
+ if (existing == null) {
3568
+ pendingGroups.set(metadata.toolCallId, {
3569
+ metadata,
3570
+ results: /* @__PURE__ */ new Map([[metadata.index, part]]),
3571
+ invalid: false
3572
+ });
3573
+ continue;
3574
+ }
3575
+ if (!hasSameParallelToolCall(existing.metadata, metadata) || existing.results.has(metadata.index)) {
3576
+ existing.invalid = true;
3577
+ continue;
3578
+ }
3579
+ existing.results.set(metadata.index, part);
3580
+ }
3581
+ }
3582
+ const completeGroups = /* @__PURE__ */ new Map();
3583
+ for (const [toolCallId, group] of pendingGroups) {
3584
+ if (group.invalid || group.results.size !== group.metadata.count) {
3585
+ continue;
3586
+ }
3587
+ const results = Array.from(
3588
+ { length: group.metadata.count },
3589
+ (_, index) => group.results.get(index)
3590
+ );
3591
+ if (results.every(import_provider_utils28.isNonNullable)) {
3592
+ completeGroups.set(toolCallId, {
3593
+ metadata: group.metadata,
3594
+ results
3595
+ });
3596
+ }
3597
+ }
3598
+ return completeGroups;
3599
+ }
3600
+ function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
3601
+ var _a2;
3602
+ return (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.promptCacheBreakpoint;
3301
3603
  }
3302
3604
  function getScalarToolResultPromptCacheBreakpoint({
3303
3605
  output,
@@ -3325,6 +3627,7 @@ async function convertToOpenAIResponsesInput({
3325
3627
  store,
3326
3628
  hasConversation = false,
3327
3629
  hasPreviousResponseId = false,
3630
+ configurationUpdateUnsupportedReason,
3328
3631
  hasLocalShellTool = false,
3329
3632
  hasShellTool = false,
3330
3633
  hasApplyPatchTool = false,
@@ -3344,6 +3647,33 @@ async function convertToOpenAIResponsesInput({
3344
3647
  for (const { role, content, providerOptions } of prompt) {
3345
3648
  switch (role) {
3346
3649
  case "system": {
3650
+ let options = await (0, import_provider_utils28.parseProviderOptions)({
3651
+ provider: providerOptionsName,
3652
+ providerOptions,
3653
+ schema: openaiResponsesSystemMessageOptionsSchema
3654
+ });
3655
+ if (options == null && providerOptionsName !== "openai") {
3656
+ options = await (0, import_provider_utils28.parseProviderOptions)({
3657
+ provider: "openai",
3658
+ providerOptions,
3659
+ schema: openaiResponsesSystemMessageOptionsSchema
3660
+ });
3661
+ }
3662
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
3663
+ if (effort != null) {
3664
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
3665
+ if (unsupportedReason != null) {
3666
+ throw new import_provider8.UnsupportedFunctionalityError({
3667
+ functionality: "Message-level reasoningEffortUpdate",
3668
+ message: unsupportedReason
3669
+ });
3670
+ }
3671
+ input.push({
3672
+ type: "configuration_update",
3673
+ reasoning: { effort }
3674
+ });
3675
+ break;
3676
+ }
3347
3677
  switch (systemMessageMode) {
3348
3678
  case "system": {
3349
3679
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -3427,7 +3757,7 @@ async function convertToOpenAIResponsesInput({
3427
3757
  return {
3428
3758
  type: "input_image",
3429
3759
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3430
- image_url: `data:${mediaType};base64,${(0, import_provider_utils27.convertToBase64)(part.data)}`
3760
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
3431
3761
  },
3432
3762
  detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b2.imageDetail,
3433
3763
  ...promptCacheBreakpoint != null && {
@@ -3453,7 +3783,7 @@ async function convertToOpenAIResponsesInput({
3453
3783
  type: "input_file",
3454
3784
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3455
3785
  filename: (_c2 = part.filename) != null ? _c2 : mediaType === "application/pdf" ? `part-${index}.pdf` : `part-${index}`,
3456
- file_data: `data:${mediaType};base64,${(0, import_provider_utils27.convertToBase64)(part.data)}`
3786
+ file_data: `data:${mediaType};base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
3457
3787
  },
3458
3788
  ...promptCacheBreakpoint != null && {
3459
3789
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -3532,10 +3862,10 @@ async function convertToOpenAIResponsesInput({
3532
3862
  input.push({ type: "item_reference", id });
3533
3863
  break;
3534
3864
  }
3535
- const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils27.parseJSON)({
3865
+ const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils28.parseJSON)({
3536
3866
  text: part.input,
3537
3867
  schema: toolSearchInputSchema
3538
- }) : await (0, import_provider_utils27.validateTypes)({
3868
+ }) : await (0, import_provider_utils28.validateTypes)({
3539
3869
  value: part.input,
3540
3870
  schema: toolSearchInputSchema
3541
3871
  });
@@ -3567,7 +3897,7 @@ async function convertToOpenAIResponsesInput({
3567
3897
  break;
3568
3898
  }
3569
3899
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
3570
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3900
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3571
3901
  value: part.input,
3572
3902
  schema: localShellInputSchema
3573
3903
  });
@@ -3587,7 +3917,7 @@ async function convertToOpenAIResponsesInput({
3587
3917
  break;
3588
3918
  }
3589
3919
  if (hasShellTool && resolvedToolName === "shell") {
3590
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3920
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3591
3921
  value: part.input,
3592
3922
  schema: shellInputSchema
3593
3923
  });
@@ -3605,7 +3935,7 @@ async function convertToOpenAIResponsesInput({
3605
3935
  break;
3606
3936
  }
3607
3937
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
3608
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3938
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3609
3939
  value: part.input,
3610
3940
  schema: applyPatchInputSchema
3611
3941
  });
@@ -3655,7 +3985,7 @@ async function convertToOpenAIResponsesInput({
3655
3985
  if (store) {
3656
3986
  input.push({ type: "item_reference", id: itemId });
3657
3987
  } else if (part.output.type === "json") {
3658
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
3988
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3659
3989
  value: part.output.value,
3660
3990
  schema: toolSearchOutputSchema
3661
3991
  });
@@ -3672,7 +4002,7 @@ async function convertToOpenAIResponsesInput({
3672
4002
  }
3673
4003
  if (hasShellTool && resolvedResultToolName === "shell") {
3674
4004
  if (part.output.type === "json") {
3675
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4005
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3676
4006
  value: part.output.value,
3677
4007
  schema: shellOutputSchema
3678
4008
  });
@@ -3703,7 +4033,7 @@ async function convertToOpenAIResponsesInput({
3703
4033
  break;
3704
4034
  }
3705
4035
  case "reasoning": {
3706
- const providerOptions2 = await (0, import_provider_utils27.parseProviderOptions)({
4036
+ const providerOptions2 = await (0, import_provider_utils28.parseProviderOptions)({
3707
4037
  provider: providerOptionsName,
3708
4038
  providerOptions: part.providerOptions,
3709
4039
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -3868,7 +4198,7 @@ ${text}`,
3868
4198
  part.toolName
3869
4199
  );
3870
4200
  if (part.toolName === toolSearchToolName && output.type === "json") {
3871
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4201
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3872
4202
  value: output.value,
3873
4203
  schema: toolSearchOutputSchema
3874
4204
  });
@@ -3882,7 +4212,7 @@ ${text}`,
3882
4212
  continue;
3883
4213
  }
3884
4214
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3885
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4215
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3886
4216
  value: output.value,
3887
4217
  schema: localShellOutputSchema
3888
4218
  });
@@ -3894,7 +4224,7 @@ ${text}`,
3894
4224
  continue;
3895
4225
  }
3896
4226
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
3897
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4227
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3898
4228
  value: output.value,
3899
4229
  schema: shellOutputSchema
3900
4230
  });
@@ -3913,7 +4243,7 @@ ${text}`,
3913
4243
  continue;
3914
4244
  }
3915
4245
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
3916
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4246
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3917
4247
  value: output.value,
3918
4248
  schema: applyPatchOutputSchema
3919
4249
  });
@@ -4011,7 +4341,7 @@ ${text}`,
4011
4341
  });
4012
4342
  return void 0;
4013
4343
  }
4014
- }).filter(import_provider_utils27.isNonNullable);
4344
+ }).filter(import_provider_utils28.isNonNullable);
4015
4345
  break;
4016
4346
  default:
4017
4347
  outputValue = "";
@@ -4060,9 +4390,9 @@ ${text}`,
4060
4390
  }
4061
4391
  return { input, warnings };
4062
4392
  }
4063
- var openaiResponsesReasoningProviderOptionsSchema = import_v421.z.object({
4064
- itemId: import_v421.z.string().nullish(),
4065
- reasoningEncryptedContent: import_v421.z.string().nullish()
4393
+ var openaiResponsesReasoningProviderOptionsSchema = import_v422.z.object({
4394
+ itemId: import_v422.z.string().nullish(),
4395
+ reasoningEncryptedContent: import_v422.z.string().nullish()
4066
4396
  });
4067
4397
 
4068
4398
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4084,75 +4414,75 @@ function mapOpenAIResponseFinishReason({
4084
4414
  }
4085
4415
 
4086
4416
  // src/responses/openai-responses-api.ts
4087
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4088
- var import_v422 = require("zod/v4");
4089
- var jsonValueSchema2 = import_v422.z.lazy(
4090
- () => import_v422.z.union([
4091
- import_v422.z.string(),
4092
- import_v422.z.number(),
4093
- import_v422.z.boolean(),
4094
- import_v422.z.null(),
4095
- import_v422.z.array(jsonValueSchema2),
4096
- import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional())
4417
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
4418
+ var import_v423 = require("zod/v4");
4419
+ var jsonValueSchema2 = import_v423.z.lazy(
4420
+ () => import_v423.z.union([
4421
+ import_v423.z.string(),
4422
+ import_v423.z.number(),
4423
+ import_v423.z.boolean(),
4424
+ import_v423.z.null(),
4425
+ import_v423.z.array(jsonValueSchema2),
4426
+ import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional())
4097
4427
  ])
4098
4428
  );
4099
- var jsonObjectSchema = import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional());
4100
- var openaiResponsesUsageSchema = import_v422.z.intersection(
4429
+ var jsonObjectSchema = import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional());
4430
+ var openaiResponsesUsageSchema = import_v423.z.intersection(
4101
4431
  jsonObjectSchema,
4102
- import_v422.z.object({
4103
- input_tokens: import_v422.z.number(),
4104
- input_tokens_details: import_v422.z.intersection(
4432
+ import_v423.z.object({
4433
+ input_tokens: import_v423.z.number(),
4434
+ input_tokens_details: import_v423.z.intersection(
4105
4435
  jsonObjectSchema,
4106
- import_v422.z.object({
4107
- cached_tokens: import_v422.z.number().nullish(),
4108
- cache_write_tokens: import_v422.z.number().nullish(),
4109
- orchestration_input_tokens: import_v422.z.number().nullish(),
4110
- orchestration_input_cached_tokens: import_v422.z.number().nullish()
4436
+ import_v423.z.object({
4437
+ cached_tokens: import_v423.z.number().nullish(),
4438
+ cache_write_tokens: import_v423.z.number().nullish(),
4439
+ orchestration_input_tokens: import_v423.z.number().nullish(),
4440
+ orchestration_input_cached_tokens: import_v423.z.number().nullish()
4111
4441
  })
4112
4442
  ).nullish(),
4113
- output_tokens: import_v422.z.number(),
4114
- output_tokens_details: import_v422.z.intersection(
4443
+ output_tokens: import_v423.z.number(),
4444
+ output_tokens_details: import_v423.z.intersection(
4115
4445
  jsonObjectSchema,
4116
- import_v422.z.object({
4117
- reasoning_tokens: import_v422.z.number().nullish(),
4118
- orchestration_output_tokens: import_v422.z.number().nullish()
4446
+ import_v423.z.object({
4447
+ reasoning_tokens: import_v423.z.number().nullish(),
4448
+ orchestration_output_tokens: import_v423.z.number().nullish()
4119
4449
  })
4120
4450
  ).nullish(),
4121
- total_tokens: import_v422.z.number().optional()
4451
+ total_tokens: import_v423.z.number().optional()
4122
4452
  })
4123
4453
  );
4124
4454
  function isRecord(value) {
4125
4455
  return value != null && typeof value === "object" && !Array.isArray(value);
4126
4456
  }
4127
- var openaiResponsesLocalShellCallSchema = import_v422.z.object({
4128
- type: import_v422.z.literal("local_shell_call"),
4129
- id: import_v422.z.string(),
4130
- call_id: import_v422.z.string(),
4131
- action: import_v422.z.object({
4132
- type: import_v422.z.literal("exec"),
4133
- command: import_v422.z.array(import_v422.z.string()),
4134
- timeout_ms: import_v422.z.number().optional(),
4135
- user: import_v422.z.string().optional(),
4136
- working_directory: import_v422.z.string().optional(),
4137
- env: import_v422.z.record(import_v422.z.string(), import_v422.z.string()).optional()
4457
+ var openaiResponsesLocalShellCallSchema = import_v423.z.object({
4458
+ type: import_v423.z.literal("local_shell_call"),
4459
+ id: import_v423.z.string(),
4460
+ call_id: import_v423.z.string(),
4461
+ action: import_v423.z.object({
4462
+ type: import_v423.z.literal("exec"),
4463
+ command: import_v423.z.array(import_v423.z.string()),
4464
+ timeout_ms: import_v423.z.number().optional(),
4465
+ user: import_v423.z.string().optional(),
4466
+ working_directory: import_v423.z.string().optional(),
4467
+ env: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional()
4138
4468
  })
4139
4469
  });
4140
- var openaiResponsesNestedErrorChunkSchema = import_v422.z.object({
4141
- type: import_v422.z.literal("error"),
4142
- sequence_number: import_v422.z.number(),
4143
- error: import_v422.z.object({
4144
- type: import_v422.z.string(),
4145
- code: import_v422.z.string(),
4146
- message: import_v422.z.string(),
4147
- param: import_v422.z.string().nullish()
4470
+ var openaiResponsesNestedErrorChunkSchema = import_v423.z.object({
4471
+ type: import_v423.z.literal("error"),
4472
+ sequence_number: import_v423.z.number(),
4473
+ error: import_v423.z.object({
4474
+ type: import_v423.z.string(),
4475
+ code: import_v423.z.string(),
4476
+ message: import_v423.z.string(),
4477
+ param: import_v423.z.string().nullish()
4148
4478
  })
4149
4479
  });
4150
- var openaiResponsesErrorChunkSchema = import_v422.z.object({
4151
- type: import_v422.z.literal("error"),
4152
- sequence_number: import_v422.z.number(),
4153
- code: import_v422.z.string().nullish(),
4154
- message: import_v422.z.string(),
4155
- param: import_v422.z.string().nullish()
4480
+ var openaiResponsesErrorChunkSchema = import_v423.z.object({
4481
+ type: import_v423.z.literal("error"),
4482
+ sequence_number: import_v423.z.number(),
4483
+ code: import_v423.z.string().nullish(),
4484
+ message: import_v423.z.string(),
4485
+ param: import_v423.z.string().nullish()
4156
4486
  });
4157
4487
  var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
4158
4488
  "error",
@@ -4208,1102 +4538,819 @@ function isModeledOpenAIResponsesChunk(value) {
4208
4538
  }
4209
4539
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4210
4540
  }
4211
- var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4212
- () => (0, import_provider_utils28.zodSchema)(
4213
- import_v422.z.union([
4214
- import_v422.z.object({
4215
- type: import_v422.z.literal("response.output_text.delta"),
4216
- item_id: import_v422.z.string(),
4217
- delta: import_v422.z.string(),
4218
- logprobs: import_v422.z.array(
4219
- import_v422.z.object({
4220
- token: import_v422.z.string(),
4221
- logprob: import_v422.z.number(),
4222
- top_logprobs: import_v422.z.array(
4223
- import_v422.z.object({
4224
- token: import_v422.z.string(),
4225
- logprob: import_v422.z.number()
4541
+ var openaiResponsesChunkSchema = (0, import_provider_utils29.lazySchema)(
4542
+ () => (0, import_provider_utils29.zodSchema)(
4543
+ import_v423.z.union([
4544
+ import_v423.z.object({
4545
+ type: import_v423.z.literal("response.output_text.delta"),
4546
+ item_id: import_v423.z.string(),
4547
+ delta: import_v423.z.string(),
4548
+ logprobs: import_v423.z.array(
4549
+ import_v423.z.object({
4550
+ token: import_v423.z.string(),
4551
+ logprob: import_v423.z.number(),
4552
+ top_logprobs: import_v423.z.array(
4553
+ import_v423.z.object({
4554
+ token: import_v423.z.string(),
4555
+ logprob: import_v423.z.number()
4226
4556
  })
4227
4557
  )
4228
4558
  })
4229
4559
  ).nullish()
4230
4560
  }),
4231
- import_v422.z.object({
4232
- type: import_v422.z.enum(["response.completed", "response.incomplete"]),
4233
- response: import_v422.z.object({
4234
- incomplete_details: import_v422.z.object({ reason: import_v422.z.string() }).nullish(),
4561
+ import_v423.z.object({
4562
+ type: import_v423.z.enum(["response.completed", "response.incomplete"]),
4563
+ response: import_v423.z.object({
4564
+ incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
4235
4565
  usage: openaiResponsesUsageSchema.nullish(),
4236
- reasoning: import_v422.z.object({
4237
- context: import_v422.z.string().nullish()
4566
+ reasoning: import_v423.z.object({
4567
+ context: import_v423.z.string().nullish()
4238
4568
  }).nullish(),
4239
- service_tier: import_v422.z.string().nullish()
4569
+ service_tier: import_v423.z.string().nullish()
4240
4570
  })
4241
4571
  }),
4242
- import_v422.z.object({
4243
- type: import_v422.z.literal("response.failed"),
4244
- sequence_number: import_v422.z.number(),
4245
- response: import_v422.z.object({
4246
- error: import_v422.z.object({
4247
- code: import_v422.z.string().nullish(),
4248
- message: import_v422.z.string()
4572
+ import_v423.z.object({
4573
+ type: import_v423.z.literal("response.failed"),
4574
+ sequence_number: import_v423.z.number(),
4575
+ response: import_v423.z.object({
4576
+ error: import_v423.z.object({
4577
+ code: import_v423.z.string().nullish(),
4578
+ message: import_v423.z.string()
4249
4579
  }).nullish(),
4250
- incomplete_details: import_v422.z.object({ reason: import_v422.z.string() }).nullish(),
4580
+ incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
4251
4581
  usage: openaiResponsesUsageSchema.nullish(),
4252
- reasoning: import_v422.z.object({
4253
- context: import_v422.z.string().nullish()
4582
+ reasoning: import_v423.z.object({
4583
+ context: import_v423.z.string().nullish()
4254
4584
  }).nullish(),
4255
- service_tier: import_v422.z.string().nullish()
4585
+ service_tier: import_v423.z.string().nullish()
4256
4586
  })
4257
4587
  }),
4258
- import_v422.z.object({
4259
- type: import_v422.z.literal("response.created"),
4260
- response: import_v422.z.object({
4261
- id: import_v422.z.string(),
4262
- created_at: import_v422.z.number(),
4263
- model: import_v422.z.string(),
4264
- service_tier: import_v422.z.string().nullish()
4588
+ import_v423.z.object({
4589
+ type: import_v423.z.literal("response.created"),
4590
+ response: import_v423.z.object({
4591
+ id: import_v423.z.string(),
4592
+ created_at: import_v423.z.number(),
4593
+ model: import_v423.z.string(),
4594
+ service_tier: import_v423.z.string().nullish()
4265
4595
  })
4266
4596
  }),
4267
- import_v422.z.object({
4268
- type: import_v422.z.literal("response.output_item.added"),
4269
- output_index: import_v422.z.number(),
4270
- item: import_v422.z.discriminatedUnion("type", [
4271
- import_v422.z.object({
4272
- type: import_v422.z.literal("message"),
4273
- id: import_v422.z.string(),
4274
- phase: import_v422.z.enum(["commentary", "final_answer"]).nullish()
4597
+ import_v423.z.object({
4598
+ type: import_v423.z.literal("response.output_item.added"),
4599
+ output_index: import_v423.z.number(),
4600
+ item: import_v423.z.discriminatedUnion("type", [
4601
+ import_v423.z.object({
4602
+ type: import_v423.z.literal("message"),
4603
+ id: import_v423.z.string(),
4604
+ phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
4275
4605
  }),
4276
- import_v422.z.object({
4277
- type: import_v422.z.literal("reasoning"),
4278
- id: import_v422.z.string(),
4279
- encrypted_content: import_v422.z.string().nullish()
4606
+ import_v423.z.object({
4607
+ type: import_v423.z.literal("reasoning"),
4608
+ id: import_v423.z.string(),
4609
+ encrypted_content: import_v423.z.string().nullish()
4280
4610
  }),
4281
- import_v422.z.object({
4282
- type: import_v422.z.literal("function_call"),
4283
- id: import_v422.z.string(),
4284
- call_id: import_v422.z.string(),
4285
- name: import_v422.z.string(),
4286
- arguments: import_v422.z.string(),
4287
- async: import_v422.z.boolean().nullish(),
4288
- namespace: import_v422.z.string().nullish()
4611
+ import_v423.z.object({
4612
+ type: import_v423.z.literal("function_call"),
4613
+ id: import_v423.z.string(),
4614
+ call_id: import_v423.z.string(),
4615
+ name: import_v423.z.string(),
4616
+ arguments: import_v423.z.string(),
4617
+ async: import_v423.z.boolean().nullish(),
4618
+ namespace: import_v423.z.string().nullish()
4289
4619
  }),
4290
- import_v422.z.object({
4291
- type: import_v422.z.literal("web_search_call"),
4292
- id: import_v422.z.string(),
4293
- status: import_v422.z.string()
4620
+ import_v423.z.object({
4621
+ type: import_v423.z.literal("web_search_call"),
4622
+ id: import_v423.z.string(),
4623
+ status: import_v423.z.string()
4294
4624
  }),
4295
- import_v422.z.object({
4296
- type: import_v422.z.literal("computer_call"),
4297
- id: import_v422.z.string(),
4298
- status: import_v422.z.string()
4625
+ import_v423.z.object({
4626
+ type: import_v423.z.literal("computer_call"),
4627
+ id: import_v423.z.string(),
4628
+ status: import_v423.z.string()
4299
4629
  }),
4300
- import_v422.z.object({
4301
- type: import_v422.z.literal("file_search_call"),
4302
- id: import_v422.z.string()
4630
+ import_v423.z.object({
4631
+ type: import_v423.z.literal("file_search_call"),
4632
+ id: import_v423.z.string()
4303
4633
  }),
4304
4634
  openaiResponsesLocalShellCallSchema,
4305
- import_v422.z.object({
4306
- type: import_v422.z.literal("image_generation_call"),
4307
- id: import_v422.z.string()
4635
+ import_v423.z.object({
4636
+ type: import_v423.z.literal("image_generation_call"),
4637
+ id: import_v423.z.string()
4308
4638
  }),
4309
- import_v422.z.object({
4310
- type: import_v422.z.literal("code_interpreter_call"),
4311
- id: import_v422.z.string(),
4312
- container_id: import_v422.z.string(),
4313
- code: import_v422.z.string().nullable(),
4314
- outputs: import_v422.z.array(
4315
- import_v422.z.discriminatedUnion("type", [
4316
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4317
- import_v422.z.object({ type: import_v422.z.literal("image"), url: import_v422.z.string() })
4639
+ import_v423.z.object({
4640
+ type: import_v423.z.literal("code_interpreter_call"),
4641
+ id: import_v423.z.string(),
4642
+ container_id: import_v423.z.string(),
4643
+ code: import_v423.z.string().nullable(),
4644
+ outputs: import_v423.z.array(
4645
+ import_v423.z.discriminatedUnion("type", [
4646
+ import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
4647
+ import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
4318
4648
  ])
4319
4649
  ).nullable(),
4320
- status: import_v422.z.string()
4650
+ status: import_v423.z.string()
4321
4651
  }),
4322
- import_v422.z.object({
4323
- type: import_v422.z.literal("mcp_call"),
4324
- id: import_v422.z.string(),
4325
- status: import_v422.z.string(),
4326
- approval_request_id: import_v422.z.string().nullish()
4652
+ import_v423.z.object({
4653
+ type: import_v423.z.literal("mcp_call"),
4654
+ id: import_v423.z.string(),
4655
+ status: import_v423.z.string(),
4656
+ approval_request_id: import_v423.z.string().nullish()
4327
4657
  }),
4328
- import_v422.z.object({
4329
- type: import_v422.z.literal("mcp_list_tools"),
4330
- id: import_v422.z.string()
4658
+ import_v423.z.object({
4659
+ type: import_v423.z.literal("mcp_list_tools"),
4660
+ id: import_v423.z.string()
4331
4661
  }),
4332
- import_v422.z.object({
4333
- type: import_v422.z.literal("mcp_approval_request"),
4334
- id: import_v422.z.string()
4662
+ import_v423.z.object({
4663
+ type: import_v423.z.literal("mcp_approval_request"),
4664
+ id: import_v423.z.string()
4335
4665
  }),
4336
- import_v422.z.object({
4337
- type: import_v422.z.literal("apply_patch_call"),
4338
- id: import_v422.z.string(),
4339
- call_id: import_v422.z.string(),
4340
- status: import_v422.z.enum(["in_progress", "completed"]),
4341
- operation: import_v422.z.discriminatedUnion("type", [
4342
- import_v422.z.object({
4343
- type: import_v422.z.literal("create_file"),
4344
- path: import_v422.z.string(),
4345
- diff: import_v422.z.string()
4666
+ import_v423.z.object({
4667
+ type: import_v423.z.literal("apply_patch_call"),
4668
+ id: import_v423.z.string(),
4669
+ call_id: import_v423.z.string(),
4670
+ status: import_v423.z.enum(["in_progress", "completed"]),
4671
+ operation: import_v423.z.discriminatedUnion("type", [
4672
+ import_v423.z.object({
4673
+ type: import_v423.z.literal("create_file"),
4674
+ path: import_v423.z.string(),
4675
+ diff: import_v423.z.string()
4346
4676
  }),
4347
- import_v422.z.object({
4348
- type: import_v422.z.literal("delete_file"),
4349
- path: import_v422.z.string()
4677
+ import_v423.z.object({
4678
+ type: import_v423.z.literal("delete_file"),
4679
+ path: import_v423.z.string()
4350
4680
  }),
4351
- import_v422.z.object({
4352
- type: import_v422.z.literal("update_file"),
4353
- path: import_v422.z.string(),
4354
- diff: import_v422.z.string()
4681
+ import_v423.z.object({
4682
+ type: import_v423.z.literal("update_file"),
4683
+ path: import_v423.z.string(),
4684
+ diff: import_v423.z.string()
4355
4685
  })
4356
4686
  ])
4357
4687
  }),
4358
- import_v422.z.object({
4359
- type: import_v422.z.literal("custom_tool_call"),
4360
- id: import_v422.z.string(),
4361
- call_id: import_v422.z.string(),
4362
- name: import_v422.z.string(),
4363
- input: import_v422.z.string(),
4364
- async: import_v422.z.boolean().nullish()
4688
+ import_v423.z.object({
4689
+ type: import_v423.z.literal("custom_tool_call"),
4690
+ id: import_v423.z.string(),
4691
+ call_id: import_v423.z.string(),
4692
+ name: import_v423.z.string(),
4693
+ input: import_v423.z.string(),
4694
+ async: import_v423.z.boolean().nullish()
4365
4695
  }),
4366
- import_v422.z.object({
4367
- type: import_v422.z.literal("shell_call"),
4368
- id: import_v422.z.string(),
4369
- call_id: import_v422.z.string(),
4370
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4371
- action: import_v422.z.object({
4372
- commands: import_v422.z.array(import_v422.z.string())
4696
+ import_v423.z.object({
4697
+ type: import_v423.z.literal("shell_call"),
4698
+ id: import_v423.z.string(),
4699
+ call_id: import_v423.z.string(),
4700
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4701
+ action: import_v423.z.object({
4702
+ commands: import_v423.z.array(import_v423.z.string())
4373
4703
  })
4374
4704
  }),
4375
- import_v422.z.object({
4376
- type: import_v422.z.literal("shell_call_output"),
4377
- id: import_v422.z.string(),
4378
- call_id: import_v422.z.string(),
4379
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4380
- output: import_v422.z.array(
4381
- import_v422.z.object({
4382
- stdout: import_v422.z.string(),
4383
- stderr: import_v422.z.string(),
4384
- outcome: import_v422.z.discriminatedUnion("type", [
4385
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4386
- import_v422.z.object({
4387
- type: import_v422.z.literal("exit"),
4388
- exit_code: import_v422.z.number()
4705
+ import_v423.z.object({
4706
+ type: import_v423.z.literal("shell_call_output"),
4707
+ id: import_v423.z.string(),
4708
+ call_id: import_v423.z.string(),
4709
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4710
+ output: import_v423.z.array(
4711
+ import_v423.z.object({
4712
+ stdout: import_v423.z.string(),
4713
+ stderr: import_v423.z.string(),
4714
+ outcome: import_v423.z.discriminatedUnion("type", [
4715
+ import_v423.z.object({ type: import_v423.z.literal("timeout") }),
4716
+ import_v423.z.object({
4717
+ type: import_v423.z.literal("exit"),
4718
+ exit_code: import_v423.z.number()
4389
4719
  })
4390
4720
  ])
4391
4721
  })
4392
4722
  )
4393
4723
  }),
4394
- import_v422.z.object({
4395
- type: import_v422.z.literal("tool_search_call"),
4396
- id: import_v422.z.string(),
4397
- execution: import_v422.z.enum(["server", "client"]),
4398
- call_id: import_v422.z.string().nullable(),
4399
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4400
- arguments: import_v422.z.unknown()
4724
+ import_v423.z.object({
4725
+ type: import_v423.z.literal("tool_search_call"),
4726
+ id: import_v423.z.string(),
4727
+ execution: import_v423.z.enum(["server", "client"]),
4728
+ call_id: import_v423.z.string().nullable(),
4729
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4730
+ arguments: import_v423.z.unknown()
4401
4731
  }),
4402
- import_v422.z.object({
4403
- type: import_v422.z.literal("tool_search_output"),
4404
- id: import_v422.z.string(),
4405
- execution: import_v422.z.enum(["server", "client"]),
4406
- call_id: import_v422.z.string().nullable(),
4407
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4408
- tools: import_v422.z.array(import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional()))
4732
+ import_v423.z.object({
4733
+ type: import_v423.z.literal("tool_search_output"),
4734
+ id: import_v423.z.string(),
4735
+ execution: import_v423.z.enum(["server", "client"]),
4736
+ call_id: import_v423.z.string().nullable(),
4737
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4738
+ tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
4409
4739
  })
4410
4740
  ])
4411
4741
  }),
4412
- import_v422.z.object({
4413
- type: import_v422.z.literal("response.output_item.done"),
4414
- output_index: import_v422.z.number(),
4415
- item: import_v422.z.discriminatedUnion("type", [
4416
- import_v422.z.object({
4417
- type: import_v422.z.literal("message"),
4418
- id: import_v422.z.string(),
4419
- phase: import_v422.z.enum(["commentary", "final_answer"]).nullish()
4742
+ import_v423.z.object({
4743
+ type: import_v423.z.literal("response.output_item.done"),
4744
+ output_index: import_v423.z.number(),
4745
+ item: import_v423.z.discriminatedUnion("type", [
4746
+ import_v423.z.object({
4747
+ type: import_v423.z.literal("message"),
4748
+ id: import_v423.z.string(),
4749
+ phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
4420
4750
  }),
4421
- import_v422.z.object({
4422
- type: import_v422.z.literal("reasoning"),
4423
- id: import_v422.z.string(),
4424
- encrypted_content: import_v422.z.string().nullish()
4751
+ import_v423.z.object({
4752
+ type: import_v423.z.literal("reasoning"),
4753
+ id: import_v423.z.string(),
4754
+ encrypted_content: import_v423.z.string().nullish()
4425
4755
  }),
4426
- import_v422.z.object({
4427
- type: import_v422.z.literal("function_call"),
4428
- id: import_v422.z.string(),
4429
- call_id: import_v422.z.string(),
4430
- name: import_v422.z.string(),
4431
- arguments: import_v422.z.string(),
4432
- async: import_v422.z.boolean().nullish(),
4433
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4434
- namespace: import_v422.z.string().nullish()
4756
+ import_v423.z.object({
4757
+ type: import_v423.z.literal("function_call"),
4758
+ id: import_v423.z.string(),
4759
+ call_id: import_v423.z.string(),
4760
+ name: import_v423.z.string(),
4761
+ arguments: import_v423.z.string(),
4762
+ async: import_v423.z.boolean().nullish(),
4763
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4764
+ namespace: import_v423.z.string().nullish()
4435
4765
  }),
4436
- import_v422.z.object({
4437
- type: import_v422.z.literal("custom_tool_call"),
4438
- id: import_v422.z.string(),
4439
- call_id: import_v422.z.string(),
4440
- name: import_v422.z.string(),
4441
- input: import_v422.z.string(),
4442
- async: import_v422.z.boolean().nullish(),
4443
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"])
4766
+ import_v423.z.object({
4767
+ type: import_v423.z.literal("custom_tool_call"),
4768
+ id: import_v423.z.string(),
4769
+ call_id: import_v423.z.string(),
4770
+ name: import_v423.z.string(),
4771
+ input: import_v423.z.string(),
4772
+ async: import_v423.z.boolean().nullish(),
4773
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"])
4444
4774
  }),
4445
- import_v422.z.object({
4446
- type: import_v422.z.literal("code_interpreter_call"),
4447
- id: import_v422.z.string(),
4448
- code: import_v422.z.string().nullable(),
4449
- container_id: import_v422.z.string(),
4450
- outputs: import_v422.z.array(
4451
- import_v422.z.discriminatedUnion("type", [
4452
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4453
- import_v422.z.object({ type: import_v422.z.literal("image"), url: import_v422.z.string() })
4775
+ import_v423.z.object({
4776
+ type: import_v423.z.literal("code_interpreter_call"),
4777
+ id: import_v423.z.string(),
4778
+ code: import_v423.z.string().nullable(),
4779
+ container_id: import_v423.z.string(),
4780
+ outputs: import_v423.z.array(
4781
+ import_v423.z.discriminatedUnion("type", [
4782
+ import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
4783
+ import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
4454
4784
  ])
4455
4785
  ).nullable()
4456
4786
  }),
4457
- import_v422.z.object({
4458
- type: import_v422.z.literal("image_generation_call"),
4459
- id: import_v422.z.string(),
4460
- result: import_v422.z.string()
4787
+ import_v423.z.object({
4788
+ type: import_v423.z.literal("image_generation_call"),
4789
+ id: import_v423.z.string(),
4790
+ result: import_v423.z.string()
4461
4791
  }),
4462
- import_v422.z.object({
4463
- type: import_v422.z.literal("web_search_call"),
4464
- id: import_v422.z.string(),
4465
- status: import_v422.z.string(),
4466
- action: import_v422.z.discriminatedUnion("type", [
4467
- import_v422.z.object({
4468
- type: import_v422.z.literal("search"),
4469
- query: import_v422.z.string().nullish(),
4470
- queries: import_v422.z.array(import_v422.z.string()).nullish(),
4471
- sources: import_v422.z.array(
4472
- import_v422.z.discriminatedUnion("type", [
4473
- import_v422.z.object({ type: import_v422.z.literal("url"), url: import_v422.z.string() }),
4474
- import_v422.z.object({ type: import_v422.z.literal("api"), name: import_v422.z.string() })
4792
+ import_v423.z.object({
4793
+ type: import_v423.z.literal("web_search_call"),
4794
+ id: import_v423.z.string(),
4795
+ status: import_v423.z.string(),
4796
+ action: import_v423.z.discriminatedUnion("type", [
4797
+ import_v423.z.object({
4798
+ type: import_v423.z.literal("search"),
4799
+ query: import_v423.z.string().nullish(),
4800
+ queries: import_v423.z.array(import_v423.z.string()).nullish(),
4801
+ sources: import_v423.z.array(
4802
+ import_v423.z.discriminatedUnion("type", [
4803
+ import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
4804
+ import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
4475
4805
  ])
4476
4806
  ).nullish()
4477
4807
  }),
4478
- import_v422.z.object({
4479
- type: import_v422.z.literal("open_page"),
4480
- url: import_v422.z.string().nullish()
4808
+ import_v423.z.object({
4809
+ type: import_v423.z.literal("open_page"),
4810
+ url: import_v423.z.string().nullish()
4481
4811
  }),
4482
- import_v422.z.object({
4483
- type: import_v422.z.literal("find_in_page"),
4484
- url: import_v422.z.string().nullish(),
4485
- pattern: import_v422.z.string().nullish()
4812
+ import_v423.z.object({
4813
+ type: import_v423.z.literal("find_in_page"),
4814
+ url: import_v423.z.string().nullish(),
4815
+ pattern: import_v423.z.string().nullish()
4486
4816
  })
4487
4817
  ]).nullish()
4488
4818
  }),
4489
- import_v422.z.object({
4490
- type: import_v422.z.literal("file_search_call"),
4491
- id: import_v422.z.string(),
4492
- queries: import_v422.z.array(import_v422.z.string()),
4493
- results: import_v422.z.array(
4494
- import_v422.z.object({
4495
- attributes: import_v422.z.record(
4496
- import_v422.z.string(),
4497
- import_v422.z.union([import_v422.z.string(), import_v422.z.number(), import_v422.z.boolean()])
4819
+ import_v423.z.object({
4820
+ type: import_v423.z.literal("file_search_call"),
4821
+ id: import_v423.z.string(),
4822
+ queries: import_v423.z.array(import_v423.z.string()),
4823
+ results: import_v423.z.array(
4824
+ import_v423.z.object({
4825
+ attributes: import_v423.z.record(
4826
+ import_v423.z.string(),
4827
+ import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
4498
4828
  ),
4499
- file_id: import_v422.z.string(),
4500
- filename: import_v422.z.string(),
4501
- score: import_v422.z.number(),
4502
- text: import_v422.z.string()
4829
+ file_id: import_v423.z.string(),
4830
+ filename: import_v423.z.string(),
4831
+ score: import_v423.z.number(),
4832
+ text: import_v423.z.string()
4503
4833
  })
4504
4834
  ).nullish()
4505
4835
  }),
4506
4836
  openaiResponsesLocalShellCallSchema,
4507
- import_v422.z.object({
4508
- type: import_v422.z.literal("computer_call"),
4509
- id: import_v422.z.string(),
4510
- status: import_v422.z.literal("completed")
4837
+ import_v423.z.object({
4838
+ type: import_v423.z.literal("computer_call"),
4839
+ id: import_v423.z.string(),
4840
+ status: import_v423.z.literal("completed")
4511
4841
  }),
4512
- import_v422.z.object({
4513
- type: import_v422.z.literal("mcp_call"),
4514
- id: import_v422.z.string(),
4515
- status: import_v422.z.string(),
4516
- arguments: import_v422.z.string(),
4517
- name: import_v422.z.string(),
4518
- server_label: import_v422.z.string(),
4519
- output: import_v422.z.string().nullish(),
4520
- error: import_v422.z.union([
4521
- import_v422.z.string(),
4522
- import_v422.z.object({
4523
- type: import_v422.z.string().optional(),
4524
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4525
- message: import_v422.z.string().optional()
4842
+ import_v423.z.object({
4843
+ type: import_v423.z.literal("mcp_call"),
4844
+ id: import_v423.z.string(),
4845
+ status: import_v423.z.string(),
4846
+ arguments: import_v423.z.string(),
4847
+ name: import_v423.z.string(),
4848
+ server_label: import_v423.z.string(),
4849
+ output: import_v423.z.string().nullish(),
4850
+ error: import_v423.z.union([
4851
+ import_v423.z.string(),
4852
+ import_v423.z.object({
4853
+ type: import_v423.z.string().optional(),
4854
+ code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
4855
+ message: import_v423.z.string().optional()
4526
4856
  }).loose()
4527
4857
  ]).nullish(),
4528
- approval_request_id: import_v422.z.string().nullish()
4858
+ approval_request_id: import_v423.z.string().nullish()
4529
4859
  }),
4530
- import_v422.z.object({
4531
- type: import_v422.z.literal("mcp_list_tools"),
4532
- id: import_v422.z.string(),
4533
- server_label: import_v422.z.string(),
4534
- tools: import_v422.z.array(
4535
- import_v422.z.object({
4536
- name: import_v422.z.string(),
4537
- description: import_v422.z.string().optional(),
4538
- input_schema: import_v422.z.any(),
4539
- annotations: import_v422.z.record(import_v422.z.string(), import_v422.z.unknown()).optional()
4860
+ import_v423.z.object({
4861
+ type: import_v423.z.literal("mcp_list_tools"),
4862
+ id: import_v423.z.string(),
4863
+ server_label: import_v423.z.string(),
4864
+ tools: import_v423.z.array(
4865
+ import_v423.z.object({
4866
+ name: import_v423.z.string(),
4867
+ description: import_v423.z.string().optional(),
4868
+ input_schema: import_v423.z.any(),
4869
+ annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
4540
4870
  })
4541
4871
  ),
4542
- error: import_v422.z.union([
4543
- import_v422.z.string(),
4544
- import_v422.z.object({
4545
- type: import_v422.z.string().optional(),
4546
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4547
- message: import_v422.z.string().optional()
4872
+ error: import_v423.z.union([
4873
+ import_v423.z.string(),
4874
+ import_v423.z.object({
4875
+ type: import_v423.z.string().optional(),
4876
+ code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
4877
+ message: import_v423.z.string().optional()
4548
4878
  }).loose()
4549
4879
  ]).optional()
4550
4880
  }),
4551
- import_v422.z.object({
4552
- type: import_v422.z.literal("mcp_approval_request"),
4553
- id: import_v422.z.string(),
4554
- server_label: import_v422.z.string(),
4555
- name: import_v422.z.string(),
4556
- arguments: import_v422.z.string(),
4557
- approval_request_id: import_v422.z.string().optional()
4881
+ import_v423.z.object({
4882
+ type: import_v423.z.literal("mcp_approval_request"),
4883
+ id: import_v423.z.string(),
4884
+ server_label: import_v423.z.string(),
4885
+ name: import_v423.z.string(),
4886
+ arguments: import_v423.z.string(),
4887
+ approval_request_id: import_v423.z.string().optional()
4558
4888
  }),
4559
- import_v422.z.object({
4560
- type: import_v422.z.literal("apply_patch_call"),
4561
- id: import_v422.z.string(),
4562
- call_id: import_v422.z.string(),
4563
- status: import_v422.z.enum(["in_progress", "completed"]),
4564
- operation: import_v422.z.discriminatedUnion("type", [
4565
- import_v422.z.object({
4566
- type: import_v422.z.literal("create_file"),
4567
- path: import_v422.z.string(),
4568
- diff: import_v422.z.string()
4889
+ import_v423.z.object({
4890
+ type: import_v423.z.literal("apply_patch_call"),
4891
+ id: import_v423.z.string(),
4892
+ call_id: import_v423.z.string(),
4893
+ status: import_v423.z.enum(["in_progress", "completed"]),
4894
+ operation: import_v423.z.discriminatedUnion("type", [
4895
+ import_v423.z.object({
4896
+ type: import_v423.z.literal("create_file"),
4897
+ path: import_v423.z.string(),
4898
+ diff: import_v423.z.string()
4569
4899
  }),
4570
- import_v422.z.object({
4571
- type: import_v422.z.literal("delete_file"),
4572
- path: import_v422.z.string()
4900
+ import_v423.z.object({
4901
+ type: import_v423.z.literal("delete_file"),
4902
+ path: import_v423.z.string()
4573
4903
  }),
4574
- import_v422.z.object({
4575
- type: import_v422.z.literal("update_file"),
4576
- path: import_v422.z.string(),
4577
- diff: import_v422.z.string()
4904
+ import_v423.z.object({
4905
+ type: import_v423.z.literal("update_file"),
4906
+ path: import_v423.z.string(),
4907
+ diff: import_v423.z.string()
4578
4908
  })
4579
4909
  ])
4580
4910
  }),
4581
- import_v422.z.object({
4582
- type: import_v422.z.literal("shell_call"),
4583
- id: import_v422.z.string(),
4584
- call_id: import_v422.z.string(),
4585
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4586
- action: import_v422.z.object({
4587
- commands: import_v422.z.array(import_v422.z.string())
4911
+ import_v423.z.object({
4912
+ type: import_v423.z.literal("shell_call"),
4913
+ id: import_v423.z.string(),
4914
+ call_id: import_v423.z.string(),
4915
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4916
+ action: import_v423.z.object({
4917
+ commands: import_v423.z.array(import_v423.z.string())
4588
4918
  })
4589
4919
  }),
4590
- import_v422.z.object({
4591
- type: import_v422.z.literal("shell_call_output"),
4592
- id: import_v422.z.string(),
4593
- call_id: import_v422.z.string(),
4594
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4595
- output: import_v422.z.array(
4596
- import_v422.z.object({
4597
- stdout: import_v422.z.string(),
4598
- stderr: import_v422.z.string(),
4599
- outcome: import_v422.z.discriminatedUnion("type", [
4600
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4601
- import_v422.z.object({
4602
- type: import_v422.z.literal("exit"),
4603
- exit_code: import_v422.z.number()
4920
+ import_v423.z.object({
4921
+ type: import_v423.z.literal("shell_call_output"),
4922
+ id: import_v423.z.string(),
4923
+ call_id: import_v423.z.string(),
4924
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4925
+ output: import_v423.z.array(
4926
+ import_v423.z.object({
4927
+ stdout: import_v423.z.string(),
4928
+ stderr: import_v423.z.string(),
4929
+ outcome: import_v423.z.discriminatedUnion("type", [
4930
+ import_v423.z.object({ type: import_v423.z.literal("timeout") }),
4931
+ import_v423.z.object({
4932
+ type: import_v423.z.literal("exit"),
4933
+ exit_code: import_v423.z.number()
4604
4934
  })
4605
4935
  ])
4606
4936
  })
4607
4937
  )
4608
4938
  }),
4609
- import_v422.z.object({
4610
- type: import_v422.z.literal("tool_search_call"),
4611
- id: import_v422.z.string(),
4612
- execution: import_v422.z.enum(["server", "client"]),
4613
- call_id: import_v422.z.string().nullable(),
4614
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4615
- arguments: import_v422.z.unknown()
4939
+ import_v423.z.object({
4940
+ type: import_v423.z.literal("tool_search_call"),
4941
+ id: import_v423.z.string(),
4942
+ execution: import_v423.z.enum(["server", "client"]),
4943
+ call_id: import_v423.z.string().nullable(),
4944
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4945
+ arguments: import_v423.z.unknown()
4616
4946
  }),
4617
- import_v422.z.object({
4618
- type: import_v422.z.literal("tool_search_output"),
4619
- id: import_v422.z.string(),
4620
- execution: import_v422.z.enum(["server", "client"]),
4621
- call_id: import_v422.z.string().nullable(),
4622
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4623
- tools: import_v422.z.array(import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional()))
4947
+ import_v423.z.object({
4948
+ type: import_v423.z.literal("tool_search_output"),
4949
+ id: import_v423.z.string(),
4950
+ execution: import_v423.z.enum(["server", "client"]),
4951
+ call_id: import_v423.z.string().nullable(),
4952
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
4953
+ tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
4624
4954
  })
4625
4955
  ])
4626
4956
  }),
4627
- import_v422.z.object({
4628
- type: import_v422.z.literal("response.function_call_arguments.delta"),
4629
- item_id: import_v422.z.string(),
4630
- output_index: import_v422.z.number(),
4631
- delta: import_v422.z.string()
4957
+ import_v423.z.object({
4958
+ type: import_v423.z.literal("response.function_call_arguments.delta"),
4959
+ item_id: import_v423.z.string(),
4960
+ output_index: import_v423.z.number(),
4961
+ delta: import_v423.z.string()
4632
4962
  }),
4633
- import_v422.z.object({
4963
+ import_v423.z.object({
4634
4964
  // `name` is documented as required but omitted from live API events:
4635
4965
  // https://github.com/openai/openai-openapi/issues/545
4636
- type: import_v422.z.literal("response.function_call_arguments.done"),
4637
- item_id: import_v422.z.string(),
4638
- output_index: import_v422.z.number(),
4639
- arguments: import_v422.z.string()
4966
+ type: import_v423.z.literal("response.function_call_arguments.done"),
4967
+ item_id: import_v423.z.string(),
4968
+ output_index: import_v423.z.number(),
4969
+ arguments: import_v423.z.string()
4640
4970
  }),
4641
- import_v422.z.object({
4642
- type: import_v422.z.literal("response.custom_tool_call_input.delta"),
4643
- item_id: import_v422.z.string(),
4644
- output_index: import_v422.z.number(),
4645
- delta: import_v422.z.string()
4971
+ import_v423.z.object({
4972
+ type: import_v423.z.literal("response.custom_tool_call_input.delta"),
4973
+ item_id: import_v423.z.string(),
4974
+ output_index: import_v423.z.number(),
4975
+ delta: import_v423.z.string()
4646
4976
  }),
4647
- import_v422.z.object({
4648
- type: import_v422.z.literal("response.image_generation_call.partial_image"),
4649
- item_id: import_v422.z.string(),
4650
- output_index: import_v422.z.number(),
4651
- partial_image_b64: import_v422.z.string()
4977
+ import_v423.z.object({
4978
+ type: import_v423.z.literal("response.image_generation_call.partial_image"),
4979
+ item_id: import_v423.z.string(),
4980
+ output_index: import_v423.z.number(),
4981
+ partial_image_b64: import_v423.z.string()
4652
4982
  }),
4653
- import_v422.z.object({
4654
- type: import_v422.z.literal("response.code_interpreter_call_code.delta"),
4655
- item_id: import_v422.z.string(),
4656
- output_index: import_v422.z.number(),
4657
- delta: import_v422.z.string()
4983
+ import_v423.z.object({
4984
+ type: import_v423.z.literal("response.code_interpreter_call_code.delta"),
4985
+ item_id: import_v423.z.string(),
4986
+ output_index: import_v423.z.number(),
4987
+ delta: import_v423.z.string()
4658
4988
  }),
4659
- import_v422.z.object({
4660
- type: import_v422.z.literal("response.code_interpreter_call_code.done"),
4661
- item_id: import_v422.z.string(),
4662
- output_index: import_v422.z.number(),
4663
- code: import_v422.z.string()
4989
+ import_v423.z.object({
4990
+ type: import_v423.z.literal("response.code_interpreter_call_code.done"),
4991
+ item_id: import_v423.z.string(),
4992
+ output_index: import_v423.z.number(),
4993
+ code: import_v423.z.string()
4664
4994
  }),
4665
- import_v422.z.object({
4666
- type: import_v422.z.literal("response.output_text.annotation.added"),
4667
- annotation: import_v422.z.discriminatedUnion("type", [
4668
- import_v422.z.object({
4669
- type: import_v422.z.literal("url_citation"),
4670
- start_index: import_v422.z.number(),
4671
- end_index: import_v422.z.number(),
4672
- url: import_v422.z.string(),
4673
- title: import_v422.z.string()
4995
+ import_v423.z.object({
4996
+ type: import_v423.z.literal("response.output_text.annotation.added"),
4997
+ annotation: import_v423.z.discriminatedUnion("type", [
4998
+ import_v423.z.object({
4999
+ type: import_v423.z.literal("url_citation"),
5000
+ start_index: import_v423.z.number(),
5001
+ end_index: import_v423.z.number(),
5002
+ url: import_v423.z.string(),
5003
+ title: import_v423.z.string()
4674
5004
  }),
4675
- import_v422.z.object({
4676
- type: import_v422.z.literal("file_citation"),
4677
- file_id: import_v422.z.string(),
4678
- filename: import_v422.z.string(),
4679
- index: import_v422.z.number()
5005
+ import_v423.z.object({
5006
+ type: import_v423.z.literal("file_citation"),
5007
+ file_id: import_v423.z.string(),
5008
+ filename: import_v423.z.string(),
5009
+ index: import_v423.z.number()
4680
5010
  }),
4681
- import_v422.z.object({
4682
- type: import_v422.z.literal("container_file_citation"),
4683
- container_id: import_v422.z.string(),
4684
- file_id: import_v422.z.string(),
4685
- filename: import_v422.z.string(),
4686
- start_index: import_v422.z.number(),
4687
- end_index: import_v422.z.number()
5011
+ import_v423.z.object({
5012
+ type: import_v423.z.literal("container_file_citation"),
5013
+ container_id: import_v423.z.string(),
5014
+ file_id: import_v423.z.string(),
5015
+ filename: import_v423.z.string(),
5016
+ start_index: import_v423.z.number(),
5017
+ end_index: import_v423.z.number()
4688
5018
  }),
4689
- import_v422.z.object({
4690
- type: import_v422.z.literal("file_path"),
4691
- file_id: import_v422.z.string(),
4692
- index: import_v422.z.number()
5019
+ import_v423.z.object({
5020
+ type: import_v423.z.literal("file_path"),
5021
+ file_id: import_v423.z.string(),
5022
+ index: import_v423.z.number()
4693
5023
  })
4694
5024
  ])
4695
5025
  }),
4696
- import_v422.z.object({
4697
- type: import_v422.z.literal("response.reasoning_summary_part.added"),
4698
- item_id: import_v422.z.string(),
4699
- summary_index: import_v422.z.number()
4700
- }),
4701
- import_v422.z.object({
4702
- type: import_v422.z.literal("response.reasoning_summary_text.delta"),
4703
- item_id: import_v422.z.string(),
4704
- summary_index: import_v422.z.number(),
4705
- delta: import_v422.z.string()
4706
- }),
4707
- import_v422.z.object({
4708
- type: import_v422.z.literal("response.reasoning_summary_part.done"),
4709
- item_id: import_v422.z.string(),
4710
- summary_index: import_v422.z.number()
5026
+ import_v423.z.object({
5027
+ type: import_v423.z.literal("response.reasoning_summary_part.added"),
5028
+ item_id: import_v423.z.string(),
5029
+ summary_index: import_v423.z.number()
4711
5030
  }),
4712
- import_v422.z.object({
4713
- type: import_v422.z.literal("response.apply_patch_call_operation_diff.delta"),
4714
- item_id: import_v422.z.string(),
4715
- output_index: import_v422.z.number(),
4716
- delta: import_v422.z.string(),
4717
- obfuscation: import_v422.z.string().nullish()
5031
+ import_v423.z.object({
5032
+ type: import_v423.z.literal("response.reasoning_summary_text.delta"),
5033
+ item_id: import_v423.z.string(),
5034
+ summary_index: import_v423.z.number(),
5035
+ delta: import_v423.z.string()
4718
5036
  }),
4719
- import_v422.z.object({
4720
- type: import_v422.z.literal("response.apply_patch_call_operation_diff.done"),
4721
- item_id: import_v422.z.string(),
4722
- output_index: import_v422.z.number(),
4723
- diff: import_v422.z.string()
4724
- }),
4725
- openaiResponsesNestedErrorChunkSchema,
4726
- openaiResponsesErrorChunkSchema,
4727
- import_v422.z.object({ type: import_v422.z.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
4728
- message: "Known response chunk failed schema validation"
4729
- }).transform((value) => ({
4730
- type: "unknown_chunk",
4731
- message: value.type
4732
- }))
4733
- // fallback for unknown chunks
4734
- ])
4735
- )
4736
- );
4737
- var openaiResponsesResponseSchema = (0, import_provider_utils28.lazySchema)(
4738
- () => (0, import_provider_utils28.zodSchema)(
4739
- import_v422.z.object({
4740
- id: import_v422.z.string().optional(),
4741
- created_at: import_v422.z.number().optional(),
4742
- error: import_v422.z.object({
4743
- message: import_v422.z.string(),
4744
- type: import_v422.z.string(),
4745
- param: import_v422.z.string().nullish(),
4746
- code: import_v422.z.string()
4747
- }).nullish(),
4748
- model: import_v422.z.string().optional(),
4749
- output: import_v422.z.array(
4750
- import_v422.z.discriminatedUnion("type", [
4751
- import_v422.z.object({
4752
- type: import_v422.z.literal("message"),
4753
- role: import_v422.z.literal("assistant"),
4754
- id: import_v422.z.string(),
4755
- phase: import_v422.z.enum(["commentary", "final_answer"]).nullish(),
4756
- content: import_v422.z.array(
4757
- import_v422.z.object({
4758
- type: import_v422.z.literal("output_text"),
4759
- text: import_v422.z.string(),
4760
- logprobs: import_v422.z.array(
4761
- import_v422.z.object({
4762
- token: import_v422.z.string(),
4763
- logprob: import_v422.z.number(),
4764
- top_logprobs: import_v422.z.array(
4765
- import_v422.z.object({
4766
- token: import_v422.z.string(),
4767
- logprob: import_v422.z.number()
4768
- })
4769
- )
4770
- })
4771
- ).nullish(),
4772
- annotations: import_v422.z.array(
4773
- import_v422.z.discriminatedUnion("type", [
4774
- import_v422.z.object({
4775
- type: import_v422.z.literal("url_citation"),
4776
- start_index: import_v422.z.number(),
4777
- end_index: import_v422.z.number(),
4778
- url: import_v422.z.string(),
4779
- title: import_v422.z.string()
4780
- }),
4781
- import_v422.z.object({
4782
- type: import_v422.z.literal("file_citation"),
4783
- file_id: import_v422.z.string(),
4784
- filename: import_v422.z.string(),
4785
- index: import_v422.z.number()
4786
- }),
4787
- import_v422.z.object({
4788
- type: import_v422.z.literal("container_file_citation"),
4789
- container_id: import_v422.z.string(),
4790
- file_id: import_v422.z.string(),
4791
- filename: import_v422.z.string(),
4792
- start_index: import_v422.z.number(),
4793
- end_index: import_v422.z.number()
4794
- }),
4795
- import_v422.z.object({
4796
- type: import_v422.z.literal("file_path"),
4797
- file_id: import_v422.z.string(),
4798
- index: import_v422.z.number()
4799
- })
4800
- ])
4801
- )
4802
- })
4803
- )
4804
- }),
4805
- import_v422.z.object({
4806
- type: import_v422.z.literal("web_search_call"),
4807
- id: import_v422.z.string(),
4808
- status: import_v422.z.string(),
4809
- action: import_v422.z.discriminatedUnion("type", [
4810
- import_v422.z.object({
4811
- type: import_v422.z.literal("search"),
4812
- query: import_v422.z.string().nullish(),
4813
- queries: import_v422.z.array(import_v422.z.string()).nullish(),
4814
- sources: import_v422.z.array(
4815
- import_v422.z.discriminatedUnion("type", [
4816
- import_v422.z.object({ type: import_v422.z.literal("url"), url: import_v422.z.string() }),
4817
- import_v422.z.object({
4818
- type: import_v422.z.literal("api"),
4819
- name: import_v422.z.string()
4820
- })
4821
- ])
4822
- ).nullish()
4823
- }),
4824
- import_v422.z.object({
4825
- type: import_v422.z.literal("open_page"),
4826
- url: import_v422.z.string().nullish()
4827
- }),
4828
- import_v422.z.object({
4829
- type: import_v422.z.literal("find_in_page"),
4830
- url: import_v422.z.string().nullish(),
4831
- pattern: import_v422.z.string().nullish()
4832
- })
4833
- ]).nullish()
4834
- }),
4835
- import_v422.z.object({
4836
- type: import_v422.z.literal("file_search_call"),
4837
- id: import_v422.z.string(),
4838
- queries: import_v422.z.array(import_v422.z.string()),
4839
- results: import_v422.z.array(
4840
- import_v422.z.object({
4841
- attributes: import_v422.z.record(
4842
- import_v422.z.string(),
4843
- import_v422.z.union([import_v422.z.string(), import_v422.z.number(), import_v422.z.boolean()])
4844
- ),
4845
- file_id: import_v422.z.string(),
4846
- filename: import_v422.z.string(),
4847
- score: import_v422.z.number(),
4848
- text: import_v422.z.string()
4849
- })
4850
- ).nullish()
4851
- }),
4852
- import_v422.z.object({
4853
- type: import_v422.z.literal("code_interpreter_call"),
4854
- id: import_v422.z.string(),
4855
- code: import_v422.z.string().nullable(),
4856
- container_id: import_v422.z.string(),
4857
- outputs: import_v422.z.array(
4858
- import_v422.z.discriminatedUnion("type", [
4859
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4860
- import_v422.z.object({ type: import_v422.z.literal("image"), url: import_v422.z.string() })
4861
- ])
4862
- ).nullable()
4863
- }),
4864
- import_v422.z.object({
4865
- type: import_v422.z.literal("image_generation_call"),
4866
- id: import_v422.z.string(),
4867
- result: import_v422.z.string()
4868
- }),
4869
- openaiResponsesLocalShellCallSchema,
4870
- import_v422.z.object({
4871
- type: import_v422.z.literal("function_call"),
4872
- call_id: import_v422.z.string(),
4873
- name: import_v422.z.string(),
4874
- arguments: import_v422.z.string(),
4875
- id: import_v422.z.string(),
4876
- async: import_v422.z.boolean().nullish(),
4877
- namespace: import_v422.z.string().nullish()
4878
- }),
4879
- import_v422.z.object({
4880
- type: import_v422.z.literal("custom_tool_call"),
4881
- call_id: import_v422.z.string(),
4882
- name: import_v422.z.string(),
4883
- input: import_v422.z.string(),
4884
- id: import_v422.z.string(),
4885
- async: import_v422.z.boolean().nullish()
4886
- }),
4887
- import_v422.z.object({
4888
- type: import_v422.z.literal("computer_call"),
4889
- id: import_v422.z.string(),
4890
- status: import_v422.z.string().optional()
4891
- }),
4892
- import_v422.z.object({
4893
- type: import_v422.z.literal("reasoning"),
4894
- id: import_v422.z.string(),
4895
- encrypted_content: import_v422.z.string().nullish(),
4896
- summary: import_v422.z.array(
4897
- import_v422.z.object({
4898
- type: import_v422.z.literal("summary_text"),
4899
- text: import_v422.z.string()
4900
- })
4901
- )
4902
- }),
4903
- import_v422.z.object({
4904
- type: import_v422.z.literal("mcp_call"),
4905
- id: import_v422.z.string(),
4906
- status: import_v422.z.string(),
4907
- arguments: import_v422.z.string(),
4908
- name: import_v422.z.string(),
4909
- server_label: import_v422.z.string(),
4910
- output: import_v422.z.string().nullish(),
4911
- error: import_v422.z.union([
4912
- import_v422.z.string(),
4913
- import_v422.z.object({
4914
- type: import_v422.z.string().optional(),
4915
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4916
- message: import_v422.z.string().optional()
4917
- }).loose()
4918
- ]).nullish(),
4919
- approval_request_id: import_v422.z.string().nullish()
4920
- }),
4921
- import_v422.z.object({
4922
- type: import_v422.z.literal("mcp_list_tools"),
4923
- id: import_v422.z.string(),
4924
- server_label: import_v422.z.string(),
4925
- tools: import_v422.z.array(
4926
- import_v422.z.object({
4927
- name: import_v422.z.string(),
4928
- description: import_v422.z.string().optional(),
4929
- input_schema: import_v422.z.any(),
4930
- annotations: import_v422.z.record(import_v422.z.string(), import_v422.z.unknown()).optional()
4931
- })
4932
- ),
4933
- error: import_v422.z.union([
4934
- import_v422.z.string(),
4935
- import_v422.z.object({
4936
- type: import_v422.z.string().optional(),
4937
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4938
- message: import_v422.z.string().optional()
4939
- }).loose()
4940
- ]).optional()
4941
- }),
4942
- import_v422.z.object({
4943
- type: import_v422.z.literal("mcp_approval_request"),
4944
- id: import_v422.z.string(),
4945
- server_label: import_v422.z.string(),
4946
- name: import_v422.z.string(),
4947
- arguments: import_v422.z.string(),
4948
- approval_request_id: import_v422.z.string().optional()
4949
- }),
4950
- import_v422.z.object({
4951
- type: import_v422.z.literal("apply_patch_call"),
4952
- id: import_v422.z.string(),
4953
- call_id: import_v422.z.string(),
4954
- status: import_v422.z.enum(["in_progress", "completed"]),
4955
- operation: import_v422.z.discriminatedUnion("type", [
4956
- import_v422.z.object({
4957
- type: import_v422.z.literal("create_file"),
4958
- path: import_v422.z.string(),
4959
- diff: import_v422.z.string()
4960
- }),
4961
- import_v422.z.object({
4962
- type: import_v422.z.literal("delete_file"),
4963
- path: import_v422.z.string()
4964
- }),
4965
- import_v422.z.object({
4966
- type: import_v422.z.literal("update_file"),
4967
- path: import_v422.z.string(),
4968
- diff: import_v422.z.string()
4969
- })
4970
- ])
4971
- }),
4972
- import_v422.z.object({
4973
- type: import_v422.z.literal("shell_call"),
4974
- id: import_v422.z.string(),
4975
- call_id: import_v422.z.string(),
4976
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4977
- action: import_v422.z.object({
4978
- commands: import_v422.z.array(import_v422.z.string())
4979
- })
4980
- }),
4981
- import_v422.z.object({
4982
- type: import_v422.z.literal("shell_call_output"),
4983
- id: import_v422.z.string(),
4984
- call_id: import_v422.z.string(),
4985
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4986
- output: import_v422.z.array(
4987
- import_v422.z.object({
4988
- stdout: import_v422.z.string(),
4989
- stderr: import_v422.z.string(),
4990
- outcome: import_v422.z.discriminatedUnion("type", [
4991
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4992
- import_v422.z.object({
4993
- type: import_v422.z.literal("exit"),
4994
- exit_code: import_v422.z.number()
4995
- })
4996
- ])
4997
- })
4998
- )
4999
- }),
5000
- import_v422.z.object({
5001
- type: import_v422.z.literal("tool_search_call"),
5002
- id: import_v422.z.string(),
5003
- execution: import_v422.z.enum(["server", "client"]),
5004
- call_id: import_v422.z.string().nullable(),
5005
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
5006
- arguments: import_v422.z.unknown()
5007
- }),
5008
- import_v422.z.object({
5009
- type: import_v422.z.literal("tool_search_output"),
5010
- id: import_v422.z.string(),
5011
- execution: import_v422.z.enum(["server", "client"]),
5012
- call_id: import_v422.z.string().nullable(),
5013
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
5014
- tools: import_v422.z.array(import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional()))
5015
- })
5016
- ])
5017
- ).optional(),
5018
- service_tier: import_v422.z.string().nullish(),
5019
- reasoning: import_v422.z.object({
5020
- context: import_v422.z.string().nullish()
5021
- }).nullish(),
5022
- incomplete_details: import_v422.z.object({ reason: import_v422.z.string() }).nullish(),
5023
- usage: openaiResponsesUsageSchema.nullish()
5024
- })
5025
- )
5026
- );
5027
-
5028
- // src/responses/openai-responses-options.ts
5029
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
5030
- var import_v423 = require("zod/v4");
5031
- var TOP_LOGPROBS_MAX = 20;
5032
- var openaiResponsesReasoningModelIds = [
5033
- "o1",
5034
- "o1-2024-12-17",
5035
- "o3",
5036
- "o3-2025-04-16",
5037
- "o3-mini",
5038
- "o3-mini-2025-01-31",
5039
- "o4-mini",
5040
- "o4-mini-2025-04-16",
5041
- "gpt-5",
5042
- "gpt-5-2025-08-07",
5043
- "gpt-5-codex",
5044
- "gpt-5-mini",
5045
- "gpt-5-mini-2025-08-07",
5046
- "gpt-5-nano",
5047
- "gpt-5-nano-2025-08-07",
5048
- "gpt-5-pro",
5049
- "gpt-5-pro-2025-10-06",
5050
- "gpt-5.1",
5051
- "gpt-5.1-chat-latest",
5052
- "gpt-5.1-codex-mini",
5053
- "gpt-5.1-codex",
5054
- "gpt-5.1-codex-max",
5055
- "gpt-5.2",
5056
- "gpt-5.2-chat-latest",
5057
- "gpt-5.2-pro",
5058
- "gpt-5.2-codex",
5059
- "gpt-5.3-chat-latest",
5060
- "gpt-5.3-codex",
5061
- "gpt-5.4",
5062
- "gpt-5.4-2026-03-05",
5063
- "gpt-5.4-mini",
5064
- "gpt-5.4-mini-2026-03-17",
5065
- "gpt-5.4-nano",
5066
- "gpt-5.4-nano-2026-03-17",
5067
- "gpt-5.4-pro",
5068
- "gpt-5.4-pro-2026-03-05",
5069
- "gpt-5.5",
5070
- "gpt-5.5-2026-04-23",
5071
- "gpt-5.6",
5072
- "gpt-5.6-luna",
5073
- "gpt-5.6-sol",
5074
- "gpt-5.6-terra",
5075
- "gpt-6-astra",
5076
- "gpt-6-luna",
5077
- "gpt-6-sol"
5078
- ];
5079
- var openaiResponsesModelIds = [
5080
- "gpt-4.1",
5081
- "gpt-4.1-2025-04-14",
5082
- "gpt-4.1-mini",
5083
- "gpt-4.1-mini-2025-04-14",
5084
- "gpt-4.1-nano",
5085
- "gpt-4.1-nano-2025-04-14",
5086
- "gpt-4o",
5087
- "gpt-4o-2024-05-13",
5088
- "gpt-4o-2024-08-06",
5089
- "gpt-4o-2024-11-20",
5090
- "gpt-4o-audio-preview",
5091
- "gpt-4o-audio-preview-2024-12-17",
5092
- "gpt-4o-search-preview",
5093
- "gpt-4o-search-preview-2025-03-11",
5094
- "gpt-4o-mini-search-preview",
5095
- "gpt-4o-mini-search-preview-2025-03-11",
5096
- "gpt-4o-mini",
5097
- "gpt-4o-mini-2024-07-18",
5098
- "gpt-3.5-turbo-0125",
5099
- "gpt-3.5-turbo",
5100
- "gpt-3.5-turbo-1106",
5101
- "gpt-5-chat-latest",
5102
- ...openaiResponsesReasoningModelIds
5103
- ];
5104
- var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils29.lazySchema)(
5037
+ import_v423.z.object({
5038
+ type: import_v423.z.literal("response.reasoning_summary_part.done"),
5039
+ item_id: import_v423.z.string(),
5040
+ summary_index: import_v423.z.number()
5041
+ }),
5042
+ import_v423.z.object({
5043
+ type: import_v423.z.literal("response.apply_patch_call_operation_diff.delta"),
5044
+ item_id: import_v423.z.string(),
5045
+ output_index: import_v423.z.number(),
5046
+ delta: import_v423.z.string(),
5047
+ obfuscation: import_v423.z.string().nullish()
5048
+ }),
5049
+ import_v423.z.object({
5050
+ type: import_v423.z.literal("response.apply_patch_call_operation_diff.done"),
5051
+ item_id: import_v423.z.string(),
5052
+ output_index: import_v423.z.number(),
5053
+ diff: import_v423.z.string()
5054
+ }),
5055
+ openaiResponsesNestedErrorChunkSchema,
5056
+ openaiResponsesErrorChunkSchema,
5057
+ import_v423.z.object({ type: import_v423.z.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5058
+ message: "Known response chunk failed schema validation"
5059
+ }).transform((value) => ({
5060
+ type: "unknown_chunk",
5061
+ message: value.type
5062
+ }))
5063
+ // fallback for unknown chunks
5064
+ ])
5065
+ )
5066
+ );
5067
+ var openaiResponsesResponseSchema = (0, import_provider_utils29.lazySchema)(
5105
5068
  () => (0, import_provider_utils29.zodSchema)(
5106
5069
  import_v423.z.object({
5107
- /**
5108
- * The ID of the OpenAI Conversation to continue.
5109
- * You must create a conversation first via the OpenAI API.
5110
- * Cannot be used in conjunction with `previousResponseId`.
5111
- * Defaults to `undefined`.
5112
- * @see https://platform.openai.com/docs/api-reference/conversations/create
5113
- */
5114
- conversation: import_v423.z.string().nullish(),
5115
- /**
5116
- * The set of extra fields to include in the response (advanced, usually not needed).
5117
- * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5118
- */
5119
- include: import_v423.z.array(
5120
- import_v423.z.enum([
5121
- "reasoning.encrypted_content",
5122
- // handled internally by default, only needed for unknown reasoning models
5123
- "file_search_call.results",
5124
- "web_search_call.results",
5125
- "message.output_text.logprobs"
5070
+ id: import_v423.z.string().optional(),
5071
+ created_at: import_v423.z.number().optional(),
5072
+ error: import_v423.z.object({
5073
+ message: import_v423.z.string(),
5074
+ type: import_v423.z.string(),
5075
+ param: import_v423.z.string().nullish(),
5076
+ code: import_v423.z.string()
5077
+ }).nullish(),
5078
+ model: import_v423.z.string().optional(),
5079
+ output: import_v423.z.array(
5080
+ import_v423.z.discriminatedUnion("type", [
5081
+ import_v423.z.object({
5082
+ type: import_v423.z.literal("message"),
5083
+ role: import_v423.z.literal("assistant"),
5084
+ id: import_v423.z.string(),
5085
+ phase: import_v423.z.enum(["commentary", "final_answer"]).nullish(),
5086
+ content: import_v423.z.array(
5087
+ import_v423.z.object({
5088
+ type: import_v423.z.literal("output_text"),
5089
+ text: import_v423.z.string(),
5090
+ logprobs: import_v423.z.array(
5091
+ import_v423.z.object({
5092
+ token: import_v423.z.string(),
5093
+ logprob: import_v423.z.number(),
5094
+ top_logprobs: import_v423.z.array(
5095
+ import_v423.z.object({
5096
+ token: import_v423.z.string(),
5097
+ logprob: import_v423.z.number()
5098
+ })
5099
+ )
5100
+ })
5101
+ ).nullish(),
5102
+ annotations: import_v423.z.array(
5103
+ import_v423.z.discriminatedUnion("type", [
5104
+ import_v423.z.object({
5105
+ type: import_v423.z.literal("url_citation"),
5106
+ start_index: import_v423.z.number(),
5107
+ end_index: import_v423.z.number(),
5108
+ url: import_v423.z.string(),
5109
+ title: import_v423.z.string()
5110
+ }),
5111
+ import_v423.z.object({
5112
+ type: import_v423.z.literal("file_citation"),
5113
+ file_id: import_v423.z.string(),
5114
+ filename: import_v423.z.string(),
5115
+ index: import_v423.z.number()
5116
+ }),
5117
+ import_v423.z.object({
5118
+ type: import_v423.z.literal("container_file_citation"),
5119
+ container_id: import_v423.z.string(),
5120
+ file_id: import_v423.z.string(),
5121
+ filename: import_v423.z.string(),
5122
+ start_index: import_v423.z.number(),
5123
+ end_index: import_v423.z.number()
5124
+ }),
5125
+ import_v423.z.object({
5126
+ type: import_v423.z.literal("file_path"),
5127
+ file_id: import_v423.z.string(),
5128
+ index: import_v423.z.number()
5129
+ })
5130
+ ])
5131
+ )
5132
+ })
5133
+ )
5134
+ }),
5135
+ import_v423.z.object({
5136
+ type: import_v423.z.literal("web_search_call"),
5137
+ id: import_v423.z.string(),
5138
+ status: import_v423.z.string(),
5139
+ action: import_v423.z.discriminatedUnion("type", [
5140
+ import_v423.z.object({
5141
+ type: import_v423.z.literal("search"),
5142
+ query: import_v423.z.string().nullish(),
5143
+ queries: import_v423.z.array(import_v423.z.string()).nullish(),
5144
+ sources: import_v423.z.array(
5145
+ import_v423.z.discriminatedUnion("type", [
5146
+ import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
5147
+ import_v423.z.object({
5148
+ type: import_v423.z.literal("api"),
5149
+ name: import_v423.z.string()
5150
+ })
5151
+ ])
5152
+ ).nullish()
5153
+ }),
5154
+ import_v423.z.object({
5155
+ type: import_v423.z.literal("open_page"),
5156
+ url: import_v423.z.string().nullish()
5157
+ }),
5158
+ import_v423.z.object({
5159
+ type: import_v423.z.literal("find_in_page"),
5160
+ url: import_v423.z.string().nullish(),
5161
+ pattern: import_v423.z.string().nullish()
5162
+ })
5163
+ ]).nullish()
5164
+ }),
5165
+ import_v423.z.object({
5166
+ type: import_v423.z.literal("file_search_call"),
5167
+ id: import_v423.z.string(),
5168
+ queries: import_v423.z.array(import_v423.z.string()),
5169
+ results: import_v423.z.array(
5170
+ import_v423.z.object({
5171
+ attributes: import_v423.z.record(
5172
+ import_v423.z.string(),
5173
+ import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
5174
+ ),
5175
+ file_id: import_v423.z.string(),
5176
+ filename: import_v423.z.string(),
5177
+ score: import_v423.z.number(),
5178
+ text: import_v423.z.string()
5179
+ })
5180
+ ).nullish()
5181
+ }),
5182
+ import_v423.z.object({
5183
+ type: import_v423.z.literal("code_interpreter_call"),
5184
+ id: import_v423.z.string(),
5185
+ code: import_v423.z.string().nullable(),
5186
+ container_id: import_v423.z.string(),
5187
+ outputs: import_v423.z.array(
5188
+ import_v423.z.discriminatedUnion("type", [
5189
+ import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
5190
+ import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
5191
+ ])
5192
+ ).nullable()
5193
+ }),
5194
+ import_v423.z.object({
5195
+ type: import_v423.z.literal("image_generation_call"),
5196
+ id: import_v423.z.string(),
5197
+ result: import_v423.z.string()
5198
+ }),
5199
+ openaiResponsesLocalShellCallSchema,
5200
+ import_v423.z.object({
5201
+ type: import_v423.z.literal("function_call"),
5202
+ call_id: import_v423.z.string(),
5203
+ name: import_v423.z.string(),
5204
+ arguments: import_v423.z.string(),
5205
+ id: import_v423.z.string(),
5206
+ async: import_v423.z.boolean().nullish(),
5207
+ namespace: import_v423.z.string().nullish()
5208
+ }),
5209
+ import_v423.z.object({
5210
+ type: import_v423.z.literal("custom_tool_call"),
5211
+ call_id: import_v423.z.string(),
5212
+ name: import_v423.z.string(),
5213
+ input: import_v423.z.string(),
5214
+ id: import_v423.z.string(),
5215
+ async: import_v423.z.boolean().nullish()
5216
+ }),
5217
+ import_v423.z.object({
5218
+ type: import_v423.z.literal("computer_call"),
5219
+ id: import_v423.z.string(),
5220
+ status: import_v423.z.string().optional()
5221
+ }),
5222
+ import_v423.z.object({
5223
+ type: import_v423.z.literal("reasoning"),
5224
+ id: import_v423.z.string(),
5225
+ encrypted_content: import_v423.z.string().nullish(),
5226
+ summary: import_v423.z.array(
5227
+ import_v423.z.object({
5228
+ type: import_v423.z.literal("summary_text"),
5229
+ text: import_v423.z.string()
5230
+ })
5231
+ )
5232
+ }),
5233
+ import_v423.z.object({
5234
+ type: import_v423.z.literal("mcp_call"),
5235
+ id: import_v423.z.string(),
5236
+ status: import_v423.z.string(),
5237
+ arguments: import_v423.z.string(),
5238
+ name: import_v423.z.string(),
5239
+ server_label: import_v423.z.string(),
5240
+ output: import_v423.z.string().nullish(),
5241
+ error: import_v423.z.union([
5242
+ import_v423.z.string(),
5243
+ import_v423.z.object({
5244
+ type: import_v423.z.string().optional(),
5245
+ code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
5246
+ message: import_v423.z.string().optional()
5247
+ }).loose()
5248
+ ]).nullish(),
5249
+ approval_request_id: import_v423.z.string().nullish()
5250
+ }),
5251
+ import_v423.z.object({
5252
+ type: import_v423.z.literal("mcp_list_tools"),
5253
+ id: import_v423.z.string(),
5254
+ server_label: import_v423.z.string(),
5255
+ tools: import_v423.z.array(
5256
+ import_v423.z.object({
5257
+ name: import_v423.z.string(),
5258
+ description: import_v423.z.string().optional(),
5259
+ input_schema: import_v423.z.any(),
5260
+ annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
5261
+ })
5262
+ ),
5263
+ error: import_v423.z.union([
5264
+ import_v423.z.string(),
5265
+ import_v423.z.object({
5266
+ type: import_v423.z.string().optional(),
5267
+ code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
5268
+ message: import_v423.z.string().optional()
5269
+ }).loose()
5270
+ ]).optional()
5271
+ }),
5272
+ import_v423.z.object({
5273
+ type: import_v423.z.literal("mcp_approval_request"),
5274
+ id: import_v423.z.string(),
5275
+ server_label: import_v423.z.string(),
5276
+ name: import_v423.z.string(),
5277
+ arguments: import_v423.z.string(),
5278
+ approval_request_id: import_v423.z.string().optional()
5279
+ }),
5280
+ import_v423.z.object({
5281
+ type: import_v423.z.literal("apply_patch_call"),
5282
+ id: import_v423.z.string(),
5283
+ call_id: import_v423.z.string(),
5284
+ status: import_v423.z.enum(["in_progress", "completed"]),
5285
+ operation: import_v423.z.discriminatedUnion("type", [
5286
+ import_v423.z.object({
5287
+ type: import_v423.z.literal("create_file"),
5288
+ path: import_v423.z.string(),
5289
+ diff: import_v423.z.string()
5290
+ }),
5291
+ import_v423.z.object({
5292
+ type: import_v423.z.literal("delete_file"),
5293
+ path: import_v423.z.string()
5294
+ }),
5295
+ import_v423.z.object({
5296
+ type: import_v423.z.literal("update_file"),
5297
+ path: import_v423.z.string(),
5298
+ diff: import_v423.z.string()
5299
+ })
5300
+ ])
5301
+ }),
5302
+ import_v423.z.object({
5303
+ type: import_v423.z.literal("shell_call"),
5304
+ id: import_v423.z.string(),
5305
+ call_id: import_v423.z.string(),
5306
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
5307
+ action: import_v423.z.object({
5308
+ commands: import_v423.z.array(import_v423.z.string())
5309
+ })
5310
+ }),
5311
+ import_v423.z.object({
5312
+ type: import_v423.z.literal("shell_call_output"),
5313
+ id: import_v423.z.string(),
5314
+ call_id: import_v423.z.string(),
5315
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
5316
+ output: import_v423.z.array(
5317
+ import_v423.z.object({
5318
+ stdout: import_v423.z.string(),
5319
+ stderr: import_v423.z.string(),
5320
+ outcome: import_v423.z.discriminatedUnion("type", [
5321
+ import_v423.z.object({ type: import_v423.z.literal("timeout") }),
5322
+ import_v423.z.object({
5323
+ type: import_v423.z.literal("exit"),
5324
+ exit_code: import_v423.z.number()
5325
+ })
5326
+ ])
5327
+ })
5328
+ )
5329
+ }),
5330
+ import_v423.z.object({
5331
+ type: import_v423.z.literal("tool_search_call"),
5332
+ id: import_v423.z.string(),
5333
+ execution: import_v423.z.enum(["server", "client"]),
5334
+ call_id: import_v423.z.string().nullable(),
5335
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
5336
+ arguments: import_v423.z.unknown()
5337
+ }),
5338
+ import_v423.z.object({
5339
+ type: import_v423.z.literal("tool_search_output"),
5340
+ id: import_v423.z.string(),
5341
+ execution: import_v423.z.enum(["server", "client"]),
5342
+ call_id: import_v423.z.string().nullable(),
5343
+ status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
5344
+ tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
5345
+ })
5126
5346
  ])
5127
- ).nullish(),
5128
- /**
5129
- * Instructions for the model.
5130
- * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5131
- * Defaults to `undefined`.
5132
- */
5133
- instructions: import_v423.z.string().nullish(),
5134
- /**
5135
- * Return the log probabilities of the tokens. Including logprobs will increase
5136
- * the response size and can slow down response times. However, it can
5137
- * be useful to better understand how the model is behaving.
5138
- *
5139
- * Setting to true will return the log probabilities of the tokens that
5140
- * were generated.
5141
- *
5142
- * Setting to a number will return the log probabilities of the top n
5143
- * tokens that were generated.
5144
- *
5145
- * @see https://platform.openai.com/docs/api-reference/responses/create
5146
- * @see https://cookbook.openai.com/examples/using_logprobs
5147
- */
5148
- logprobs: import_v423.z.union([import_v423.z.boolean(), import_v423.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5149
- /**
5150
- * The maximum number of total calls to built-in tools that can be processed in a response.
5151
- * This maximum number applies across all built-in tool calls, not per individual tool.
5152
- * Any further attempts to call a tool by the model will be ignored.
5153
- */
5154
- maxToolCalls: import_v423.z.number().nullish(),
5155
- /**
5156
- * Additional metadata to store with the generation.
5157
- */
5158
- metadata: import_v423.z.any().nullish(),
5159
- /**
5160
- * Whether to use parallel tool calls. Defaults to `true`.
5161
- */
5162
- parallelToolCalls: import_v423.z.boolean().nullish(),
5163
- /**
5164
- * The ID of the previous response. You can use it to continue a conversation.
5165
- * Defaults to `undefined`.
5166
- */
5167
- previousResponseId: import_v423.z.string().nullish(),
5168
- /**
5169
- * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5170
- */
5171
- promptCacheKey: import_v423.z.string().nullish(),
5172
- /**
5173
- * Prompt cache behavior for GPT-5.6 and later models.
5174
- * `mode` controls whether OpenAI also places an implicit breakpoint.
5175
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5176
- */
5177
- promptCacheOptions: import_v423.z.object({
5178
- mode: import_v423.z.enum(["implicit", "explicit"]).optional(),
5179
- ttl: import_v423.z.literal("30m").optional()
5180
- }).optional(),
5181
- /**
5182
- * The retention policy for the prompt cache.
5183
- * - 'in_memory': Default. Standard prompt caching behavior.
5184
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
5185
- * Available for models before GPT-5.6 that support extended caching.
5186
- *
5187
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
5188
- *
5189
- * @default 'in_memory'
5190
- */
5191
- promptCacheRetention: import_v423.z.enum(["in_memory", "24h"]).nullish(),
5192
- /**
5193
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5194
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5195
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5196
- * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5197
- * Supported values vary by model.
5198
- */
5199
- reasoningEffort: import_v423.z.string().nullish(),
5200
- /**
5201
- * Updates the reasoning effort for GPT-6 and later models starting with this response
5202
- * without changing the request-level reasoning effort. This preserves the
5203
- * request prefix for prompt caching.
5204
- *
5205
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
5206
- * combined with automatic truncation.
5207
- */
5208
- reasoningEffortUpdate: import_v423.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5209
- /**
5210
- * Controls how much model work GPT-5.6 performs before returning a final answer.
5211
- * `standard` is the default. `pro` increases quality, latency, and token usage.
5212
- */
5213
- reasoningMode: import_v423.z.enum(["standard", "pro"]).optional(),
5214
- /**
5215
- * Controls which available reasoning items GPT-5.6 can use.
5216
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5217
- * turns, and `all_turns` makes compatible earlier reasoning available.
5218
- */
5219
- reasoningContext: import_v423.z.enum(["auto", "current_turn", "all_turns"]).optional(),
5220
- /**
5221
- * Controls reasoning summary output from the model.
5222
- * Set to "auto" to automatically receive the richest level available,
5223
- * or "detailed" for comprehensive summaries.
5224
- */
5225
- reasoningSummary: import_v423.z.string().nullish(),
5226
- /**
5227
- * The identifier for safety monitoring and tracking.
5228
- */
5229
- safetyIdentifier: import_v423.z.string().nullish(),
5230
- /**
5231
- * Service tier for the request.
5232
- * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
5233
- * Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
5234
- * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
5235
- *
5236
- * Defaults to 'auto'.
5237
- */
5238
- serviceTier: import_v423.z.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
5239
- /**
5240
- * Whether to store the generation. Defaults to `true`.
5241
- */
5242
- store: import_v423.z.boolean().nullish(),
5243
- /**
5244
- * Whether to pass through non-image file types as generic input files.
5245
- *
5246
- * By default, inline file inputs are restricted to images and PDFs.
5247
- * Enable this when the target OpenAI Responses model supports additional
5248
- * file media types, such as text/csv.
5249
- */
5250
- passThroughUnsupportedFiles: import_v423.z.boolean().optional(),
5251
- /**
5252
- * Whether to use strict JSON schema validation.
5253
- * Defaults to `true`.
5254
- */
5255
- strictJsonSchema: import_v423.z.boolean().nullish(),
5256
- /**
5257
- * Controls the verbosity of the model's responses. Lower values ('low') will result
5258
- * in more concise responses, while higher values ('high') will result in more verbose responses.
5259
- * Valid values: 'low', 'medium', 'high'.
5260
- */
5261
- textVerbosity: import_v423.z.enum(["low", "medium", "high"]).nullish(),
5262
- /**
5263
- * Controls output truncation. 'auto' (default) performs truncation automatically;
5264
- * 'disabled' turns truncation off.
5265
- */
5266
- truncation: import_v423.z.enum(["auto", "disabled"]).nullish(),
5267
- /**
5268
- * A unique identifier representing your end-user, which can help OpenAI to
5269
- * monitor and detect abuse.
5270
- * Defaults to `undefined`.
5271
- * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5272
- */
5273
- user: import_v423.z.string().nullish(),
5274
- /**
5275
- * Override the system message mode for this model.
5276
- * - 'system': Use the 'system' role for system messages (default for most models)
5277
- * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
5278
- * - 'remove': Remove system messages entirely
5279
- *
5280
- * If not specified, the mode is automatically determined based on the model.
5281
- */
5282
- systemMessageMode: import_v423.z.enum(["system", "developer", "remove"]).optional(),
5283
- /**
5284
- * Force treating this model as a reasoning model.
5285
- *
5286
- * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
5287
- * where the model ID is not recognized by the SDK's allowlist.
5288
- *
5289
- * When enabled, the SDK applies reasoning-model parameter compatibility rules
5290
- * and defaults `systemMessageMode` to `developer` unless overridden.
5291
- */
5292
- forceReasoning: import_v423.z.boolean().optional(),
5293
- /**
5294
- * Restrict the callable tools to a subset while keeping the full tools
5295
- * list intact, so prompt caching is preserved across requests with
5296
- * different allowlists.
5297
- *
5298
- * When set, this overrides the request-level `toolChoice` and emits
5299
- * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
5300
- *
5301
- * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5302
- */
5303
- allowedTools: import_v423.z.object({
5304
- toolNames: import_v423.z.array(import_v423.z.string()).min(1),
5305
- mode: import_v423.z.enum(["auto", "required"]).optional()
5306
- }).optional()
5347
+ ).optional(),
5348
+ service_tier: import_v423.z.string().nullish(),
5349
+ reasoning: import_v423.z.object({
5350
+ context: import_v423.z.string().nullish()
5351
+ }).nullish(),
5352
+ incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
5353
+ usage: openaiResponsesUsageSchema.nullish()
5307
5354
  })
5308
5355
  )
5309
5356
  );
@@ -5806,6 +5853,18 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
5806
5853
  }
5807
5854
  return mapping;
5808
5855
  }
5856
+ function getConfigurationUpdateUnsupportedReason({
5857
+ modelCapabilities,
5858
+ options
5859
+ }) {
5860
+ if (!modelCapabilities.supportsConfigurationUpdate) {
5861
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
5862
+ }
5863
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
5864
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
5865
+ }
5866
+ return void 0;
5867
+ }
5809
5868
  var OpenAIResponsesLanguageModel = class {
5810
5869
  constructor(modelId, config) {
5811
5870
  this.specificationVersion = "v3";
@@ -5913,8 +5972,13 @@ var OpenAIResponsesLanguageModel = class {
5913
5972
  customProviderToolNames,
5914
5973
  supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
5915
5974
  });
5975
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
5976
+ modelCapabilities,
5977
+ options: openaiOptions
5978
+ });
5916
5979
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
5917
5980
  prompt,
5981
+ configurationUpdateUnsupportedReason,
5918
5982
  toolNameMapping,
5919
5983
  systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
5920
5984
  providerOptionsName,
@@ -5932,18 +5996,27 @@ var OpenAIResponsesLanguageModel = class {
5932
5996
  });
5933
5997
  warnings.push(...inputWarnings);
5934
5998
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
5935
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
5936
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
5999
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
5937
6000
  warnings.push({
5938
6001
  type: "unsupported",
5939
6002
  feature: "reasoningEffortUpdate",
5940
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
6003
+ details: configurationUpdateUnsupportedReason
5941
6004
  });
5942
6005
  } else if (reasoningEffortUpdate != null) {
5943
- input.unshift({
5944
- type: "configuration_update",
5945
- reasoning: { effort: reasoningEffortUpdate }
5946
- });
6006
+ const firstItem = input[0];
6007
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
6008
+ input.unshift({
6009
+ type: "configuration_update",
6010
+ reasoning: { effort: reasoningEffortUpdate }
6011
+ });
6012
+ }
6013
+ }
6014
+ for (let i = 1; i < input.length; i++) {
6015
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
6016
+ throw new import_provider10.UnsupportedFunctionalityError({
6017
+ functionality: "Adjacent reasoning effort configuration updates"
6018
+ });
6019
+ }
5947
6020
  }
5948
6021
  const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
5949
6022
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -6890,7 +6963,7 @@ var OpenAIResponsesLanguageModel = class {
6890
6963
  };
6891
6964
  } else if (value.item.type === "shell_call_output") {
6892
6965
  } else if (value.item.type === "message") {
6893
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
6966
+ ongoingAnnotations.splice(0);
6894
6967
  activeMessagePhase = (_b2 = value.item.phase) != null ? _b2 : void 0;
6895
6968
  controller.enqueue({
6896
6969
  type: "text-start",
@@ -8132,7 +8205,7 @@ var OpenAITranscriptionModel = class {
8132
8205
  };
8133
8206
 
8134
8207
  // src/version.ts
8135
- var VERSION = true ? "3.0.116" : "0.0.0-test";
8208
+ var VERSION = true ? "3.0.118" : "0.0.0-test";
8136
8209
 
8137
8210
  // src/openai-provider.ts
8138
8211
  function createOpenAI(options = {}) {