@ai-sdk/openai 3.0.117 → 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
@@ -3047,12 +3047,310 @@ function convertOpenAIResponsesUsage(usage) {
3047
3047
 
3048
3048
  // src/responses/convert-to-openai-responses-input.ts
3049
3049
  var import_provider8 = require("@ai-sdk/provider");
3050
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
3050
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
3051
+ var import_v422 = require("zod/v4");
3052
+
3053
+ // src/responses/openai-responses-options.ts
3054
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
3051
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
+ );
3052
3350
 
3053
3351
  // src/responses/expand-parallel-tool-call.ts
3054
3352
  var import_provider7 = require("@ai-sdk/provider");
3055
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
3353
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
3056
3354
  var parallelToolName = "parallel";
3057
3355
  var recipientNamePrefix = "functions.";
3058
3356
  function getParallelToolCallMetadata({
@@ -3081,7 +3379,7 @@ async function expandParallelToolCall({
3081
3379
  if (!isUndeclaredParallelToolCall({ toolName: toolCall.toolName, tools })) {
3082
3380
  return void 0;
3083
3381
  }
3084
- const parsedInput = await (0, import_provider_utils26.safeParseJSON)({ text: toolCall.input });
3382
+ const parsedInput = await (0, import_provider_utils27.safeParseJSON)({ text: toolCall.input });
3085
3383
  if (!parsedInput.success || !(0, import_provider7.isJSONObject)(parsedInput.value)) {
3086
3384
  return void 0;
3087
3385
  }
@@ -3239,7 +3537,7 @@ async function convertFunctionToolResultOutput({
3239
3537
  return void 0;
3240
3538
  }
3241
3539
  }
3242
- }).filter(import_provider_utils27.isNonNullable);
3540
+ }).filter(import_provider_utils28.isNonNullable);
3243
3541
  }
3244
3542
  }
