@ai-sdk/openai 3.0.116 → 3.0.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,7 +145,8 @@ function createOpenAIStreamError({
145
145
  statusCode: streamError == null ? 500 : getStatusCode(streamError),
146
146
  responseHeaders,
147
147
  responseBody: JSON.stringify(frame),
148
- data: frame
148
+ data: frame,
149
+ isRetryable: streamError == null ? true : isRetryableStreamError(streamError, getStatusCode(streamError))
149
150
  });
150
151
  }
151
152
  function parseStreamError(frame) {
@@ -564,6 +565,9 @@ var openaiChatResponseSchema = lazySchema(
564
565
  message: z2.object({
565
566
  role: z2.literal("assistant").nullish(),
566
567
  content: z2.string().nullish(),
568
+ audio: z2.object({
569
+ transcript: z2.string().nullish()
570
+ }).nullish(),
567
571
  tool_calls: z2.array(
568
572
  z2.object({
569
573
  id: z2.string().nullish(),
@@ -1108,7 +1112,7 @@ var OpenAIChatLanguageModel = class {
1108
1112
  };
1109
1113
  }
1110
1114
  async doGenerate(options) {
1111
- var _a2, _b, _c, _d, _e, _f, _g;
1115
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1112
1116
  const { args: body, warnings } = await this.getArgs(options);
1113
1117
  const {
1114
1118
  responseHeaders,
@@ -1136,19 +1140,19 @@ var OpenAIChatLanguageModel = class {
1136
1140
  });
1137
1141
  }
1138
1142
  const content = [];
1139
- const text = choice.message.content;
1143
+ const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
1140
1144
  if (text != null && text.length > 0) {
1141
1145
  content.push({ type: "text", text });
1142
1146
  }
1143
- for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
1147
+ for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
1144
1148
  content.push({
1145
1149
  type: "tool-call",
1146
- toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
1150
+ toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
1147
1151
  toolName: toolCall.function.name,
1148
1152
  input: toolCall.function.arguments
1149
1153
  });
1150
1154
  }
1151
- for (const annotation of (_c = choice.message.annotations) != null ? _c : []) {
1155
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
1152
1156
  content.push({
1153
1157
  type: "source",
1154
1158
  sourceType: "url",
@@ -1157,8 +1161,8 @@ var OpenAIChatLanguageModel = class {
1157
1161
  title: annotation.url_citation.title
1158
1162
  });
1159
1163
  }
1160
- const completionTokenDetails = (_d = response.usage) == null ? void 0 : _d.completion_tokens_details;
1161
- const promptTokenDetails = (_e = response.usage) == null ? void 0 : _e.prompt_tokens_details;
1164
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
1165
+ const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
1162
1166
  const providerMetadata = { openai: {} };
1163
1167
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
1164
1168
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -1166,14 +1170,14 @@ var OpenAIChatLanguageModel = class {
1166
1170
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
1167
1171
  providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
1168
1172
  }
1169
- if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
1173
+ if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
1170
1174
  providerMetadata.openai.logprobs = choice.logprobs.content;
1171
1175
  }
1172
1176
  return {
1173
1177
  content,
1174
1178
  finishReason: {
1175
1179
  unified: mapOpenAIFinishReason(choice.finish_reason),
1176
- raw: (_g = choice.finish_reason) != null ? _g : void 0
1180
+ raw: (_h = choice.finish_reason) != null ? _h : void 0
1177
1181
  },
1178
1182
  usage: convertOpenAIChatUsage(response.usage),
1179
1183
  request: { body },
@@ -2752,6 +2756,7 @@ var OpenAISpeechModel = class {
2752
2756
 
2753
2757
  // src/responses/openai-responses-language-model.ts
2754
2758
  import {
2759
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
2755
2760
  APICallError as APICallError2
2756
2761
  } from "@ai-sdk/provider";
2757
2762
  import {
@@ -2815,47 +2820,348 @@ import {
2815
2820
  parseProviderOptions as parseProviderOptions7,
2816
2821
  validateTypes
2817
2822
  } from "@ai-sdk/provider-utils";
2818
- import { z as z17 } from "zod/v4";
2823
+ import { z as z18 } from "zod/v4";
2819
2824
 
2820
- // src/tool/apply-patch.ts
2825
+ // src/responses/openai-responses-options.ts
2821
2826
  import {
2822
- createProviderToolFactoryWithOutputSchema,
2823
2827
  lazySchema as lazySchema12,
2824
2828
  zodSchema as zodSchema12
2825
2829
  } from "@ai-sdk/provider-utils";
2826
2830
  import { z as z13 } from "zod/v4";
2827
- var applyPatchInputSchema = lazySchema12(
2831
+ var TOP_LOGPROBS_MAX = 20;
2832
+ var openaiResponsesReasoningModelIds = [
2833
+ "o1",
2834
+ "o1-2024-12-17",
2835
+ "o3",
2836
+ "o3-2025-04-16",
2837
+ "o3-mini",
2838
+ "o3-mini-2025-01-31",
2839
+ "o4-mini",
2840
+ "o4-mini-2025-04-16",
2841
+ "gpt-5",
2842
+ "gpt-5-2025-08-07",
2843
+ "gpt-5-codex",
2844
+ "gpt-5-mini",
2845
+ "gpt-5-mini-2025-08-07",
2846
+ "gpt-5-nano",
2847
+ "gpt-5-nano-2025-08-07",
2848
+ "gpt-5-pro",
2849
+ "gpt-5-pro-2025-10-06",
2850
+ "gpt-5.1",
2851
+ "gpt-5.1-chat-latest",
2852
+ "gpt-5.1-codex-mini",
2853
+ "gpt-5.1-codex",
2854
+ "gpt-5.1-codex-max",
2855
+ "gpt-5.2",
2856
+ "gpt-5.2-chat-latest",
2857
+ "gpt-5.2-pro",
2858
+ "gpt-5.2-codex",
2859
+ "gpt-5.3-chat-latest",
2860
+ "gpt-5.3-codex",
2861
+ "gpt-5.4",
2862
+ "gpt-5.4-2026-03-05",
2863
+ "gpt-5.4-mini",
2864
+ "gpt-5.4-mini-2026-03-17",
2865
+ "gpt-5.4-nano",
2866
+ "gpt-5.4-nano-2026-03-17",
2867
+ "gpt-5.4-pro",
2868
+ "gpt-5.4-pro-2026-03-05",
2869
+ "gpt-5.5",
2870
+ "gpt-5.5-2026-04-23",
2871
+ "gpt-5.6",
2872
+ "gpt-5.6-luna",
2873
+ "gpt-5.6-sol",
2874
+ "gpt-5.6-terra",
2875
+ "gpt-6-astra",
2876
+ "gpt-6-luna",
2877
+ "gpt-6-sol"
2878
+ ];
2879
+ var openaiResponsesModelIds = [
2880
+ "gpt-4.1",
2881
+ "gpt-4.1-2025-04-14",
2882
+ "gpt-4.1-mini",
2883
+ "gpt-4.1-mini-2025-04-14",
2884
+ "gpt-4.1-nano",
2885
+ "gpt-4.1-nano-2025-04-14",
2886
+ "gpt-4o",
2887
+ "gpt-4o-2024-05-13",
2888
+ "gpt-4o-2024-08-06",
2889
+ "gpt-4o-2024-11-20",
2890
+ "gpt-4o-audio-preview",
2891
+ "gpt-4o-audio-preview-2024-12-17",
2892
+ "gpt-4o-search-preview",
2893
+ "gpt-4o-search-preview-2025-03-11",
2894
+ "gpt-4o-mini-search-preview",
2895
+ "gpt-4o-mini-search-preview-2025-03-11",
2896
+ "gpt-4o-mini",
2897
+ "gpt-4o-mini-2024-07-18",
2898
+ "gpt-3.5-turbo-0125",
2899
+ "gpt-3.5-turbo",
2900
+ "gpt-3.5-turbo-1106",
2901
+ "gpt-5-chat-latest",
2902
+ ...openaiResponsesReasoningModelIds
2903
+ ];
2904
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
2828
2905
  () => zodSchema12(
2829
2906
  z13.object({
2830
- callId: z13.string(),
2831
- operation: z13.discriminatedUnion("type", [
2832
- z13.object({
2833
- type: z13.literal("create_file"),
2834
- path: z13.string(),
2835
- diff: z13.string()
2836
- }),
2837
- z13.object({
2838
- type: z13.literal("delete_file"),
2839
- path: z13.string()
2840
- }),
2841
- z13.object({
2842
- type: z13.literal("update_file"),
2843
- path: z13.string(),
2844
- diff: z13.string()
2845
- })
2846
- ])
2907
+ /**
2908
+ * The ID of the OpenAI Conversation to continue.
2909
+ * You must create a conversation first via the OpenAI API.
2910
+ * Cannot be used in conjunction with `previousResponseId`.
2911
+ * Defaults to `undefined`.
2912
+ * @see https://platform.openai.com/docs/api-reference/conversations/create
2913
+ */
2914
+ conversation: z13.string().nullish(),
2915
+ /**
2916
+ * The set of extra fields to include in the response (advanced, usually not needed).
2917
+ * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
2918
+ */
2919
+ include: z13.array(
2920
+ z13.enum([
2921
+ "reasoning.encrypted_content",
2922
+ // handled internally by default, only needed for unknown reasoning models
2923
+ "file_search_call.results",
2924
+ "web_search_call.results",
2925
+ "message.output_text.logprobs"
2926
+ ])
2927
+ ).nullish(),
2928
+ /**
2929
+ * Instructions for the model.
2930
+ * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
2931
+ * Defaults to `undefined`.
2932
+ */
2933
+ instructions: z13.string().nullish(),
2934
+ /**
2935
+ * Return the log probabilities of the tokens. Including logprobs will increase
2936
+ * the response size and can slow down response times. However, it can
2937
+ * be useful to better understand how the model is behaving.
2938
+ *
2939
+ * Setting to true will return the log probabilities of the tokens that
2940
+ * were generated.
2941
+ *
2942
+ * Setting to a number will return the log probabilities of the top n
2943
+ * tokens that were generated.
2944
+ *
2945
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2946
+ * @see https://cookbook.openai.com/examples/using_logprobs
2947
+ */
2948
+ logprobs: z13.union([z13.boolean(), z13.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2949
+ /**
2950
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2951
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2952
+ * Any further attempts to call a tool by the model will be ignored.
2953
+ */
2954
+ maxToolCalls: z13.number().nullish(),
2955
+ /**
2956
+ * Additional metadata to store with the generation.
2957
+ */
2958
+ metadata: z13.any().nullish(),
2959
+ /**
2960
+ * Whether to use parallel tool calls. Defaults to `true`.
2961
+ */
2962
+ parallelToolCalls: z13.boolean().nullish(),
2963
+ /**
2964
+ * The ID of the previous response. You can use it to continue a conversation.
2965
+ * Defaults to `undefined`.
2966
+ */
2967
+ previousResponseId: z13.string().nullish(),
2968
+ /**
2969
+ * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
2970
+ */
2971
+ promptCacheKey: z13.string().nullish(),
2972
+ /**
2973
+ * Prompt cache behavior for GPT-5.6 and later models.
2974
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2975
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2976
+ */
2977
+ promptCacheOptions: z13.object({
2978
+ mode: z13.enum(["implicit", "explicit"]).optional(),
2979
+ ttl: z13.literal("30m").optional()
2980
+ }).optional(),
2981
+ /**
2982
+ * The retention policy for the prompt cache.
2983
+ * - 'in_memory': Default. Standard prompt caching behavior.
2984
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2985
+ * Available for models before GPT-5.6 that support extended caching.
2986
+ *
2987
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2988
+ *
2989
+ * @default 'in_memory'
2990
+ */
2991
+ promptCacheRetention: z13.enum(["in_memory", "24h"]).nullish(),
2992
+ /**
2993
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2994
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2995
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2996
+ * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2997
+ * Supported values vary by model.
2998
+ */
2999
+ reasoningEffort: z13.string().nullish(),
3000
+ /**
3001
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
3002
+ * without changing the request-level reasoning effort. This preserves the
3003
+ * request prefix for prompt caching.
3004
+ *
3005
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3006
+ * combined with automatic truncation.
3007
+ */
3008
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3009
+ /**
3010
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
3011
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
3012
+ */
3013
+ reasoningMode: z13.enum(["standard", "pro"]).optional(),
3014
+ /**
3015
+ * Controls which available reasoning items GPT-5.6 can use.
3016
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
3017
+ * turns, and `all_turns` makes compatible earlier reasoning available.
3018
+ */
3019
+ reasoningContext: z13.enum(["auto", "current_turn", "all_turns"]).optional(),
3020
+ /**
3021
+ * Controls reasoning summary output from the model.
3022
+ * Set to "auto" to automatically receive the richest level available,
3023
+ * or "detailed" for comprehensive summaries.
3024
+ */
3025
+ reasoningSummary: z13.string().nullish(),
3026
+ /**
3027
+ * The identifier for safety monitoring and tracking.
3028
+ */
3029
+ safetyIdentifier: z13.string().nullish(),
3030
+ /**
3031
+ * Service tier for the request.
3032
+ * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
3033
+ * 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).
3034
+ * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
3035
+ *
3036
+ * Defaults to 'auto'.
3037
+ */
3038
+ serviceTier: z13.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
3039
+ /**
3040
+ * Whether to store the generation. Defaults to `true`.
3041
+ */
3042
+ store: z13.boolean().nullish(),
3043
+ /**
3044
+ * Whether to pass through non-image file types as generic input files.
3045
+ *
3046
+ * By default, inline file inputs are restricted to images and PDFs.
3047
+ * Enable this when the target OpenAI Responses model supports additional
3048
+ * file media types, such as text/csv.
3049
+ */
3050
+ passThroughUnsupportedFiles: z13.boolean().optional(),
3051
+ /**
3052
+ * Whether to use strict JSON schema validation.
3053
+ * Defaults to `true`.
3054
+ */
3055
+ strictJsonSchema: z13.boolean().nullish(),
3056
+ /**
3057
+ * Controls the verbosity of the model's responses. Lower values ('low') will result
3058
+ * in more concise responses, while higher values ('high') will result in more verbose responses.
3059
+ * Valid values: 'low', 'medium', 'high'.
3060
+ */
3061
+ textVerbosity: z13.enum(["low", "medium", "high"]).nullish(),
3062
+ /**
3063
+ * Controls output truncation. 'auto' (default) performs truncation automatically;
3064
+ * 'disabled' turns truncation off.
3065
+ */
3066
+ truncation: z13.enum(["auto", "disabled"]).nullish(),
3067
+ /**
3068
+ * A unique identifier representing your end-user, which can help OpenAI to
3069
+ * monitor and detect abuse.
3070
+ * Defaults to `undefined`.
3071
+ * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
3072
+ */
3073
+ user: z13.string().nullish(),
3074
+ /**
3075
+ * Override the system message mode for this model.
3076
+ * - 'system': Use the 'system' role for system messages (default for most models)
3077
+ * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
3078
+ * - 'remove': Remove system messages entirely
3079
+ *
3080
+ * If not specified, the mode is automatically determined based on the model.
3081
+ */
3082
+ systemMessageMode: z13.enum(["system", "developer", "remove"]).optional(),
3083
+ /**
3084
+ * Force treating this model as a reasoning model.
3085
+ *
3086
+ * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
3087
+ * where the model ID is not recognized by the SDK's allowlist.
3088
+ *
3089
+ * When enabled, the SDK applies reasoning-model parameter compatibility rules
3090
+ * and defaults `systemMessageMode` to `developer` unless overridden.
3091
+ */
3092
+ forceReasoning: z13.boolean().optional(),
3093
+ /**
3094
+ * Restrict the callable tools to a subset while keeping the full tools
3095
+ * list intact, so prompt caching is preserved across requests with
3096
+ * different allowlists.
3097
+ *
3098
+ * When set, this overrides the request-level `toolChoice` and emits
3099
+ * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
3100
+ *
3101
+ * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
3102
+ */
3103
+ allowedTools: z13.object({
3104
+ toolNames: z13.array(z13.string()).min(1),
3105
+ mode: z13.enum(["auto", "required"]).optional()
3106
+ }).optional()
2847
3107
  })
2848
3108
  )
2849
3109
  );
2850
- var applyPatchOutputSchema = lazySchema12(
3110
+ var openaiResponsesSystemMessageOptionsSchema = lazySchema12(
2851
3111
  () => zodSchema12(
2852
3112
  z13.object({
2853
- status: z13.enum(["completed", "failed"]),
2854
- output: z13.string().optional()
3113
+ /**
3114
+ * Emit a configuration update at this position in Responses history.
3115
+ * Requires empty system message content and the same supported
3116
+ * configuration as the request-level reasoningEffortUpdate option.
3117
+ * Unsupported historical updates throw instead of being omitted.
3118
+ *
3119
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
3120
+ */
3121
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2855
3122
  })
2856
3123
  )
2857
3124
  );
2858
- var applyPatchArgsSchema = lazySchema12(() => zodSchema12(z13.object({})));
3125
+
3126
+ // src/tool/apply-patch.ts
3127
+ import {
3128
+ createProviderToolFactoryWithOutputSchema,
3129
+ lazySchema as lazySchema13,
3130
+ zodSchema as zodSchema13
3131
+ } from "@ai-sdk/provider-utils";
3132
+ import { z as z14 } from "zod/v4";
3133
+ var applyPatchInputSchema = lazySchema13(
3134
+ () => zodSchema13(
3135
+ z14.object({
3136
+ callId: z14.string(),
3137
+ operation: z14.discriminatedUnion("type", [
3138
+ z14.object({
3139
+ type: z14.literal("create_file"),
3140
+ path: z14.string(),
3141
+ diff: z14.string()
3142
+ }),
3143
+ z14.object({
3144
+ type: z14.literal("delete_file"),
3145
+ path: z14.string()
3146
+ }),
3147
+ z14.object({
3148
+ type: z14.literal("update_file"),
3149
+ path: z14.string(),
3150
+ diff: z14.string()
3151
+ })
3152
+ ])
3153
+ })
3154
+ )
3155
+ );
3156
+ var applyPatchOutputSchema = lazySchema13(
3157
+ () => zodSchema13(
3158
+ z14.object({
3159
+ status: z14.enum(["completed", "failed"]),
3160
+ output: z14.string().optional()
3161
+ })
3162
+ )
3163
+ );
3164
+ var applyPatchArgsSchema = lazySchema13(() => zodSchema13(z14.object({})));
2859
3165
  var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2860
3166
  id: "openai.apply_patch",
2861
3167
  inputSchema: applyPatchInputSchema,
@@ -2866,26 +3172,26 @@ var applyPatch = applyPatchToolFactory;
2866
3172
  // src/tool/local-shell.ts
2867
3173
  import {
2868
3174
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2869
- lazySchema as lazySchema13,
2870
- zodSchema as zodSchema13
3175
+ lazySchema as lazySchema14,
3176
+ zodSchema as zodSchema14
2871
3177
  } from "@ai-sdk/provider-utils";
2872
- import { z as z14 } from "zod/v4";
2873
- var localShellInputSchema = lazySchema13(
2874
- () => zodSchema13(
2875
- z14.object({
2876
- action: z14.object({
2877
- type: z14.literal("exec"),
2878
- command: z14.array(z14.string()),
2879
- timeoutMs: z14.number().optional(),
2880
- user: z14.string().optional(),
2881
- workingDirectory: z14.string().optional(),
2882
- env: z14.record(z14.string(), z14.string()).optional()
3178
+ import { z as z15 } from "zod/v4";
3179
+ var localShellInputSchema = lazySchema14(
3180
+ () => zodSchema14(
3181
+ z15.object({
3182
+ action: z15.object({
3183
+ type: z15.literal("exec"),
3184
+ command: z15.array(z15.string()),
3185
+ timeoutMs: z15.number().optional(),
3186
+ user: z15.string().optional(),
3187
+ workingDirectory: z15.string().optional(),
3188
+ env: z15.record(z15.string(), z15.string()).optional()
2883
3189
  })
2884
3190
  })
2885
3191
  )
2886
3192
  );
2887
- var localShellOutputSchema = lazySchema13(
2888
- () => zodSchema13(z14.object({ output: z14.string() }))
3193
+ var localShellOutputSchema = lazySchema14(
3194
+ () => zodSchema14(z15.object({ output: z15.string() }))
2889
3195
  );
2890
3196
  var localShell = createProviderToolFactoryWithOutputSchema2({
2891
3197
  id: "openai.local_shell",
@@ -2896,91 +3202,91 @@ var localShell = createProviderToolFactoryWithOutputSchema2({
2896
3202
  // src/tool/shell.ts
2897
3203
  import {
2898
3204
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2899
- lazySchema as lazySchema14,
2900
- zodSchema as zodSchema14
3205
+ lazySchema as lazySchema15,
3206
+ zodSchema as zodSchema15
2901
3207
  } from "@ai-sdk/provider-utils";
2902
- import { z as z15 } from "zod/v4";
2903
- var shellInputSchema = lazySchema14(
2904
- () => zodSchema14(
2905
- z15.object({
2906
- action: z15.object({
2907
- commands: z15.array(z15.string()),
2908
- timeoutMs: z15.number().optional(),
2909
- maxOutputLength: z15.number().optional()
3208
+ import { z as z16 } from "zod/v4";
3209
+ var shellInputSchema = lazySchema15(
3210
+ () => zodSchema15(
3211
+ z16.object({
3212
+ action: z16.object({
3213
+ commands: z16.array(z16.string()),
3214
+ timeoutMs: z16.number().optional(),
3215
+ maxOutputLength: z16.number().optional()
2910
3216
  })
2911
3217
  })
2912
3218
  )
2913
3219
  );
2914
- var shellOutputSchema = lazySchema14(
2915
- () => zodSchema14(
2916
- z15.object({
2917
- output: z15.array(
2918
- z15.object({
2919
- stdout: z15.string(),
2920
- stderr: z15.string(),
2921
- outcome: z15.discriminatedUnion("type", [
2922
- z15.object({ type: z15.literal("timeout") }),
2923
- z15.object({ type: z15.literal("exit"), exitCode: z15.number() })
3220
+ var shellOutputSchema = lazySchema15(
3221
+ () => zodSchema15(
3222
+ z16.object({
3223
+ output: z16.array(
3224
+ z16.object({
3225
+ stdout: z16.string(),
3226
+ stderr: z16.string(),
3227
+ outcome: z16.discriminatedUnion("type", [
3228
+ z16.object({ type: z16.literal("timeout") }),
3229
+ z16.object({ type: z16.literal("exit"), exitCode: z16.number() })
2924
3230
  ])
2925
3231
  })
2926
3232
  )
2927
3233
  })
2928
3234
  )
2929
3235
  );
2930
- var shellSkillsSchema = z15.array(
2931
- z15.discriminatedUnion("type", [
2932
- z15.object({
2933
- type: z15.literal("skillReference"),
2934
- skillId: z15.string(),
2935
- version: z15.string().optional()
3236
+ var shellSkillsSchema = z16.array(
3237
+ z16.discriminatedUnion("type", [
3238
+ z16.object({
3239
+ type: z16.literal("skillReference"),
3240
+ skillId: z16.string(),
3241
+ version: z16.string().optional()
2936
3242
  }),
2937
- z15.object({
2938
- type: z15.literal("inline"),
2939
- name: z15.string(),
2940
- description: z15.string(),
2941
- source: z15.object({
2942
- type: z15.literal("base64"),
2943
- mediaType: z15.literal("application/zip"),
2944
- data: z15.string()
3243
+ z16.object({
3244
+ type: z16.literal("inline"),
3245
+ name: z16.string(),
3246
+ description: z16.string(),
3247
+ source: z16.object({
3248
+ type: z16.literal("base64"),
3249
+ mediaType: z16.literal("application/zip"),
3250
+ data: z16.string()
2945
3251
  })
2946
3252
  })
2947
3253
  ])
2948
3254
  ).optional();
2949
- var shellArgsSchema = lazySchema14(
2950
- () => zodSchema14(
2951
- z15.object({
2952
- environment: z15.union([
2953
- z15.object({
2954
- type: z15.literal("containerAuto"),
2955
- fileIds: z15.array(z15.string()).optional(),
2956
- memoryLimit: z15.enum(["1g", "4g", "16g", "64g"]).optional(),
2957
- networkPolicy: z15.discriminatedUnion("type", [
2958
- z15.object({ type: z15.literal("disabled") }),
2959
- z15.object({
2960
- type: z15.literal("allowlist"),
2961
- allowedDomains: z15.array(z15.string()),
2962
- domainSecrets: z15.array(
2963
- z15.object({
2964
- domain: z15.string(),
2965
- name: z15.string(),
2966
- value: z15.string()
3255
+ var shellArgsSchema = lazySchema15(
3256
+ () => zodSchema15(
3257
+ z16.object({
3258
+ environment: z16.union([
3259
+ z16.object({
3260
+ type: z16.literal("containerAuto"),
3261
+ fileIds: z16.array(z16.string()).optional(),
3262
+ memoryLimit: z16.enum(["1g", "4g", "16g", "64g"]).optional(),
3263
+ networkPolicy: z16.discriminatedUnion("type", [
3264
+ z16.object({ type: z16.literal("disabled") }),
3265
+ z16.object({
3266
+ type: z16.literal("allowlist"),
3267
+ allowedDomains: z16.array(z16.string()),
3268
+ domainSecrets: z16.array(
3269
+ z16.object({
3270
+ domain: z16.string(),
3271
+ name: z16.string(),
3272
+ value: z16.string()
2967
3273
  })
2968
3274
  ).optional()
2969
3275
  })
2970
3276
  ]).optional(),
2971
3277
  skills: shellSkillsSchema
2972
3278
  }),
2973
- z15.object({
2974
- type: z15.literal("containerReference"),
2975
- containerId: z15.string()
3279
+ z16.object({
3280
+ type: z16.literal("containerReference"),
3281
+ containerId: z16.string()
2976
3282
  }),
2977
- z15.object({
2978
- type: z15.literal("local").optional(),
2979
- skills: z15.array(
2980
- z15.object({
2981
- name: z15.string(),
2982
- description: z15.string(),
2983
- path: z15.string()
3283
+ z16.object({
3284
+ type: z16.literal("local").optional(),
3285
+ skills: z16.array(
3286
+ z16.object({
3287
+ name: z16.string(),
3288
+ description: z16.string(),
3289
+ path: z16.string()
2984
3290
  })
2985
3291
  ).optional()
2986
3292
  })
@@ -2997,31 +3303,31 @@ var shell = createProviderToolFactoryWithOutputSchema3({
2997
3303
  // src/tool/tool-search.ts
2998
3304
  import {
2999
3305
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3000
- lazySchema as lazySchema15,
3001
- zodSchema as zodSchema15
3306
+ lazySchema as lazySchema16,
3307
+ zodSchema as zodSchema16
3002
3308
  } from "@ai-sdk/provider-utils";
3003
- import { z as z16 } from "zod/v4";
3004
- var toolSearchArgsSchema = lazySchema15(
3005
- () => zodSchema15(
3006
- z16.object({
3007
- execution: z16.enum(["server", "client"]).optional(),
3008
- description: z16.string().optional(),
3009
- parameters: z16.record(z16.string(), z16.unknown()).optional()
3309
+ import { z as z17 } from "zod/v4";
3310
+ var toolSearchArgsSchema = lazySchema16(
3311
+ () => zodSchema16(
3312
+ z17.object({
3313
+ execution: z17.enum(["server", "client"]).optional(),
3314
+ description: z17.string().optional(),
3315
+ parameters: z17.record(z17.string(), z17.unknown()).optional()
3010
3316
  })
3011
3317
  )
3012
3318
  );
3013
- var toolSearchInputSchema = lazySchema15(
3014
- () => zodSchema15(
3015
- z16.object({
3016
- arguments: z16.unknown().optional(),
3017
- call_id: z16.string().nullish()
3319
+ var toolSearchInputSchema = lazySchema16(
3320
+ () => zodSchema16(
3321
+ z17.object({
3322
+ arguments: z17.unknown().optional(),
3323
+ call_id: z17.string().nullish()
3018
3324
  })
3019
3325
  )
3020
3326
  );
3021
- var toolSearchOutputSchema = lazySchema15(
3022
- () => zodSchema15(
3023
- z16.object({
3024
- tools: z16.array(z16.record(z16.string(), z16.unknown()))
3327
+ var toolSearchOutputSchema = lazySchema16(
3328
+ () => zodSchema16(
3329
+ z17.object({
3330
+ tools: z17.array(z17.record(z17.string(), z17.unknown()))
3025
3331
  })
3026
3332
  )
3027
3333
  );
@@ -3312,6 +3618,7 @@ async function convertToOpenAIResponsesInput({
3312
3618
  store,
3313
3619
  hasConversation = false,
3314
3620
  hasPreviousResponseId = false,
3621
+ configurationUpdateUnsupportedReason,
3315
3622
  hasLocalShellTool = false,
3316
3623
  hasShellTool = false,
3317
3624
  hasApplyPatchTool = false,
@@ -3331,6 +3638,33 @@ async function convertToOpenAIResponsesInput({
3331
3638
  for (const { role, content, providerOptions } of prompt) {
3332
3639
  switch (role) {
3333
3640
  case "system": {
3641
+ let options = await parseProviderOptions7({
3642
+ provider: providerOptionsName,
3643
+ providerOptions,
3644
+ schema: openaiResponsesSystemMessageOptionsSchema
3645
+ });
3646
+ if (options == null && providerOptionsName !== "openai") {
3647
+ options = await parseProviderOptions7({
3648
+ provider: "openai",
3649
+ providerOptions,
3650
+ schema: openaiResponsesSystemMessageOptionsSchema
3651
+ });
3652
+ }
3653
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
3654
+ if (effort != null) {
3655
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
3656
+ if (unsupportedReason != null) {
3657
+ throw new UnsupportedFunctionalityError4({
3658
+ functionality: "Message-level reasoningEffortUpdate",
3659
+ message: unsupportedReason
3660
+ });
3661
+ }
3662
+ input.push({
3663
+ type: "configuration_update",
3664
+ reasoning: { effort }
3665
+ });
3666
+ break;
3667
+ }
3334
3668
  switch (systemMessageMode) {
3335
3669
  case "system": {
3336
3670
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -4047,9 +4381,9 @@ ${text}`,
4047
4381
  }
4048
4382
  return { input, warnings };
4049
4383
  }
4050
- var openaiResponsesReasoningProviderOptionsSchema = z17.object({
4051
- itemId: z17.string().nullish(),
4052
- reasoningEncryptedContent: z17.string().nullish()
4384
+ var openaiResponsesReasoningProviderOptionsSchema = z18.object({
4385
+ itemId: z18.string().nullish(),
4386
+ reasoningEncryptedContent: z18.string().nullish()
4053
4387
  });
4054
4388
 
4055
4389
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4072,77 +4406,77 @@ function mapOpenAIResponseFinishReason({
4072
4406
 
4073
4407
  // src/responses/openai-responses-api.ts
4074
4408
  import {
4075
- lazySchema as lazySchema16,
4076
- zodSchema as zodSchema16
4409
+ lazySchema as lazySchema17,
4410
+ zodSchema as zodSchema17
4077
4411
  } from "@ai-sdk/provider-utils";
4078
- import { z as z18 } from "zod/v4";
4079
- var jsonValueSchema = z18.lazy(
4080
- () => z18.union([
4081
- z18.string(),
4082
- z18.number(),
4083
- z18.boolean(),
4084
- z18.null(),
4085
- z18.array(jsonValueSchema),
4086
- z18.record(z18.string(), jsonValueSchema.optional())
4412
+ import { z as z19 } from "zod/v4";
4413
+ var jsonValueSchema = z19.lazy(
4414
+ () => z19.union([
4415
+ z19.string(),
4416
+ z19.number(),
4417
+ z19.boolean(),
4418
+ z19.null(),
4419
+ z19.array(jsonValueSchema),
4420
+ z19.record(z19.string(), jsonValueSchema.optional())
4087
4421
  ])
4088
4422
  );
4089
- var jsonObjectSchema = z18.record(z18.string(), jsonValueSchema.optional());
4090
- var openaiResponsesUsageSchema = z18.intersection(
4423
+ var jsonObjectSchema = z19.record(z19.string(), jsonValueSchema.optional());
4424
+ var openaiResponsesUsageSchema = z19.intersection(
4091
4425
  jsonObjectSchema,
4092
- z18.object({
4093
- input_tokens: z18.number(),
4094
- input_tokens_details: z18.intersection(
4426
+ z19.object({
4427
+ input_tokens: z19.number(),
4428
+ input_tokens_details: z19.intersection(
4095
4429
  jsonObjectSchema,
4096
- z18.object({
4097
- cached_tokens: z18.number().nullish(),
4098
- cache_write_tokens: z18.number().nullish(),
4099
- orchestration_input_tokens: z18.number().nullish(),
4100
- orchestration_input_cached_tokens: z18.number().nullish()
4430
+ z19.object({
4431
+ cached_tokens: z19.number().nullish(),
4432
+ cache_write_tokens: z19.number().nullish(),
4433
+ orchestration_input_tokens: z19.number().nullish(),
4434
+ orchestration_input_cached_tokens: z19.number().nullish()
4101
4435
  })
4102
4436
  ).nullish(),
4103
- output_tokens: z18.number(),
4104
- output_tokens_details: z18.intersection(
4437
+ output_tokens: z19.number(),
4438
+ output_tokens_details: z19.intersection(
4105
4439
  jsonObjectSchema,
4106
- z18.object({
4107
- reasoning_tokens: z18.number().nullish(),
4108
- orchestration_output_tokens: z18.number().nullish()
4440
+ z19.object({
4441
+ reasoning_tokens: z19.number().nullish(),
4442
+ orchestration_output_tokens: z19.number().nullish()
4109
4443
  })
4110
4444
  ).nullish(),
4111
- total_tokens: z18.number().optional()
4445
+ total_tokens: z19.number().optional()
4112
4446
  })
4113
4447
  );
4114
4448
  function isRecord(value) {
4115
4449
  return value != null && typeof value === "object" && !Array.isArray(value);
4116
4450
  }
4117
- var openaiResponsesLocalShellCallSchema = z18.object({
4118
- type: z18.literal("local_shell_call"),
4119
- id: z18.string(),
4120
- call_id: z18.string(),
4121
- action: z18.object({
4122
- type: z18.literal("exec"),
4123
- command: z18.array(z18.string()),
4124
- timeout_ms: z18.number().optional(),
4125
- user: z18.string().optional(),
4126
- working_directory: z18.string().optional(),
4127
- env: z18.record(z18.string(), z18.string()).optional()
4451
+ var openaiResponsesLocalShellCallSchema = z19.object({
4452
+ type: z19.literal("local_shell_call"),
4453
+ id: z19.string(),
4454
+ call_id: z19.string(),
4455
+ action: z19.object({
4456
+ type: z19.literal("exec"),
4457
+ command: z19.array(z19.string()),
4458
+ timeout_ms: z19.number().optional(),
4459
+ user: z19.string().optional(),
4460
+ working_directory: z19.string().optional(),
4461
+ env: z19.record(z19.string(), z19.string()).optional()
4128
4462
  })
4129
4463
  });
4130
- var openaiResponsesNestedErrorChunkSchema = z18.object({
4131
- type: z18.literal("error"),
4132
- sequence_number: z18.number(),
4133
- error: z18.object({
4134
- type: z18.string(),
4135
- code: z18.string(),
4136
- message: z18.string(),
4137
- param: z18.string().nullish()
4464
+ var openaiResponsesNestedErrorChunkSchema = z19.object({
4465
+ type: z19.literal("error"),
4466
+ sequence_number: z19.number(),
4467
+ error: z19.object({
4468
+ type: z19.string(),
4469
+ code: z19.string(),
4470
+ message: z19.string(),
4471
+ param: z19.string().nullish()
4138
4472
  })
4139
4473
  });
4140
- var openaiResponsesErrorChunkSchema = z18.object({
4141
- type: z18.literal("error"),
4142
- sequence_number: z18.number(),
4143
- code: z18.string().nullish(),
4144
- message: z18.string(),
4145
- param: z18.string().nullish()
4474
+ var openaiResponsesErrorChunkSchema = z19.object({
4475
+ type: z19.literal("error"),
4476
+ sequence_number: z19.number(),
4477
+ code: z19.string().nullish(),
4478
+ message: z19.string(),
4479
+ param: z19.string().nullish()
4146
4480
  });
4147
4481
  var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
4148
4482
  "error",
@@ -4198,523 +4532,523 @@ function isModeledOpenAIResponsesChunk(value) {
4198
4532
  }
4199
4533
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4200
4534
  }
4201
- var openaiResponsesChunkSchema = lazySchema16(
4202
- () => zodSchema16(
4203
- z18.union([
4204
- z18.object({
4205
- type: z18.literal("response.output_text.delta"),
4206
- item_id: z18.string(),
4207
- delta: z18.string(),
4208
- logprobs: z18.array(
4209
- z18.object({
4210
- token: z18.string(),
4211
- logprob: z18.number(),
4212
- top_logprobs: z18.array(
4213
- z18.object({
4214
- token: z18.string(),
4215
- logprob: z18.number()
4535
+ var openaiResponsesChunkSchema = lazySchema17(
4536
+ () => zodSchema17(
4537
+ z19.union([
4538
+ z19.object({
4539
+ type: z19.literal("response.output_text.delta"),
4540
+ item_id: z19.string(),
4541
+ delta: z19.string(),
4542
+ logprobs: z19.array(
4543
+ z19.object({
4544
+ token: z19.string(),
4545
+ logprob: z19.number(),
4546
+ top_logprobs: z19.array(
4547
+ z19.object({
4548
+ token: z19.string(),
4549
+ logprob: z19.number()
4216
4550
  })
4217
4551
  )
4218
4552
  })
4219
4553
  ).nullish()
4220
4554
  }),
4221
- z18.object({
4222
- type: z18.enum(["response.completed", "response.incomplete"]),
4223
- response: z18.object({
4224
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
4555
+ z19.object({
4556
+ type: z19.enum(["response.completed", "response.incomplete"]),
4557
+ response: z19.object({
4558
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4225
4559
  usage: openaiResponsesUsageSchema.nullish(),
4226
- reasoning: z18.object({
4227
- context: z18.string().nullish()
4560
+ reasoning: z19.object({
4561
+ context: z19.string().nullish()
4228
4562
  }).nullish(),
4229
- service_tier: z18.string().nullish()
4563
+ service_tier: z19.string().nullish()
4230
4564
  })
4231
4565
  }),
4232
- z18.object({
4233
- type: z18.literal("response.failed"),
4234
- sequence_number: z18.number(),
4235
- response: z18.object({
4236
- error: z18.object({
4237
- code: z18.string().nullish(),
4238
- message: z18.string()
4566
+ z19.object({
4567
+ type: z19.literal("response.failed"),
4568
+ sequence_number: z19.number(),
4569
+ response: z19.object({
4570
+ error: z19.object({
4571
+ code: z19.string().nullish(),
4572
+ message: z19.string()
4239
4573
  }).nullish(),
4240
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
4574
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4241
4575
  usage: openaiResponsesUsageSchema.nullish(),
4242
- reasoning: z18.object({
4243
- context: z18.string().nullish()
4576
+ reasoning: z19.object({
4577
+ context: z19.string().nullish()
4244
4578
  }).nullish(),
4245
- service_tier: z18.string().nullish()
4579
+ service_tier: z19.string().nullish()
4246
4580
  })
4247
4581
  }),
4248
- z18.object({
4249
- type: z18.literal("response.created"),
4250
- response: z18.object({
4251
- id: z18.string(),
4252
- created_at: z18.number(),
4253
- model: z18.string(),
4254
- service_tier: z18.string().nullish()
4582
+ z19.object({
4583
+ type: z19.literal("response.created"),
4584
+ response: z19.object({
4585
+ id: z19.string(),
4586
+ created_at: z19.number(),
4587
+ model: z19.string(),
4588
+ service_tier: z19.string().nullish()
4255
4589
  })
4256
4590
  }),
4257
- z18.object({
4258
- type: z18.literal("response.output_item.added"),
4259
- output_index: z18.number(),
4260
- item: z18.discriminatedUnion("type", [
4261
- z18.object({
4262
- type: z18.literal("message"),
4263
- id: z18.string(),
4264
- phase: z18.enum(["commentary", "final_answer"]).nullish()
4591
+ z19.object({
4592
+ type: z19.literal("response.output_item.added"),
4593
+ output_index: z19.number(),
4594
+ item: z19.discriminatedUnion("type", [
4595
+ z19.object({
4596
+ type: z19.literal("message"),
4597
+ id: z19.string(),
4598
+ phase: z19.enum(["commentary", "final_answer"]).nullish()
4265
4599
  }),
4266
- z18.object({
4267
- type: z18.literal("reasoning"),
4268
- id: z18.string(),
4269
- encrypted_content: z18.string().nullish()
4600
+ z19.object({
4601
+ type: z19.literal("reasoning"),
4602
+ id: z19.string(),
4603
+ encrypted_content: z19.string().nullish()
4270
4604
  }),
4271
- z18.object({
4272
- type: z18.literal("function_call"),
4273
- id: z18.string(),
4274
- call_id: z18.string(),
4275
- name: z18.string(),
4276
- arguments: z18.string(),
4277
- async: z18.boolean().nullish(),
4278
- namespace: z18.string().nullish()
4605
+ z19.object({
4606
+ type: z19.literal("function_call"),
4607
+ id: z19.string(),
4608
+ call_id: z19.string(),
4609
+ name: z19.string(),
4610
+ arguments: z19.string(),
4611
+ async: z19.boolean().nullish(),
4612
+ namespace: z19.string().nullish()
4279
4613
  }),
4280
- z18.object({
4281
- type: z18.literal("web_search_call"),
4282
- id: z18.string(),
4283
- status: z18.string()
4614
+ z19.object({
4615
+ type: z19.literal("web_search_call"),
4616
+ id: z19.string(),
4617
+ status: z19.string()
4284
4618
  }),
4285
- z18.object({
4286
- type: z18.literal("computer_call"),
4287
- id: z18.string(),
4288
- status: z18.string()
4619
+ z19.object({
4620
+ type: z19.literal("computer_call"),
4621
+ id: z19.string(),
4622
+ status: z19.string()
4289
4623
  }),
4290
- z18.object({
4291
- type: z18.literal("file_search_call"),
4292
- id: z18.string()
4624
+ z19.object({
4625
+ type: z19.literal("file_search_call"),
4626
+ id: z19.string()
4293
4627
  }),
4294
4628
  openaiResponsesLocalShellCallSchema,
4295
- z18.object({
4296
- type: z18.literal("image_generation_call"),
4297
- id: z18.string()
4629
+ z19.object({
4630
+ type: z19.literal("image_generation_call"),
4631
+ id: z19.string()
4298
4632
  }),
4299
- z18.object({
4300
- type: z18.literal("code_interpreter_call"),
4301
- id: z18.string(),
4302
- container_id: z18.string(),
4303
- code: z18.string().nullable(),
4304
- outputs: z18.array(
4305
- z18.discriminatedUnion("type", [
4306
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
4307
- z18.object({ type: z18.literal("image"), url: z18.string() })
4633
+ z19.object({
4634
+ type: z19.literal("code_interpreter_call"),
4635
+ id: z19.string(),
4636
+ container_id: z19.string(),
4637
+ code: z19.string().nullable(),
4638
+ outputs: z19.array(
4639
+ z19.discriminatedUnion("type", [
4640
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4641
+ z19.object({ type: z19.literal("image"), url: z19.string() })
4308
4642
  ])
4309
4643
  ).nullable(),
4310
- status: z18.string()
4644
+ status: z19.string()
4311
4645
  }),
4312
- z18.object({
4313
- type: z18.literal("mcp_call"),
4314
- id: z18.string(),
4315
- status: z18.string(),
4316
- approval_request_id: z18.string().nullish()
4646
+ z19.object({
4647
+ type: z19.literal("mcp_call"),
4648
+ id: z19.string(),
4649
+ status: z19.string(),
4650
+ approval_request_id: z19.string().nullish()
4317
4651
  }),
4318
- z18.object({
4319
- type: z18.literal("mcp_list_tools"),
4320
- id: z18.string()
4652
+ z19.object({
4653
+ type: z19.literal("mcp_list_tools"),
4654
+ id: z19.string()
4321
4655
  }),
4322
- z18.object({
4323
- type: z18.literal("mcp_approval_request"),
4324
- id: z18.string()
4656
+ z19.object({
4657
+ type: z19.literal("mcp_approval_request"),
4658
+ id: z19.string()
4325
4659
  }),
4326
- z18.object({
4327
- type: z18.literal("apply_patch_call"),
4328
- id: z18.string(),
4329
- call_id: z18.string(),
4330
- status: z18.enum(["in_progress", "completed"]),
4331
- operation: z18.discriminatedUnion("type", [
4332
- z18.object({
4333
- type: z18.literal("create_file"),
4334
- path: z18.string(),
4335
- diff: z18.string()
4660
+ z19.object({
4661
+ type: z19.literal("apply_patch_call"),
4662
+ id: z19.string(),
4663
+ call_id: z19.string(),
4664
+ status: z19.enum(["in_progress", "completed"]),
4665
+ operation: z19.discriminatedUnion("type", [
4666
+ z19.object({
4667
+ type: z19.literal("create_file"),
4668
+ path: z19.string(),
4669
+ diff: z19.string()
4336
4670
  }),
4337
- z18.object({
4338
- type: z18.literal("delete_file"),
4339
- path: z18.string()
4671
+ z19.object({
4672
+ type: z19.literal("delete_file"),
4673
+ path: z19.string()
4340
4674
  }),
4341
- z18.object({
4342
- type: z18.literal("update_file"),
4343
- path: z18.string(),
4344
- diff: z18.string()
4675
+ z19.object({
4676
+ type: z19.literal("update_file"),
4677
+ path: z19.string(),
4678
+ diff: z19.string()
4345
4679
  })
4346
4680
  ])
4347
4681
  }),
4348
- z18.object({
4349
- type: z18.literal("custom_tool_call"),
4350
- id: z18.string(),
4351
- call_id: z18.string(),
4352
- name: z18.string(),
4353
- input: z18.string(),
4354
- async: z18.boolean().nullish()
4682
+ z19.object({
4683
+ type: z19.literal("custom_tool_call"),
4684
+ id: z19.string(),
4685
+ call_id: z19.string(),
4686
+ name: z19.string(),
4687
+ input: z19.string(),
4688
+ async: z19.boolean().nullish()
4355
4689
  }),
4356
- z18.object({
4357
- type: z18.literal("shell_call"),
4358
- id: z18.string(),
4359
- call_id: z18.string(),
4360
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4361
- action: z18.object({
4362
- commands: z18.array(z18.string())
4690
+ z19.object({
4691
+ type: z19.literal("shell_call"),
4692
+ id: z19.string(),
4693
+ call_id: z19.string(),
4694
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4695
+ action: z19.object({
4696
+ commands: z19.array(z19.string())
4363
4697
  })
4364
4698
  }),
4365
- z18.object({
4366
- type: z18.literal("shell_call_output"),
4367
- id: z18.string(),
4368
- call_id: z18.string(),
4369
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4370
- output: z18.array(
4371
- z18.object({
4372
- stdout: z18.string(),
4373
- stderr: z18.string(),
4374
- outcome: z18.discriminatedUnion("type", [
4375
- z18.object({ type: z18.literal("timeout") }),
4376
- z18.object({
4377
- type: z18.literal("exit"),
4378
- exit_code: z18.number()
4699
+ z19.object({
4700
+ type: z19.literal("shell_call_output"),
4701
+ id: z19.string(),
4702
+ call_id: z19.string(),
4703
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4704
+ output: z19.array(
4705
+ z19.object({
4706
+ stdout: z19.string(),
4707
+ stderr: z19.string(),
4708
+ outcome: z19.discriminatedUnion("type", [
4709
+ z19.object({ type: z19.literal("timeout") }),
4710
+ z19.object({
4711
+ type: z19.literal("exit"),
4712
+ exit_code: z19.number()
4379
4713
  })
4380
4714
  ])
4381
4715
  })
4382
4716
  )
4383
4717
  }),
4384
- z18.object({
4385
- type: z18.literal("tool_search_call"),
4386
- id: z18.string(),
4387
- execution: z18.enum(["server", "client"]),
4388
- call_id: z18.string().nullable(),
4389
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4390
- arguments: z18.unknown()
4718
+ z19.object({
4719
+ type: z19.literal("tool_search_call"),
4720
+ id: z19.string(),
4721
+ execution: z19.enum(["server", "client"]),
4722
+ call_id: z19.string().nullable(),
4723
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4724
+ arguments: z19.unknown()
4391
4725
  }),
4392
- z18.object({
4393
- type: z18.literal("tool_search_output"),
4394
- id: z18.string(),
4395
- execution: z18.enum(["server", "client"]),
4396
- call_id: z18.string().nullable(),
4397
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4398
- tools: z18.array(z18.record(z18.string(), jsonValueSchema.optional()))
4726
+ z19.object({
4727
+ type: z19.literal("tool_search_output"),
4728
+ id: z19.string(),
4729
+ execution: z19.enum(["server", "client"]),
4730
+ call_id: z19.string().nullable(),
4731
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4732
+ tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
4399
4733
  })
4400
4734
  ])
4401
4735
  }),
4402
- z18.object({
4403
- type: z18.literal("response.output_item.done"),
4404
- output_index: z18.number(),
4405
- item: z18.discriminatedUnion("type", [
4406
- z18.object({
4407
- type: z18.literal("message"),
4408
- id: z18.string(),
4409
- phase: z18.enum(["commentary", "final_answer"]).nullish()
4736
+ z19.object({
4737
+ type: z19.literal("response.output_item.done"),
4738
+ output_index: z19.number(),
4739
+ item: z19.discriminatedUnion("type", [
4740
+ z19.object({
4741
+ type: z19.literal("message"),
4742
+ id: z19.string(),
4743
+ phase: z19.enum(["commentary", "final_answer"]).nullish()
4410
4744
  }),
4411
- z18.object({
4412
- type: z18.literal("reasoning"),
4413
- id: z18.string(),
4414
- encrypted_content: z18.string().nullish()
4745
+ z19.object({
4746
+ type: z19.literal("reasoning"),
4747
+ id: z19.string(),
4748
+ encrypted_content: z19.string().nullish()
4415
4749
  }),
4416
- z18.object({
4417
- type: z18.literal("function_call"),
4418
- id: z18.string(),
4419
- call_id: z18.string(),
4420
- name: z18.string(),
4421
- arguments: z18.string(),
4422
- async: z18.boolean().nullish(),
4423
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4424
- namespace: z18.string().nullish()
4750
+ z19.object({
4751
+ type: z19.literal("function_call"),
4752
+ id: z19.string(),
4753
+ call_id: z19.string(),
4754
+ name: z19.string(),
4755
+ arguments: z19.string(),
4756
+ async: z19.boolean().nullish(),
4757
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4758
+ namespace: z19.string().nullish()
4425
4759
  }),
4426
- z18.object({
4427
- type: z18.literal("custom_tool_call"),
4428
- id: z18.string(),
4429
- call_id: z18.string(),
4430
- name: z18.string(),
4431
- input: z18.string(),
4432
- async: z18.boolean().nullish(),
4433
- status: z18.enum(["in_progress", "completed", "incomplete"])
4760
+ z19.object({
4761
+ type: z19.literal("custom_tool_call"),
4762
+ id: z19.string(),
4763
+ call_id: z19.string(),
4764
+ name: z19.string(),
4765
+ input: z19.string(),
4766
+ async: z19.boolean().nullish(),
4767
+ status: z19.enum(["in_progress", "completed", "incomplete"])
4434
4768
  }),
4435
- z18.object({
4436
- type: z18.literal("code_interpreter_call"),
4437
- id: z18.string(),
4438
- code: z18.string().nullable(),
4439
- container_id: z18.string(),
4440
- outputs: z18.array(
4441
- z18.discriminatedUnion("type", [
4442
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
4443
- z18.object({ type: z18.literal("image"), url: z18.string() })
4769
+ z19.object({
4770
+ type: z19.literal("code_interpreter_call"),
4771
+ id: z19.string(),
4772
+ code: z19.string().nullable(),
4773
+ container_id: z19.string(),
4774
+ outputs: z19.array(
4775
+ z19.discriminatedUnion("type", [
4776
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4777
+ z19.object({ type: z19.literal("image"), url: z19.string() })
4444
4778
  ])
4445
4779
  ).nullable()
4446
4780
  }),
4447
- z18.object({
4448
- type: z18.literal("image_generation_call"),
4449
- id: z18.string(),
4450
- result: z18.string()
4781
+ z19.object({
4782
+ type: z19.literal("image_generation_call"),
4783
+ id: z19.string(),
4784
+ result: z19.string()
4451
4785
  }),
4452
- z18.object({
4453
- type: z18.literal("web_search_call"),
4454
- id: z18.string(),
4455
- status: z18.string(),
4456
- action: z18.discriminatedUnion("type", [
4457
- z18.object({
4458
- type: z18.literal("search"),
4459
- query: z18.string().nullish(),
4460
- queries: z18.array(z18.string()).nullish(),
4461
- sources: z18.array(
4462
- z18.discriminatedUnion("type", [
4463
- z18.object({ type: z18.literal("url"), url: z18.string() }),
4464
- z18.object({ type: z18.literal("api"), name: z18.string() })
4786
+ z19.object({
4787
+ type: z19.literal("web_search_call"),
4788
+ id: z19.string(),
4789
+ status: z19.string(),
4790
+ action: z19.discriminatedUnion("type", [
4791
+ z19.object({
4792
+ type: z19.literal("search"),
4793
+ query: z19.string().nullish(),
4794
+ queries: z19.array(z19.string()).nullish(),
4795
+ sources: z19.array(
4796
+ z19.discriminatedUnion("type", [
4797
+ z19.object({ type: z19.literal("url"), url: z19.string() }),
4798
+ z19.object({ type: z19.literal("api"), name: z19.string() })
4465
4799
  ])
4466
4800
  ).nullish()
4467
4801
  }),
4468
- z18.object({
4469
- type: z18.literal("open_page"),
4470
- url: z18.string().nullish()
4802
+ z19.object({
4803
+ type: z19.literal("open_page"),
4804
+ url: z19.string().nullish()
4471
4805
  }),
4472
- z18.object({
4473
- type: z18.literal("find_in_page"),
4474
- url: z18.string().nullish(),
4475
- pattern: z18.string().nullish()
4806
+ z19.object({
4807
+ type: z19.literal("find_in_page"),
4808
+ url: z19.string().nullish(),
4809
+ pattern: z19.string().nullish()
4476
4810
  })
4477
4811
  ]).nullish()
4478
4812
  }),
4479
- z18.object({
4480
- type: z18.literal("file_search_call"),
4481
- id: z18.string(),
4482
- queries: z18.array(z18.string()),
4483
- results: z18.array(
4484
- z18.object({
4485
- attributes: z18.record(
4486
- z18.string(),
4487
- z18.union([z18.string(), z18.number(), z18.boolean()])
4813
+ z19.object({
4814
+ type: z19.literal("file_search_call"),
4815
+ id: z19.string(),
4816
+ queries: z19.array(z19.string()),
4817
+ results: z19.array(
4818
+ z19.object({
4819
+ attributes: z19.record(
4820
+ z19.string(),
4821
+ z19.union([z19.string(), z19.number(), z19.boolean()])
4488
4822
  ),
4489
- file_id: z18.string(),
4490
- filename: z18.string(),
4491
- score: z18.number(),
4492
- text: z18.string()
4823
+ file_id: z19.string(),
4824
+ filename: z19.string(),
4825
+ score: z19.number(),
4826
+ text: z19.string()
4493
4827
  })
4494
4828
  ).nullish()
4495
4829
  }),
4496
4830
  openaiResponsesLocalShellCallSchema,
4497
- z18.object({
4498
- type: z18.literal("computer_call"),
4499
- id: z18.string(),
4500
- status: z18.literal("completed")
4831
+ z19.object({
4832
+ type: z19.literal("computer_call"),
4833
+ id: z19.string(),
4834
+ status: z19.literal("completed")
4501
4835
  }),
4502
- z18.object({
4503
- type: z18.literal("mcp_call"),
4504
- id: z18.string(),
4505
- status: z18.string(),
4506
- arguments: z18.string(),
4507
- name: z18.string(),
4508
- server_label: z18.string(),
4509
- output: z18.string().nullish(),
4510
- error: z18.union([
4511
- z18.string(),
4512
- z18.object({
4513
- type: z18.string().optional(),
4514
- code: z18.union([z18.number(), z18.string()]).optional(),
4515
- message: z18.string().optional()
4836
+ z19.object({
4837
+ type: z19.literal("mcp_call"),
4838
+ id: z19.string(),
4839
+ status: z19.string(),
4840
+ arguments: z19.string(),
4841
+ name: z19.string(),
4842
+ server_label: z19.string(),
4843
+ output: z19.string().nullish(),
4844
+ error: z19.union([
4845
+ z19.string(),
4846
+ z19.object({
4847
+ type: z19.string().optional(),
4848
+ code: z19.union([z19.number(), z19.string()]).optional(),
4849
+ message: z19.string().optional()
4516
4850
  }).loose()
4517
4851
  ]).nullish(),
4518
- approval_request_id: z18.string().nullish()
4852
+ approval_request_id: z19.string().nullish()
4519
4853
  }),
4520
- z18.object({
4521
- type: z18.literal("mcp_list_tools"),
4522
- id: z18.string(),
4523
- server_label: z18.string(),
4524
- tools: z18.array(
4525
- z18.object({
4526
- name: z18.string(),
4527
- description: z18.string().optional(),
4528
- input_schema: z18.any(),
4529
- annotations: z18.record(z18.string(), z18.unknown()).optional()
4854
+ z19.object({
4855
+ type: z19.literal("mcp_list_tools"),
4856
+ id: z19.string(),
4857
+ server_label: z19.string(),
4858
+ tools: z19.array(
4859
+ z19.object({
4860
+ name: z19.string(),
4861
+ description: z19.string().optional(),
4862
+ input_schema: z19.any(),
4863
+ annotations: z19.record(z19.string(), z19.unknown()).optional()
4530
4864
  })
4531
4865
  ),
4532
- error: z18.union([
4533
- z18.string(),
4534
- z18.object({
4535
- type: z18.string().optional(),
4536
- code: z18.union([z18.number(), z18.string()]).optional(),
4537
- message: z18.string().optional()
4866
+ error: z19.union([
4867
+ z19.string(),
4868
+ z19.object({
4869
+ type: z19.string().optional(),
4870
+ code: z19.union([z19.number(), z19.string()]).optional(),
4871
+ message: z19.string().optional()
4538
4872
  }).loose()
4539
4873
  ]).optional()
4540
4874
  }),
4541
- z18.object({
4542
- type: z18.literal("mcp_approval_request"),
4543
- id: z18.string(),
4544
- server_label: z18.string(),
4545
- name: z18.string(),
4546
- arguments: z18.string(),
4547
- approval_request_id: z18.string().optional()
4875
+ z19.object({
4876
+ type: z19.literal("mcp_approval_request"),
4877
+ id: z19.string(),
4878
+ server_label: z19.string(),
4879
+ name: z19.string(),
4880
+ arguments: z19.string(),
4881
+ approval_request_id: z19.string().optional()
4548
4882
  }),
4549
- z18.object({
4550
- type: z18.literal("apply_patch_call"),
4551
- id: z18.string(),
4552
- call_id: z18.string(),
4553
- status: z18.enum(["in_progress", "completed"]),
4554
- operation: z18.discriminatedUnion("type", [
4555
- z18.object({
4556
- type: z18.literal("create_file"),
4557
- path: z18.string(),
4558
- diff: z18.string()
4883
+ z19.object({
4884
+ type: z19.literal("apply_patch_call"),
4885
+ id: z19.string(),
4886
+ call_id: z19.string(),
4887
+ status: z19.enum(["in_progress", "completed"]),
4888
+ operation: z19.discriminatedUnion("type", [
4889
+ z19.object({
4890
+ type: z19.literal("create_file"),
4891
+ path: z19.string(),
4892
+ diff: z19.string()
4559
4893
  }),
4560
- z18.object({
4561
- type: z18.literal("delete_file"),
4562
- path: z18.string()
4894
+ z19.object({
4895
+ type: z19.literal("delete_file"),
4896
+ path: z19.string()
4563
4897
  }),
4564
- z18.object({
4565
- type: z18.literal("update_file"),
4566
- path: z18.string(),
4567
- diff: z18.string()
4898
+ z19.object({
4899
+ type: z19.literal("update_file"),
4900
+ path: z19.string(),
4901
+ diff: z19.string()
4568
4902
  })
4569
4903
  ])
4570
4904
  }),
4571
- z18.object({
4572
- type: z18.literal("shell_call"),
4573
- id: z18.string(),
4574
- call_id: z18.string(),
4575
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4576
- action: z18.object({
4577
- commands: z18.array(z18.string())
4905
+ z19.object({
4906
+ type: z19.literal("shell_call"),
4907
+ id: z19.string(),
4908
+ call_id: z19.string(),
4909
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4910
+ action: z19.object({
4911
+ commands: z19.array(z19.string())
4578
4912
  })
4579
4913
  }),
4580
- z18.object({
4581
- type: z18.literal("shell_call_output"),
4582
- id: z18.string(),
4583
- call_id: z18.string(),
4584
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4585
- output: z18.array(
4586
- z18.object({
4587
- stdout: z18.string(),
4588
- stderr: z18.string(),
4589
- outcome: z18.discriminatedUnion("type", [
4590
- z18.object({ type: z18.literal("timeout") }),
4591
- z18.object({
4592
- type: z18.literal("exit"),
4593
- exit_code: z18.number()
4914
+ z19.object({
4915
+ type: z19.literal("shell_call_output"),
4916
+ id: z19.string(),
4917
+ call_id: z19.string(),
4918
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4919
+ output: z19.array(
4920
+ z19.object({
4921
+ stdout: z19.string(),
4922
+ stderr: z19.string(),
4923
+ outcome: z19.discriminatedUnion("type", [
4924
+ z19.object({ type: z19.literal("timeout") }),
4925
+ z19.object({
4926
+ type: z19.literal("exit"),
4927
+ exit_code: z19.number()
4594
4928
  })
4595
4929
  ])
4596
4930
  })
4597
4931
  )
4598
4932
  }),
4599
- z18.object({
4600
- type: z18.literal("tool_search_call"),
4601
- id: z18.string(),
4602
- execution: z18.enum(["server", "client"]),
4603
- call_id: z18.string().nullable(),
4604
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4605
- arguments: z18.unknown()
4933
+ z19.object({
4934
+ type: z19.literal("tool_search_call"),
4935
+ id: z19.string(),
4936
+ execution: z19.enum(["server", "client"]),
4937
+ call_id: z19.string().nullable(),
4938
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4939
+ arguments: z19.unknown()
4606
4940
  }),
4607
- z18.object({
4608
- type: z18.literal("tool_search_output"),
4609
- id: z18.string(),
4610
- execution: z18.enum(["server", "client"]),
4611
- call_id: z18.string().nullable(),
4612
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4613
- tools: z18.array(z18.record(z18.string(), jsonValueSchema.optional()))
4941
+ z19.object({
4942
+ type: z19.literal("tool_search_output"),
4943
+ id: z19.string(),
4944
+ execution: z19.enum(["server", "client"]),
4945
+ call_id: z19.string().nullable(),
4946
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
4947
+ tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
4614
4948
  })
4615
4949
  ])
4616
4950
  }),
4617
- z18.object({
4618
- type: z18.literal("response.function_call_arguments.delta"),
4619
- item_id: z18.string(),
4620
- output_index: z18.number(),
4621
- delta: z18.string()
4951
+ z19.object({
4952
+ type: z19.literal("response.function_call_arguments.delta"),
4953
+ item_id: z19.string(),
4954
+ output_index: z19.number(),
4955
+ delta: z19.string()
4622
4956
  }),
4623
- z18.object({
4957
+ z19.object({
4624
4958
  // `name` is documented as required but omitted from live API events:
4625
4959
  // https://github.com/openai/openai-openapi/issues/545
4626
- type: z18.literal("response.function_call_arguments.done"),
4627
- item_id: z18.string(),
4628
- output_index: z18.number(),
4629
- arguments: z18.string()
4960
+ type: z19.literal("response.function_call_arguments.done"),
4961
+ item_id: z19.string(),
4962
+ output_index: z19.number(),
4963
+ arguments: z19.string()
4630
4964
  }),
4631
- z18.object({
4632
- type: z18.literal("response.custom_tool_call_input.delta"),
4633
- item_id: z18.string(),
4634
- output_index: z18.number(),
4635
- delta: z18.string()
4965
+ z19.object({
4966
+ type: z19.literal("response.custom_tool_call_input.delta"),
4967
+ item_id: z19.string(),
4968
+ output_index: z19.number(),
4969
+ delta: z19.string()
4636
4970
  }),
4637
- z18.object({
4638
- type: z18.literal("response.image_generation_call.partial_image"),
4639
- item_id: z18.string(),
4640
- output_index: z18.number(),
4641
- partial_image_b64: z18.string()
4971
+ z19.object({
4972
+ type: z19.literal("response.image_generation_call.partial_image"),
4973
+ item_id: z19.string(),
4974
+ output_index: z19.number(),
4975
+ partial_image_b64: z19.string()
4642
4976
  }),
4643
- z18.object({
4644
- type: z18.literal("response.code_interpreter_call_code.delta"),
4645
- item_id: z18.string(),
4646
- output_index: z18.number(),
4647
- delta: z18.string()
4977
+ z19.object({
4978
+ type: z19.literal("response.code_interpreter_call_code.delta"),
4979
+ item_id: z19.string(),
4980
+ output_index: z19.number(),
4981
+ delta: z19.string()
4648
4982
  }),
4649
- z18.object({
4650
- type: z18.literal("response.code_interpreter_call_code.done"),
4651
- item_id: z18.string(),
4652
- output_index: z18.number(),
4653
- code: z18.string()
4983
+ z19.object({
4984
+ type: z19.literal("response.code_interpreter_call_code.done"),
4985
+ item_id: z19.string(),
4986
+ output_index: z19.number(),
4987
+ code: z19.string()
4654
4988
  }),
4655
- z18.object({
4656
- type: z18.literal("response.output_text.annotation.added"),
4657
- annotation: z18.discriminatedUnion("type", [
4658
- z18.object({
4659
- type: z18.literal("url_citation"),
4660
- start_index: z18.number(),
4661
- end_index: z18.number(),
4662
- url: z18.string(),
4663
- title: z18.string()
4989
+ z19.object({
4990
+ type: z19.literal("response.output_text.annotation.added"),
4991
+ annotation: z19.discriminatedUnion("type", [
4992
+ z19.object({
4993
+ type: z19.literal("url_citation"),
4994
+ start_index: z19.number(),
4995
+ end_index: z19.number(),
4996
+ url: z19.string(),
4997
+ title: z19.string()
4664
4998
  }),
4665
- z18.object({
4666
- type: z18.literal("file_citation"),
4667
- file_id: z18.string(),
4668
- filename: z18.string(),
4669
- index: z18.number()
4999
+ z19.object({
5000
+ type: z19.literal("file_citation"),
5001
+ file_id: z19.string(),
5002
+ filename: z19.string(),
5003
+ index: z19.number()
4670
5004
  }),
4671
- z18.object({
4672
- type: z18.literal("container_file_citation"),
4673
- container_id: z18.string(),
4674
- file_id: z18.string(),
4675
- filename: z18.string(),
4676
- start_index: z18.number(),
4677
- end_index: z18.number()
5005
+ z19.object({
5006
+ type: z19.literal("container_file_citation"),
5007
+ container_id: z19.string(),
5008
+ file_id: z19.string(),
5009
+ filename: z19.string(),
5010
+ start_index: z19.number(),
5011
+ end_index: z19.number()
4678
5012
  }),
4679
- z18.object({
4680
- type: z18.literal("file_path"),
4681
- file_id: z18.string(),
4682
- index: z18.number()
5013
+ z19.object({
5014
+ type: z19.literal("file_path"),
5015
+ file_id: z19.string(),
5016
+ index: z19.number()
4683
5017
  })
4684
5018
  ])
4685
5019
  }),
4686
- z18.object({
4687
- type: z18.literal("response.reasoning_summary_part.added"),
4688
- item_id: z18.string(),
4689
- summary_index: z18.number()
5020
+ z19.object({
5021
+ type: z19.literal("response.reasoning_summary_part.added"),
5022
+ item_id: z19.string(),
5023
+ summary_index: z19.number()
4690
5024
  }),
4691
- z18.object({
4692
- type: z18.literal("response.reasoning_summary_text.delta"),
4693
- item_id: z18.string(),
4694
- summary_index: z18.number(),
4695
- delta: z18.string()
5025
+ z19.object({
5026
+ type: z19.literal("response.reasoning_summary_text.delta"),
5027
+ item_id: z19.string(),
5028
+ summary_index: z19.number(),
5029
+ delta: z19.string()
4696
5030
  }),
4697
- z18.object({
4698
- type: z18.literal("response.reasoning_summary_part.done"),
4699
- item_id: z18.string(),
4700
- summary_index: z18.number()
5031
+ z19.object({
5032
+ type: z19.literal("response.reasoning_summary_part.done"),
5033
+ item_id: z19.string(),
5034
+ summary_index: z19.number()
4701
5035
  }),
4702
- z18.object({
4703
- type: z18.literal("response.apply_patch_call_operation_diff.delta"),
4704
- item_id: z18.string(),
4705
- output_index: z18.number(),
4706
- delta: z18.string(),
4707
- obfuscation: z18.string().nullish()
5036
+ z19.object({
5037
+ type: z19.literal("response.apply_patch_call_operation_diff.delta"),
5038
+ item_id: z19.string(),
5039
+ output_index: z19.number(),
5040
+ delta: z19.string(),
5041
+ obfuscation: z19.string().nullish()
4708
5042
  }),
4709
- z18.object({
4710
- type: z18.literal("response.apply_patch_call_operation_diff.done"),
4711
- item_id: z18.string(),
4712
- output_index: z18.number(),
4713
- diff: z18.string()
5043
+ z19.object({
5044
+ type: z19.literal("response.apply_patch_call_operation_diff.done"),
5045
+ item_id: z19.string(),
5046
+ output_index: z19.number(),
5047
+ diff: z19.string()
4714
5048
  }),
4715
5049
  openaiResponsesNestedErrorChunkSchema,
4716
5050
  openaiResponsesErrorChunkSchema,
4717
- z18.object({ type: z18.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5051
+ z19.object({ type: z19.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
4718
5052
  message: "Known response chunk failed schema validation"
4719
5053
  }).transform((value) => ({
4720
5054
  type: "unknown_chunk",
@@ -4724,583 +5058,297 @@ var openaiResponsesChunkSchema = lazySchema16(
4724
5058
  ])
4725
5059
  )
4726
5060
  );
4727
- var openaiResponsesResponseSchema = lazySchema16(
4728
- () => zodSchema16(
4729
- z18.object({
4730
- id: z18.string().optional(),
4731
- created_at: z18.number().optional(),
4732
- error: z18.object({
4733
- message: z18.string(),
4734
- type: z18.string(),
4735
- param: z18.string().nullish(),
4736
- code: z18.string()
5061
+ var openaiResponsesResponseSchema = lazySchema17(
5062
+ () => zodSchema17(
5063
+ z19.object({
5064
+ id: z19.string().optional(),
5065
+ created_at: z19.number().optional(),
5066
+ error: z19.object({
5067
+ message: z19.string(),
5068
+ type: z19.string(),
5069
+ param: z19.string().nullish(),
5070
+ code: z19.string()
4737
5071
  }).nullish(),
4738
- model: z18.string().optional(),
4739
- output: z18.array(
4740
- z18.discriminatedUnion("type", [
4741
- z18.object({
4742
- type: z18.literal("message"),
4743
- role: z18.literal("assistant"),
4744
- id: z18.string(),
4745
- phase: z18.enum(["commentary", "final_answer"]).nullish(),
4746
- content: z18.array(
4747
- z18.object({
4748
- type: z18.literal("output_text"),
4749
- text: z18.string(),
4750
- logprobs: z18.array(
4751
- z18.object({
4752
- token: z18.string(),
4753
- logprob: z18.number(),
4754
- top_logprobs: z18.array(
4755
- z18.object({
4756
- token: z18.string(),
4757
- logprob: z18.number()
5072
+ model: z19.string().optional(),
5073
+ output: z19.array(
5074
+ z19.discriminatedUnion("type", [
5075
+ z19.object({
5076
+ type: z19.literal("message"),
5077
+ role: z19.literal("assistant"),
5078
+ id: z19.string(),
5079
+ phase: z19.enum(["commentary", "final_answer"]).nullish(),
5080
+ content: z19.array(
5081
+ z19.object({
5082
+ type: z19.literal("output_text"),
5083
+ text: z19.string(),
5084
+ logprobs: z19.array(
5085
+ z19.object({
5086
+ token: z19.string(),
5087
+ logprob: z19.number(),
5088
+ top_logprobs: z19.array(
5089
+ z19.object({
5090
+ token: z19.string(),
5091
+ logprob: z19.number()
4758
5092
  })
4759
5093
  )
4760
5094
  })
4761
5095
  ).nullish(),
4762
- annotations: z18.array(
4763
- z18.discriminatedUnion("type", [
4764
- z18.object({
4765
- type: z18.literal("url_citation"),
4766
- start_index: z18.number(),
4767
- end_index: z18.number(),
4768
- url: z18.string(),
4769
- title: z18.string()
5096
+ annotations: z19.array(
5097
+ z19.discriminatedUnion("type", [
5098
+ z19.object({
5099
+ type: z19.literal("url_citation"),
5100
+ start_index: z19.number(),
5101
+ end_index: z19.number(),
5102
+ url: z19.string(),
5103
+ title: z19.string()
4770
5104
  }),
4771
- z18.object({
4772
- type: z18.literal("file_citation"),
4773
- file_id: z18.string(),
4774
- filename: z18.string(),
4775
- index: z18.number()
5105
+ z19.object({
5106
+ type: z19.literal("file_citation"),
5107
+ file_id: z19.string(),
5108
+ filename: z19.string(),
5109
+ index: z19.number()
4776
5110
  }),
4777
- z18.object({
4778
- type: z18.literal("container_file_citation"),
4779
- container_id: z18.string(),
4780
- file_id: z18.string(),
4781
- filename: z18.string(),
4782
- start_index: z18.number(),
4783
- end_index: z18.number()
5111
+ z19.object({
5112
+ type: z19.literal("container_file_citation"),
5113
+ container_id: z19.string(),
5114
+ file_id: z19.string(),
5115
+ filename: z19.string(),
5116
+ start_index: z19.number(),
5117
+ end_index: z19.number()
4784
5118
  }),
4785
- z18.object({
4786
- type: z18.literal("file_path"),
4787
- file_id: z18.string(),
4788
- index: z18.number()
5119
+ z19.object({
5120
+ type: z19.literal("file_path"),
5121
+ file_id: z19.string(),
5122
+ index: z19.number()
4789
5123
  })
4790
5124
  ])
4791
5125
  )
4792
5126
  })
4793
5127
  )
4794
5128
  }),
4795
- z18.object({
4796
- type: z18.literal("web_search_call"),
4797
- id: z18.string(),
4798
- status: z18.string(),
4799
- action: z18.discriminatedUnion("type", [
4800
- z18.object({
4801
- type: z18.literal("search"),
4802
- query: z18.string().nullish(),
4803
- queries: z18.array(z18.string()).nullish(),
4804
- sources: z18.array(
4805
- z18.discriminatedUnion("type", [
4806
- z18.object({ type: z18.literal("url"), url: z18.string() }),
4807
- z18.object({
4808
- type: z18.literal("api"),
4809
- name: z18.string()
5129
+ z19.object({
5130
+ type: z19.literal("web_search_call"),
5131
+ id: z19.string(),
5132
+ status: z19.string(),
5133
+ action: z19.discriminatedUnion("type", [
5134
+ z19.object({
5135
+ type: z19.literal("search"),
5136
+ query: z19.string().nullish(),
5137
+ queries: z19.array(z19.string()).nullish(),
5138
+ sources: z19.array(
5139
+ z19.discriminatedUnion("type", [
5140
+ z19.object({ type: z19.literal("url"), url: z19.string() }),
5141
+ z19.object({
5142
+ type: z19.literal("api"),
5143
+ name: z19.string()
4810
5144
  })
4811
5145
  ])
4812
5146
  ).nullish()
4813
5147
  }),
4814
- z18.object({
4815
- type: z18.literal("open_page"),
4816
- url: z18.string().nullish()
5148
+ z19.object({
5149
+ type: z19.literal("open_page"),
5150
+ url: z19.string().nullish()
4817
5151
  }),
4818
- z18.object({
4819
- type: z18.literal("find_in_page"),
4820
- url: z18.string().nullish(),
4821
- pattern: z18.string().nullish()
5152
+ z19.object({
5153
+ type: z19.literal("find_in_page"),
5154
+ url: z19.string().nullish(),
5155
+ pattern: z19.string().nullish()
4822
5156
  })
4823
5157
  ]).nullish()
4824
5158
  }),
4825
- z18.object({
4826
- type: z18.literal("file_search_call"),
4827
- id: z18.string(),
4828
- queries: z18.array(z18.string()),
4829
- results: z18.array(
4830
- z18.object({
4831
- attributes: z18.record(
4832
- z18.string(),
4833
- z18.union([z18.string(), z18.number(), z18.boolean()])
5159
+ z19.object({
5160
+ type: z19.literal("file_search_call"),
5161
+ id: z19.string(),
5162
+ queries: z19.array(z19.string()),
5163
+ results: z19.array(
5164
+ z19.object({
5165
+ attributes: z19.record(
5166
+ z19.string(),
5167
+ z19.union([z19.string(), z19.number(), z19.boolean()])
4834
5168
  ),
4835
- file_id: z18.string(),
4836
- filename: z18.string(),
4837
- score: z18.number(),
4838
- text: z18.string()
5169
+ file_id: z19.string(),
5170
+ filename: z19.string(),
5171
+ score: z19.number(),
5172
+ text: z19.string()
4839
5173
  })
4840
5174
  ).nullish()
4841
5175
  }),
4842
- z18.object({
4843
- type: z18.literal("code_interpreter_call"),
4844
- id: z18.string(),
4845
- code: z18.string().nullable(),
4846
- container_id: z18.string(),
4847
- outputs: z18.array(
4848
- z18.discriminatedUnion("type", [
4849
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
4850
- z18.object({ type: z18.literal("image"), url: z18.string() })
5176
+ z19.object({
5177
+ type: z19.literal("code_interpreter_call"),
5178
+ id: z19.string(),
5179
+ code: z19.string().nullable(),
5180
+ container_id: z19.string(),
5181
+ outputs: z19.array(
5182
+ z19.discriminatedUnion("type", [
5183
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
5184
+ z19.object({ type: z19.literal("image"), url: z19.string() })
4851
5185
  ])
4852
5186
  ).nullable()
4853
5187
  }),
4854
- z18.object({
4855
- type: z18.literal("image_generation_call"),
4856
- id: z18.string(),
4857
- result: z18.string()
5188
+ z19.object({
5189
+ type: z19.literal("image_generation_call"),
5190
+ id: z19.string(),
5191
+ result: z19.string()
4858
5192
  }),
4859
5193
  openaiResponsesLocalShellCallSchema,
4860
- z18.object({
4861
- type: z18.literal("function_call"),
4862
- call_id: z18.string(),
4863
- name: z18.string(),
4864
- arguments: z18.string(),
4865
- id: z18.string(),
4866
- async: z18.boolean().nullish(),
4867
- namespace: z18.string().nullish()
5194
+ z19.object({
5195
+ type: z19.literal("function_call"),
5196
+ call_id: z19.string(),
5197
+ name: z19.string(),
5198
+ arguments: z19.string(),
5199
+ id: z19.string(),
5200
+ async: z19.boolean().nullish(),
5201
+ namespace: z19.string().nullish()
4868
5202
  }),
4869
- z18.object({
4870
- type: z18.literal("custom_tool_call"),
4871
- call_id: z18.string(),
4872
- name: z18.string(),
4873
- input: z18.string(),
4874
- id: z18.string(),
4875
- async: z18.boolean().nullish()
5203
+ z19.object({
5204
+ type: z19.literal("custom_tool_call"),
5205
+ call_id: z19.string(),
5206
+ name: z19.string(),
5207
+ input: z19.string(),
5208
+ id: z19.string(),
5209
+ async: z19.boolean().nullish()
4876
5210
  }),
4877
- z18.object({
4878
- type: z18.literal("computer_call"),
4879
- id: z18.string(),
4880
- status: z18.string().optional()
5211
+ z19.object({
5212
+ type: z19.literal("computer_call"),
5213
+ id: z19.string(),
5214
+ status: z19.string().optional()
4881
5215
  }),
4882
- z18.object({
4883
- type: z18.literal("reasoning"),
4884
- id: z18.string(),
4885
- encrypted_content: z18.string().nullish(),
4886
- summary: z18.array(
4887
- z18.object({
4888
- type: z18.literal("summary_text"),
4889
- text: z18.string()
5216
+ z19.object({
5217
+ type: z19.literal("reasoning"),
5218
+ id: z19.string(),
5219
+ encrypted_content: z19.string().nullish(),
5220
+ summary: z19.array(
5221
+ z19.object({
5222
+ type: z19.literal("summary_text"),
5223
+ text: z19.string()
4890
5224
  })
4891
5225
  )
4892
5226
  }),
4893
- z18.object({
4894
- type: z18.literal("mcp_call"),
4895
- id: z18.string(),
4896
- status: z18.string(),
4897
- arguments: z18.string(),
4898
- name: z18.string(),
4899
- server_label: z18.string(),
4900
- output: z18.string().nullish(),
4901
- error: z18.union([
4902
- z18.string(),
4903
- z18.object({
4904
- type: z18.string().optional(),
4905
- code: z18.union([z18.number(), z18.string()]).optional(),
4906
- message: z18.string().optional()
5227
+ z19.object({
5228
+ type: z19.literal("mcp_call"),
5229
+ id: z19.string(),
5230
+ status: z19.string(),
5231
+ arguments: z19.string(),
5232
+ name: z19.string(),
5233
+ server_label: z19.string(),
5234
+ output: z19.string().nullish(),
5235
+ error: z19.union([
5236
+ z19.string(),
5237
+ z19.object({
5238
+ type: z19.string().optional(),
5239
+ code: z19.union([z19.number(), z19.string()]).optional(),
5240
+ message: z19.string().optional()
4907
5241
  }).loose()
4908
5242
  ]).nullish(),
4909
- approval_request_id: z18.string().nullish()
5243
+ approval_request_id: z19.string().nullish()
4910
5244
  }),
4911
- z18.object({
4912
- type: z18.literal("mcp_list_tools"),
4913
- id: z18.string(),
4914
- server_label: z18.string(),
4915
- tools: z18.array(
4916
- z18.object({
4917
- name: z18.string(),
4918
- description: z18.string().optional(),
4919
- input_schema: z18.any(),
4920
- annotations: z18.record(z18.string(), z18.unknown()).optional()
5245
+ z19.object({
5246
+ type: z19.literal("mcp_list_tools"),
5247
+ id: z19.string(),
5248
+ server_label: z19.string(),
5249
+ tools: z19.array(
5250
+ z19.object({
5251
+ name: z19.string(),
5252
+ description: z19.string().optional(),
5253
+ input_schema: z19.any(),
5254
+ annotations: z19.record(z19.string(), z19.unknown()).optional()
4921
5255
  })
4922
5256
  ),
4923
- error: z18.union([
4924
- z18.string(),
4925
- z18.object({
4926
- type: z18.string().optional(),
4927
- code: z18.union([z18.number(), z18.string()]).optional(),
4928
- message: z18.string().optional()
5257
+ error: z19.union([
5258
+ z19.string(),
5259
+ z19.object({
5260
+ type: z19.string().optional(),
5261
+ code: z19.union([z19.number(), z19.string()]).optional(),
5262
+ message: z19.string().optional()
4929
5263
  }).loose()
4930
5264
  ]).optional()
4931
5265
  }),
4932
- z18.object({
4933
- type: z18.literal("mcp_approval_request"),
4934
- id: z18.string(),
4935
- server_label: z18.string(),
4936
- name: z18.string(),
4937
- arguments: z18.string(),
4938
- approval_request_id: z18.string().optional()
5266
+ z19.object({
5267
+ type: z19.literal("mcp_approval_request"),
5268
+ id: z19.string(),
5269
+ server_label: z19.string(),
5270
+ name: z19.string(),
5271
+ arguments: z19.string(),
5272
+ approval_request_id: z19.string().optional()
4939
5273
  }),
4940
- z18.object({
4941
- type: z18.literal("apply_patch_call"),
4942
- id: z18.string(),
4943
- call_id: z18.string(),
4944
- status: z18.enum(["in_progress", "completed"]),
4945
- operation: z18.discriminatedUnion("type", [
4946
- z18.object({
4947
- type: z18.literal("create_file"),
4948
- path: z18.string(),
4949
- diff: z18.string()
5274
+ z19.object({
5275
+ type: z19.literal("apply_patch_call"),
5276
+ id: z19.string(),
5277
+ call_id: z19.string(),
5278
+ status: z19.enum(["in_progress", "completed"]),
5279
+ operation: z19.discriminatedUnion("type", [
5280
+ z19.object({
5281
+ type: z19.literal("create_file"),
5282
+ path: z19.string(),
5283
+ diff: z19.string()
4950
5284
  }),
4951
- z18.object({
4952
- type: z18.literal("delete_file"),
4953
- path: z18.string()
5285
+ z19.object({
5286
+ type: z19.literal("delete_file"),
5287
+ path: z19.string()
4954
5288
  }),
4955
- z18.object({
4956
- type: z18.literal("update_file"),
4957
- path: z18.string(),
4958
- diff: z18.string()
5289
+ z19.object({
5290
+ type: z19.literal("update_file"),
5291
+ path: z19.string(),
5292
+ diff: z19.string()
4959
5293
  })
4960
5294
  ])
4961
5295
  }),
4962
- z18.object({
4963
- type: z18.literal("shell_call"),
4964
- id: z18.string(),
4965
- call_id: z18.string(),
4966
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4967
- action: z18.object({
4968
- commands: z18.array(z18.string())
5296
+ z19.object({
5297
+ type: z19.literal("shell_call"),
5298
+ id: z19.string(),
5299
+ call_id: z19.string(),
5300
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
5301
+ action: z19.object({
5302
+ commands: z19.array(z19.string())
4969
5303
  })
4970
5304
  }),
4971
- z18.object({
4972
- type: z18.literal("shell_call_output"),
4973
- id: z18.string(),
4974
- call_id: z18.string(),
4975
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4976
- output: z18.array(
4977
- z18.object({
4978
- stdout: z18.string(),
4979
- stderr: z18.string(),
4980
- outcome: z18.discriminatedUnion("type", [
4981
- z18.object({ type: z18.literal("timeout") }),
4982
- z18.object({
4983
- type: z18.literal("exit"),
4984
- exit_code: z18.number()
5305
+ z19.object({
5306
+ type: z19.literal("shell_call_output"),
5307
+ id: z19.string(),
5308
+ call_id: z19.string(),
5309
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
5310
+ output: z19.array(
5311
+ z19.object({
5312
+ stdout: z19.string(),
5313
+ stderr: z19.string(),
5314
+ outcome: z19.discriminatedUnion("type", [
5315
+ z19.object({ type: z19.literal("timeout") }),
5316
+ z19.object({
5317
+ type: z19.literal("exit"),
5318
+ exit_code: z19.number()
4985
5319
  })
4986
5320
  ])
4987
5321
  })
4988
5322
  )
4989
5323
  }),
4990
- z18.object({
4991
- type: z18.literal("tool_search_call"),
4992
- id: z18.string(),
4993
- execution: z18.enum(["server", "client"]),
4994
- call_id: z18.string().nullable(),
4995
- status: z18.enum(["in_progress", "completed", "incomplete"]),
4996
- arguments: z18.unknown()
5324
+ z19.object({
5325
+ type: z19.literal("tool_search_call"),
5326
+ id: z19.string(),
5327
+ execution: z19.enum(["server", "client"]),
5328
+ call_id: z19.string().nullable(),
5329
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
5330
+ arguments: z19.unknown()
4997
5331
  }),
4998
- z18.object({
4999
- type: z18.literal("tool_search_output"),
5000
- id: z18.string(),
5001
- execution: z18.enum(["server", "client"]),
5002
- call_id: z18.string().nullable(),
5003
- status: z18.enum(["in_progress", "completed", "incomplete"]),
5004
- tools: z18.array(z18.record(z18.string(), jsonValueSchema.optional()))
5332
+ z19.object({
5333
+ type: z19.literal("tool_search_output"),
5334
+ id: z19.string(),
5335
+ execution: z19.enum(["server", "client"]),
5336
+ call_id: z19.string().nullable(),
5337
+ status: z19.enum(["in_progress", "completed", "incomplete"]),
5338
+ tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
5005
5339
  })
5006
5340
  ])
5007
5341
  ).optional(),
5008
- service_tier: z18.string().nullish(),
5009
- reasoning: z18.object({
5010
- context: z18.string().nullish()
5342
+ service_tier: z19.string().nullish(),
5343
+ reasoning: z19.object({
5344
+ context: z19.string().nullish()
5011
5345
  }).nullish(),
5012
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
5346
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
5013
5347
  usage: openaiResponsesUsageSchema.nullish()
5014
5348
  })
5015
5349
  )
5016
5350
  );
5017
5351
 
5018
- // src/responses/openai-responses-options.ts
5019
- import {
5020
- lazySchema as lazySchema17,
5021
- zodSchema as zodSchema17
5022
- } from "@ai-sdk/provider-utils";
5023
- import { z as z19 } from "zod/v4";
5024
- var TOP_LOGPROBS_MAX = 20;
5025
- var openaiResponsesReasoningModelIds = [
5026
- "o1",
5027
- "o1-2024-12-17",
5028
- "o3",
5029
- "o3-2025-04-16",
5030
- "o3-mini",
5031
- "o3-mini-2025-01-31",
5032
- "o4-mini",
5033
- "o4-mini-2025-04-16",
5034
- "gpt-5",
5035
- "gpt-5-2025-08-07",
5036
- "gpt-5-codex",
5037
- "gpt-5-mini",
5038
- "gpt-5-mini-2025-08-07",
5039
- "gpt-5-nano",
5040
- "gpt-5-nano-2025-08-07",
5041
- "gpt-5-pro",
5042
- "gpt-5-pro-2025-10-06",
5043
- "gpt-5.1",
5044
- "gpt-5.1-chat-latest",
5045
- "gpt-5.1-codex-mini",
5046
- "gpt-5.1-codex",
5047
- "gpt-5.1-codex-max",
5048
- "gpt-5.2",
5049
- "gpt-5.2-chat-latest",
5050
- "gpt-5.2-pro",
5051
- "gpt-5.2-codex",
5052
- "gpt-5.3-chat-latest",
5053
- "gpt-5.3-codex",
5054
- "gpt-5.4",
5055
- "gpt-5.4-2026-03-05",
5056
- "gpt-5.4-mini",
5057
- "gpt-5.4-mini-2026-03-17",
5058
- "gpt-5.4-nano",
5059
- "gpt-5.4-nano-2026-03-17",
5060
- "gpt-5.4-pro",
5061
- "gpt-5.4-pro-2026-03-05",
5062
- "gpt-5.5",
5063
- "gpt-5.5-2026-04-23",
5064
- "gpt-5.6",
5065
- "gpt-5.6-luna",
5066
- "gpt-5.6-sol",
5067
- "gpt-5.6-terra",
5068
- "gpt-6-astra",
5069
- "gpt-6-luna",
5070
- "gpt-6-sol"
5071
- ];
5072
- var openaiResponsesModelIds = [
5073
- "gpt-4.1",
5074
- "gpt-4.1-2025-04-14",
5075
- "gpt-4.1-mini",
5076
- "gpt-4.1-mini-2025-04-14",
5077
- "gpt-4.1-nano",
5078
- "gpt-4.1-nano-2025-04-14",
5079
- "gpt-4o",
5080
- "gpt-4o-2024-05-13",
5081
- "gpt-4o-2024-08-06",
5082
- "gpt-4o-2024-11-20",
5083
- "gpt-4o-audio-preview",
5084
- "gpt-4o-audio-preview-2024-12-17",
5085
- "gpt-4o-search-preview",
5086
- "gpt-4o-search-preview-2025-03-11",
5087
- "gpt-4o-mini-search-preview",
5088
- "gpt-4o-mini-search-preview-2025-03-11",
5089
- "gpt-4o-mini",
5090
- "gpt-4o-mini-2024-07-18",
5091
- "gpt-3.5-turbo-0125",
5092
- "gpt-3.5-turbo",
5093
- "gpt-3.5-turbo-1106",
5094
- "gpt-5-chat-latest",
5095
- ...openaiResponsesReasoningModelIds
5096
- ];
5097
- var openaiLanguageModelResponsesOptionsSchema = lazySchema17(
5098
- () => zodSchema17(
5099
- z19.object({
5100
- /**
5101
- * The ID of the OpenAI Conversation to continue.
5102
- * You must create a conversation first via the OpenAI API.
5103
- * Cannot be used in conjunction with `previousResponseId`.
5104
- * Defaults to `undefined`.
5105
- * @see https://platform.openai.com/docs/api-reference/conversations/create
5106
- */
5107
- conversation: z19.string().nullish(),
5108
- /**
5109
- * The set of extra fields to include in the response (advanced, usually not needed).
5110
- * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5111
- */
5112
- include: z19.array(
5113
- z19.enum([
5114
- "reasoning.encrypted_content",
5115
- // handled internally by default, only needed for unknown reasoning models
5116
- "file_search_call.results",
5117
- "web_search_call.results",
5118
- "message.output_text.logprobs"
5119
- ])
5120
- ).nullish(),
5121
- /**
5122
- * Instructions for the model.
5123
- * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5124
- * Defaults to `undefined`.
5125
- */
5126
- instructions: z19.string().nullish(),
5127
- /**
5128
- * Return the log probabilities of the tokens. Including logprobs will increase
5129
- * the response size and can slow down response times. However, it can
5130
- * be useful to better understand how the model is behaving.
5131
- *
5132
- * Setting to true will return the log probabilities of the tokens that
5133
- * were generated.
5134
- *
5135
- * Setting to a number will return the log probabilities of the top n
5136
- * tokens that were generated.
5137
- *
5138
- * @see https://platform.openai.com/docs/api-reference/responses/create
5139
- * @see https://cookbook.openai.com/examples/using_logprobs
5140
- */
5141
- logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5142
- /**
5143
- * The maximum number of total calls to built-in tools that can be processed in a response.
5144
- * This maximum number applies across all built-in tool calls, not per individual tool.
5145
- * Any further attempts to call a tool by the model will be ignored.
5146
- */
5147
- maxToolCalls: z19.number().nullish(),
5148
- /**
5149
- * Additional metadata to store with the generation.
5150
- */
5151
- metadata: z19.any().nullish(),
5152
- /**
5153
- * Whether to use parallel tool calls. Defaults to `true`.
5154
- */
5155
- parallelToolCalls: z19.boolean().nullish(),
5156
- /**
5157
- * The ID of the previous response. You can use it to continue a conversation.
5158
- * Defaults to `undefined`.
5159
- */
5160
- previousResponseId: z19.string().nullish(),
5161
- /**
5162
- * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5163
- */
5164
- promptCacheKey: z19.string().nullish(),
5165
- /**
5166
- * Prompt cache behavior for GPT-5.6 and later models.
5167
- * `mode` controls whether OpenAI also places an implicit breakpoint.
5168
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5169
- */
5170
- promptCacheOptions: z19.object({
5171
- mode: z19.enum(["implicit", "explicit"]).optional(),
5172
- ttl: z19.literal("30m").optional()
5173
- }).optional(),
5174
- /**
5175
- * The retention policy for the prompt cache.
5176
- * - 'in_memory': Default. Standard prompt caching behavior.
5177
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
5178
- * Available for models before GPT-5.6 that support extended caching.
5179
- *
5180
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
5181
- *
5182
- * @default 'in_memory'
5183
- */
5184
- promptCacheRetention: z19.enum(["in_memory", "24h"]).nullish(),
5185
- /**
5186
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5187
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5188
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5189
- * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5190
- * Supported values vary by model.
5191
- */
5192
- reasoningEffort: z19.string().nullish(),
5193
- /**
5194
- * Updates the reasoning effort for GPT-6 and later models starting with this response
5195
- * without changing the request-level reasoning effort. This preserves the
5196
- * request prefix for prompt caching.
5197
- *
5198
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
5199
- * combined with automatic truncation.
5200
- */
5201
- reasoningEffortUpdate: z19.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5202
- /**
5203
- * Controls how much model work GPT-5.6 performs before returning a final answer.
5204
- * `standard` is the default. `pro` increases quality, latency, and token usage.
5205
- */
5206
- reasoningMode: z19.enum(["standard", "pro"]).optional(),
5207
- /**
5208
- * Controls which available reasoning items GPT-5.6 can use.
5209
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5210
- * turns, and `all_turns` makes compatible earlier reasoning available.
5211
- */
5212
- reasoningContext: z19.enum(["auto", "current_turn", "all_turns"]).optional(),
5213
- /**
5214
- * Controls reasoning summary output from the model.
5215
- * Set to "auto" to automatically receive the richest level available,
5216
- * or "detailed" for comprehensive summaries.
5217
- */
5218
- reasoningSummary: z19.string().nullish(),
5219
- /**
5220
- * The identifier for safety monitoring and tracking.
5221
- */
5222
- safetyIdentifier: z19.string().nullish(),
5223
- /**
5224
- * Service tier for the request.
5225
- * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
5226
- * 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).
5227
- * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
5228
- *
5229
- * Defaults to 'auto'.
5230
- */
5231
- serviceTier: z19.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
5232
- /**
5233
- * Whether to store the generation. Defaults to `true`.
5234
- */
5235
- store: z19.boolean().nullish(),
5236
- /**
5237
- * Whether to pass through non-image file types as generic input files.
5238
- *
5239
- * By default, inline file inputs are restricted to images and PDFs.
5240
- * Enable this when the target OpenAI Responses model supports additional
5241
- * file media types, such as text/csv.
5242
- */
5243
- passThroughUnsupportedFiles: z19.boolean().optional(),
5244
- /**
5245
- * Whether to use strict JSON schema validation.
5246
- * Defaults to `true`.
5247
- */
5248
- strictJsonSchema: z19.boolean().nullish(),
5249
- /**
5250
- * Controls the verbosity of the model's responses. Lower values ('low') will result
5251
- * in more concise responses, while higher values ('high') will result in more verbose responses.
5252
- * Valid values: 'low', 'medium', 'high'.
5253
- */
5254
- textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
5255
- /**
5256
- * Controls output truncation. 'auto' (default) performs truncation automatically;
5257
- * 'disabled' turns truncation off.
5258
- */
5259
- truncation: z19.enum(["auto", "disabled"]).nullish(),
5260
- /**
5261
- * A unique identifier representing your end-user, which can help OpenAI to
5262
- * monitor and detect abuse.
5263
- * Defaults to `undefined`.
5264
- * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5265
- */
5266
- user: z19.string().nullish(),
5267
- /**
5268
- * Override the system message mode for this model.
5269
- * - 'system': Use the 'system' role for system messages (default for most models)
5270
- * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
5271
- * - 'remove': Remove system messages entirely
5272
- *
5273
- * If not specified, the mode is automatically determined based on the model.
5274
- */
5275
- systemMessageMode: z19.enum(["system", "developer", "remove"]).optional(),
5276
- /**
5277
- * Force treating this model as a reasoning model.
5278
- *
5279
- * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
5280
- * where the model ID is not recognized by the SDK's allowlist.
5281
- *
5282
- * When enabled, the SDK applies reasoning-model parameter compatibility rules
5283
- * and defaults `systemMessageMode` to `developer` unless overridden.
5284
- */
5285
- forceReasoning: z19.boolean().optional(),
5286
- /**
5287
- * Restrict the callable tools to a subset while keeping the full tools
5288
- * list intact, so prompt caching is preserved across requests with
5289
- * different allowlists.
5290
- *
5291
- * When set, this overrides the request-level `toolChoice` and emits
5292
- * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
5293
- *
5294
- * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5295
- */
5296
- allowedTools: z19.object({
5297
- toolNames: z19.array(z19.string()).min(1),
5298
- mode: z19.enum(["auto", "required"]).optional()
5299
- }).optional()
5300
- })
5301
- )
5302
- );
5303
-
5304
5352
  // src/responses/openai-responses-prepare-tools.ts
5305
5353
  import {
5306
5354
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
@@ -6154,6 +6202,18 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
6154
6202
  }
6155
6203
  return mapping;
6156
6204
  }
6205
+ function getConfigurationUpdateUnsupportedReason({
6206
+ modelCapabilities,
6207
+ options
6208
+ }) {
6209
+ if (!modelCapabilities.supportsConfigurationUpdate) {
6210
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
6211
+ }
6212
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
6213
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
6214
+ }
6215
+ return void 0;
6216
+ }
6157
6217
  var OpenAIResponsesLanguageModel = class {
6158
6218
  constructor(modelId, config) {
6159
6219
  this.specificationVersion = "v3";
@@ -6261,8 +6321,13 @@ var OpenAIResponsesLanguageModel = class {
6261
6321
  customProviderToolNames,
6262
6322
  supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6263
6323
  });
6324
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
6325
+ modelCapabilities,
6326
+ options: openaiOptions
6327
+ });
6264
6328
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
6265
6329
  prompt,
6330
+ configurationUpdateUnsupportedReason,
6266
6331
  toolNameMapping,
6267
6332
  systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
6268
6333
  providerOptionsName,
@@ -6280,18 +6345,27 @@ var OpenAIResponsesLanguageModel = class {
6280
6345
  });
6281
6346
  warnings.push(...inputWarnings);
6282
6347
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
6283
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
6284
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
6348
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
6285
6349
  warnings.push({
6286
6350
  type: "unsupported",
6287
6351
  feature: "reasoningEffortUpdate",
6288
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
6352
+ details: configurationUpdateUnsupportedReason
6289
6353
  });
6290
6354
  } else if (reasoningEffortUpdate != null) {
6291
- input.unshift({
6292
- type: "configuration_update",
6293
- reasoning: { effort: reasoningEffortUpdate }
6294
- });
6355
+ const firstItem = input[0];
6356
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
6357
+ input.unshift({
6358
+ type: "configuration_update",
6359
+ reasoning: { effort: reasoningEffortUpdate }
6360
+ });
6361
+ }
6362
+ }
6363
+ for (let i = 1; i < input.length; i++) {
6364
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
6365
+ throw new UnsupportedFunctionalityError6({
6366
+ functionality: "Adjacent reasoning effort configuration updates"
6367
+ });
6368
+ }
6295
6369
  }
6296
6370
  const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
6297
6371
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -7238,7 +7312,7 @@ var OpenAIResponsesLanguageModel = class {
7238
7312
  };
7239
7313
  } else if (value.item.type === "shell_call_output") {
7240
7314
  } else if (value.item.type === "message") {
7241
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
7315
+ ongoingAnnotations.splice(0);
7242
7316
  activeMessagePhase = (_b2 = value.item.phase) != null ? _b2 : void 0;
7243
7317
  controller.enqueue({
7244
7318
  type: "text-start",