3245
3543
  function hasSameParallelToolCall(first, second) {
@@ -3290,7 +3588,7 @@ function collectCompleteParallelToolResultGroups({
3290
3588
  { length: group.metadata.count },
3291
3589
  (_, index) => group.results.get(index)
3292
3590
  );
3293
- if (results.every(import_provider_utils27.isNonNullable)) {
3591
+ if (results.every(import_provider_utils28.isNonNullable)) {
3294
3592
  completeGroups.set(toolCallId, {
3295
3593
  metadata: group.metadata,
3296
3594
  results
@@ -3329,6 +3627,7 @@ async function convertToOpenAIResponsesInput({
3329
3627
  store,
3330
3628
  hasConversation = false,
3331
3629
  hasPreviousResponseId = false,
3630
+ configurationUpdateUnsupportedReason,
3332
3631
  hasLocalShellTool = false,
3333
3632
  hasShellTool = false,
3334
3633
  hasApplyPatchTool = false,
@@ -3348,6 +3647,33 @@ async function convertToOpenAIResponsesInput({
3348
3647
  for (const { role, content, providerOptions } of prompt) {
3349
3648
  switch (role) {
3350
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
+ }
3351
3677
  switch (systemMessageMode) {
3352
3678
  case "system": {
3353
3679
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -3431,7 +3757,7 @@ async function convertToOpenAIResponsesInput({
3431
3757
  return {
3432
3758
  type: "input_image",
3433
3759
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3434
- 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)}`
3435
3761
  },
3436
3762
  detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b2.imageDetail,
3437
3763
  ...promptCacheBreakpoint != null && {
@@ -3457,7 +3783,7 @@ async function convertToOpenAIResponsesInput({
3457
3783
  type: "input_file",
3458
3784
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3459
3785
  filename: (_c2 = part.filename) != null ? _c2 : mediaType === "application/pdf" ? `part-${index}.pdf` : `part-${index}`,
3460
- 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)}`
3461
3787
  },
3462
3788
  ...promptCacheBreakpoint != null && {
3463
3789
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -3536,10 +3862,10 @@ async function convertToOpenAIResponsesInput({
3536
3862
  input.push({ type: "item_reference", id });
3537
3863
  break;
3538
3864
  }
3539
- 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)({
3540
3866
  text: part.input,
3541
3867
  schema: toolSearchInputSchema
3542
- }) : await (0, import_provider_utils27.validateTypes)({
3868
+ }) : await (0, import_provider_utils28.validateTypes)({
3543
3869
  value: part.input,
3544
3870
  schema: toolSearchInputSchema
3545
3871
  });
@@ -3571,7 +3897,7 @@ async function convertToOpenAIResponsesInput({
3571
3897
  break;
3572
3898
  }
3573
3899
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
3574
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3900
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3575
3901
  value: part.input,
3576
3902
  schema: localShellInputSchema
3577
3903
  });
@@ -3591,7 +3917,7 @@ async function convertToOpenAIResponsesInput({
3591
3917
  break;
3592
3918
  }
3593
3919
  if (hasShellTool && resolvedToolName === "shell") {
3594
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3920
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3595
3921
  value: part.input,
3596
3922
  schema: shellInputSchema
3597
3923
  });
@@ -3609,7 +3935,7 @@ async function convertToOpenAIResponsesInput({
3609
3935
  break;
3610
3936
  }
3611
3937
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
3612
- const parsedInput = await (0, import_provider_utils27.validateTypes)({
3938
+ const parsedInput = await (0, import_provider_utils28.validateTypes)({
3613
3939
  value: part.input,
3614
3940
  schema: applyPatchInputSchema
3615
3941
  });
@@ -3659,7 +3985,7 @@ async function convertToOpenAIResponsesInput({
3659
3985
  if (store) {
3660
3986
  input.push({ type: "item_reference", id: itemId });
3661
3987
  } else if (part.output.type === "json") {
3662
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
3988
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3663
3989
  value: part.output.value,
3664
3990
  schema: toolSearchOutputSchema
3665
3991
  });
@@ -3676,7 +4002,7 @@ async function convertToOpenAIResponsesInput({
3676
4002
  }
3677
4003
  if (hasShellTool && resolvedResultToolName === "shell") {
3678
4004
  if (part.output.type === "json") {
3679
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4005
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3680
4006
  value: part.output.value,
3681
4007
  schema: shellOutputSchema
3682
4008
  });
@@ -3707,7 +4033,7 @@ async function convertToOpenAIResponsesInput({
3707
4033
  break;
3708
4034
  }
3709
4035
  case "reasoning": {
3710
- const providerOptions2 = await (0, import_provider_utils27.parseProviderOptions)({
4036
+ const providerOptions2 = await (0, import_provider_utils28.parseProviderOptions)({
3711
4037
  provider: providerOptionsName,
3712
4038
  providerOptions: part.providerOptions,
3713
4039
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -3872,7 +4198,7 @@ ${text}`,
3872
4198
  part.toolName
3873
4199
  );
3874
4200
  if (part.toolName === toolSearchToolName && output.type === "json") {
3875
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4201
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3876
4202
  value: output.value,
3877
4203
  schema: toolSearchOutputSchema
3878
4204
  });
@@ -3886,7 +4212,7 @@ ${text}`,
3886
4212
  continue;
3887
4213
  }
3888
4214
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3889
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4215
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3890
4216
  value: output.value,
3891
4217
  schema: localShellOutputSchema
3892
4218
  });
@@ -3898,7 +4224,7 @@ ${text}`,
3898
4224
  continue;
3899
4225
  }
3900
4226
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
3901
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4227
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3902
4228
  value: output.value,
3903
4229
  schema: shellOutputSchema
3904
4230
  });
@@ -3917,7 +4243,7 @@ ${text}`,
3917
4243
  continue;
3918
4244
  }
3919
4245
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
3920
- const parsedOutput = await (0, import_provider_utils27.validateTypes)({
4246
+ const parsedOutput = await (0, import_provider_utils28.validateTypes)({
3921
4247
  value: output.value,
3922
4248
  schema: applyPatchOutputSchema
3923
4249
  });
@@ -4015,7 +4341,7 @@ ${text}`,
4015
4341
  });
4016
4342
  return void 0;
4017
4343
  }
4018
- }).filter(import_provider_utils27.isNonNullable);
4344
+ }).filter(import_provider_utils28.isNonNullable);
4019
4345
  break;
4020
4346
  default:
4021
4347
  outputValue = "";
@@ -4064,9 +4390,9 @@ ${text}`,
4064
4390
  }
4065
4391
  return { input, warnings };
4066
4392
  }
4067
- var openaiResponsesReasoningProviderOptionsSchema = import_v421.z.object({
4068
- itemId: import_v421.z.string().nullish(),
4069
- 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()
4070
4396
  });
4071
4397
 
4072
4398
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4088,75 +4414,75 @@ function mapOpenAIResponseFinishReason({
4088
4414
  }
4089
4415
 
4090
4416
  // src/responses/openai-responses-api.ts
4091
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4092
- var import_v422 = require("zod/v4");
4093
- var jsonValueSchema2 = import_v422.z.lazy(
4094
- () => import_v422.z.union([
4095
- import_v422.z.string(),
4096
- import_v422.z.number(),
4097
- import_v422.z.boolean(),
4098
- import_v422.z.null(),
4099
- import_v422.z.array(jsonValueSchema2),
4100
- 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())
4101
4427
  ])
4102
4428
  );
4103
- var jsonObjectSchema = import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional());
4104
- 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(
4105
4431
  jsonObjectSchema,
4106
- import_v422.z.object({
4107
- input_tokens: import_v422.z.number(),
4108
- 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(
4109
4435
  jsonObjectSchema,
4110
- import_v422.z.object({
4111
- cached_tokens: import_v422.z.number().nullish(),
4112
- cache_write_tokens: import_v422.z.number().nullish(),
4113
- orchestration_input_tokens: import_v422.z.number().nullish(),
4114
- 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()
4115
4441
  })
4116
4442
  ).nullish(),
4117
- output_tokens: import_v422.z.number(),
4118
- output_tokens_details: import_v422.z.intersection(
4443
+ output_tokens: import_v423.z.number(),
4444
+ output_tokens_details: import_v423.z.intersection(
4119
4445
  jsonObjectSchema,
4120
- import_v422.z.object({
4121
- reasoning_tokens: import_v422.z.number().nullish(),
4122
- 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()
4123
4449
  })
4124
4450
  ).nullish(),
4125
- total_tokens: import_v422.z.number().optional()
4451
+ total_tokens: import_v423.z.number().optional()
4126
4452
  })
4127
4453
  );
4128
4454
  function isRecord(value) {
4129
4455
  return value != null && typeof value === "object" && !Array.isArray(value);
4130
4456
  }
4131
- var openaiResponsesLocalShellCallSchema = import_v422.z.object({
4132
- type: import_v422.z.literal("local_shell_call"),
4133
- id: import_v422.z.string(),
4134
- call_id: import_v422.z.string(),
4135
- action: import_v422.z.object({
4136
- type: import_v422.z.literal("exec"),
4137
- command: import_v422.z.array(import_v422.z.string()),
4138
- timeout_ms: import_v422.z.number().optional(),
4139
- user: import_v422.z.string().optional(),
4140
- working_directory: import_v422.z.string().optional(),
4141
- 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()
4142
4468
  })
4143
4469
  });
4144
- var openaiResponsesNestedErrorChunkSchema = import_v422.z.object({
4145
- type: import_v422.z.literal("error"),
4146
- sequence_number: import_v422.z.number(),
4147
- error: import_v422.z.object({
4148
- type: import_v422.z.string(),
4149
- code: import_v422.z.string(),
4150
- message: import_v422.z.string(),
4151
- 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()
4152
4478
  })
4153
4479
  });
4154
- var openaiResponsesErrorChunkSchema = import_v422.z.object({
4155
- type: import_v422.z.literal("error"),
4156
- sequence_number: import_v422.z.number(),
4157
- code: import_v422.z.string().nullish(),
4158
- message: import_v422.z.string(),
4159
- 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()
4160
4486
  });
4161
4487
  var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
4162
4488
  "error",
@@ -4212,1102 +4538,819 @@ function isModeledOpenAIResponsesChunk(value) {
4212
4538
  }
4213
4539
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4214
4540
  }
4215
- var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4216
- () => (0, import_provider_utils28.zodSchema)(
4217
- import_v422.z.union([
4218
- import_v422.z.object({
4219
- type: import_v422.z.literal("response.output_text.delta"),
4220
- item_id: import_v422.z.string(),
4221
- delta: import_v422.z.string(),
4222
- logprobs: import_v422.z.array(
4223
- import_v422.z.object({
4224
- token: import_v422.z.string(),
4225
- logprob: import_v422.z.number(),
4226
- top_logprobs: import_v422.z.array(
4227
- import_v422.z.object({
4228
- token: import_v422.z.string(),
4229
- 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()
4230
4556
  })
4231
4557
  )
4232
4558
  })
4233
4559
  ).nullish()
4234
4560
  }),
4235
- import_v422.z.object({
4236
- type: import_v422.z.enum(["response.completed", "response.incomplete"]),
4237
- response: import_v422.z.object({
4238
- 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(),
4239
4565
  usage: openaiResponsesUsageSchema.nullish(),
4240
- reasoning: import_v422.z.object({
4241
- context: import_v422.z.string().nullish()
4566
+ reasoning: import_v423.z.object({
4567
+ context: import_v423.z.string().nullish()
4242
4568
  }).nullish(),
4243
- service_tier: import_v422.z.string().nullish()
4569
+ service_tier: import_v423.z.string().nullish()
4244
4570
  })
4245
4571
  }),
4246
- import_v422.z.object({
4247
- type: import_v422.z.literal("response.failed"),
4248
- sequence_number: import_v422.z.number(),
4249
- response: import_v422.z.object({
4250
- error: import_v422.z.object({
4251
- code: import_v422.z.string().nullish(),
4252
- 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()
4253
4579
  }).nullish(),
4254
- 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(),
4255
4581
  usage: openaiResponsesUsageSchema.nullish(),
4256
- reasoning: import_v422.z.object({
4257
- context: import_v422.z.string().nullish()
4582
+ reasoning: import_v423.z.object({
4583
+ context: import_v423.z.string().nullish()
4258
4584
  }).nullish(),
4259
- service_tier: import_v422.z.string().nullish()
4585
+ service_tier: import_v423.z.string().nullish()
4260
4586
  })
4261
4587
  }),
4262
- import_v422.z.object({
4263
- type: import_v422.z.literal("response.created"),
4264
- response: import_v422.z.object({
4265
- id: import_v422.z.string(),
4266
- created_at: import_v422.z.number(),
4267
- model: import_v422.z.string(),
4268
- 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()
4269
4595
  })
4270
4596
  }),
4271
- import_v422.z.object({
4272
- type: import_v422.z.literal("response.output_item.added"),
4273
- output_index: import_v422.z.number(),
4274
- item: import_v422.z.discriminatedUnion("type", [
4275
- import_v422.z.object({
4276
- type: import_v422.z.literal("message"),
4277
- id: import_v422.z.string(),
4278
- 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()
4279
4605
  }),
4280
- import_v422.z.object({
4281
- type: import_v422.z.literal("reasoning"),
4282
- id: import_v422.z.string(),
4283
- 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()
4284
4610
  }),
4285
- import_v422.z.object({
4286
- type: import_v422.z.literal("function_call"),
4287
- id: import_v422.z.string(),
4288
- call_id: import_v422.z.string(),
4289
- name: import_v422.z.string(),
4290
- arguments: import_v422.z.string(),
4291
- async: import_v422.z.boolean().nullish(),
4292
- 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()
4293
4619
  }),
4294
- import_v422.z.object({
4295
- type: import_v422.z.literal("web_search_call"),
4296
- id: import_v422.z.string(),
4297
- 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()
4298
4624
  }),
4299
- import_v422.z.object({
4300
- type: import_v422.z.literal("computer_call"),
4301
- id: import_v422.z.string(),
4302
- 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()
4303
4629
  }),
4304
- import_v422.z.object({
4305
- type: import_v422.z.literal("file_search_call"),
4306
- 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()
4307
4633
  }),
4308
4634
  openaiResponsesLocalShellCallSchema,
4309
- import_v422.z.object({
4310
- type: import_v422.z.literal("image_generation_call"),
4311
- 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()
4312
4638
  }),
4313
- import_v422.z.object({
4314
- type: import_v422.z.literal("code_interpreter_call"),
4315
- id: import_v422.z.string(),
4316
- container_id: import_v422.z.string(),
4317
- code: import_v422.z.string().nullable(),
4318
- outputs: import_v422.z.array(
4319
- import_v422.z.discriminatedUnion("type", [
4320
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4321
- 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() })
4322
4648
  ])
4323
4649
  ).nullable(),
4324
- status: import_v422.z.string()
4650
+ status: import_v423.z.string()
4325
4651
  }),
4326
- import_v422.z.object({
4327
- type: import_v422.z.literal("mcp_call"),
4328
- id: import_v422.z.string(),
4329
- status: import_v422.z.string(),
4330
- 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()
4331
4657
  }),
4332
- import_v422.z.object({
4333
- type: import_v422.z.literal("mcp_list_tools"),
4334
- 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()
4335
4661
  }),
4336
- import_v422.z.object({
4337
- type: import_v422.z.literal("mcp_approval_request"),
4338
- 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()
4339
4665
  }),
4340
- import_v422.z.object({
4341
- type: import_v422.z.literal("apply_patch_call"),
4342
- id: import_v422.z.string(),
4343
- call_id: import_v422.z.string(),
4344
- status: import_v422.z.enum(["in_progress", "completed"]),
4345
- operation: import_v422.z.discriminatedUnion("type", [
4346
- import_v422.z.object({
4347
- type: import_v422.z.literal("create_file"),
4348
- path: import_v422.z.string(),
4349
- 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()
4350
4676
  }),
4351
- import_v422.z.object({
4352
- type: import_v422.z.literal("delete_file"),
4353
- path: import_v422.z.string()
4677
+ import_v423.z.object({
4678
+ type: import_v423.z.literal("delete_file"),
4679
+ path: import_v423.z.string()
4354
4680
  }),
4355
- import_v422.z.object({
4356
- type: import_v422.z.literal("update_file"),
4357
- path: import_v422.z.string(),
4358
- 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()
4359
4685
  })
4360
4686
  ])
4361
4687
  }),
4362
- import_v422.z.object({
4363
- type: import_v422.z.literal("custom_tool_call"),
4364
- id: import_v422.z.string(),
4365
- call_id: import_v422.z.string(),
4366
- name: import_v422.z.string(),
4367
- input: import_v422.z.string(),
4368
- 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()
4369
4695
  }),
4370
- import_v422.z.object({
4371
- type: import_v422.z.literal("shell_call"),
4372
- id: import_v422.z.string(),
4373
- call_id: import_v422.z.string(),
4374
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4375
- action: import_v422.z.object({
4376
- 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())
4377
4703
  })
4378
4704
  }),
4379
- import_v422.z.object({
4380
- type: import_v422.z.literal("shell_call_output"),
4381
- id: import_v422.z.string(),
4382
- call_id: import_v422.z.string(),
4383
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4384
- output: import_v422.z.array(
4385
- import_v422.z.object({
4386
- stdout: import_v422.z.string(),
4387
- stderr: import_v422.z.string(),
4388
- outcome: import_v422.z.discriminatedUnion("type", [
4389
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4390
- import_v422.z.object({
4391
- type: import_v422.z.literal("exit"),
4392
- 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()
4393
4719
  })
4394
4720
  ])
4395
4721
  })
4396
4722
  )
4397
4723
  }),
4398
- import_v422.z.object({
4399
- type: import_v422.z.literal("tool_search_call"),
4400
- id: import_v422.z.string(),
4401
- execution: import_v422.z.enum(["server", "client"]),
4402
- call_id: import_v422.z.string().nullable(),
4403
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4404
- 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()
4405
4731
  }),
4406
- import_v422.z.object({
4407
- type: import_v422.z.literal("tool_search_output"),
4408
- id: import_v422.z.string(),
4409
- execution: import_v422.z.enum(["server", "client"]),
4410
- call_id: import_v422.z.string().nullable(),
4411
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4412
- 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()))
4413
4739
  })
4414
4740
  ])
4415
4741
  }),
4416
- import_v422.z.object({
4417
- type: import_v422.z.literal("response.output_item.done"),
4418
- output_index: import_v422.z.number(),
4419
- item: import_v422.z.discriminatedUnion("type", [
4420
- import_v422.z.object({
4421
- type: import_v422.z.literal("message"),
4422
- id: import_v422.z.string(),
4423
- 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()
4424
4750
  }),
4425
- import_v422.z.object({
4426
- type: import_v422.z.literal("reasoning"),
4427
- id: import_v422.z.string(),
4428
- 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()
4429
4755
  }),
4430
- import_v422.z.object({
4431
- type: import_v422.z.literal("function_call"),
4432
- id: import_v422.z.string(),
4433
- call_id: import_v422.z.string(),
4434
- name: import_v422.z.string(),
4435
- arguments: import_v422.z.string(),
4436
- async: import_v422.z.boolean().nullish(),
4437
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4438
- 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()
4439
4765
  }),
4440
- import_v422.z.object({
4441
- type: import_v422.z.literal("custom_tool_call"),
4442
- id: import_v422.z.string(),
4443
- call_id: import_v422.z.string(),
4444
- name: import_v422.z.string(),
4445
- input: import_v422.z.string(),
4446
- async: import_v422.z.boolean().nullish(),
4447
- 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"])
4448
4774
  }),
4449
- import_v422.z.object({
4450
- type: import_v422.z.literal("code_interpreter_call"),
4451
- id: import_v422.z.string(),
4452
- code: import_v422.z.string().nullable(),
4453
- container_id: import_v422.z.string(),
4454
- outputs: import_v422.z.array(
4455
- import_v422.z.discriminatedUnion("type", [
4456
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4457
- 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() })
4458
4784
  ])
4459
4785
  ).nullable()
4460
4786
  }),
4461
- import_v422.z.object({
4462
- type: import_v422.z.literal("image_generation_call"),
4463
- id: import_v422.z.string(),
4464
- 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()
4465
4791
  }),
4466
- import_v422.z.object({
4467
- type: import_v422.z.literal("web_search_call"),
4468
- id: import_v422.z.string(),
4469
- status: import_v422.z.string(),
4470
- action: import_v422.z.discriminatedUnion("type", [
4471
- import_v422.z.object({
4472
- type: import_v422.z.literal("search"),
4473
- query: import_v422.z.string().nullish(),
4474
- queries: import_v422.z.array(import_v422.z.string()).nullish(),
4475
- sources: import_v422.z.array(
4476
- import_v422.z.discriminatedUnion("type", [
4477
- import_v422.z.object({ type: import_v422.z.literal("url"), url: import_v422.z.string() }),
4478
- 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() })
4479
4805
  ])
4480
4806
  ).nullish()
4481
4807
  }),
4482
- import_v422.z.object({
4483
- type: import_v422.z.literal("open_page"),
4484
- 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()
4485
4811
  }),
4486
- import_v422.z.object({
4487
- type: import_v422.z.literal("find_in_page"),
4488
- url: import_v422.z.string().nullish(),
4489
- 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()
4490
4816
  })
4491
4817
  ]).nullish()
4492
4818
  }),
4493
- import_v422.z.object({
4494
- type: import_v422.z.literal("file_search_call"),
4495
- id: import_v422.z.string(),
4496
- queries: import_v422.z.array(import_v422.z.string()),
4497
- results: import_v422.z.array(
4498
- import_v422.z.object({
4499
- attributes: import_v422.z.record(
4500
- import_v422.z.string(),
4501
- 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()])
4502
4828
  ),
4503
- file_id: import_v422.z.string(),
4504
- filename: import_v422.z.string(),
4505
- score: import_v422.z.number(),
4506
- 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()
4507
4833
  })
4508
4834
  ).nullish()
4509
4835
  }),
4510
4836
  openaiResponsesLocalShellCallSchema,
4511
- import_v422.z.object({
4512
- type: import_v422.z.literal("computer_call"),
4513
- id: import_v422.z.string(),
4514
- 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")
4515
4841
  }),
4516
- import_v422.z.object({
4517
- type: import_v422.z.literal("mcp_call"),
4518
- id: import_v422.z.string(),
4519
- status: import_v422.z.string(),
4520
- arguments: import_v422.z.string(),
4521
- name: import_v422.z.string(),
4522
- server_label: import_v422.z.string(),
4523
- output: import_v422.z.string().nullish(),
4524
- error: import_v422.z.union([
4525
- import_v422.z.string(),
4526
- import_v422.z.object({
4527
- type: import_v422.z.string().optional(),
4528
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4529
- 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()
4530
4856
  }).loose()
4531
4857
  ]).nullish(),
4532
- approval_request_id: import_v422.z.string().nullish()
4858
+ approval_request_id: import_v423.z.string().nullish()
4533
4859
  }),
4534
- import_v422.z.object({
4535
- type: import_v422.z.literal("mcp_list_tools"),
4536
- id: import_v422.z.string(),
4537
- server_label: import_v422.z.string(),
4538
- tools: import_v422.z.array(
4539
- import_v422.z.object({
4540
- name: import_v422.z.string(),
4541
- description: import_v422.z.string().optional(),
4542
- input_schema: import_v422.z.any(),
4543
- 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()
4544
4870
  })
4545
4871
  ),
4546
- error: import_v422.z.union([
4547
- import_v422.z.string(),
4548
- import_v422.z.object({
4549
- type: import_v422.z.string().optional(),
4550
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4551
- 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()
4552
4878
  }).loose()
4553
4879
  ]).optional()
4554
4880
  }),
4555
- import_v422.z.object({
4556
- type: import_v422.z.literal("mcp_approval_request"),
4557
- id: import_v422.z.string(),
4558
- server_label: import_v422.z.string(),
4559
- name: import_v422.z.string(),
4560
- arguments: import_v422.z.string(),
4561
- 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()
4562
4888
  }),
4563
- import_v422.z.object({
4564
- type: import_v422.z.literal("apply_patch_call"),
4565
- id: import_v422.z.string(),
4566
- call_id: import_v422.z.string(),
4567
- status: import_v422.z.enum(["in_progress", "completed"]),
4568
- operation: import_v422.z.discriminatedUnion("type", [
4569
- import_v422.z.object({
4570
- type: import_v422.z.literal("create_file"),
4571
- path: import_v422.z.string(),
4572
- 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()
4573
4899
  }),
4574
- import_v422.z.object({
4575
- type: import_v422.z.literal("delete_file"),
4576
- path: import_v422.z.string()
4900
+ import_v423.z.object({
4901
+ type: import_v423.z.literal("delete_file"),
4902
+ path: import_v423.z.string()
4577
4903
  }),
4578
- import_v422.z.object({
4579
- type: import_v422.z.literal("update_file"),
4580
- path: import_v422.z.string(),
4581
- 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()
4582
4908
  })
4583
4909
  ])
4584
4910
  }),
4585
- import_v422.z.object({
4586
- type: import_v422.z.literal("shell_call"),
4587
- id: import_v422.z.string(),
4588
- call_id: import_v422.z.string(),
4589
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4590
- action: import_v422.z.object({
4591
- 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())
4592
4918
  })
4593
4919
  }),
4594
- import_v422.z.object({
4595
- type: import_v422.z.literal("shell_call_output"),
4596
- id: import_v422.z.string(),
4597
- call_id: import_v422.z.string(),
4598
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4599
- output: import_v422.z.array(
4600
- import_v422.z.object({
4601
- stdout: import_v422.z.string(),
4602
- stderr: import_v422.z.string(),
4603
- outcome: import_v422.z.discriminatedUnion("type", [
4604
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4605
- import_v422.z.object({
4606
- type: import_v422.z.literal("exit"),
4607
- 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()
4608
4934
  })
4609
4935
  ])
4610
4936
  })
4611
4937
  )
4612
4938
  }),
4613
- import_v422.z.object({
4614
- type: import_v422.z.literal("tool_search_call"),
4615
- id: import_v422.z.string(),
4616
- execution: import_v422.z.enum(["server", "client"]),
4617
- call_id: import_v422.z.string().nullable(),
4618
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4619
- 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()
4620
4946
  }),
4621
- import_v422.z.object({
4622
- type: import_v422.z.literal("tool_search_output"),
4623
- id: import_v422.z.string(),
4624
- execution: import_v422.z.enum(["server", "client"]),
4625
- call_id: import_v422.z.string().nullable(),
4626
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4627
- 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()))
4628
4954
  })
4629
4955
  ])
4630
4956
  }),
4631
- import_v422.z.object({
4632
- type: import_v422.z.literal("response.function_call_arguments.delta"),
4633
- item_id: import_v422.z.string(),
4634
- output_index: import_v422.z.number(),
4635
- 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()
4636
4962
  }),
4637
- import_v422.z.object({
4963
+ import_v423.z.object({
4638
4964
  // `name` is documented as required but omitted from live API events:
4639
4965
  // https://github.com/openai/openai-openapi/issues/545
4640
- type: import_v422.z.literal("response.function_call_arguments.done"),
4641
- item_id: import_v422.z.string(),
4642
- output_index: import_v422.z.number(),
4643
- 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()
4644
4970
  }),
4645
- import_v422.z.object({
4646
- type: import_v422.z.literal("response.custom_tool_call_input.delta"),
4647
- item_id: import_v422.z.string(),
4648
- output_index: import_v422.z.number(),
4649
- 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()
4650
4976
  }),
4651
- import_v422.z.object({
4652
- type: import_v422.z.literal("response.image_generation_call.partial_image"),
4653
- item_id: import_v422.z.string(),
4654
- output_index: import_v422.z.number(),
4655
- 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()
4656
4982
  }),
4657
- import_v422.z.object({
4658
- type: import_v422.z.literal("response.code_interpreter_call_code.delta"),
4659
- item_id: import_v422.z.string(),
4660
- output_index: import_v422.z.number(),
4661
- 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()
4662
4988
  }),
4663
- import_v422.z.object({
4664
- type: import_v422.z.literal("response.code_interpreter_call_code.done"),
4665
- item_id: import_v422.z.string(),
4666
- output_index: import_v422.z.number(),
4667
- 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()
4668
4994
  }),
4669
- import_v422.z.object({
4670
- type: import_v422.z.literal("response.output_text.annotation.added"),
4671
- annotation: import_v422.z.discriminatedUnion("type", [
4672
- import_v422.z.object({
4673
- type: import_v422.z.literal("url_citation"),
4674
- start_index: import_v422.z.number(),
4675
- end_index: import_v422.z.number(),
4676
- url: import_v422.z.string(),
4677
- 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()
4678
5004
  }),
4679
- import_v422.z.object({
4680
- type: import_v422.z.literal("file_citation"),
4681
- file_id: import_v422.z.string(),
4682
- filename: import_v422.z.string(),
4683
- 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()
4684
5010
  }),
4685
- import_v422.z.object({
4686
- type: import_v422.z.literal("container_file_citation"),
4687
- container_id: import_v422.z.string(),
4688
- file_id: import_v422.z.string(),
4689
- filename: import_v422.z.string(),
4690
- start_index: import_v422.z.number(),
4691
- 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()
4692
5018
  }),
4693
- import_v422.z.object({
4694
- type: import_v422.z.literal("file_path"),
4695
- file_id: import_v422.z.string(),
4696
- 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()
4697
5023
  })
4698
5024
  ])
4699
5025
  }),
4700
- import_v422.z.object({
4701
- type: import_v422.z.literal("response.reasoning_summary_part.added"),
4702
- item_id: import_v422.z.string(),
4703
- summary_index: import_v422.z.number()
4704
- }),
4705
- import_v422.z.object({
4706
- type: import_v422.z.literal("response.reasoning_summary_text.delta"),
4707
- item_id: import_v422.z.string(),
4708
- summary_index: import_v422.z.number(),
4709
- delta: import_v422.z.string()
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()
4710
5030
  }),
4711
- import_v422.z.object({
4712
- type: import_v422.z.literal("response.reasoning_summary_part.done"),
4713
- item_id: import_v422.z.string(),
4714
- summary_index: import_v422.z.number()
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()
4715
5036
  }),
4716
- import_v422.z.object({
4717
- type: import_v422.z.literal("response.apply_patch_call_operation_diff.delta"),
4718
- item_id: import_v422.z.string(),
4719
- output_index: import_v422.z.number(),
4720
- delta: import_v422.z.string(),
4721
- obfuscation: import_v422.z.string().nullish()
4722
- }),
4723
- import_v422.z.object({
4724
- type: import_v422.z.literal("response.apply_patch_call_operation_diff.done"),
4725
- item_id: import_v422.z.string(),
4726
- output_index: import_v422.z.number(),
4727
- diff: import_v422.z.string()
4728
- }),
4729
- openaiResponsesNestedErrorChunkSchema,
4730
- openaiResponsesErrorChunkSchema,
4731
- import_v422.z.object({ type: import_v422.z.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
4732
- message: "Known response chunk failed schema validation"
4733
- }).transform((value) => ({
4734
- type: "unknown_chunk",
4735
- message: value.type
4736
- }))
4737
- // fallback for unknown chunks
4738
- ])
4739
- )
4740
- );
4741
- var openaiResponsesResponseSchema = (0, import_provider_utils28.lazySchema)(
4742
- () => (0, import_provider_utils28.zodSchema)(
4743
- import_v422.z.object({
4744
- id: import_v422.z.string().optional(),
4745
- created_at: import_v422.z.number().optional(),
4746
- error: import_v422.z.object({
4747
- message: import_v422.z.string(),
4748
- type: import_v422.z.string(),
4749
- param: import_v422.z.string().nullish(),
4750
- code: import_v422.z.string()
4751
- }).nullish(),
4752
- model: import_v422.z.string().optional(),
4753
- output: import_v422.z.array(
4754
- import_v422.z.discriminatedUnion("type", [
4755
- import_v422.z.object({
4756
- type: import_v422.z.literal("message"),
4757
- role: import_v422.z.literal("assistant"),
4758
- id: import_v422.z.string(),
4759
- phase: import_v422.z.enum(["commentary", "final_answer"]).nullish(),
4760
- content: import_v422.z.array(
4761
- import_v422.z.object({
4762
- type: import_v422.z.literal("output_text"),
4763
- text: import_v422.z.string(),
4764
- logprobs: import_v422.z.array(
4765
- import_v422.z.object({
4766
- token: import_v422.z.string(),
4767
- logprob: import_v422.z.number(),
4768
- top_logprobs: import_v422.z.array(
4769
- import_v422.z.object({
4770
- token: import_v422.z.string(),
4771
- logprob: import_v422.z.number()
4772
- })
4773
- )
4774
- })
4775
- ).nullish(),
4776
- annotations: import_v422.z.array(
4777
- import_v422.z.discriminatedUnion("type", [
4778
- import_v422.z.object({
4779
- type: import_v422.z.literal("url_citation"),
4780
- start_index: import_v422.z.number(),
4781
- end_index: import_v422.z.number(),
4782
- url: import_v422.z.string(),
4783
- title: import_v422.z.string()
4784
- }),
4785
- import_v422.z.object({
4786
- type: import_v422.z.literal("file_citation"),
4787
- file_id: import_v422.z.string(),
4788
- filename: import_v422.z.string(),
4789
- index: import_v422.z.number()
4790
- }),
4791
- import_v422.z.object({
4792
- type: import_v422.z.literal("container_file_citation"),
4793
- container_id: import_v422.z.string(),
4794
- file_id: import_v422.z.string(),
4795
- filename: import_v422.z.string(),
4796
- start_index: import_v422.z.number(),
4797
- end_index: import_v422.z.number()
4798
- }),
4799
- import_v422.z.object({
4800
- type: import_v422.z.literal("file_path"),
4801
- file_id: import_v422.z.string(),
4802
- index: import_v422.z.number()
4803
- })
4804
- ])
4805
- )
4806
- })
4807
- )
4808
- }),
4809
- import_v422.z.object({
4810
- type: import_v422.z.literal("web_search_call"),
4811
- id: import_v422.z.string(),
4812
- status: import_v422.z.string(),
4813
- action: import_v422.z.discriminatedUnion("type", [
4814
- import_v422.z.object({
4815
- type: import_v422.z.literal("search"),
4816
- query: import_v422.z.string().nullish(),
4817
- queries: import_v422.z.array(import_v422.z.string()).nullish(),
4818
- sources: import_v422.z.array(
4819
- import_v422.z.discriminatedUnion("type", [
4820
- import_v422.z.object({ type: import_v422.z.literal("url"), url: import_v422.z.string() }),
4821
- import_v422.z.object({
4822
- type: import_v422.z.literal("api"),
4823
- name: import_v422.z.string()
4824
- })
4825
- ])
4826
- ).nullish()
4827
- }),
4828
- import_v422.z.object({
4829
- type: import_v422.z.literal("open_page"),
4830
- url: import_v422.z.string().nullish()
4831
- }),
4832
- import_v422.z.object({
4833
- type: import_v422.z.literal("find_in_page"),
4834
- url: import_v422.z.string().nullish(),
4835
- pattern: import_v422.z.string().nullish()
4836
- })
4837
- ]).nullish()
4838
- }),
4839
- import_v422.z.object({
4840
- type: import_v422.z.literal("file_search_call"),
4841
- id: import_v422.z.string(),
4842
- queries: import_v422.z.array(import_v422.z.string()),
4843
- results: import_v422.z.array(
4844
- import_v422.z.object({
4845
- attributes: import_v422.z.record(
4846
- import_v422.z.string(),
4847
- import_v422.z.union([import_v422.z.string(), import_v422.z.number(), import_v422.z.boolean()])
4848
- ),
4849
- file_id: import_v422.z.string(),
4850
- filename: import_v422.z.string(),
4851
- score: import_v422.z.number(),
4852
- text: import_v422.z.string()
4853
- })
4854
- ).nullish()
4855
- }),
4856
- import_v422.z.object({
4857
- type: import_v422.z.literal("code_interpreter_call"),
4858
- id: import_v422.z.string(),
4859
- code: import_v422.z.string().nullable(),
4860
- container_id: import_v422.z.string(),
4861
- outputs: import_v422.z.array(
4862
- import_v422.z.discriminatedUnion("type", [
4863
- import_v422.z.object({ type: import_v422.z.literal("logs"), logs: import_v422.z.string() }),
4864
- import_v422.z.object({ type: import_v422.z.literal("image"), url: import_v422.z.string() })
4865
- ])
4866
- ).nullable()
4867
- }),
4868
- import_v422.z.object({
4869
- type: import_v422.z.literal("image_generation_call"),
4870
- id: import_v422.z.string(),
4871
- result: import_v422.z.string()
4872
- }),
4873
- openaiResponsesLocalShellCallSchema,
4874
- import_v422.z.object({
4875
- type: import_v422.z.literal("function_call"),
4876
- call_id: import_v422.z.string(),
4877
- name: import_v422.z.string(),
4878
- arguments: import_v422.z.string(),
4879
- id: import_v422.z.string(),
4880
- async: import_v422.z.boolean().nullish(),
4881
- namespace: import_v422.z.string().nullish()
4882
- }),
4883
- import_v422.z.object({
4884
- type: import_v422.z.literal("custom_tool_call"),
4885
- call_id: import_v422.z.string(),
4886
- name: import_v422.z.string(),
4887
- input: import_v422.z.string(),
4888
- id: import_v422.z.string(),
4889
- async: import_v422.z.boolean().nullish()
4890
- }),
4891
- import_v422.z.object({
4892
- type: import_v422.z.literal("computer_call"),
4893
- id: import_v422.z.string(),
4894
- status: import_v422.z.string().optional()
4895
- }),
4896
- import_v422.z.object({
4897
- type: import_v422.z.literal("reasoning"),
4898
- id: import_v422.z.string(),
4899
- encrypted_content: import_v422.z.string().nullish(),
4900
- summary: import_v422.z.array(
4901
- import_v422.z.object({
4902
- type: import_v422.z.literal("summary_text"),
4903
- text: import_v422.z.string()
4904
- })
4905
- )
4906
- }),
4907
- import_v422.z.object({
4908
- type: import_v422.z.literal("mcp_call"),
4909
- id: import_v422.z.string(),
4910
- status: import_v422.z.string(),
4911
- arguments: import_v422.z.string(),
4912
- name: import_v422.z.string(),
4913
- server_label: import_v422.z.string(),
4914
- output: import_v422.z.string().nullish(),
4915
- error: import_v422.z.union([
4916
- import_v422.z.string(),
4917
- import_v422.z.object({
4918
- type: import_v422.z.string().optional(),
4919
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4920
- message: import_v422.z.string().optional()
4921
- }).loose()
4922
- ]).nullish(),
4923
- approval_request_id: import_v422.z.string().nullish()
4924
- }),
4925
- import_v422.z.object({
4926
- type: import_v422.z.literal("mcp_list_tools"),
4927
- id: import_v422.z.string(),
4928
- server_label: import_v422.z.string(),
4929
- tools: import_v422.z.array(
4930
- import_v422.z.object({
4931
- name: import_v422.z.string(),
4932
- description: import_v422.z.string().optional(),
4933
- input_schema: import_v422.z.any(),
4934
- annotations: import_v422.z.record(import_v422.z.string(), import_v422.z.unknown()).optional()
4935
- })
4936
- ),
4937
- error: import_v422.z.union([
4938
- import_v422.z.string(),
4939
- import_v422.z.object({
4940
- type: import_v422.z.string().optional(),
4941
- code: import_v422.z.union([import_v422.z.number(), import_v422.z.string()]).optional(),
4942
- message: import_v422.z.string().optional()
4943
- }).loose()
4944
- ]).optional()
4945
- }),
4946
- import_v422.z.object({
4947
- type: import_v422.z.literal("mcp_approval_request"),
4948
- id: import_v422.z.string(),
4949
- server_label: import_v422.z.string(),
4950
- name: import_v422.z.string(),
4951
- arguments: import_v422.z.string(),
4952
- approval_request_id: import_v422.z.string().optional()
4953
- }),
4954
- import_v422.z.object({
4955
- type: import_v422.z.literal("apply_patch_call"),
4956
- id: import_v422.z.string(),
4957
- call_id: import_v422.z.string(),
4958
- status: import_v422.z.enum(["in_progress", "completed"]),
4959
- operation: import_v422.z.discriminatedUnion("type", [
4960
- import_v422.z.object({
4961
- type: import_v422.z.literal("create_file"),
4962
- path: import_v422.z.string(),
4963
- diff: import_v422.z.string()
4964
- }),
4965
- import_v422.z.object({
4966
- type: import_v422.z.literal("delete_file"),
4967
- path: import_v422.z.string()
4968
- }),
4969
- import_v422.z.object({
4970
- type: import_v422.z.literal("update_file"),
4971
- path: import_v422.z.string(),
4972
- diff: import_v422.z.string()
4973
- })
4974
- ])
4975
- }),
4976
- import_v422.z.object({
4977
- type: import_v422.z.literal("shell_call"),
4978
- id: import_v422.z.string(),
4979
- call_id: import_v422.z.string(),
4980
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4981
- action: import_v422.z.object({
4982
- commands: import_v422.z.array(import_v422.z.string())
4983
- })
4984
- }),
4985
- import_v422.z.object({
4986
- type: import_v422.z.literal("shell_call_output"),
4987
- id: import_v422.z.string(),
4988
- call_id: import_v422.z.string(),
4989
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
4990
- output: import_v422.z.array(
4991
- import_v422.z.object({
4992
- stdout: import_v422.z.string(),
4993
- stderr: import_v422.z.string(),
4994
- outcome: import_v422.z.discriminatedUnion("type", [
4995
- import_v422.z.object({ type: import_v422.z.literal("timeout") }),
4996
- import_v422.z.object({
4997
- type: import_v422.z.literal("exit"),
4998
- exit_code: import_v422.z.number()
4999
- })
5000
- ])
5001
- })
5002
- )
5003
- }),
5004
- import_v422.z.object({
5005
- type: import_v422.z.literal("tool_search_call"),
5006
- id: import_v422.z.string(),
5007
- execution: import_v422.z.enum(["server", "client"]),
5008
- call_id: import_v422.z.string().nullable(),
5009
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
5010
- arguments: import_v422.z.unknown()
5011
- }),
5012
- import_v422.z.object({
5013
- type: import_v422.z.literal("tool_search_output"),
5014
- id: import_v422.z.string(),
5015
- execution: import_v422.z.enum(["server", "client"]),
5016
- call_id: import_v422.z.string().nullable(),
5017
- status: import_v422.z.enum(["in_progress", "completed", "incomplete"]),
5018
- tools: import_v422.z.array(import_v422.z.record(import_v422.z.string(), jsonValueSchema2.optional()))
5019
- })
5020
- ])
5021
- ).optional(),
5022
- service_tier: import_v422.z.string().nullish(),
5023
- reasoning: import_v422.z.object({
5024
- context: import_v422.z.string().nullish()
5025
- }).nullish(),
5026
- incomplete_details: import_v422.z.object({ reason: import_v422.z.string() }).nullish(),
5027
- usage: openaiResponsesUsageSchema.nullish()
5028
- })
5029
- )
5030
- );
5031
-
5032
- // src/responses/openai-responses-options.ts
5033
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
5034
- var import_v423 = require("zod/v4");
5035
- var TOP_LOGPROBS_MAX = 20;
5036
- var openaiResponsesReasoningModelIds = [
5037
- "o1",
5038
- "o1-2024-12-17",
5039
- "o3",
5040
- "o3-2025-04-16",
5041
- "o3-mini",
5042
- "o3-mini-2025-01-31",
5043
- "o4-mini",
5044
- "o4-mini-2025-04-16",
5045
- "gpt-5",
5046
- "gpt-5-2025-08-07",
5047
- "gpt-5-codex",
5048
- "gpt-5-mini",
5049
- "gpt-5-mini-2025-08-07",
5050
- "gpt-5-nano",
5051
- "gpt-5-nano-2025-08-07",
5052
- "gpt-5-pro",
5053
- "gpt-5-pro-2025-10-06",
5054
- "gpt-5.1",
5055
- "gpt-5.1-chat-latest",
5056
- "gpt-5.1-codex-mini",
5057
- "gpt-5.1-codex",
5058
- "gpt-5.1-codex-max",
5059
- "gpt-5.2",
5060
- "gpt-5.2-chat-latest",
5061
- "gpt-5.2-pro",
5062
- "gpt-5.2-codex",
5063
- "gpt-5.3-chat-latest",
5064
- "gpt-5.3-codex",
5065
- "gpt-5.4",
5066
- "gpt-5.4-2026-03-05",
5067
- "gpt-5.4-mini",
5068
- "gpt-5.4-mini-2026-03-17",
5069
- "gpt-5.4-nano",
5070
- "gpt-5.4-nano-2026-03-17",
5071
- "gpt-5.4-pro",
5072
- "gpt-5.4-pro-2026-03-05",
5073
- "gpt-5.5",
5074
- "gpt-5.5-2026-04-23",
5075
- "gpt-5.6",
5076
- "gpt-5.6-luna",
5077
- "gpt-5.6-sol",
5078
- "gpt-5.6-terra",
5079
- "gpt-6-astra",
5080
- "gpt-6-luna",
5081
- "gpt-6-sol"
5082
- ];
5083
- var openaiResponsesModelIds = [
5084
- "gpt-4.1",
5085
- "gpt-4.1-2025-04-14",
5086
- "gpt-4.1-mini",
5087
- "gpt-4.1-mini-2025-04-14",
5088
- "gpt-4.1-nano",
5089
- "gpt-4.1-nano-2025-04-14",
5090
- "gpt-4o",
5091
- "gpt-4o-2024-05-13",
5092
- "gpt-4o-2024-08-06",
5093
- "gpt-4o-2024-11-20",
5094
- "gpt-4o-audio-preview",
5095
- "gpt-4o-audio-preview-2024-12-17",
5096
- "gpt-4o-search-preview",
5097
- "gpt-4o-search-preview-2025-03-11",
5098
- "gpt-4o-mini-search-preview",
5099
- "gpt-4o-mini-search-preview-2025-03-11",
5100
- "gpt-4o-mini",
5101
- "gpt-4o-mini-2024-07-18",
5102
- "gpt-3.5-turbo-0125",
5103
- "gpt-3.5-turbo",
5104
- "gpt-3.5-turbo-1106",
5105
- "gpt-5-chat-latest",
5106
- ...openaiResponsesReasoningModelIds
5107
- ];
5108
- 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)(
5109
5068
  () => (0, import_provider_utils29.zodSchema)(
5110
5069
  import_v423.z.object({
5111
- /**
5112
- * The ID of the OpenAI Conversation to continue.
5113
- * You must create a conversation first via the OpenAI API.
5114
- * Cannot be used in conjunction with `previousResponseId`.
5115
- * Defaults to `undefined`.
5116
- * @see https://platform.openai.com/docs/api-reference/conversations/create
5117
- */
5118
- conversation: import_v423.z.string().nullish(),
5119
- /**
5120
- * The set of extra fields to include in the response (advanced, usually not needed).
5121
- * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5122
- */
5123
- include: import_v423.z.array(
5124
- import_v423.z.enum([
5125
- "reasoning.encrypted_content",
5126
- // handled internally by default, only needed for unknown reasoning models
5127
- "file_search_call.results",
5128
- "web_search_call.results",
5129
- "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
+ })
5130
5346
  ])
5131
- ).nullish(),
5132
- /**
5133
- * Instructions for the model.
5134
- * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5135
- * Defaults to `undefined`.
5136
- */
5137
- instructions: import_v423.z.string().nullish(),
5138
- /**
5139
- * Return the log probabilities of the tokens. Including logprobs will increase
5140
- * the response size and can slow down response times. However, it can
5141
- * be useful to better understand how the model is behaving.
5142
- *
5143
- * Setting to true will return the log probabilities of the tokens that
5144
- * were generated.
5145
- *
5146
- * Setting to a number will return the log probabilities of the top n
5147
- * tokens that were generated.
5148
- *
5149
- * @see https://platform.openai.com/docs/api-reference/responses/create
5150
- * @see https://cookbook.openai.com/examples/using_logprobs
5151
- */
5152
- logprobs: import_v423.z.union([import_v423.z.boolean(), import_v423.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5153
- /**
5154
- * The maximum number of total calls to built-in tools that can be processed in a response.
5155
- * This maximum number applies across all built-in tool calls, not per individual tool.
5156
- * Any further attempts to call a tool by the model will be ignored.
5157
- */
5158
- maxToolCalls: import_v423.z.number().nullish(),
5159
- /**
5160
- * Additional metadata to store with the generation.
5161
- */
5162
- metadata: import_v423.z.any().nullish(),
5163
- /**
5164
- * Whether to use parallel tool calls. Defaults to `true`.
5165
- */
5166
- parallelToolCalls: import_v423.z.boolean().nullish(),
5167
- /**
5168
- * The ID of the previous response. You can use it to continue a conversation.
5169
- * Defaults to `undefined`.
5170
- */
5171
- previousResponseId: import_v423.z.string().nullish(),
5172
- /**
5173
- * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5174
- */
5175
- promptCacheKey: import_v423.z.string().nullish(),
5176
- /**
5177
- * Prompt cache behavior for GPT-5.6 and later models.
5178
- * `mode` controls whether OpenAI also places an implicit breakpoint.
5179
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5180
- */
5181
- promptCacheOptions: import_v423.z.object({
5182
- mode: import_v423.z.enum(["implicit", "explicit"]).optional(),
5183
- ttl: import_v423.z.literal("30m").optional()
5184
- }).optional(),
5185
- /**
5186
- * The retention policy for the prompt cache.
5187
- * - 'in_memory': Default. Standard prompt caching behavior.
5188
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
5189
- * Available for models before GPT-5.6 that support extended caching.
5190
- *
5191
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
5192
- *
5193
- * @default 'in_memory'
5194
- */
5195
- promptCacheRetention: import_v423.z.enum(["in_memory", "24h"]).nullish(),
5196
- /**
5197
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5198
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5199
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5200
- * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5201
- * Supported values vary by model.
5202
- */
5203
- reasoningEffort: import_v423.z.string().nullish(),
5204
- /**
5205
- * Updates the reasoning effort for GPT-6 and later models starting with this response
5206
- * without changing the request-level reasoning effort. This preserves the
5207
- * request prefix for prompt caching.
5208
- *
5209
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
5210
- * combined with automatic truncation.
5211
- */
5212
- reasoningEffortUpdate: import_v423.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5213
- /**
5214
- * Controls how much model work GPT-5.6 performs before returning a final answer.
5215
- * `standard` is the default. `pro` increases quality, latency, and token usage.
5216
- */
5217
- reasoningMode: import_v423.z.enum(["standard", "pro"]).optional(),
5218
- /**
5219
- * Controls which available reasoning items GPT-5.6 can use.
5220
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5221
- * turns, and `all_turns` makes compatible earlier reasoning available.
5222
- */
5223
- reasoningContext: import_v423.z.enum(["auto", "current_turn", "all_turns"]).optional(),
5224
- /**
5225
- * Controls reasoning summary output from the model.
5226
- * Set to "auto" to automatically receive the richest level available,
5227
- * or "detailed" for comprehensive summaries.
5228
- */
5229
- reasoningSummary: import_v423.z.string().nullish(),
5230
- /**
5231
- * The identifier for safety monitoring and tracking.
5232
- */
5233
- safetyIdentifier: import_v423.z.string().nullish(),
5234
- /**
5235
- * Service tier for the request.
5236
- * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
5237
- * 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).
5238
- * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
5239
- *
5240
- * Defaults to 'auto'.
5241
- */
5242
- serviceTier: import_v423.z.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
5243
- /**
5244
- * Whether to store the generation. Defaults to `true`.
5245
- */
5246
- store: import_v423.z.boolean().nullish(),
5247
- /**
5248
- * Whether to pass through non-image file types as generic input files.
5249
- *
5250
- * By default, inline file inputs are restricted to images and PDFs.
5251
- * Enable this when the target OpenAI Responses model supports additional
5252
- * file media types, such as text/csv.
5253
- */
5254
- passThroughUnsupportedFiles: import_v423.z.boolean().optional(),
5255
- /**
5256
- * Whether to use strict JSON schema validation.
5257
- * Defaults to `true`.
5258
- */
5259
- strictJsonSchema: import_v423.z.boolean().nullish(),
5260
- /**
5261
- * Controls the verbosity of the model's responses. Lower values ('low') will result
5262
- * in more concise responses, while higher values ('high') will result in more verbose responses.
5263
- * Valid values: 'low', 'medium', 'high'.
5264
- */
5265
- textVerbosity: import_v423.z.enum(["low", "medium", "high"]).nullish(),
5266
- /**
5267
- * Controls output truncation. 'auto' (default) performs truncation automatically;
5268
- * 'disabled' turns truncation off.
5269
- */
5270
- truncation: import_v423.z.enum(["auto", "disabled"]).nullish(),
5271
- /**
5272
- * A unique identifier representing your end-user, which can help OpenAI to
5273
- * monitor and detect abuse.
5274
- * Defaults to `undefined`.
5275
- * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5276
- */
5277
- user: import_v423.z.string().nullish(),
5278
- /**
5279
- * Override the system message mode for this model.
5280
- * - 'system': Use the 'system' role for system messages (default for most models)
5281
- * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
5282
- * - 'remove': Remove system messages entirely
5283
- *
5284
- * If not specified, the mode is automatically determined based on the model.
5285
- */
5286
- systemMessageMode: import_v423.z.enum(["system", "developer", "remove"]).optional(),
5287
- /**
5288
- * Force treating this model as a reasoning model.
5289
- *
5290
- * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
5291
- * where the model ID is not recognized by the SDK's allowlist.
5292
- *
5293
- * When enabled, the SDK applies reasoning-model parameter compatibility rules
5294
- * and defaults `systemMessageMode` to `developer` unless overridden.
5295
- */
5296
- forceReasoning: import_v423.z.boolean().optional(),
5297
- /**
5298
- * Restrict the callable tools to a subset while keeping the full tools
5299
- * list intact, so prompt caching is preserved across requests with
5300
- * different allowlists.
5301
- *
5302
- * When set, this overrides the request-level `toolChoice` and emits
5303
- * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
5304
- *
5305
- * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5306
- */
5307
- allowedTools: import_v423.z.object({
5308
- toolNames: import_v423.z.array(import_v423.z.string()).min(1),
5309
- mode: import_v423.z.enum(["auto", "required"]).optional()
5310
- }).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()
5311
5354
  })
5312
5355
  )
5313
5356
  );
@@ -5810,6 +5853,18 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
5810
5853
  }
5811
5854
  return mapping;
5812
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
+ }
5813
5868
  var OpenAIResponsesLanguageModel = class {
5814
5869
  constructor(modelId, config) {
5815
5870
  this.specificationVersion = "v3";
@@ -5917,8 +5972,13 @@ var OpenAIResponsesLanguageModel = class {
5917
5972
  customProviderToolNames,
5918
5973
  supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
5919
5974
  });
5975
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
5976
+ modelCapabilities,
5977
+ options: openaiOptions
5978
+ });
5920
5979
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
5921
5980
  prompt,
5981
+ configurationUpdateUnsupportedReason,
5922
5982
  toolNameMapping,
5923
5983
  systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
5924
5984
  providerOptionsName,
@@ -5936,18 +5996,27 @@ var OpenAIResponsesLanguageModel = class {
5936
5996
  });
5937
5997
  warnings.push(...inputWarnings);
5938
5998
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
5939
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
5940
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
5999
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
5941
6000
  warnings.push({
5942
6001
  type: "unsupported",
5943
6002
  feature: "reasoningEffortUpdate",
5944
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
6003
+ details: configurationUpdateUnsupportedReason
5945
6004
  });
5946
6005
  } else if (reasoningEffortUpdate != null) {
5947
- input.unshift({
5948
- type: "configuration_update",
5949
- reasoning: { effort: reasoningEffortUpdate }
5950
- });
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
+ }
5951
6020
  }
5952
6021
  const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
5953
6022
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -8136,7 +8205,7 @@ var OpenAITranscriptionModel = class {
8136
8205
  };
8137
8206
 
8138
8207
  // src/version.ts
8139
- var VERSION = true ? "3.0.117" : "0.0.0-test";
8208
+ var VERSION = true ? "3.0.118" : "0.0.0-test";
8140
8209
 
8141
8210
  // src/openai-provider.ts
8142
8211
  function createOpenAI(options = {}) {