@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.
@@ -202,7 +202,8 @@ function createOpenAIStreamError({
202
202
  statusCode: streamError == null ? 500 : getStatusCode(streamError),
203
203
  responseHeaders,
204
204
  responseBody: JSON.stringify(frame),
205
- data: frame
205
+ data: frame,
206
+ isRetryable: streamError == null ? true : isRetryableStreamError(streamError, getStatusCode(streamError))
206
207
  });
207
208
  }
208
209
  function parseStreamError(frame) {
@@ -616,6 +617,9 @@ var openaiChatResponseSchema = (0, import_provider_utils3.lazySchema)(
616
617
  message: import_v42.z.object({
617
618
  role: import_v42.z.literal("assistant").nullish(),
618
619
  content: import_v42.z.string().nullish(),
620
+ audio: import_v42.z.object({
621
+ transcript: import_v42.z.string().nullish()
622
+ }).nullish(),
619
623
  tool_calls: import_v42.z.array(
620
624
  import_v42.z.object({
621
625
  id: import_v42.z.string().nullish(),
@@ -1155,7 +1159,7 @@ var OpenAIChatLanguageModel = class {
1155
1159
  };
1156
1160
  }
1157
1161
  async doGenerate(options) {
1158
- var _a2, _b, _c, _d, _e, _f, _g;
1162
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1159
1163
  const { args: body, warnings } = await this.getArgs(options);
1160
1164
  const {
1161
1165
  responseHeaders,
@@ -1183,19 +1187,19 @@ var OpenAIChatLanguageModel = class {
1183
1187
  });
1184
1188
  }
1185
1189
  const content = [];
1186
- const text = choice.message.content;
1190
+ const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
1187
1191
  if (text != null && text.length > 0) {
1188
1192
  content.push({ type: "text", text });
1189
1193
  }
1190
- for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
1194
+ for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
1191
1195
  content.push({
1192
1196
  type: "tool-call",
1193
- toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils5.generateId)(),
1197
+ toolCallId: (_c = toolCall.id) != null ? _c : (0, import_provider_utils5.generateId)(),
1194
1198
  toolName: toolCall.function.name,
1195
1199
  input: toolCall.function.arguments
1196
1200
  });
1197
1201
  }
1198
- for (const annotation of (_c = choice.message.annotations) != null ? _c : []) {
1202
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
1199
1203
  content.push({
1200
1204
  type: "source",
1201
1205
  sourceType: "url",
@@ -1204,8 +1208,8 @@ var OpenAIChatLanguageModel = class {
1204
1208
  title: annotation.url_citation.title
1205
1209
  });
1206
1210
  }
1207
- const completionTokenDetails = (_d = response.usage) == null ? void 0 : _d.completion_tokens_details;
1208
- const promptTokenDetails = (_e = response.usage) == null ? void 0 : _e.prompt_tokens_details;
1211
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
1212
+ const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
1209
1213
  const providerMetadata = { openai: {} };
1210
1214
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
1211
1215
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -1213,14 +1217,14 @@ var OpenAIChatLanguageModel = class {
1213
1217
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
1214
1218
  providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
1215
1219
  }
1216
- if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
1220
+ if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
1217
1221
  providerMetadata.openai.logprobs = choice.logprobs.content;
1218
1222
  }
1219
1223
  return {
1220
1224
  content,
1221
1225
  finishReason: {
1222
1226
  unified: mapOpenAIFinishReason(choice.finish_reason),
1223
- raw: (_g = choice.finish_reason) != null ? _g : void 0
1227
+ raw: (_h = choice.finish_reason) != null ? _h : void 0
1224
1228
  },
1225
1229
  usage: convertOpenAIChatUsage(response.usage),
1226
1230
  request: { body },
@@ -2787,45 +2791,343 @@ function convertOpenAIResponsesUsage(usage) {
2787
2791
 
2788
2792
  // src/responses/convert-to-openai-responses-input.ts
2789
2793
  var import_provider8 = require("@ai-sdk/provider");
2790
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
2791
- var import_v417 = require("zod/v4");
2794
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
2795
+ var import_v418 = require("zod/v4");
2792
2796
 
2793
- // src/tool/apply-patch.ts
2797
+ // src/responses/openai-responses-options.ts
2794
2798
  var import_provider_utils20 = require("@ai-sdk/provider-utils");
2795
2799
  var import_v413 = require("zod/v4");
2796
- var applyPatchInputSchema = (0, import_provider_utils20.lazySchema)(
2800
+ var TOP_LOGPROBS_MAX = 20;
2801
+ var openaiResponsesReasoningModelIds = [
2802
+ "o1",
2803
+ "o1-2024-12-17",
2804
+ "o3",
2805
+ "o3-2025-04-16",
2806
+ "o3-mini",
2807
+ "o3-mini-2025-01-31",
2808
+ "o4-mini",
2809
+ "o4-mini-2025-04-16",
2810
+ "gpt-5",
2811
+ "gpt-5-2025-08-07",
2812
+ "gpt-5-codex",
2813
+ "gpt-5-mini",
2814
+ "gpt-5-mini-2025-08-07",
2815
+ "gpt-5-nano",
2816
+ "gpt-5-nano-2025-08-07",
2817
+ "gpt-5-pro",
2818
+ "gpt-5-pro-2025-10-06",
2819
+ "gpt-5.1",
2820
+ "gpt-5.1-chat-latest",
2821
+ "gpt-5.1-codex-mini",
2822
+ "gpt-5.1-codex",
2823
+ "gpt-5.1-codex-max",
2824
+ "gpt-5.2",
2825
+ "gpt-5.2-chat-latest",
2826
+ "gpt-5.2-pro",
2827
+ "gpt-5.2-codex",
2828
+ "gpt-5.3-chat-latest",
2829
+ "gpt-5.3-codex",
2830
+ "gpt-5.4",
2831
+ "gpt-5.4-2026-03-05",
2832
+ "gpt-5.4-mini",
2833
+ "gpt-5.4-mini-2026-03-17",
2834
+ "gpt-5.4-nano",
2835
+ "gpt-5.4-nano-2026-03-17",
2836
+ "gpt-5.4-pro",
2837
+ "gpt-5.4-pro-2026-03-05",
2838
+ "gpt-5.5",
2839
+ "gpt-5.5-2026-04-23",
2840
+ "gpt-5.6",
2841
+ "gpt-5.6-luna",
2842
+ "gpt-5.6-sol",
2843
+ "gpt-5.6-terra",
2844
+ "gpt-6-astra",
2845
+ "gpt-6-luna",
2846
+ "gpt-6-sol"
2847
+ ];
2848
+ var openaiResponsesModelIds = [
2849
+ "gpt-4.1",
2850
+ "gpt-4.1-2025-04-14",
2851
+ "gpt-4.1-mini",
2852
+ "gpt-4.1-mini-2025-04-14",
2853
+ "gpt-4.1-nano",
2854
+ "gpt-4.1-nano-2025-04-14",
2855
+ "gpt-4o",
2856
+ "gpt-4o-2024-05-13",
2857
+ "gpt-4o-2024-08-06",
2858
+ "gpt-4o-2024-11-20",
2859
+ "gpt-4o-audio-preview",
2860
+ "gpt-4o-audio-preview-2024-12-17",
2861
+ "gpt-4o-search-preview",
2862
+ "gpt-4o-search-preview-2025-03-11",
2863
+ "gpt-4o-mini-search-preview",
2864
+ "gpt-4o-mini-search-preview-2025-03-11",
2865
+ "gpt-4o-mini",
2866
+ "gpt-4o-mini-2024-07-18",
2867
+ "gpt-3.5-turbo-0125",
2868
+ "gpt-3.5-turbo",
2869
+ "gpt-3.5-turbo-1106",
2870
+ "gpt-5-chat-latest",
2871
+ ...openaiResponsesReasoningModelIds
2872
+ ];
2873
+ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils20.lazySchema)(
2797
2874
  () => (0, import_provider_utils20.zodSchema)(
2798
2875
  import_v413.z.object({
2799
- callId: import_v413.z.string(),
2800
- operation: import_v413.z.discriminatedUnion("type", [
2801
- import_v413.z.object({
2802
- type: import_v413.z.literal("create_file"),
2803
- path: import_v413.z.string(),
2804
- diff: import_v413.z.string()
2805
- }),
2806
- import_v413.z.object({
2807
- type: import_v413.z.literal("delete_file"),
2808
- path: import_v413.z.string()
2809
- }),
2810
- import_v413.z.object({
2811
- type: import_v413.z.literal("update_file"),
2812
- path: import_v413.z.string(),
2813
- diff: import_v413.z.string()
2814
- })
2815
- ])
2876
+ /**
2877
+ * The ID of the OpenAI Conversation to continue.
2878
+ * You must create a conversation first via the OpenAI API.
2879
+ * Cannot be used in conjunction with `previousResponseId`.
2880
+ * Defaults to `undefined`.
2881
+ * @see https://platform.openai.com/docs/api-reference/conversations/create
2882
+ */
2883
+ conversation: import_v413.z.string().nullish(),
2884
+ /**
2885
+ * The set of extra fields to include in the response (advanced, usually not needed).
2886
+ * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
2887
+ */
2888
+ include: import_v413.z.array(
2889
+ import_v413.z.enum([
2890
+ "reasoning.encrypted_content",
2891
+ // handled internally by default, only needed for unknown reasoning models
2892
+ "file_search_call.results",
2893
+ "web_search_call.results",
2894
+ "message.output_text.logprobs"
2895
+ ])
2896
+ ).nullish(),
2897
+ /**
2898
+ * Instructions for the model.
2899
+ * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
2900
+ * Defaults to `undefined`.
2901
+ */
2902
+ instructions: import_v413.z.string().nullish(),
2903
+ /**
2904
+ * Return the log probabilities of the tokens. Including logprobs will increase
2905
+ * the response size and can slow down response times. However, it can
2906
+ * be useful to better understand how the model is behaving.
2907
+ *
2908
+ * Setting to true will return the log probabilities of the tokens that
2909
+ * were generated.
2910
+ *
2911
+ * Setting to a number will return the log probabilities of the top n
2912
+ * tokens that were generated.
2913
+ *
2914
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2915
+ * @see https://cookbook.openai.com/examples/using_logprobs
2916
+ */
2917
+ logprobs: import_v413.z.union([import_v413.z.boolean(), import_v413.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2918
+ /**
2919
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2920
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2921
+ * Any further attempts to call a tool by the model will be ignored.
2922
+ */
2923
+ maxToolCalls: import_v413.z.number().nullish(),
2924
+ /**
2925
+ * Additional metadata to store with the generation.
2926
+ */
2927
+ metadata: import_v413.z.any().nullish(),
2928
+ /**
2929
+ * Whether to use parallel tool calls. Defaults to `true`.
2930
+ */
2931
+ parallelToolCalls: import_v413.z.boolean().nullish(),
2932
+ /**
2933
+ * The ID of the previous response. You can use it to continue a conversation.
2934
+ * Defaults to `undefined`.
2935
+ */
2936
+ previousResponseId: import_v413.z.string().nullish(),
2937
+ /**
2938
+ * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
2939
+ */
2940
+ promptCacheKey: import_v413.z.string().nullish(),
2941
+ /**
2942
+ * Prompt cache behavior for GPT-5.6 and later models.
2943
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2944
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2945
+ */
2946
+ promptCacheOptions: import_v413.z.object({
2947
+ mode: import_v413.z.enum(["implicit", "explicit"]).optional(),
2948
+ ttl: import_v413.z.literal("30m").optional()
2949
+ }).optional(),
2950
+ /**
2951
+ * The retention policy for the prompt cache.
2952
+ * - 'in_memory': Default. Standard prompt caching behavior.
2953
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2954
+ * Available for models before GPT-5.6 that support extended caching.
2955
+ *
2956
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2957
+ *
2958
+ * @default 'in_memory'
2959
+ */
2960
+ promptCacheRetention: import_v413.z.enum(["in_memory", "24h"]).nullish(),
2961
+ /**
2962
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2963
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2964
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2965
+ * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2966
+ * Supported values vary by model.
2967
+ */
2968
+ reasoningEffort: import_v413.z.string().nullish(),
2969
+ /**
2970
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
2971
+ * without changing the request-level reasoning effort. This preserves the
2972
+ * request prefix for prompt caching.
2973
+ *
2974
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2975
+ * combined with automatic truncation.
2976
+ */
2977
+ reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2978
+ /**
2979
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
2980
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
2981
+ */
2982
+ reasoningMode: import_v413.z.enum(["standard", "pro"]).optional(),
2983
+ /**
2984
+ * Controls which available reasoning items GPT-5.6 can use.
2985
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2986
+ * turns, and `all_turns` makes compatible earlier reasoning available.
2987
+ */
2988
+ reasoningContext: import_v413.z.enum(["auto", "current_turn", "all_turns"]).optional(),
2989
+ /**
2990
+ * Controls reasoning summary output from the model.
2991
+ * Set to "auto" to automatically receive the richest level available,
2992
+ * or "detailed" for comprehensive summaries.
2993
+ */
2994
+ reasoningSummary: import_v413.z.string().nullish(),
2995
+ /**
2996
+ * The identifier for safety monitoring and tracking.
2997
+ */
2998
+ safetyIdentifier: import_v413.z.string().nullish(),
2999
+ /**
3000
+ * Service tier for the request.
3001
+ * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
3002
+ * 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).
3003
+ * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
3004
+ *
3005
+ * Defaults to 'auto'.
3006
+ */
3007
+ serviceTier: import_v413.z.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
3008
+ /**
3009
+ * Whether to store the generation. Defaults to `true`.
3010
+ */
3011
+ store: import_v413.z.boolean().nullish(),
3012
+ /**
3013
+ * Whether to pass through non-image file types as generic input files.
3014
+ *
3015
+ * By default, inline file inputs are restricted to images and PDFs.
3016
+ * Enable this when the target OpenAI Responses model supports additional
3017
+ * file media types, such as text/csv.
3018
+ */
3019
+ passThroughUnsupportedFiles: import_v413.z.boolean().optional(),
3020
+ /**
3021
+ * Whether to use strict JSON schema validation.
3022
+ * Defaults to `true`.
3023
+ */
3024
+ strictJsonSchema: import_v413.z.boolean().nullish(),
3025
+ /**
3026
+ * Controls the verbosity of the model's responses. Lower values ('low') will result
3027
+ * in more concise responses, while higher values ('high') will result in more verbose responses.
3028
+ * Valid values: 'low', 'medium', 'high'.
3029
+ */
3030
+ textVerbosity: import_v413.z.enum(["low", "medium", "high"]).nullish(),
3031
+ /**
3032
+ * Controls output truncation. 'auto' (default) performs truncation automatically;
3033
+ * 'disabled' turns truncation off.
3034
+ */
3035
+ truncation: import_v413.z.enum(["auto", "disabled"]).nullish(),
3036
+ /**
3037
+ * A unique identifier representing your end-user, which can help OpenAI to
3038
+ * monitor and detect abuse.
3039
+ * Defaults to `undefined`.
3040
+ * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
3041
+ */
3042
+ user: import_v413.z.string().nullish(),
3043
+ /**
3044
+ * Override the system message mode for this model.
3045
+ * - 'system': Use the 'system' role for system messages (default for most models)
3046
+ * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
3047
+ * - 'remove': Remove system messages entirely
3048
+ *
3049
+ * If not specified, the mode is automatically determined based on the model.
3050
+ */
3051
+ systemMessageMode: import_v413.z.enum(["system", "developer", "remove"]).optional(),
3052
+ /**
3053
+ * Force treating this model as a reasoning model.
3054
+ *
3055
+ * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
3056
+ * where the model ID is not recognized by the SDK's allowlist.
3057
+ *
3058
+ * When enabled, the SDK applies reasoning-model parameter compatibility rules
3059
+ * and defaults `systemMessageMode` to `developer` unless overridden.
3060
+ */
3061
+ forceReasoning: import_v413.z.boolean().optional(),
3062
+ /**
3063
+ * Restrict the callable tools to a subset while keeping the full tools
3064
+ * list intact, so prompt caching is preserved across requests with
3065
+ * different allowlists.
3066
+ *
3067
+ * When set, this overrides the request-level `toolChoice` and emits
3068
+ * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
3069
+ *
3070
+ * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
3071
+ */
3072
+ allowedTools: import_v413.z.object({
3073
+ toolNames: import_v413.z.array(import_v413.z.string()).min(1),
3074
+ mode: import_v413.z.enum(["auto", "required"]).optional()
3075
+ }).optional()
2816
3076
  })
2817
3077
  )
2818
3078
  );
2819
- var applyPatchOutputSchema = (0, import_provider_utils20.lazySchema)(
3079
+ var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils20.lazySchema)(
2820
3080
  () => (0, import_provider_utils20.zodSchema)(
2821
3081
  import_v413.z.object({
2822
- status: import_v413.z.enum(["completed", "failed"]),
2823
- output: import_v413.z.string().optional()
2824
- })
2825
- )
3082
+ /**
3083
+ * Emit a configuration update at this position in Responses history.
3084
+ * Requires empty system message content and the same supported
3085
+ * configuration as the request-level reasoningEffortUpdate option.
3086
+ * Unsupported historical updates throw instead of being omitted.
3087
+ *
3088
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
3089
+ */
3090
+ reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
3091
+ })
3092
+ )
3093
+ );
3094
+
3095
+ // src/tool/apply-patch.ts
3096
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
3097
+ var import_v414 = require("zod/v4");
3098
+ var applyPatchInputSchema = (0, import_provider_utils21.lazySchema)(
3099
+ () => (0, import_provider_utils21.zodSchema)(
3100
+ import_v414.z.object({
3101
+ callId: import_v414.z.string(),
3102
+ operation: import_v414.z.discriminatedUnion("type", [
3103
+ import_v414.z.object({
3104
+ type: import_v414.z.literal("create_file"),
3105
+ path: import_v414.z.string(),
3106
+ diff: import_v414.z.string()
3107
+ }),
3108
+ import_v414.z.object({
3109
+ type: import_v414.z.literal("delete_file"),
3110
+ path: import_v414.z.string()
3111
+ }),
3112
+ import_v414.z.object({
3113
+ type: import_v414.z.literal("update_file"),
3114
+ path: import_v414.z.string(),
3115
+ diff: import_v414.z.string()
3116
+ })
3117
+ ])
3118
+ })
3119
+ )
3120
+ );
3121
+ var applyPatchOutputSchema = (0, import_provider_utils21.lazySchema)(
3122
+ () => (0, import_provider_utils21.zodSchema)(
3123
+ import_v414.z.object({
3124
+ status: import_v414.z.enum(["completed", "failed"]),
3125
+ output: import_v414.z.string().optional()
3126
+ })
3127
+ )
2826
3128
  );
2827
- var applyPatchArgsSchema = (0, import_provider_utils20.lazySchema)(() => (0, import_provider_utils20.zodSchema)(import_v413.z.object({})));
2828
- var applyPatchToolFactory = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
3129
+ var applyPatchArgsSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v414.z.object({})));
3130
+ var applyPatchToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
2829
3131
  id: "openai.apply_patch",
2830
3132
  inputSchema: applyPatchInputSchema,
2831
3133
  outputSchema: applyPatchOutputSchema
@@ -2833,115 +3135,115 @@ var applyPatchToolFactory = (0, import_provider_utils20.createProviderToolFactor
2833
3135
  var applyPatch = applyPatchToolFactory;
2834
3136
 
2835
3137
  // src/tool/local-shell.ts
2836
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
2837
- var import_v414 = require("zod/v4");
2838
- var localShellInputSchema = (0, import_provider_utils21.lazySchema)(
2839
- () => (0, import_provider_utils21.zodSchema)(
2840
- import_v414.z.object({
2841
- action: import_v414.z.object({
2842
- type: import_v414.z.literal("exec"),
2843
- command: import_v414.z.array(import_v414.z.string()),
2844
- timeoutMs: import_v414.z.number().optional(),
2845
- user: import_v414.z.string().optional(),
2846
- workingDirectory: import_v414.z.string().optional(),
2847
- env: import_v414.z.record(import_v414.z.string(), import_v414.z.string()).optional()
3138
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
3139
+ var import_v415 = require("zod/v4");
3140
+ var localShellInputSchema = (0, import_provider_utils22.lazySchema)(
3141
+ () => (0, import_provider_utils22.zodSchema)(
3142
+ import_v415.z.object({
3143
+ action: import_v415.z.object({
3144
+ type: import_v415.z.literal("exec"),
3145
+ command: import_v415.z.array(import_v415.z.string()),
3146
+ timeoutMs: import_v415.z.number().optional(),
3147
+ user: import_v415.z.string().optional(),
3148
+ workingDirectory: import_v415.z.string().optional(),
3149
+ env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
2848
3150
  })
2849
3151
  })
2850
3152
  )
2851
3153
  );
2852
- var localShellOutputSchema = (0, import_provider_utils21.lazySchema)(
2853
- () => (0, import_provider_utils21.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
3154
+ var localShellOutputSchema = (0, import_provider_utils22.lazySchema)(
3155
+ () => (0, import_provider_utils22.zodSchema)(import_v415.z.object({ output: import_v415.z.string() }))
2854
3156
  );
2855
- var localShell = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
3157
+ var localShell = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
2856
3158
  id: "openai.local_shell",
2857
3159
  inputSchema: localShellInputSchema,
2858
3160
  outputSchema: localShellOutputSchema
2859
3161
  });
2860
3162
 
2861
3163
  // src/tool/shell.ts
2862
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2863
- var import_v415 = require("zod/v4");
2864
- var shellInputSchema = (0, import_provider_utils22.lazySchema)(
2865
- () => (0, import_provider_utils22.zodSchema)(
2866
- import_v415.z.object({
2867
- action: import_v415.z.object({
2868
- commands: import_v415.z.array(import_v415.z.string()),
2869
- timeoutMs: import_v415.z.number().optional(),
2870
- maxOutputLength: import_v415.z.number().optional()
3164
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
3165
+ var import_v416 = require("zod/v4");
3166
+ var shellInputSchema = (0, import_provider_utils23.lazySchema)(
3167
+ () => (0, import_provider_utils23.zodSchema)(
3168
+ import_v416.z.object({
3169
+ action: import_v416.z.object({
3170
+ commands: import_v416.z.array(import_v416.z.string()),
3171
+ timeoutMs: import_v416.z.number().optional(),
3172
+ maxOutputLength: import_v416.z.number().optional()
2871
3173
  })
2872
3174
  })
2873
3175
  )
2874
3176
  );
2875
- var shellOutputSchema = (0, import_provider_utils22.lazySchema)(
2876
- () => (0, import_provider_utils22.zodSchema)(
2877
- import_v415.z.object({
2878
- output: import_v415.z.array(
2879
- import_v415.z.object({
2880
- stdout: import_v415.z.string(),
2881
- stderr: import_v415.z.string(),
2882
- outcome: import_v415.z.discriminatedUnion("type", [
2883
- import_v415.z.object({ type: import_v415.z.literal("timeout") }),
2884
- import_v415.z.object({ type: import_v415.z.literal("exit"), exitCode: import_v415.z.number() })
3177
+ var shellOutputSchema = (0, import_provider_utils23.lazySchema)(
3178
+ () => (0, import_provider_utils23.zodSchema)(
3179
+ import_v416.z.object({
3180
+ output: import_v416.z.array(
3181
+ import_v416.z.object({
3182
+ stdout: import_v416.z.string(),
3183
+ stderr: import_v416.z.string(),
3184
+ outcome: import_v416.z.discriminatedUnion("type", [
3185
+ import_v416.z.object({ type: import_v416.z.literal("timeout") }),
3186
+ import_v416.z.object({ type: import_v416.z.literal("exit"), exitCode: import_v416.z.number() })
2885
3187
  ])
2886
3188
  })
2887
3189
  )
2888
3190
  })
2889
3191
  )
2890
3192
  );
2891
- var shellSkillsSchema = import_v415.z.array(
2892
- import_v415.z.discriminatedUnion("type", [
2893
- import_v415.z.object({
2894
- type: import_v415.z.literal("skillReference"),
2895
- skillId: import_v415.z.string(),
2896
- version: import_v415.z.string().optional()
3193
+ var shellSkillsSchema = import_v416.z.array(
3194
+ import_v416.z.discriminatedUnion("type", [
3195
+ import_v416.z.object({
3196
+ type: import_v416.z.literal("skillReference"),
3197
+ skillId: import_v416.z.string(),
3198
+ version: import_v416.z.string().optional()
2897
3199
  }),
2898
- import_v415.z.object({
2899
- type: import_v415.z.literal("inline"),
2900
- name: import_v415.z.string(),
2901
- description: import_v415.z.string(),
2902
- source: import_v415.z.object({
2903
- type: import_v415.z.literal("base64"),
2904
- mediaType: import_v415.z.literal("application/zip"),
2905
- data: import_v415.z.string()
3200
+ import_v416.z.object({
3201
+ type: import_v416.z.literal("inline"),
3202
+ name: import_v416.z.string(),
3203
+ description: import_v416.z.string(),
3204
+ source: import_v416.z.object({
3205
+ type: import_v416.z.literal("base64"),
3206
+ mediaType: import_v416.z.literal("application/zip"),
3207
+ data: import_v416.z.string()
2906
3208
  })
2907
3209
  })
2908
3210
  ])
2909
3211
  ).optional();
2910
- var shellArgsSchema = (0, import_provider_utils22.lazySchema)(
2911
- () => (0, import_provider_utils22.zodSchema)(
2912
- import_v415.z.object({
2913
- environment: import_v415.z.union([
2914
- import_v415.z.object({
2915
- type: import_v415.z.literal("containerAuto"),
2916
- fileIds: import_v415.z.array(import_v415.z.string()).optional(),
2917
- memoryLimit: import_v415.z.enum(["1g", "4g", "16g", "64g"]).optional(),
2918
- networkPolicy: import_v415.z.discriminatedUnion("type", [
2919
- import_v415.z.object({ type: import_v415.z.literal("disabled") }),
2920
- import_v415.z.object({
2921
- type: import_v415.z.literal("allowlist"),
2922
- allowedDomains: import_v415.z.array(import_v415.z.string()),
2923
- domainSecrets: import_v415.z.array(
2924
- import_v415.z.object({
2925
- domain: import_v415.z.string(),
2926
- name: import_v415.z.string(),
2927
- value: import_v415.z.string()
3212
+ var shellArgsSchema = (0, import_provider_utils23.lazySchema)(
3213
+ () => (0, import_provider_utils23.zodSchema)(
3214
+ import_v416.z.object({
3215
+ environment: import_v416.z.union([
3216
+ import_v416.z.object({
3217
+ type: import_v416.z.literal("containerAuto"),
3218
+ fileIds: import_v416.z.array(import_v416.z.string()).optional(),
3219
+ memoryLimit: import_v416.z.enum(["1g", "4g", "16g", "64g"]).optional(),
3220
+ networkPolicy: import_v416.z.discriminatedUnion("type", [
3221
+ import_v416.z.object({ type: import_v416.z.literal("disabled") }),
3222
+ import_v416.z.object({
3223
+ type: import_v416.z.literal("allowlist"),
3224
+ allowedDomains: import_v416.z.array(import_v416.z.string()),
3225
+ domainSecrets: import_v416.z.array(
3226
+ import_v416.z.object({
3227
+ domain: import_v416.z.string(),
3228
+ name: import_v416.z.string(),
3229
+ value: import_v416.z.string()
2928
3230
  })
2929
3231
  ).optional()
2930
3232
  })
2931
3233
  ]).optional(),
2932
3234
  skills: shellSkillsSchema
2933
3235
  }),
2934
- import_v415.z.object({
2935
- type: import_v415.z.literal("containerReference"),
2936
- containerId: import_v415.z.string()
3236
+ import_v416.z.object({
3237
+ type: import_v416.z.literal("containerReference"),
3238
+ containerId: import_v416.z.string()
2937
3239
  }),
2938
- import_v415.z.object({
2939
- type: import_v415.z.literal("local").optional(),
2940
- skills: import_v415.z.array(
2941
- import_v415.z.object({
2942
- name: import_v415.z.string(),
2943
- description: import_v415.z.string(),
2944
- path: import_v415.z.string()
3240
+ import_v416.z.object({
3241
+ type: import_v416.z.literal("local").optional(),
3242
+ skills: import_v416.z.array(
3243
+ import_v416.z.object({
3244
+ name: import_v416.z.string(),
3245
+ description: import_v416.z.string(),
3246
+ path: import_v416.z.string()
2945
3247
  })
2946
3248
  ).optional()
2947
3249
  })
@@ -2949,40 +3251,40 @@ var shellArgsSchema = (0, import_provider_utils22.lazySchema)(
2949
3251
  })
2950
3252
  )
2951
3253
  );
2952
- var shell = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
3254
+ var shell = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
2953
3255
  id: "openai.shell",
2954
3256
  inputSchema: shellInputSchema,
2955
3257
  outputSchema: shellOutputSchema
2956
3258
  });
2957
3259
 
2958
3260
  // src/tool/tool-search.ts
2959
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
2960
- var import_v416 = require("zod/v4");
2961
- var toolSearchArgsSchema = (0, import_provider_utils23.lazySchema)(
2962
- () => (0, import_provider_utils23.zodSchema)(
2963
- import_v416.z.object({
2964
- execution: import_v416.z.enum(["server", "client"]).optional(),
2965
- description: import_v416.z.string().optional(),
2966
- parameters: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()).optional()
3261
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
3262
+ var import_v417 = require("zod/v4");
3263
+ var toolSearchArgsSchema = (0, import_provider_utils24.lazySchema)(
3264
+ () => (0, import_provider_utils24.zodSchema)(
3265
+ import_v417.z.object({
3266
+ execution: import_v417.z.enum(["server", "client"]).optional(),
3267
+ description: import_v417.z.string().optional(),
3268
+ parameters: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
2967
3269
  })
2968
3270
  )
2969
3271
  );
2970
- var toolSearchInputSchema = (0, import_provider_utils23.lazySchema)(
2971
- () => (0, import_provider_utils23.zodSchema)(
2972
- import_v416.z.object({
2973
- arguments: import_v416.z.unknown().optional(),
2974
- call_id: import_v416.z.string().nullish()
3272
+ var toolSearchInputSchema = (0, import_provider_utils24.lazySchema)(
3273
+ () => (0, import_provider_utils24.zodSchema)(
3274
+ import_v417.z.object({
3275
+ arguments: import_v417.z.unknown().optional(),
3276
+ call_id: import_v417.z.string().nullish()
2975
3277
  })
2976
3278
  )
2977
3279
  );
2978
- var toolSearchOutputSchema = (0, import_provider_utils23.lazySchema)(
2979
- () => (0, import_provider_utils23.zodSchema)(
2980
- import_v416.z.object({
2981
- tools: import_v416.z.array(import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()))
3280
+ var toolSearchOutputSchema = (0, import_provider_utils24.lazySchema)(
3281
+ () => (0, import_provider_utils24.zodSchema)(
3282
+ import_v417.z.object({
3283
+ tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()))
2982
3284
  })
2983
3285
  )
2984
3286
  );
2985
- var toolSearchToolFactory = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
3287
+ var toolSearchToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
2986
3288
  id: "openai.tool_search",
2987
3289
  inputSchema: toolSearchInputSchema,
2988
3290
  outputSchema: toolSearchOutputSchema
@@ -2990,7 +3292,7 @@ var toolSearchToolFactory = (0, import_provider_utils23.createProviderToolFactor
2990
3292
 
2991
3293
  // src/responses/expand-parallel-tool-call.ts
2992
3294
  var import_provider7 = require("@ai-sdk/provider");
2993
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
3295
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
2994
3296
  var parallelToolName = "parallel";
2995
3297
  var recipientNamePrefix = "functions.";
2996
3298
  function getParallelToolCallMetadata({
@@ -3019,7 +3321,7 @@ async function expandParallelToolCall({
3019
3321
  if (!isUndeclaredParallelToolCall({ toolName: toolCall.toolName, tools })) {
3020
3322
  return void 0;
3021
3323
  }
3022
- const parsedInput = await (0, import_provider_utils24.safeParseJSON)({ text: toolCall.input });
3324
+ const parsedInput = await (0, import_provider_utils25.safeParseJSON)({ text: toolCall.input });
3023
3325
  if (!parsedInput.success || !(0, import_provider7.isJSONObject)(parsedInput.value)) {
3024
3326
  return void 0;
3025
3327
  }
@@ -3177,7 +3479,7 @@ async function convertFunctionToolResultOutput({
3177
3479
  return void 0;
3178
3480
  }
3179
3481
  }
3180
- }).filter(import_provider_utils25.isNonNullable);
3482
+ }).filter(import_provider_utils26.isNonNullable);
3181
3483
  }
3182
3484
  }
3183
3485
  function hasSameParallelToolCall(first, second) {
@@ -3228,7 +3530,7 @@ function collectCompleteParallelToolResultGroups({
3228
3530
  { length: group.metadata.count },
3229
3531
  (_, index) => group.results.get(index)
3230
3532
  );
3231
- if (results.every(import_provider_utils25.isNonNullable)) {
3533
+ if (results.every(import_provider_utils26.isNonNullable)) {
3232
3534
  completeGroups.set(toolCallId, {
3233
3535
  metadata: group.metadata,
3234
3536
  results
@@ -3267,6 +3569,7 @@ async function convertToOpenAIResponsesInput({
3267
3569
  store,
3268
3570
  hasConversation = false,
3269
3571
  hasPreviousResponseId = false,
3572
+ configurationUpdateUnsupportedReason,
3270
3573
  hasLocalShellTool = false,
3271
3574
  hasShellTool = false,
3272
3575
  hasApplyPatchTool = false,
@@ -3286,6 +3589,33 @@ async function convertToOpenAIResponsesInput({
3286
3589
  for (const { role, content, providerOptions } of prompt) {
3287
3590
  switch (role) {
3288
3591
  case "system": {
3592
+ let options = await (0, import_provider_utils26.parseProviderOptions)({
3593
+ provider: providerOptionsName,
3594
+ providerOptions,
3595
+ schema: openaiResponsesSystemMessageOptionsSchema
3596
+ });
3597
+ if (options == null && providerOptionsName !== "openai") {
3598
+ options = await (0, import_provider_utils26.parseProviderOptions)({
3599
+ provider: "openai",
3600
+ providerOptions,
3601
+ schema: openaiResponsesSystemMessageOptionsSchema
3602
+ });
3603
+ }
3604
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
3605
+ if (effort != null) {
3606
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
3607
+ if (unsupportedReason != null) {
3608
+ throw new import_provider8.UnsupportedFunctionalityError({
3609
+ functionality: "Message-level reasoningEffortUpdate",
3610
+ message: unsupportedReason
3611
+ });
3612
+ }
3613
+ input.push({
3614
+ type: "configuration_update",
3615
+ reasoning: { effort }
3616
+ });
3617
+ break;
3618
+ }
3289
3619
  switch (systemMessageMode) {
3290
3620
  case "system": {
3291
3621
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -3369,7 +3699,7 @@ async function convertToOpenAIResponsesInput({
3369
3699
  return {
3370
3700
  type: "input_image",
3371
3701
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3372
- image_url: `data:${mediaType};base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
3702
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils26.convertToBase64)(part.data)}`
3373
3703
  },
3374
3704
  detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b2.imageDetail,
3375
3705
  ...promptCacheBreakpoint != null && {
@@ -3395,7 +3725,7 @@ async function convertToOpenAIResponsesInput({
3395
3725
  type: "input_file",
3396
3726
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
3397
3727
  filename: (_c2 = part.filename) != null ? _c2 : mediaType === "application/pdf" ? `part-${index}.pdf` : `part-${index}`,
3398
- file_data: `data:${mediaType};base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
3728
+ file_data: `data:${mediaType};base64,${(0, import_provider_utils26.convertToBase64)(part.data)}`
3399
3729
  },
3400
3730
  ...promptCacheBreakpoint != null && {
3401
3731
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -3474,10 +3804,10 @@ async function convertToOpenAIResponsesInput({
3474
3804
  input.push({ type: "item_reference", id });
3475
3805
  break;
3476
3806
  }
3477
- const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils25.parseJSON)({
3807
+ const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils26.parseJSON)({
3478
3808
  text: part.input,
3479
3809
  schema: toolSearchInputSchema
3480
- }) : await (0, import_provider_utils25.validateTypes)({
3810
+ }) : await (0, import_provider_utils26.validateTypes)({
3481
3811
  value: part.input,
3482
3812
  schema: toolSearchInputSchema
3483
3813
  });
@@ -3509,7 +3839,7 @@ async function convertToOpenAIResponsesInput({
3509
3839
  break;
3510
3840
  }
3511
3841
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
3512
- const parsedInput = await (0, import_provider_utils25.validateTypes)({
3842
+ const parsedInput = await (0, import_provider_utils26.validateTypes)({
3513
3843
  value: part.input,
3514
3844
  schema: localShellInputSchema
3515
3845
  });
@@ -3529,7 +3859,7 @@ async function convertToOpenAIResponsesInput({
3529
3859
  break;
3530
3860
  }
3531
3861
  if (hasShellTool && resolvedToolName === "shell") {
3532
- const parsedInput = await (0, import_provider_utils25.validateTypes)({
3862
+ const parsedInput = await (0, import_provider_utils26.validateTypes)({
3533
3863
  value: part.input,
3534
3864
  schema: shellInputSchema
3535
3865
  });
@@ -3547,7 +3877,7 @@ async function convertToOpenAIResponsesInput({
3547
3877
  break;
3548
3878
  }
3549
3879
  if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
3550
- const parsedInput = await (0, import_provider_utils25.validateTypes)({
3880
+ const parsedInput = await (0, import_provider_utils26.validateTypes)({
3551
3881
  value: part.input,
3552
3882
  schema: applyPatchInputSchema
3553
3883
  });
@@ -3597,7 +3927,7 @@ async function convertToOpenAIResponsesInput({
3597
3927
  if (store) {
3598
3928
  input.push({ type: "item_reference", id: itemId });
3599
3929
  } else if (part.output.type === "json") {
3600
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
3930
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3601
3931
  value: part.output.value,
3602
3932
  schema: toolSearchOutputSchema
3603
3933
  });
@@ -3614,7 +3944,7 @@ async function convertToOpenAIResponsesInput({
3614
3944
  }
3615
3945
  if (hasShellTool && resolvedResultToolName === "shell") {
3616
3946
  if (part.output.type === "json") {
3617
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
3947
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3618
3948
  value: part.output.value,
3619
3949
  schema: shellOutputSchema
3620
3950
  });
@@ -3645,7 +3975,7 @@ async function convertToOpenAIResponsesInput({
3645
3975
  break;
3646
3976
  }
3647
3977
  case "reasoning": {
3648
- const providerOptions2 = await (0, import_provider_utils25.parseProviderOptions)({
3978
+ const providerOptions2 = await (0, import_provider_utils26.parseProviderOptions)({
3649
3979
  provider: providerOptionsName,
3650
3980
  providerOptions: part.providerOptions,
3651
3981
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -3810,7 +4140,7 @@ ${text}`,
3810
4140
  part.toolName
3811
4141
  );
3812
4142
  if (part.toolName === toolSearchToolName && output.type === "json") {
3813
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
4143
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3814
4144
  value: output.value,
3815
4145
  schema: toolSearchOutputSchema
3816
4146
  });
@@ -3824,7 +4154,7 @@ ${text}`,
3824
4154
  continue;
3825
4155
  }
3826
4156
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3827
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
4157
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3828
4158
  value: output.value,
3829
4159
  schema: localShellOutputSchema
3830
4160
  });
@@ -3836,7 +4166,7 @@ ${text}`,
3836
4166
  continue;
3837
4167
  }
3838
4168
  if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
3839
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
4169
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3840
4170
  value: output.value,
3841
4171
  schema: shellOutputSchema
3842
4172
  });
@@ -3855,7 +4185,7 @@ ${text}`,
3855
4185
  continue;
3856
4186
  }
3857
4187
  if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
3858
- const parsedOutput = await (0, import_provider_utils25.validateTypes)({
4188
+ const parsedOutput = await (0, import_provider_utils26.validateTypes)({
3859
4189
  value: output.value,
3860
4190
  schema: applyPatchOutputSchema
3861
4191
  });
@@ -3953,7 +4283,7 @@ ${text}`,
3953
4283
  });
3954
4284
  return void 0;
3955
4285
  }
3956
- }).filter(import_provider_utils25.isNonNullable);
4286
+ }).filter(import_provider_utils26.isNonNullable);
3957
4287
  break;
3958
4288
  default:
3959
4289
  outputValue = "";
@@ -4002,9 +4332,9 @@ ${text}`,
4002
4332
  }
4003
4333
  return { input, warnings };
4004
4334
  }
4005
- var openaiResponsesReasoningProviderOptionsSchema = import_v417.z.object({
4006
- itemId: import_v417.z.string().nullish(),
4007
- reasoningEncryptedContent: import_v417.z.string().nullish()
4335
+ var openaiResponsesReasoningProviderOptionsSchema = import_v418.z.object({
4336
+ itemId: import_v418.z.string().nullish(),
4337
+ reasoningEncryptedContent: import_v418.z.string().nullish()
4008
4338
  });
4009
4339
 
4010
4340
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4026,75 +4356,75 @@ function mapOpenAIResponseFinishReason({
4026
4356
  }
4027
4357
 
4028
4358
  // src/responses/openai-responses-api.ts
4029
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
4030
- var import_v418 = require("zod/v4");
4031
- var jsonValueSchema = import_v418.z.lazy(
4032
- () => import_v418.z.union([
4033
- import_v418.z.string(),
4034
- import_v418.z.number(),
4035
- import_v418.z.boolean(),
4036
- import_v418.z.null(),
4037
- import_v418.z.array(jsonValueSchema),
4038
- import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional())
4359
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
4360
+ var import_v419 = require("zod/v4");
4361
+ var jsonValueSchema = import_v419.z.lazy(
4362
+ () => import_v419.z.union([
4363
+ import_v419.z.string(),
4364
+ import_v419.z.number(),
4365
+ import_v419.z.boolean(),
4366
+ import_v419.z.null(),
4367
+ import_v419.z.array(jsonValueSchema),
4368
+ import_v419.z.record(import_v419.z.string(), jsonValueSchema.optional())
4039
4369
  ])
4040
4370
  );
4041
- var jsonObjectSchema = import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional());
4042
- var openaiResponsesUsageSchema = import_v418.z.intersection(
4371
+ var jsonObjectSchema = import_v419.z.record(import_v419.z.string(), jsonValueSchema.optional());
4372
+ var openaiResponsesUsageSchema = import_v419.z.intersection(
4043
4373
  jsonObjectSchema,
4044
- import_v418.z.object({
4045
- input_tokens: import_v418.z.number(),
4046
- input_tokens_details: import_v418.z.intersection(
4374
+ import_v419.z.object({
4375
+ input_tokens: import_v419.z.number(),
4376
+ input_tokens_details: import_v419.z.intersection(
4047
4377
  jsonObjectSchema,
4048
- import_v418.z.object({
4049
- cached_tokens: import_v418.z.number().nullish(),
4050
- cache_write_tokens: import_v418.z.number().nullish(),
4051
- orchestration_input_tokens: import_v418.z.number().nullish(),
4052
- orchestration_input_cached_tokens: import_v418.z.number().nullish()
4378
+ import_v419.z.object({
4379
+ cached_tokens: import_v419.z.number().nullish(),
4380
+ cache_write_tokens: import_v419.z.number().nullish(),
4381
+ orchestration_input_tokens: import_v419.z.number().nullish(),
4382
+ orchestration_input_cached_tokens: import_v419.z.number().nullish()
4053
4383
  })
4054
4384
  ).nullish(),
4055
- output_tokens: import_v418.z.number(),
4056
- output_tokens_details: import_v418.z.intersection(
4385
+ output_tokens: import_v419.z.number(),
4386
+ output_tokens_details: import_v419.z.intersection(
4057
4387
  jsonObjectSchema,
4058
- import_v418.z.object({
4059
- reasoning_tokens: import_v418.z.number().nullish(),
4060
- orchestration_output_tokens: import_v418.z.number().nullish()
4388
+ import_v419.z.object({
4389
+ reasoning_tokens: import_v419.z.number().nullish(),
4390
+ orchestration_output_tokens: import_v419.z.number().nullish()
4061
4391
  })
4062
4392
  ).nullish(),
4063
- total_tokens: import_v418.z.number().optional()
4393
+ total_tokens: import_v419.z.number().optional()
4064
4394
  })
4065
4395
  );
4066
4396
  function isRecord(value) {
4067
4397
  return value != null && typeof value === "object" && !Array.isArray(value);
4068
4398
  }
4069
- var openaiResponsesLocalShellCallSchema = import_v418.z.object({
4070
- type: import_v418.z.literal("local_shell_call"),
4071
- id: import_v418.z.string(),
4072
- call_id: import_v418.z.string(),
4073
- action: import_v418.z.object({
4074
- type: import_v418.z.literal("exec"),
4075
- command: import_v418.z.array(import_v418.z.string()),
4076
- timeout_ms: import_v418.z.number().optional(),
4077
- user: import_v418.z.string().optional(),
4078
- working_directory: import_v418.z.string().optional(),
4079
- env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
4399
+ var openaiResponsesLocalShellCallSchema = import_v419.z.object({
4400
+ type: import_v419.z.literal("local_shell_call"),
4401
+ id: import_v419.z.string(),
4402
+ call_id: import_v419.z.string(),
4403
+ action: import_v419.z.object({
4404
+ type: import_v419.z.literal("exec"),
4405
+ command: import_v419.z.array(import_v419.z.string()),
4406
+ timeout_ms: import_v419.z.number().optional(),
4407
+ user: import_v419.z.string().optional(),
4408
+ working_directory: import_v419.z.string().optional(),
4409
+ env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
4080
4410
  })
4081
4411
  });
4082
- var openaiResponsesNestedErrorChunkSchema = import_v418.z.object({
4083
- type: import_v418.z.literal("error"),
4084
- sequence_number: import_v418.z.number(),
4085
- error: import_v418.z.object({
4086
- type: import_v418.z.string(),
4087
- code: import_v418.z.string(),
4088
- message: import_v418.z.string(),
4089
- param: import_v418.z.string().nullish()
4412
+ var openaiResponsesNestedErrorChunkSchema = import_v419.z.object({
4413
+ type: import_v419.z.literal("error"),
4414
+ sequence_number: import_v419.z.number(),
4415
+ error: import_v419.z.object({
4416
+ type: import_v419.z.string(),
4417
+ code: import_v419.z.string(),
4418
+ message: import_v419.z.string(),
4419
+ param: import_v419.z.string().nullish()
4090
4420
  })
4091
4421
  });
4092
- var openaiResponsesErrorChunkSchema = import_v418.z.object({
4093
- type: import_v418.z.literal("error"),
4094
- sequence_number: import_v418.z.number(),
4095
- code: import_v418.z.string().nullish(),
4096
- message: import_v418.z.string(),
4097
- param: import_v418.z.string().nullish()
4422
+ var openaiResponsesErrorChunkSchema = import_v419.z.object({
4423
+ type: import_v419.z.literal("error"),
4424
+ sequence_number: import_v419.z.number(),
4425
+ code: import_v419.z.string().nullish(),
4426
+ message: import_v419.z.string(),
4427
+ param: import_v419.z.string().nullish()
4098
4428
  });
4099
4429
  var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
4100
4430
  "error",
@@ -4150,523 +4480,523 @@ function isModeledOpenAIResponsesChunk(value) {
4150
4480
  }
4151
4481
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4152
4482
  }
4153
- var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4154
- () => (0, import_provider_utils26.zodSchema)(
4155
- import_v418.z.union([
4156
- import_v418.z.object({
4157
- type: import_v418.z.literal("response.output_text.delta"),
4158
- item_id: import_v418.z.string(),
4159
- delta: import_v418.z.string(),
4160
- logprobs: import_v418.z.array(
4161
- import_v418.z.object({
4162
- token: import_v418.z.string(),
4163
- logprob: import_v418.z.number(),
4164
- top_logprobs: import_v418.z.array(
4165
- import_v418.z.object({
4166
- token: import_v418.z.string(),
4167
- logprob: import_v418.z.number()
4483
+ var openaiResponsesChunkSchema = (0, import_provider_utils27.lazySchema)(
4484
+ () => (0, import_provider_utils27.zodSchema)(
4485
+ import_v419.z.union([
4486
+ import_v419.z.object({
4487
+ type: import_v419.z.literal("response.output_text.delta"),
4488
+ item_id: import_v419.z.string(),
4489
+ delta: import_v419.z.string(),
4490
+ logprobs: import_v419.z.array(
4491
+ import_v419.z.object({
4492
+ token: import_v419.z.string(),
4493
+ logprob: import_v419.z.number(),
4494
+ top_logprobs: import_v419.z.array(
4495
+ import_v419.z.object({
4496
+ token: import_v419.z.string(),
4497
+ logprob: import_v419.z.number()
4168
4498
  })
4169
4499
  )
4170
4500
  })
4171
4501
  ).nullish()
4172
4502
  }),
4173
- import_v418.z.object({
4174
- type: import_v418.z.enum(["response.completed", "response.incomplete"]),
4175
- response: import_v418.z.object({
4176
- incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
4503
+ import_v419.z.object({
4504
+ type: import_v419.z.enum(["response.completed", "response.incomplete"]),
4505
+ response: import_v419.z.object({
4506
+ incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
4177
4507
  usage: openaiResponsesUsageSchema.nullish(),
4178
- reasoning: import_v418.z.object({
4179
- context: import_v418.z.string().nullish()
4508
+ reasoning: import_v419.z.object({
4509
+ context: import_v419.z.string().nullish()
4180
4510
  }).nullish(),
4181
- service_tier: import_v418.z.string().nullish()
4511
+ service_tier: import_v419.z.string().nullish()
4182
4512
  })
4183
4513
  }),
4184
- import_v418.z.object({
4185
- type: import_v418.z.literal("response.failed"),
4186
- sequence_number: import_v418.z.number(),
4187
- response: import_v418.z.object({
4188
- error: import_v418.z.object({
4189
- code: import_v418.z.string().nullish(),
4190
- message: import_v418.z.string()
4514
+ import_v419.z.object({
4515
+ type: import_v419.z.literal("response.failed"),
4516
+ sequence_number: import_v419.z.number(),
4517
+ response: import_v419.z.object({
4518
+ error: import_v419.z.object({
4519
+ code: import_v419.z.string().nullish(),
4520
+ message: import_v419.z.string()
4191
4521
  }).nullish(),
4192
- incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
4522
+ incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
4193
4523
  usage: openaiResponsesUsageSchema.nullish(),
4194
- reasoning: import_v418.z.object({
4195
- context: import_v418.z.string().nullish()
4524
+ reasoning: import_v419.z.object({
4525
+ context: import_v419.z.string().nullish()
4196
4526
  }).nullish(),
4197
- service_tier: import_v418.z.string().nullish()
4527
+ service_tier: import_v419.z.string().nullish()
4198
4528
  })
4199
4529
  }),
4200
- import_v418.z.object({
4201
- type: import_v418.z.literal("response.created"),
4202
- response: import_v418.z.object({
4203
- id: import_v418.z.string(),
4204
- created_at: import_v418.z.number(),
4205
- model: import_v418.z.string(),
4206
- service_tier: import_v418.z.string().nullish()
4530
+ import_v419.z.object({
4531
+ type: import_v419.z.literal("response.created"),
4532
+ response: import_v419.z.object({
4533
+ id: import_v419.z.string(),
4534
+ created_at: import_v419.z.number(),
4535
+ model: import_v419.z.string(),
4536
+ service_tier: import_v419.z.string().nullish()
4207
4537
  })
4208
4538
  }),
4209
- import_v418.z.object({
4210
- type: import_v418.z.literal("response.output_item.added"),
4211
- output_index: import_v418.z.number(),
4212
- item: import_v418.z.discriminatedUnion("type", [
4213
- import_v418.z.object({
4214
- type: import_v418.z.literal("message"),
4215
- id: import_v418.z.string(),
4216
- phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
4539
+ import_v419.z.object({
4540
+ type: import_v419.z.literal("response.output_item.added"),
4541
+ output_index: import_v419.z.number(),
4542
+ item: import_v419.z.discriminatedUnion("type", [
4543
+ import_v419.z.object({
4544
+ type: import_v419.z.literal("message"),
4545
+ id: import_v419.z.string(),
4546
+ phase: import_v419.z.enum(["commentary", "final_answer"]).nullish()
4217
4547
  }),
4218
- import_v418.z.object({
4219
- type: import_v418.z.literal("reasoning"),
4220
- id: import_v418.z.string(),
4221
- encrypted_content: import_v418.z.string().nullish()
4548
+ import_v419.z.object({
4549
+ type: import_v419.z.literal("reasoning"),
4550
+ id: import_v419.z.string(),
4551
+ encrypted_content: import_v419.z.string().nullish()
4222
4552
  }),
4223
- import_v418.z.object({
4224
- type: import_v418.z.literal("function_call"),
4225
- id: import_v418.z.string(),
4226
- call_id: import_v418.z.string(),
4227
- name: import_v418.z.string(),
4228
- arguments: import_v418.z.string(),
4229
- async: import_v418.z.boolean().nullish(),
4230
- namespace: import_v418.z.string().nullish()
4553
+ import_v419.z.object({
4554
+ type: import_v419.z.literal("function_call"),
4555
+ id: import_v419.z.string(),
4556
+ call_id: import_v419.z.string(),
4557
+ name: import_v419.z.string(),
4558
+ arguments: import_v419.z.string(),
4559
+ async: import_v419.z.boolean().nullish(),
4560
+ namespace: import_v419.z.string().nullish()
4231
4561
  }),
4232
- import_v418.z.object({
4233
- type: import_v418.z.literal("web_search_call"),
4234
- id: import_v418.z.string(),
4235
- status: import_v418.z.string()
4562
+ import_v419.z.object({
4563
+ type: import_v419.z.literal("web_search_call"),
4564
+ id: import_v419.z.string(),
4565
+ status: import_v419.z.string()
4236
4566
  }),
4237
- import_v418.z.object({
4238
- type: import_v418.z.literal("computer_call"),
4239
- id: import_v418.z.string(),
4240
- status: import_v418.z.string()
4567
+ import_v419.z.object({
4568
+ type: import_v419.z.literal("computer_call"),
4569
+ id: import_v419.z.string(),
4570
+ status: import_v419.z.string()
4241
4571
  }),
4242
- import_v418.z.object({
4243
- type: import_v418.z.literal("file_search_call"),
4244
- id: import_v418.z.string()
4572
+ import_v419.z.object({
4573
+ type: import_v419.z.literal("file_search_call"),
4574
+ id: import_v419.z.string()
4245
4575
  }),
4246
4576
  openaiResponsesLocalShellCallSchema,
4247
- import_v418.z.object({
4248
- type: import_v418.z.literal("image_generation_call"),
4249
- id: import_v418.z.string()
4577
+ import_v419.z.object({
4578
+ type: import_v419.z.literal("image_generation_call"),
4579
+ id: import_v419.z.string()
4250
4580
  }),
4251
- import_v418.z.object({
4252
- type: import_v418.z.literal("code_interpreter_call"),
4253
- id: import_v418.z.string(),
4254
- container_id: import_v418.z.string(),
4255
- code: import_v418.z.string().nullable(),
4256
- outputs: import_v418.z.array(
4257
- import_v418.z.discriminatedUnion("type", [
4258
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
4259
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
4581
+ import_v419.z.object({
4582
+ type: import_v419.z.literal("code_interpreter_call"),
4583
+ id: import_v419.z.string(),
4584
+ container_id: import_v419.z.string(),
4585
+ code: import_v419.z.string().nullable(),
4586
+ outputs: import_v419.z.array(
4587
+ import_v419.z.discriminatedUnion("type", [
4588
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
4589
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4260
4590
  ])
4261
4591
  ).nullable(),
4262
- status: import_v418.z.string()
4592
+ status: import_v419.z.string()
4263
4593
  }),
4264
- import_v418.z.object({
4265
- type: import_v418.z.literal("mcp_call"),
4266
- id: import_v418.z.string(),
4267
- status: import_v418.z.string(),
4268
- approval_request_id: import_v418.z.string().nullish()
4594
+ import_v419.z.object({
4595
+ type: import_v419.z.literal("mcp_call"),
4596
+ id: import_v419.z.string(),
4597
+ status: import_v419.z.string(),
4598
+ approval_request_id: import_v419.z.string().nullish()
4269
4599
  }),
4270
- import_v418.z.object({
4271
- type: import_v418.z.literal("mcp_list_tools"),
4272
- id: import_v418.z.string()
4600
+ import_v419.z.object({
4601
+ type: import_v419.z.literal("mcp_list_tools"),
4602
+ id: import_v419.z.string()
4273
4603
  }),
4274
- import_v418.z.object({
4275
- type: import_v418.z.literal("mcp_approval_request"),
4276
- id: import_v418.z.string()
4604
+ import_v419.z.object({
4605
+ type: import_v419.z.literal("mcp_approval_request"),
4606
+ id: import_v419.z.string()
4277
4607
  }),
4278
- import_v418.z.object({
4279
- type: import_v418.z.literal("apply_patch_call"),
4280
- id: import_v418.z.string(),
4281
- call_id: import_v418.z.string(),
4282
- status: import_v418.z.enum(["in_progress", "completed"]),
4283
- operation: import_v418.z.discriminatedUnion("type", [
4284
- import_v418.z.object({
4285
- type: import_v418.z.literal("create_file"),
4286
- path: import_v418.z.string(),
4287
- diff: import_v418.z.string()
4608
+ import_v419.z.object({
4609
+ type: import_v419.z.literal("apply_patch_call"),
4610
+ id: import_v419.z.string(),
4611
+ call_id: import_v419.z.string(),
4612
+ status: import_v419.z.enum(["in_progress", "completed"]),
4613
+ operation: import_v419.z.discriminatedUnion("type", [
4614
+ import_v419.z.object({
4615
+ type: import_v419.z.literal("create_file"),
4616
+ path: import_v419.z.string(),
4617
+ diff: import_v419.z.string()
4288
4618
  }),
4289
- import_v418.z.object({
4290
- type: import_v418.z.literal("delete_file"),
4291
- path: import_v418.z.string()
4619
+ import_v419.z.object({
4620
+ type: import_v419.z.literal("delete_file"),
4621
+ path: import_v419.z.string()
4292
4622
  }),
4293
- import_v418.z.object({
4294
- type: import_v418.z.literal("update_file"),
4295
- path: import_v418.z.string(),
4296
- diff: import_v418.z.string()
4623
+ import_v419.z.object({
4624
+ type: import_v419.z.literal("update_file"),
4625
+ path: import_v419.z.string(),
4626
+ diff: import_v419.z.string()
4297
4627
  })
4298
4628
  ])
4299
4629
  }),
4300
- import_v418.z.object({
4301
- type: import_v418.z.literal("custom_tool_call"),
4302
- id: import_v418.z.string(),
4303
- call_id: import_v418.z.string(),
4304
- name: import_v418.z.string(),
4305
- input: import_v418.z.string(),
4306
- async: import_v418.z.boolean().nullish()
4630
+ import_v419.z.object({
4631
+ type: import_v419.z.literal("custom_tool_call"),
4632
+ id: import_v419.z.string(),
4633
+ call_id: import_v419.z.string(),
4634
+ name: import_v419.z.string(),
4635
+ input: import_v419.z.string(),
4636
+ async: import_v419.z.boolean().nullish()
4307
4637
  }),
4308
- import_v418.z.object({
4309
- type: import_v418.z.literal("shell_call"),
4310
- id: import_v418.z.string(),
4311
- call_id: import_v418.z.string(),
4312
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4313
- action: import_v418.z.object({
4314
- commands: import_v418.z.array(import_v418.z.string())
4638
+ import_v419.z.object({
4639
+ type: import_v419.z.literal("shell_call"),
4640
+ id: import_v419.z.string(),
4641
+ call_id: import_v419.z.string(),
4642
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4643
+ action: import_v419.z.object({
4644
+ commands: import_v419.z.array(import_v419.z.string())
4315
4645
  })
4316
4646
  }),
4317
- import_v418.z.object({
4318
- type: import_v418.z.literal("shell_call_output"),
4319
- id: import_v418.z.string(),
4320
- call_id: import_v418.z.string(),
4321
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4322
- output: import_v418.z.array(
4323
- import_v418.z.object({
4324
- stdout: import_v418.z.string(),
4325
- stderr: import_v418.z.string(),
4326
- outcome: import_v418.z.discriminatedUnion("type", [
4327
- import_v418.z.object({ type: import_v418.z.literal("timeout") }),
4328
- import_v418.z.object({
4329
- type: import_v418.z.literal("exit"),
4330
- exit_code: import_v418.z.number()
4647
+ import_v419.z.object({
4648
+ type: import_v419.z.literal("shell_call_output"),
4649
+ id: import_v419.z.string(),
4650
+ call_id: import_v419.z.string(),
4651
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4652
+ output: import_v419.z.array(
4653
+ import_v419.z.object({
4654
+ stdout: import_v419.z.string(),
4655
+ stderr: import_v419.z.string(),
4656
+ outcome: import_v419.z.discriminatedUnion("type", [
4657
+ import_v419.z.object({ type: import_v419.z.literal("timeout") }),
4658
+ import_v419.z.object({
4659
+ type: import_v419.z.literal("exit"),
4660
+ exit_code: import_v419.z.number()
4331
4661
  })
4332
4662
  ])
4333
4663
  })
4334
4664
  )
4335
4665
  }),
4336
- import_v418.z.object({
4337
- type: import_v418.z.literal("tool_search_call"),
4338
- id: import_v418.z.string(),
4339
- execution: import_v418.z.enum(["server", "client"]),
4340
- call_id: import_v418.z.string().nullable(),
4341
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4342
- arguments: import_v418.z.unknown()
4666
+ import_v419.z.object({
4667
+ type: import_v419.z.literal("tool_search_call"),
4668
+ id: import_v419.z.string(),
4669
+ execution: import_v419.z.enum(["server", "client"]),
4670
+ call_id: import_v419.z.string().nullable(),
4671
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4672
+ arguments: import_v419.z.unknown()
4343
4673
  }),
4344
- import_v418.z.object({
4345
- type: import_v418.z.literal("tool_search_output"),
4346
- id: import_v418.z.string(),
4347
- execution: import_v418.z.enum(["server", "client"]),
4348
- call_id: import_v418.z.string().nullable(),
4349
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4350
- tools: import_v418.z.array(import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional()))
4674
+ import_v419.z.object({
4675
+ type: import_v419.z.literal("tool_search_output"),
4676
+ id: import_v419.z.string(),
4677
+ execution: import_v419.z.enum(["server", "client"]),
4678
+ call_id: import_v419.z.string().nullable(),
4679
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4680
+ tools: import_v419.z.array(import_v419.z.record(import_v419.z.string(), jsonValueSchema.optional()))
4351
4681
  })
4352
4682
  ])
4353
4683
  }),
4354
- import_v418.z.object({
4355
- type: import_v418.z.literal("response.output_item.done"),
4356
- output_index: import_v418.z.number(),
4357
- item: import_v418.z.discriminatedUnion("type", [
4358
- import_v418.z.object({
4359
- type: import_v418.z.literal("message"),
4360
- id: import_v418.z.string(),
4361
- phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
4684
+ import_v419.z.object({
4685
+ type: import_v419.z.literal("response.output_item.done"),
4686
+ output_index: import_v419.z.number(),
4687
+ item: import_v419.z.discriminatedUnion("type", [
4688
+ import_v419.z.object({
4689
+ type: import_v419.z.literal("message"),
4690
+ id: import_v419.z.string(),
4691
+ phase: import_v419.z.enum(["commentary", "final_answer"]).nullish()
4362
4692
  }),
4363
- import_v418.z.object({
4364
- type: import_v418.z.literal("reasoning"),
4365
- id: import_v418.z.string(),
4366
- encrypted_content: import_v418.z.string().nullish()
4693
+ import_v419.z.object({
4694
+ type: import_v419.z.literal("reasoning"),
4695
+ id: import_v419.z.string(),
4696
+ encrypted_content: import_v419.z.string().nullish()
4367
4697
  }),
4368
- import_v418.z.object({
4369
- type: import_v418.z.literal("function_call"),
4370
- id: import_v418.z.string(),
4371
- call_id: import_v418.z.string(),
4372
- name: import_v418.z.string(),
4373
- arguments: import_v418.z.string(),
4374
- async: import_v418.z.boolean().nullish(),
4375
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4376
- namespace: import_v418.z.string().nullish()
4698
+ import_v419.z.object({
4699
+ type: import_v419.z.literal("function_call"),
4700
+ id: import_v419.z.string(),
4701
+ call_id: import_v419.z.string(),
4702
+ name: import_v419.z.string(),
4703
+ arguments: import_v419.z.string(),
4704
+ async: import_v419.z.boolean().nullish(),
4705
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4706
+ namespace: import_v419.z.string().nullish()
4377
4707
  }),
4378
- import_v418.z.object({
4379
- type: import_v418.z.literal("custom_tool_call"),
4380
- id: import_v418.z.string(),
4381
- call_id: import_v418.z.string(),
4382
- name: import_v418.z.string(),
4383
- input: import_v418.z.string(),
4384
- async: import_v418.z.boolean().nullish(),
4385
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"])
4708
+ import_v419.z.object({
4709
+ type: import_v419.z.literal("custom_tool_call"),
4710
+ id: import_v419.z.string(),
4711
+ call_id: import_v419.z.string(),
4712
+ name: import_v419.z.string(),
4713
+ input: import_v419.z.string(),
4714
+ async: import_v419.z.boolean().nullish(),
4715
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"])
4386
4716
  }),
4387
- import_v418.z.object({
4388
- type: import_v418.z.literal("code_interpreter_call"),
4389
- id: import_v418.z.string(),
4390
- code: import_v418.z.string().nullable(),
4391
- container_id: import_v418.z.string(),
4392
- outputs: import_v418.z.array(
4393
- import_v418.z.discriminatedUnion("type", [
4394
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
4395
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
4717
+ import_v419.z.object({
4718
+ type: import_v419.z.literal("code_interpreter_call"),
4719
+ id: import_v419.z.string(),
4720
+ code: import_v419.z.string().nullable(),
4721
+ container_id: import_v419.z.string(),
4722
+ outputs: import_v419.z.array(
4723
+ import_v419.z.discriminatedUnion("type", [
4724
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
4725
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4396
4726
  ])
4397
4727
  ).nullable()
4398
4728
  }),
4399
- import_v418.z.object({
4400
- type: import_v418.z.literal("image_generation_call"),
4401
- id: import_v418.z.string(),
4402
- result: import_v418.z.string()
4729
+ import_v419.z.object({
4730
+ type: import_v419.z.literal("image_generation_call"),
4731
+ id: import_v419.z.string(),
4732
+ result: import_v419.z.string()
4403
4733
  }),
4404
- import_v418.z.object({
4405
- type: import_v418.z.literal("web_search_call"),
4406
- id: import_v418.z.string(),
4407
- status: import_v418.z.string(),
4408
- action: import_v418.z.discriminatedUnion("type", [
4409
- import_v418.z.object({
4410
- type: import_v418.z.literal("search"),
4411
- query: import_v418.z.string().nullish(),
4412
- queries: import_v418.z.array(import_v418.z.string()).nullish(),
4413
- sources: import_v418.z.array(
4414
- import_v418.z.discriminatedUnion("type", [
4415
- import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
4416
- import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
4734
+ import_v419.z.object({
4735
+ type: import_v419.z.literal("web_search_call"),
4736
+ id: import_v419.z.string(),
4737
+ status: import_v419.z.string(),
4738
+ action: import_v419.z.discriminatedUnion("type", [
4739
+ import_v419.z.object({
4740
+ type: import_v419.z.literal("search"),
4741
+ query: import_v419.z.string().nullish(),
4742
+ queries: import_v419.z.array(import_v419.z.string()).nullish(),
4743
+ sources: import_v419.z.array(
4744
+ import_v419.z.discriminatedUnion("type", [
4745
+ import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
4746
+ import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
4417
4747
  ])
4418
4748
  ).nullish()
4419
4749
  }),
4420
- import_v418.z.object({
4421
- type: import_v418.z.literal("open_page"),
4422
- url: import_v418.z.string().nullish()
4750
+ import_v419.z.object({
4751
+ type: import_v419.z.literal("open_page"),
4752
+ url: import_v419.z.string().nullish()
4423
4753
  }),
4424
- import_v418.z.object({
4425
- type: import_v418.z.literal("find_in_page"),
4426
- url: import_v418.z.string().nullish(),
4427
- pattern: import_v418.z.string().nullish()
4754
+ import_v419.z.object({
4755
+ type: import_v419.z.literal("find_in_page"),
4756
+ url: import_v419.z.string().nullish(),
4757
+ pattern: import_v419.z.string().nullish()
4428
4758
  })
4429
4759
  ]).nullish()
4430
4760
  }),
4431
- import_v418.z.object({
4432
- type: import_v418.z.literal("file_search_call"),
4433
- id: import_v418.z.string(),
4434
- queries: import_v418.z.array(import_v418.z.string()),
4435
- results: import_v418.z.array(
4436
- import_v418.z.object({
4437
- attributes: import_v418.z.record(
4438
- import_v418.z.string(),
4439
- import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
4761
+ import_v419.z.object({
4762
+ type: import_v419.z.literal("file_search_call"),
4763
+ id: import_v419.z.string(),
4764
+ queries: import_v419.z.array(import_v419.z.string()),
4765
+ results: import_v419.z.array(
4766
+ import_v419.z.object({
4767
+ attributes: import_v419.z.record(
4768
+ import_v419.z.string(),
4769
+ import_v419.z.union([import_v419.z.string(), import_v419.z.number(), import_v419.z.boolean()])
4440
4770
  ),
4441
- file_id: import_v418.z.string(),
4442
- filename: import_v418.z.string(),
4443
- score: import_v418.z.number(),
4444
- text: import_v418.z.string()
4771
+ file_id: import_v419.z.string(),
4772
+ filename: import_v419.z.string(),
4773
+ score: import_v419.z.number(),
4774
+ text: import_v419.z.string()
4445
4775
  })
4446
4776
  ).nullish()
4447
4777
  }),
4448
4778
  openaiResponsesLocalShellCallSchema,
4449
- import_v418.z.object({
4450
- type: import_v418.z.literal("computer_call"),
4451
- id: import_v418.z.string(),
4452
- status: import_v418.z.literal("completed")
4779
+ import_v419.z.object({
4780
+ type: import_v419.z.literal("computer_call"),
4781
+ id: import_v419.z.string(),
4782
+ status: import_v419.z.literal("completed")
4453
4783
  }),
4454
- import_v418.z.object({
4455
- type: import_v418.z.literal("mcp_call"),
4456
- id: import_v418.z.string(),
4457
- status: import_v418.z.string(),
4458
- arguments: import_v418.z.string(),
4459
- name: import_v418.z.string(),
4460
- server_label: import_v418.z.string(),
4461
- output: import_v418.z.string().nullish(),
4462
- error: import_v418.z.union([
4463
- import_v418.z.string(),
4464
- import_v418.z.object({
4465
- type: import_v418.z.string().optional(),
4466
- code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
4467
- message: import_v418.z.string().optional()
4784
+ import_v419.z.object({
4785
+ type: import_v419.z.literal("mcp_call"),
4786
+ id: import_v419.z.string(),
4787
+ status: import_v419.z.string(),
4788
+ arguments: import_v419.z.string(),
4789
+ name: import_v419.z.string(),
4790
+ server_label: import_v419.z.string(),
4791
+ output: import_v419.z.string().nullish(),
4792
+ error: import_v419.z.union([
4793
+ import_v419.z.string(),
4794
+ import_v419.z.object({
4795
+ type: import_v419.z.string().optional(),
4796
+ code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
4797
+ message: import_v419.z.string().optional()
4468
4798
  }).loose()
4469
4799
  ]).nullish(),
4470
- approval_request_id: import_v418.z.string().nullish()
4800
+ approval_request_id: import_v419.z.string().nullish()
4471
4801
  }),
4472
- import_v418.z.object({
4473
- type: import_v418.z.literal("mcp_list_tools"),
4474
- id: import_v418.z.string(),
4475
- server_label: import_v418.z.string(),
4476
- tools: import_v418.z.array(
4477
- import_v418.z.object({
4478
- name: import_v418.z.string(),
4479
- description: import_v418.z.string().optional(),
4480
- input_schema: import_v418.z.any(),
4481
- annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
4802
+ import_v419.z.object({
4803
+ type: import_v419.z.literal("mcp_list_tools"),
4804
+ id: import_v419.z.string(),
4805
+ server_label: import_v419.z.string(),
4806
+ tools: import_v419.z.array(
4807
+ import_v419.z.object({
4808
+ name: import_v419.z.string(),
4809
+ description: import_v419.z.string().optional(),
4810
+ input_schema: import_v419.z.any(),
4811
+ annotations: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()).optional()
4482
4812
  })
4483
4813
  ),
4484
- error: import_v418.z.union([
4485
- import_v418.z.string(),
4486
- import_v418.z.object({
4487
- type: import_v418.z.string().optional(),
4488
- code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
4489
- message: import_v418.z.string().optional()
4814
+ error: import_v419.z.union([
4815
+ import_v419.z.string(),
4816
+ import_v419.z.object({
4817
+ type: import_v419.z.string().optional(),
4818
+ code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
4819
+ message: import_v419.z.string().optional()
4490
4820
  }).loose()
4491
4821
  ]).optional()
4492
4822
  }),
4493
- import_v418.z.object({
4494
- type: import_v418.z.literal("mcp_approval_request"),
4495
- id: import_v418.z.string(),
4496
- server_label: import_v418.z.string(),
4497
- name: import_v418.z.string(),
4498
- arguments: import_v418.z.string(),
4499
- approval_request_id: import_v418.z.string().optional()
4823
+ import_v419.z.object({
4824
+ type: import_v419.z.literal("mcp_approval_request"),
4825
+ id: import_v419.z.string(),
4826
+ server_label: import_v419.z.string(),
4827
+ name: import_v419.z.string(),
4828
+ arguments: import_v419.z.string(),
4829
+ approval_request_id: import_v419.z.string().optional()
4500
4830
  }),
4501
- import_v418.z.object({
4502
- type: import_v418.z.literal("apply_patch_call"),
4503
- id: import_v418.z.string(),
4504
- call_id: import_v418.z.string(),
4505
- status: import_v418.z.enum(["in_progress", "completed"]),
4506
- operation: import_v418.z.discriminatedUnion("type", [
4507
- import_v418.z.object({
4508
- type: import_v418.z.literal("create_file"),
4509
- path: import_v418.z.string(),
4510
- diff: import_v418.z.string()
4831
+ import_v419.z.object({
4832
+ type: import_v419.z.literal("apply_patch_call"),
4833
+ id: import_v419.z.string(),
4834
+ call_id: import_v419.z.string(),
4835
+ status: import_v419.z.enum(["in_progress", "completed"]),
4836
+ operation: import_v419.z.discriminatedUnion("type", [
4837
+ import_v419.z.object({
4838
+ type: import_v419.z.literal("create_file"),
4839
+ path: import_v419.z.string(),
4840
+ diff: import_v419.z.string()
4511
4841
  }),
4512
- import_v418.z.object({
4513
- type: import_v418.z.literal("delete_file"),
4514
- path: import_v418.z.string()
4842
+ import_v419.z.object({
4843
+ type: import_v419.z.literal("delete_file"),
4844
+ path: import_v419.z.string()
4515
4845
  }),
4516
- import_v418.z.object({
4517
- type: import_v418.z.literal("update_file"),
4518
- path: import_v418.z.string(),
4519
- diff: import_v418.z.string()
4846
+ import_v419.z.object({
4847
+ type: import_v419.z.literal("update_file"),
4848
+ path: import_v419.z.string(),
4849
+ diff: import_v419.z.string()
4520
4850
  })
4521
4851
  ])
4522
4852
  }),
4523
- import_v418.z.object({
4524
- type: import_v418.z.literal("shell_call"),
4525
- id: import_v418.z.string(),
4526
- call_id: import_v418.z.string(),
4527
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4528
- action: import_v418.z.object({
4529
- commands: import_v418.z.array(import_v418.z.string())
4853
+ import_v419.z.object({
4854
+ type: import_v419.z.literal("shell_call"),
4855
+ id: import_v419.z.string(),
4856
+ call_id: import_v419.z.string(),
4857
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4858
+ action: import_v419.z.object({
4859
+ commands: import_v419.z.array(import_v419.z.string())
4530
4860
  })
4531
4861
  }),
4532
- import_v418.z.object({
4533
- type: import_v418.z.literal("shell_call_output"),
4534
- id: import_v418.z.string(),
4535
- call_id: import_v418.z.string(),
4536
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4537
- output: import_v418.z.array(
4538
- import_v418.z.object({
4539
- stdout: import_v418.z.string(),
4540
- stderr: import_v418.z.string(),
4541
- outcome: import_v418.z.discriminatedUnion("type", [
4542
- import_v418.z.object({ type: import_v418.z.literal("timeout") }),
4543
- import_v418.z.object({
4544
- type: import_v418.z.literal("exit"),
4545
- exit_code: import_v418.z.number()
4862
+ import_v419.z.object({
4863
+ type: import_v419.z.literal("shell_call_output"),
4864
+ id: import_v419.z.string(),
4865
+ call_id: import_v419.z.string(),
4866
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4867
+ output: import_v419.z.array(
4868
+ import_v419.z.object({
4869
+ stdout: import_v419.z.string(),
4870
+ stderr: import_v419.z.string(),
4871
+ outcome: import_v419.z.discriminatedUnion("type", [
4872
+ import_v419.z.object({ type: import_v419.z.literal("timeout") }),
4873
+ import_v419.z.object({
4874
+ type: import_v419.z.literal("exit"),
4875
+ exit_code: import_v419.z.number()
4546
4876
  })
4547
4877
  ])
4548
4878
  })
4549
4879
  )
4550
4880
  }),
4551
- import_v418.z.object({
4552
- type: import_v418.z.literal("tool_search_call"),
4553
- id: import_v418.z.string(),
4554
- execution: import_v418.z.enum(["server", "client"]),
4555
- call_id: import_v418.z.string().nullable(),
4556
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4557
- arguments: import_v418.z.unknown()
4881
+ import_v419.z.object({
4882
+ type: import_v419.z.literal("tool_search_call"),
4883
+ id: import_v419.z.string(),
4884
+ execution: import_v419.z.enum(["server", "client"]),
4885
+ call_id: import_v419.z.string().nullable(),
4886
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4887
+ arguments: import_v419.z.unknown()
4558
4888
  }),
4559
- import_v418.z.object({
4560
- type: import_v418.z.literal("tool_search_output"),
4561
- id: import_v418.z.string(),
4562
- execution: import_v418.z.enum(["server", "client"]),
4563
- call_id: import_v418.z.string().nullable(),
4564
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4565
- tools: import_v418.z.array(import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional()))
4889
+ import_v419.z.object({
4890
+ type: import_v419.z.literal("tool_search_output"),
4891
+ id: import_v419.z.string(),
4892
+ execution: import_v419.z.enum(["server", "client"]),
4893
+ call_id: import_v419.z.string().nullable(),
4894
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
4895
+ tools: import_v419.z.array(import_v419.z.record(import_v419.z.string(), jsonValueSchema.optional()))
4566
4896
  })
4567
4897
  ])
4568
4898
  }),
4569
- import_v418.z.object({
4570
- type: import_v418.z.literal("response.function_call_arguments.delta"),
4571
- item_id: import_v418.z.string(),
4572
- output_index: import_v418.z.number(),
4573
- delta: import_v418.z.string()
4899
+ import_v419.z.object({
4900
+ type: import_v419.z.literal("response.function_call_arguments.delta"),
4901
+ item_id: import_v419.z.string(),
4902
+ output_index: import_v419.z.number(),
4903
+ delta: import_v419.z.string()
4574
4904
  }),
4575
- import_v418.z.object({
4905
+ import_v419.z.object({
4576
4906
  // `name` is documented as required but omitted from live API events:
4577
4907
  // https://github.com/openai/openai-openapi/issues/545
4578
- type: import_v418.z.literal("response.function_call_arguments.done"),
4579
- item_id: import_v418.z.string(),
4580
- output_index: import_v418.z.number(),
4581
- arguments: import_v418.z.string()
4908
+ type: import_v419.z.literal("response.function_call_arguments.done"),
4909
+ item_id: import_v419.z.string(),
4910
+ output_index: import_v419.z.number(),
4911
+ arguments: import_v419.z.string()
4582
4912
  }),
4583
- import_v418.z.object({
4584
- type: import_v418.z.literal("response.custom_tool_call_input.delta"),
4585
- item_id: import_v418.z.string(),
4586
- output_index: import_v418.z.number(),
4587
- delta: import_v418.z.string()
4913
+ import_v419.z.object({
4914
+ type: import_v419.z.literal("response.custom_tool_call_input.delta"),
4915
+ item_id: import_v419.z.string(),
4916
+ output_index: import_v419.z.number(),
4917
+ delta: import_v419.z.string()
4588
4918
  }),
4589
- import_v418.z.object({
4590
- type: import_v418.z.literal("response.image_generation_call.partial_image"),
4591
- item_id: import_v418.z.string(),
4592
- output_index: import_v418.z.number(),
4593
- partial_image_b64: import_v418.z.string()
4919
+ import_v419.z.object({
4920
+ type: import_v419.z.literal("response.image_generation_call.partial_image"),
4921
+ item_id: import_v419.z.string(),
4922
+ output_index: import_v419.z.number(),
4923
+ partial_image_b64: import_v419.z.string()
4594
4924
  }),
4595
- import_v418.z.object({
4596
- type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
4597
- item_id: import_v418.z.string(),
4598
- output_index: import_v418.z.number(),
4599
- delta: import_v418.z.string()
4925
+ import_v419.z.object({
4926
+ type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
4927
+ item_id: import_v419.z.string(),
4928
+ output_index: import_v419.z.number(),
4929
+ delta: import_v419.z.string()
4600
4930
  }),
4601
- import_v418.z.object({
4602
- type: import_v418.z.literal("response.code_interpreter_call_code.done"),
4603
- item_id: import_v418.z.string(),
4604
- output_index: import_v418.z.number(),
4605
- code: import_v418.z.string()
4931
+ import_v419.z.object({
4932
+ type: import_v419.z.literal("response.code_interpreter_call_code.done"),
4933
+ item_id: import_v419.z.string(),
4934
+ output_index: import_v419.z.number(),
4935
+ code: import_v419.z.string()
4606
4936
  }),
4607
- import_v418.z.object({
4608
- type: import_v418.z.literal("response.output_text.annotation.added"),
4609
- annotation: import_v418.z.discriminatedUnion("type", [
4610
- import_v418.z.object({
4611
- type: import_v418.z.literal("url_citation"),
4612
- start_index: import_v418.z.number(),
4613
- end_index: import_v418.z.number(),
4614
- url: import_v418.z.string(),
4615
- title: import_v418.z.string()
4937
+ import_v419.z.object({
4938
+ type: import_v419.z.literal("response.output_text.annotation.added"),
4939
+ annotation: import_v419.z.discriminatedUnion("type", [
4940
+ import_v419.z.object({
4941
+ type: import_v419.z.literal("url_citation"),
4942
+ start_index: import_v419.z.number(),
4943
+ end_index: import_v419.z.number(),
4944
+ url: import_v419.z.string(),
4945
+ title: import_v419.z.string()
4616
4946
  }),
4617
- import_v418.z.object({
4618
- type: import_v418.z.literal("file_citation"),
4619
- file_id: import_v418.z.string(),
4620
- filename: import_v418.z.string(),
4621
- index: import_v418.z.number()
4947
+ import_v419.z.object({
4948
+ type: import_v419.z.literal("file_citation"),
4949
+ file_id: import_v419.z.string(),
4950
+ filename: import_v419.z.string(),
4951
+ index: import_v419.z.number()
4622
4952
  }),
4623
- import_v418.z.object({
4624
- type: import_v418.z.literal("container_file_citation"),
4625
- container_id: import_v418.z.string(),
4626
- file_id: import_v418.z.string(),
4627
- filename: import_v418.z.string(),
4628
- start_index: import_v418.z.number(),
4629
- end_index: import_v418.z.number()
4953
+ import_v419.z.object({
4954
+ type: import_v419.z.literal("container_file_citation"),
4955
+ container_id: import_v419.z.string(),
4956
+ file_id: import_v419.z.string(),
4957
+ filename: import_v419.z.string(),
4958
+ start_index: import_v419.z.number(),
4959
+ end_index: import_v419.z.number()
4630
4960
  }),
4631
- import_v418.z.object({
4632
- type: import_v418.z.literal("file_path"),
4633
- file_id: import_v418.z.string(),
4634
- index: import_v418.z.number()
4961
+ import_v419.z.object({
4962
+ type: import_v419.z.literal("file_path"),
4963
+ file_id: import_v419.z.string(),
4964
+ index: import_v419.z.number()
4635
4965
  })
4636
4966
  ])
4637
4967
  }),
4638
- import_v418.z.object({
4639
- type: import_v418.z.literal("response.reasoning_summary_part.added"),
4640
- item_id: import_v418.z.string(),
4641
- summary_index: import_v418.z.number()
4968
+ import_v419.z.object({
4969
+ type: import_v419.z.literal("response.reasoning_summary_part.added"),
4970
+ item_id: import_v419.z.string(),
4971
+ summary_index: import_v419.z.number()
4642
4972
  }),
4643
- import_v418.z.object({
4644
- type: import_v418.z.literal("response.reasoning_summary_text.delta"),
4645
- item_id: import_v418.z.string(),
4646
- summary_index: import_v418.z.number(),
4647
- delta: import_v418.z.string()
4973
+ import_v419.z.object({
4974
+ type: import_v419.z.literal("response.reasoning_summary_text.delta"),
4975
+ item_id: import_v419.z.string(),
4976
+ summary_index: import_v419.z.number(),
4977
+ delta: import_v419.z.string()
4648
4978
  }),
4649
- import_v418.z.object({
4650
- type: import_v418.z.literal("response.reasoning_summary_part.done"),
4651
- item_id: import_v418.z.string(),
4652
- summary_index: import_v418.z.number()
4979
+ import_v419.z.object({
4980
+ type: import_v419.z.literal("response.reasoning_summary_part.done"),
4981
+ item_id: import_v419.z.string(),
4982
+ summary_index: import_v419.z.number()
4653
4983
  }),
4654
- import_v418.z.object({
4655
- type: import_v418.z.literal("response.apply_patch_call_operation_diff.delta"),
4656
- item_id: import_v418.z.string(),
4657
- output_index: import_v418.z.number(),
4658
- delta: import_v418.z.string(),
4659
- obfuscation: import_v418.z.string().nullish()
4984
+ import_v419.z.object({
4985
+ type: import_v419.z.literal("response.apply_patch_call_operation_diff.delta"),
4986
+ item_id: import_v419.z.string(),
4987
+ output_index: import_v419.z.number(),
4988
+ delta: import_v419.z.string(),
4989
+ obfuscation: import_v419.z.string().nullish()
4660
4990
  }),
4661
- import_v418.z.object({
4662
- type: import_v418.z.literal("response.apply_patch_call_operation_diff.done"),
4663
- item_id: import_v418.z.string(),
4664
- output_index: import_v418.z.number(),
4665
- diff: import_v418.z.string()
4991
+ import_v419.z.object({
4992
+ type: import_v419.z.literal("response.apply_patch_call_operation_diff.done"),
4993
+ item_id: import_v419.z.string(),
4994
+ output_index: import_v419.z.number(),
4995
+ diff: import_v419.z.string()
4666
4996
  }),
4667
4997
  openaiResponsesNestedErrorChunkSchema,
4668
4998
  openaiResponsesErrorChunkSchema,
4669
- import_v418.z.object({ type: import_v418.z.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
4999
+ import_v419.z.object({ type: import_v419.z.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
4670
5000
  message: "Known response chunk failed schema validation"
4671
5001
  }).transform((value) => ({
4672
5002
  type: "unknown_chunk",
@@ -4676,580 +5006,297 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4676
5006
  ])
4677
5007
  )
4678
5008
  );
4679
- var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
4680
- () => (0, import_provider_utils26.zodSchema)(
4681
- import_v418.z.object({
4682
- id: import_v418.z.string().optional(),
4683
- created_at: import_v418.z.number().optional(),
4684
- error: import_v418.z.object({
4685
- message: import_v418.z.string(),
4686
- type: import_v418.z.string(),
4687
- param: import_v418.z.string().nullish(),
4688
- code: import_v418.z.string()
5009
+ var openaiResponsesResponseSchema = (0, import_provider_utils27.lazySchema)(
5010
+ () => (0, import_provider_utils27.zodSchema)(
5011
+ import_v419.z.object({
5012
+ id: import_v419.z.string().optional(),
5013
+ created_at: import_v419.z.number().optional(),
5014
+ error: import_v419.z.object({
5015
+ message: import_v419.z.string(),
5016
+ type: import_v419.z.string(),
5017
+ param: import_v419.z.string().nullish(),
5018
+ code: import_v419.z.string()
4689
5019
  }).nullish(),
4690
- model: import_v418.z.string().optional(),
4691
- output: import_v418.z.array(
4692
- import_v418.z.discriminatedUnion("type", [
4693
- import_v418.z.object({
4694
- type: import_v418.z.literal("message"),
4695
- role: import_v418.z.literal("assistant"),
4696
- id: import_v418.z.string(),
4697
- phase: import_v418.z.enum(["commentary", "final_answer"]).nullish(),
4698
- content: import_v418.z.array(
4699
- import_v418.z.object({
4700
- type: import_v418.z.literal("output_text"),
4701
- text: import_v418.z.string(),
4702
- logprobs: import_v418.z.array(
4703
- import_v418.z.object({
4704
- token: import_v418.z.string(),
4705
- logprob: import_v418.z.number(),
4706
- top_logprobs: import_v418.z.array(
4707
- import_v418.z.object({
4708
- token: import_v418.z.string(),
4709
- logprob: import_v418.z.number()
5020
+ model: import_v419.z.string().optional(),
5021
+ output: import_v419.z.array(
5022
+ import_v419.z.discriminatedUnion("type", [
5023
+ import_v419.z.object({
5024
+ type: import_v419.z.literal("message"),
5025
+ role: import_v419.z.literal("assistant"),
5026
+ id: import_v419.z.string(),
5027
+ phase: import_v419.z.enum(["commentary", "final_answer"]).nullish(),
5028
+ content: import_v419.z.array(
5029
+ import_v419.z.object({
5030
+ type: import_v419.z.literal("output_text"),
5031
+ text: import_v419.z.string(),
5032
+ logprobs: import_v419.z.array(
5033
+ import_v419.z.object({
5034
+ token: import_v419.z.string(),
5035
+ logprob: import_v419.z.number(),
5036
+ top_logprobs: import_v419.z.array(
5037
+ import_v419.z.object({
5038
+ token: import_v419.z.string(),
5039
+ logprob: import_v419.z.number()
4710
5040
  })
4711
5041
  )
4712
5042
  })
4713
5043
  ).nullish(),
4714
- annotations: import_v418.z.array(
4715
- import_v418.z.discriminatedUnion("type", [
4716
- import_v418.z.object({
4717
- type: import_v418.z.literal("url_citation"),
4718
- start_index: import_v418.z.number(),
4719
- end_index: import_v418.z.number(),
4720
- url: import_v418.z.string(),
4721
- title: import_v418.z.string()
5044
+ annotations: import_v419.z.array(
5045
+ import_v419.z.discriminatedUnion("type", [
5046
+ import_v419.z.object({
5047
+ type: import_v419.z.literal("url_citation"),
5048
+ start_index: import_v419.z.number(),
5049
+ end_index: import_v419.z.number(),
5050
+ url: import_v419.z.string(),
5051
+ title: import_v419.z.string()
4722
5052
  }),
4723
- import_v418.z.object({
4724
- type: import_v418.z.literal("file_citation"),
4725
- file_id: import_v418.z.string(),
4726
- filename: import_v418.z.string(),
4727
- index: import_v418.z.number()
5053
+ import_v419.z.object({
5054
+ type: import_v419.z.literal("file_citation"),
5055
+ file_id: import_v419.z.string(),
5056
+ filename: import_v419.z.string(),
5057
+ index: import_v419.z.number()
4728
5058
  }),
4729
- import_v418.z.object({
4730
- type: import_v418.z.literal("container_file_citation"),
4731
- container_id: import_v418.z.string(),
4732
- file_id: import_v418.z.string(),
4733
- filename: import_v418.z.string(),
4734
- start_index: import_v418.z.number(),
4735
- end_index: import_v418.z.number()
5059
+ import_v419.z.object({
5060
+ type: import_v419.z.literal("container_file_citation"),
5061
+ container_id: import_v419.z.string(),
5062
+ file_id: import_v419.z.string(),
5063
+ filename: import_v419.z.string(),
5064
+ start_index: import_v419.z.number(),
5065
+ end_index: import_v419.z.number()
4736
5066
  }),
4737
- import_v418.z.object({
4738
- type: import_v418.z.literal("file_path"),
4739
- file_id: import_v418.z.string(),
4740
- index: import_v418.z.number()
5067
+ import_v419.z.object({
5068
+ type: import_v419.z.literal("file_path"),
5069
+ file_id: import_v419.z.string(),
5070
+ index: import_v419.z.number()
4741
5071
  })
4742
5072
  ])
4743
5073
  )
4744
5074
  })
4745
5075
  )
4746
5076
  }),
4747
- import_v418.z.object({
4748
- type: import_v418.z.literal("web_search_call"),
4749
- id: import_v418.z.string(),
4750
- status: import_v418.z.string(),
4751
- action: import_v418.z.discriminatedUnion("type", [
4752
- import_v418.z.object({
4753
- type: import_v418.z.literal("search"),
4754
- query: import_v418.z.string().nullish(),
4755
- queries: import_v418.z.array(import_v418.z.string()).nullish(),
4756
- sources: import_v418.z.array(
4757
- import_v418.z.discriminatedUnion("type", [
4758
- import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
4759
- import_v418.z.object({
4760
- type: import_v418.z.literal("api"),
4761
- name: import_v418.z.string()
5077
+ import_v419.z.object({
5078
+ type: import_v419.z.literal("web_search_call"),
5079
+ id: import_v419.z.string(),
5080
+ status: import_v419.z.string(),
5081
+ action: import_v419.z.discriminatedUnion("type", [
5082
+ import_v419.z.object({
5083
+ type: import_v419.z.literal("search"),
5084
+ query: import_v419.z.string().nullish(),
5085
+ queries: import_v419.z.array(import_v419.z.string()).nullish(),
5086
+ sources: import_v419.z.array(
5087
+ import_v419.z.discriminatedUnion("type", [
5088
+ import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
5089
+ import_v419.z.object({
5090
+ type: import_v419.z.literal("api"),
5091
+ name: import_v419.z.string()
4762
5092
  })
4763
5093
  ])
4764
5094
  ).nullish()
4765
5095
  }),
4766
- import_v418.z.object({
4767
- type: import_v418.z.literal("open_page"),
4768
- url: import_v418.z.string().nullish()
5096
+ import_v419.z.object({
5097
+ type: import_v419.z.literal("open_page"),
5098
+ url: import_v419.z.string().nullish()
4769
5099
  }),
4770
- import_v418.z.object({
4771
- type: import_v418.z.literal("find_in_page"),
4772
- url: import_v418.z.string().nullish(),
4773
- pattern: import_v418.z.string().nullish()
5100
+ import_v419.z.object({
5101
+ type: import_v419.z.literal("find_in_page"),
5102
+ url: import_v419.z.string().nullish(),
5103
+ pattern: import_v419.z.string().nullish()
4774
5104
  })
4775
5105
  ]).nullish()
4776
5106
  }),
4777
- import_v418.z.object({
4778
- type: import_v418.z.literal("file_search_call"),
4779
- id: import_v418.z.string(),
4780
- queries: import_v418.z.array(import_v418.z.string()),
4781
- results: import_v418.z.array(
4782
- import_v418.z.object({
4783
- attributes: import_v418.z.record(
4784
- import_v418.z.string(),
4785
- import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
5107
+ import_v419.z.object({
5108
+ type: import_v419.z.literal("file_search_call"),
5109
+ id: import_v419.z.string(),
5110
+ queries: import_v419.z.array(import_v419.z.string()),
5111
+ results: import_v419.z.array(
5112
+ import_v419.z.object({
5113
+ attributes: import_v419.z.record(
5114
+ import_v419.z.string(),
5115
+ import_v419.z.union([import_v419.z.string(), import_v419.z.number(), import_v419.z.boolean()])
4786
5116
  ),
4787
- file_id: import_v418.z.string(),
4788
- filename: import_v418.z.string(),
4789
- score: import_v418.z.number(),
4790
- text: import_v418.z.string()
5117
+ file_id: import_v419.z.string(),
5118
+ filename: import_v419.z.string(),
5119
+ score: import_v419.z.number(),
5120
+ text: import_v419.z.string()
4791
5121
  })
4792
5122
  ).nullish()
4793
5123
  }),
4794
- import_v418.z.object({
4795
- type: import_v418.z.literal("code_interpreter_call"),
4796
- id: import_v418.z.string(),
4797
- code: import_v418.z.string().nullable(),
4798
- container_id: import_v418.z.string(),
4799
- outputs: import_v418.z.array(
4800
- import_v418.z.discriminatedUnion("type", [
4801
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
4802
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
5124
+ import_v419.z.object({
5125
+ type: import_v419.z.literal("code_interpreter_call"),
5126
+ id: import_v419.z.string(),
5127
+ code: import_v419.z.string().nullable(),
5128
+ container_id: import_v419.z.string(),
5129
+ outputs: import_v419.z.array(
5130
+ import_v419.z.discriminatedUnion("type", [
5131
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
5132
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
4803
5133
  ])
4804
5134
  ).nullable()
4805
5135
  }),
4806
- import_v418.z.object({
4807
- type: import_v418.z.literal("image_generation_call"),
4808
- id: import_v418.z.string(),
4809
- result: import_v418.z.string()
5136
+ import_v419.z.object({
5137
+ type: import_v419.z.literal("image_generation_call"),
5138
+ id: import_v419.z.string(),
5139
+ result: import_v419.z.string()
4810
5140
  }),
4811
5141
  openaiResponsesLocalShellCallSchema,
4812
- import_v418.z.object({
4813
- type: import_v418.z.literal("function_call"),
4814
- call_id: import_v418.z.string(),
4815
- name: import_v418.z.string(),
4816
- arguments: import_v418.z.string(),
4817
- id: import_v418.z.string(),
4818
- async: import_v418.z.boolean().nullish(),
4819
- namespace: import_v418.z.string().nullish()
5142
+ import_v419.z.object({
5143
+ type: import_v419.z.literal("function_call"),
5144
+ call_id: import_v419.z.string(),
5145
+ name: import_v419.z.string(),
5146
+ arguments: import_v419.z.string(),
5147
+ id: import_v419.z.string(),
5148
+ async: import_v419.z.boolean().nullish(),
5149
+ namespace: import_v419.z.string().nullish()
4820
5150
  }),
4821
- import_v418.z.object({
4822
- type: import_v418.z.literal("custom_tool_call"),
4823
- call_id: import_v418.z.string(),
4824
- name: import_v418.z.string(),
4825
- input: import_v418.z.string(),
4826
- id: import_v418.z.string(),
4827
- async: import_v418.z.boolean().nullish()
5151
+ import_v419.z.object({
5152
+ type: import_v419.z.literal("custom_tool_call"),
5153
+ call_id: import_v419.z.string(),
5154
+ name: import_v419.z.string(),
5155
+ input: import_v419.z.string(),
5156
+ id: import_v419.z.string(),
5157
+ async: import_v419.z.boolean().nullish()
4828
5158
  }),
4829
- import_v418.z.object({
4830
- type: import_v418.z.literal("computer_call"),
4831
- id: import_v418.z.string(),
4832
- status: import_v418.z.string().optional()
5159
+ import_v419.z.object({
5160
+ type: import_v419.z.literal("computer_call"),
5161
+ id: import_v419.z.string(),
5162
+ status: import_v419.z.string().optional()
4833
5163
  }),
4834
- import_v418.z.object({
4835
- type: import_v418.z.literal("reasoning"),
4836
- id: import_v418.z.string(),
4837
- encrypted_content: import_v418.z.string().nullish(),
4838
- summary: import_v418.z.array(
4839
- import_v418.z.object({
4840
- type: import_v418.z.literal("summary_text"),
4841
- text: import_v418.z.string()
5164
+ import_v419.z.object({
5165
+ type: import_v419.z.literal("reasoning"),
5166
+ id: import_v419.z.string(),
5167
+ encrypted_content: import_v419.z.string().nullish(),
5168
+ summary: import_v419.z.array(
5169
+ import_v419.z.object({
5170
+ type: import_v419.z.literal("summary_text"),
5171
+ text: import_v419.z.string()
4842
5172
  })
4843
5173
  )
4844
5174
  }),
4845
- import_v418.z.object({
4846
- type: import_v418.z.literal("mcp_call"),
4847
- id: import_v418.z.string(),
4848
- status: import_v418.z.string(),
4849
- arguments: import_v418.z.string(),
4850
- name: import_v418.z.string(),
4851
- server_label: import_v418.z.string(),
4852
- output: import_v418.z.string().nullish(),
4853
- error: import_v418.z.union([
4854
- import_v418.z.string(),
4855
- import_v418.z.object({
4856
- type: import_v418.z.string().optional(),
4857
- code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
4858
- message: import_v418.z.string().optional()
5175
+ import_v419.z.object({
5176
+ type: import_v419.z.literal("mcp_call"),
5177
+ id: import_v419.z.string(),
5178
+ status: import_v419.z.string(),
5179
+ arguments: import_v419.z.string(),
5180
+ name: import_v419.z.string(),
5181
+ server_label: import_v419.z.string(),
5182
+ output: import_v419.z.string().nullish(),
5183
+ error: import_v419.z.union([
5184
+ import_v419.z.string(),
5185
+ import_v419.z.object({
5186
+ type: import_v419.z.string().optional(),
5187
+ code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
5188
+ message: import_v419.z.string().optional()
4859
5189
  }).loose()
4860
5190
  ]).nullish(),
4861
- approval_request_id: import_v418.z.string().nullish()
5191
+ approval_request_id: import_v419.z.string().nullish()
4862
5192
  }),
4863
- import_v418.z.object({
4864
- type: import_v418.z.literal("mcp_list_tools"),
4865
- id: import_v418.z.string(),
4866
- server_label: import_v418.z.string(),
4867
- tools: import_v418.z.array(
4868
- import_v418.z.object({
4869
- name: import_v418.z.string(),
4870
- description: import_v418.z.string().optional(),
4871
- input_schema: import_v418.z.any(),
4872
- annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
5193
+ import_v419.z.object({
5194
+ type: import_v419.z.literal("mcp_list_tools"),
5195
+ id: import_v419.z.string(),
5196
+ server_label: import_v419.z.string(),
5197
+ tools: import_v419.z.array(
5198
+ import_v419.z.object({
5199
+ name: import_v419.z.string(),
5200
+ description: import_v419.z.string().optional(),
5201
+ input_schema: import_v419.z.any(),
5202
+ annotations: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()).optional()
4873
5203
  })
4874
5204
  ),
4875
- error: import_v418.z.union([
4876
- import_v418.z.string(),
4877
- import_v418.z.object({
4878
- type: import_v418.z.string().optional(),
4879
- code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
4880
- message: import_v418.z.string().optional()
5205
+ error: import_v419.z.union([
5206
+ import_v419.z.string(),
5207
+ import_v419.z.object({
5208
+ type: import_v419.z.string().optional(),
5209
+ code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
5210
+ message: import_v419.z.string().optional()
4881
5211
  }).loose()
4882
5212
  ]).optional()
4883
5213
  }),
4884
- import_v418.z.object({
4885
- type: import_v418.z.literal("mcp_approval_request"),
4886
- id: import_v418.z.string(),
4887
- server_label: import_v418.z.string(),
4888
- name: import_v418.z.string(),
4889
- arguments: import_v418.z.string(),
4890
- approval_request_id: import_v418.z.string().optional()
5214
+ import_v419.z.object({
5215
+ type: import_v419.z.literal("mcp_approval_request"),
5216
+ id: import_v419.z.string(),
5217
+ server_label: import_v419.z.string(),
5218
+ name: import_v419.z.string(),
5219
+ arguments: import_v419.z.string(),
5220
+ approval_request_id: import_v419.z.string().optional()
4891
5221
  }),
4892
- import_v418.z.object({
4893
- type: import_v418.z.literal("apply_patch_call"),
4894
- id: import_v418.z.string(),
4895
- call_id: import_v418.z.string(),
4896
- status: import_v418.z.enum(["in_progress", "completed"]),
4897
- operation: import_v418.z.discriminatedUnion("type", [
4898
- import_v418.z.object({
4899
- type: import_v418.z.literal("create_file"),
4900
- path: import_v418.z.string(),
4901
- diff: import_v418.z.string()
5222
+ import_v419.z.object({
5223
+ type: import_v419.z.literal("apply_patch_call"),
5224
+ id: import_v419.z.string(),
5225
+ call_id: import_v419.z.string(),
5226
+ status: import_v419.z.enum(["in_progress", "completed"]),
5227
+ operation: import_v419.z.discriminatedUnion("type", [
5228
+ import_v419.z.object({
5229
+ type: import_v419.z.literal("create_file"),
5230
+ path: import_v419.z.string(),
5231
+ diff: import_v419.z.string()
4902
5232
  }),
4903
- import_v418.z.object({
4904
- type: import_v418.z.literal("delete_file"),
4905
- path: import_v418.z.string()
5233
+ import_v419.z.object({
5234
+ type: import_v419.z.literal("delete_file"),
5235
+ path: import_v419.z.string()
4906
5236
  }),
4907
- import_v418.z.object({
4908
- type: import_v418.z.literal("update_file"),
4909
- path: import_v418.z.string(),
4910
- diff: import_v418.z.string()
5237
+ import_v419.z.object({
5238
+ type: import_v419.z.literal("update_file"),
5239
+ path: import_v419.z.string(),
5240
+ diff: import_v419.z.string()
4911
5241
  })
4912
5242
  ])
4913
5243
  }),
4914
- import_v418.z.object({
4915
- type: import_v418.z.literal("shell_call"),
4916
- id: import_v418.z.string(),
4917
- call_id: import_v418.z.string(),
4918
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4919
- action: import_v418.z.object({
4920
- commands: import_v418.z.array(import_v418.z.string())
5244
+ import_v419.z.object({
5245
+ type: import_v419.z.literal("shell_call"),
5246
+ id: import_v419.z.string(),
5247
+ call_id: import_v419.z.string(),
5248
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
5249
+ action: import_v419.z.object({
5250
+ commands: import_v419.z.array(import_v419.z.string())
4921
5251
  })
4922
5252
  }),
4923
- import_v418.z.object({
4924
- type: import_v418.z.literal("shell_call_output"),
4925
- id: import_v418.z.string(),
4926
- call_id: import_v418.z.string(),
4927
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4928
- output: import_v418.z.array(
4929
- import_v418.z.object({
4930
- stdout: import_v418.z.string(),
4931
- stderr: import_v418.z.string(),
4932
- outcome: import_v418.z.discriminatedUnion("type", [
4933
- import_v418.z.object({ type: import_v418.z.literal("timeout") }),
4934
- import_v418.z.object({
4935
- type: import_v418.z.literal("exit"),
4936
- exit_code: import_v418.z.number()
5253
+ import_v419.z.object({
5254
+ type: import_v419.z.literal("shell_call_output"),
5255
+ id: import_v419.z.string(),
5256
+ call_id: import_v419.z.string(),
5257
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
5258
+ output: import_v419.z.array(
5259
+ import_v419.z.object({
5260
+ stdout: import_v419.z.string(),
5261
+ stderr: import_v419.z.string(),
5262
+ outcome: import_v419.z.discriminatedUnion("type", [
5263
+ import_v419.z.object({ type: import_v419.z.literal("timeout") }),
5264
+ import_v419.z.object({
5265
+ type: import_v419.z.literal("exit"),
5266
+ exit_code: import_v419.z.number()
4937
5267
  })
4938
5268
  ])
4939
5269
  })
4940
5270
  )
4941
5271
  }),
4942
- import_v418.z.object({
4943
- type: import_v418.z.literal("tool_search_call"),
4944
- id: import_v418.z.string(),
4945
- execution: import_v418.z.enum(["server", "client"]),
4946
- call_id: import_v418.z.string().nullable(),
4947
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4948
- arguments: import_v418.z.unknown()
5272
+ import_v419.z.object({
5273
+ type: import_v419.z.literal("tool_search_call"),
5274
+ id: import_v419.z.string(),
5275
+ execution: import_v419.z.enum(["server", "client"]),
5276
+ call_id: import_v419.z.string().nullable(),
5277
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
5278
+ arguments: import_v419.z.unknown()
4949
5279
  }),
4950
- import_v418.z.object({
4951
- type: import_v418.z.literal("tool_search_output"),
4952
- id: import_v418.z.string(),
4953
- execution: import_v418.z.enum(["server", "client"]),
4954
- call_id: import_v418.z.string().nullable(),
4955
- status: import_v418.z.enum(["in_progress", "completed", "incomplete"]),
4956
- tools: import_v418.z.array(import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional()))
5280
+ import_v419.z.object({
5281
+ type: import_v419.z.literal("tool_search_output"),
5282
+ id: import_v419.z.string(),
5283
+ execution: import_v419.z.enum(["server", "client"]),
5284
+ call_id: import_v419.z.string().nullable(),
5285
+ status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
5286
+ tools: import_v419.z.array(import_v419.z.record(import_v419.z.string(), jsonValueSchema.optional()))
4957
5287
  })
4958
5288
  ])
4959
5289
  ).optional(),
4960
- service_tier: import_v418.z.string().nullish(),
4961
- reasoning: import_v418.z.object({
4962
- context: import_v418.z.string().nullish()
5290
+ service_tier: import_v419.z.string().nullish(),
5291
+ reasoning: import_v419.z.object({
5292
+ context: import_v419.z.string().nullish()
4963
5293
  }).nullish(),
4964
- incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
5294
+ incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
4965
5295
  usage: openaiResponsesUsageSchema.nullish()
4966
5296
  })
4967
5297
  )
4968
5298
  );
4969
5299
 
4970
- // src/responses/openai-responses-options.ts
4971
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
4972
- var import_v419 = require("zod/v4");
4973
- var TOP_LOGPROBS_MAX = 20;
4974
- var openaiResponsesReasoningModelIds = [
4975
- "o1",
4976
- "o1-2024-12-17",
4977
- "o3",
4978
- "o3-2025-04-16",
4979
- "o3-mini",
4980
- "o3-mini-2025-01-31",
4981
- "o4-mini",
4982
- "o4-mini-2025-04-16",
4983
- "gpt-5",
4984
- "gpt-5-2025-08-07",
4985
- "gpt-5-codex",
4986
- "gpt-5-mini",
4987
- "gpt-5-mini-2025-08-07",
4988
- "gpt-5-nano",
4989
- "gpt-5-nano-2025-08-07",
4990
- "gpt-5-pro",
4991
- "gpt-5-pro-2025-10-06",
4992
- "gpt-5.1",
4993
- "gpt-5.1-chat-latest",
4994
- "gpt-5.1-codex-mini",
4995
- "gpt-5.1-codex",
4996
- "gpt-5.1-codex-max",
4997
- "gpt-5.2",
4998
- "gpt-5.2-chat-latest",
4999
- "gpt-5.2-pro",
5000
- "gpt-5.2-codex",
5001
- "gpt-5.3-chat-latest",
5002
- "gpt-5.3-codex",
5003
- "gpt-5.4",
5004
- "gpt-5.4-2026-03-05",
5005
- "gpt-5.4-mini",
5006
- "gpt-5.4-mini-2026-03-17",
5007
- "gpt-5.4-nano",
5008
- "gpt-5.4-nano-2026-03-17",
5009
- "gpt-5.4-pro",
5010
- "gpt-5.4-pro-2026-03-05",
5011
- "gpt-5.5",
5012
- "gpt-5.5-2026-04-23",
5013
- "gpt-5.6",
5014
- "gpt-5.6-luna",
5015
- "gpt-5.6-sol",
5016
- "gpt-5.6-terra",
5017
- "gpt-6-astra",
5018
- "gpt-6-luna",
5019
- "gpt-6-sol"
5020
- ];
5021
- var openaiResponsesModelIds = [
5022
- "gpt-4.1",
5023
- "gpt-4.1-2025-04-14",
5024
- "gpt-4.1-mini",
5025
- "gpt-4.1-mini-2025-04-14",
5026
- "gpt-4.1-nano",
5027
- "gpt-4.1-nano-2025-04-14",
5028
- "gpt-4o",
5029
- "gpt-4o-2024-05-13",
5030
- "gpt-4o-2024-08-06",
5031
- "gpt-4o-2024-11-20",
5032
- "gpt-4o-audio-preview",
5033
- "gpt-4o-audio-preview-2024-12-17",
5034
- "gpt-4o-search-preview",
5035
- "gpt-4o-search-preview-2025-03-11",
5036
- "gpt-4o-mini-search-preview",
5037
- "gpt-4o-mini-search-preview-2025-03-11",
5038
- "gpt-4o-mini",
5039
- "gpt-4o-mini-2024-07-18",
5040
- "gpt-3.5-turbo-0125",
5041
- "gpt-3.5-turbo",
5042
- "gpt-3.5-turbo-1106",
5043
- "gpt-5-chat-latest",
5044
- ...openaiResponsesReasoningModelIds
5045
- ];
5046
- var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazySchema)(
5047
- () => (0, import_provider_utils27.zodSchema)(
5048
- import_v419.z.object({
5049
- /**
5050
- * The ID of the OpenAI Conversation to continue.
5051
- * You must create a conversation first via the OpenAI API.
5052
- * Cannot be used in conjunction with `previousResponseId`.
5053
- * Defaults to `undefined`.
5054
- * @see https://platform.openai.com/docs/api-reference/conversations/create
5055
- */
5056
- conversation: import_v419.z.string().nullish(),
5057
- /**
5058
- * The set of extra fields to include in the response (advanced, usually not needed).
5059
- * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5060
- */
5061
- include: import_v419.z.array(
5062
- import_v419.z.enum([
5063
- "reasoning.encrypted_content",
5064
- // handled internally by default, only needed for unknown reasoning models
5065
- "file_search_call.results",
5066
- "web_search_call.results",
5067
- "message.output_text.logprobs"
5068
- ])
5069
- ).nullish(),
5070
- /**
5071
- * Instructions for the model.
5072
- * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5073
- * Defaults to `undefined`.
5074
- */
5075
- instructions: import_v419.z.string().nullish(),
5076
- /**
5077
- * Return the log probabilities of the tokens. Including logprobs will increase
5078
- * the response size and can slow down response times. However, it can
5079
- * be useful to better understand how the model is behaving.
5080
- *
5081
- * Setting to true will return the log probabilities of the tokens that
5082
- * were generated.
5083
- *
5084
- * Setting to a number will return the log probabilities of the top n
5085
- * tokens that were generated.
5086
- *
5087
- * @see https://platform.openai.com/docs/api-reference/responses/create
5088
- * @see https://cookbook.openai.com/examples/using_logprobs
5089
- */
5090
- logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5091
- /**
5092
- * The maximum number of total calls to built-in tools that can be processed in a response.
5093
- * This maximum number applies across all built-in tool calls, not per individual tool.
5094
- * Any further attempts to call a tool by the model will be ignored.
5095
- */
5096
- maxToolCalls: import_v419.z.number().nullish(),
5097
- /**
5098
- * Additional metadata to store with the generation.
5099
- */
5100
- metadata: import_v419.z.any().nullish(),
5101
- /**
5102
- * Whether to use parallel tool calls. Defaults to `true`.
5103
- */
5104
- parallelToolCalls: import_v419.z.boolean().nullish(),
5105
- /**
5106
- * The ID of the previous response. You can use it to continue a conversation.
5107
- * Defaults to `undefined`.
5108
- */
5109
- previousResponseId: import_v419.z.string().nullish(),
5110
- /**
5111
- * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5112
- */
5113
- promptCacheKey: import_v419.z.string().nullish(),
5114
- /**
5115
- * Prompt cache behavior for GPT-5.6 and later models.
5116
- * `mode` controls whether OpenAI also places an implicit breakpoint.
5117
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5118
- */
5119
- promptCacheOptions: import_v419.z.object({
5120
- mode: import_v419.z.enum(["implicit", "explicit"]).optional(),
5121
- ttl: import_v419.z.literal("30m").optional()
5122
- }).optional(),
5123
- /**
5124
- * The retention policy for the prompt cache.
5125
- * - 'in_memory': Default. Standard prompt caching behavior.
5126
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
5127
- * Available for models before GPT-5.6 that support extended caching.
5128
- *
5129
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
5130
- *
5131
- * @default 'in_memory'
5132
- */
5133
- promptCacheRetention: import_v419.z.enum(["in_memory", "24h"]).nullish(),
5134
- /**
5135
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5136
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5137
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5138
- * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5139
- * Supported values vary by model.
5140
- */
5141
- reasoningEffort: import_v419.z.string().nullish(),
5142
- /**
5143
- * Updates the reasoning effort for GPT-6 and later models starting with this response
5144
- * without changing the request-level reasoning effort. This preserves the
5145
- * request prefix for prompt caching.
5146
- *
5147
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
5148
- * combined with automatic truncation.
5149
- */
5150
- reasoningEffortUpdate: import_v419.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5151
- /**
5152
- * Controls how much model work GPT-5.6 performs before returning a final answer.
5153
- * `standard` is the default. `pro` increases quality, latency, and token usage.
5154
- */
5155
- reasoningMode: import_v419.z.enum(["standard", "pro"]).optional(),
5156
- /**
5157
- * Controls which available reasoning items GPT-5.6 can use.
5158
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5159
- * turns, and `all_turns` makes compatible earlier reasoning available.
5160
- */
5161
- reasoningContext: import_v419.z.enum(["auto", "current_turn", "all_turns"]).optional(),
5162
- /**
5163
- * Controls reasoning summary output from the model.
5164
- * Set to "auto" to automatically receive the richest level available,
5165
- * or "detailed" for comprehensive summaries.
5166
- */
5167
- reasoningSummary: import_v419.z.string().nullish(),
5168
- /**
5169
- * The identifier for safety monitoring and tracking.
5170
- */
5171
- safetyIdentifier: import_v419.z.string().nullish(),
5172
- /**
5173
- * Service tier for the request.
5174
- * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
5175
- * 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).
5176
- * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
5177
- *
5178
- * Defaults to 'auto'.
5179
- */
5180
- serviceTier: import_v419.z.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
5181
- /**
5182
- * Whether to store the generation. Defaults to `true`.
5183
- */
5184
- store: import_v419.z.boolean().nullish(),
5185
- /**
5186
- * Whether to pass through non-image file types as generic input files.
5187
- *
5188
- * By default, inline file inputs are restricted to images and PDFs.
5189
- * Enable this when the target OpenAI Responses model supports additional
5190
- * file media types, such as text/csv.
5191
- */
5192
- passThroughUnsupportedFiles: import_v419.z.boolean().optional(),
5193
- /**
5194
- * Whether to use strict JSON schema validation.
5195
- * Defaults to `true`.
5196
- */
5197
- strictJsonSchema: import_v419.z.boolean().nullish(),
5198
- /**
5199
- * Controls the verbosity of the model's responses. Lower values ('low') will result
5200
- * in more concise responses, while higher values ('high') will result in more verbose responses.
5201
- * Valid values: 'low', 'medium', 'high'.
5202
- */
5203
- textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
5204
- /**
5205
- * Controls output truncation. 'auto' (default) performs truncation automatically;
5206
- * 'disabled' turns truncation off.
5207
- */
5208
- truncation: import_v419.z.enum(["auto", "disabled"]).nullish(),
5209
- /**
5210
- * A unique identifier representing your end-user, which can help OpenAI to
5211
- * monitor and detect abuse.
5212
- * Defaults to `undefined`.
5213
- * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5214
- */
5215
- user: import_v419.z.string().nullish(),
5216
- /**
5217
- * Override the system message mode for this model.
5218
- * - 'system': Use the 'system' role for system messages (default for most models)
5219
- * - 'developer': Use the 'developer' role for system messages (used by reasoning models)
5220
- * - 'remove': Remove system messages entirely
5221
- *
5222
- * If not specified, the mode is automatically determined based on the model.
5223
- */
5224
- systemMessageMode: import_v419.z.enum(["system", "developer", "remove"]).optional(),
5225
- /**
5226
- * Force treating this model as a reasoning model.
5227
- *
5228
- * This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
5229
- * where the model ID is not recognized by the SDK's allowlist.
5230
- *
5231
- * When enabled, the SDK applies reasoning-model parameter compatibility rules
5232
- * and defaults `systemMessageMode` to `developer` unless overridden.
5233
- */
5234
- forceReasoning: import_v419.z.boolean().optional(),
5235
- /**
5236
- * Restrict the callable tools to a subset while keeping the full tools
5237
- * list intact, so prompt caching is preserved across requests with
5238
- * different allowlists.
5239
- *
5240
- * When set, this overrides the request-level `toolChoice` and emits
5241
- * `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
5242
- *
5243
- * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5244
- */
5245
- allowedTools: import_v419.z.object({
5246
- toolNames: import_v419.z.array(import_v419.z.string()).min(1),
5247
- mode: import_v419.z.enum(["auto", "required"]).optional()
5248
- }).optional()
5249
- })
5250
- )
5251
- );
5252
-
5253
5300
  // src/responses/openai-responses-prepare-tools.ts
5254
5301
  var import_provider9 = require("@ai-sdk/provider");
5255
5302
  var import_provider_utils35 = require("@ai-sdk/provider-utils");
@@ -6073,6 +6120,18 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
6073
6120
  }
6074
6121
  return mapping;
6075
6122
  }
6123
+ function getConfigurationUpdateUnsupportedReason({
6124
+ modelCapabilities,
6125
+ options
6126
+ }) {
6127
+ if (!modelCapabilities.supportsConfigurationUpdate) {
6128
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
6129
+ }
6130
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
6131
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
6132
+ }
6133
+ return void 0;
6134
+ }
6076
6135
  var OpenAIResponsesLanguageModel = class {
6077
6136
  constructor(modelId, config) {
6078
6137
  this.specificationVersion = "v3";
@@ -6180,8 +6239,13 @@ var OpenAIResponsesLanguageModel = class {
6180
6239
  customProviderToolNames,
6181
6240
  supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6182
6241
  });
6242
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
6243
+ modelCapabilities,
6244
+ options: openaiOptions
6245
+ });
6183
6246
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
6184
6247
  prompt,
6248
+ configurationUpdateUnsupportedReason,
6185
6249
  toolNameMapping,
6186
6250
  systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
6187
6251
  providerOptionsName,
@@ -6199,18 +6263,27 @@ var OpenAIResponsesLanguageModel = class {
6199
6263
  });
6200
6264
  warnings.push(...inputWarnings);
6201
6265
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
6202
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
6203
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
6266
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
6204
6267
  warnings.push({
6205
6268
  type: "unsupported",
6206
6269
  feature: "reasoningEffortUpdate",
6207
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
6270
+ details: configurationUpdateUnsupportedReason
6208
6271
  });
6209
6272
  } else if (reasoningEffortUpdate != null) {
6210
- input.unshift({
6211
- type: "configuration_update",
6212
- reasoning: { effort: reasoningEffortUpdate }
6213
- });
6273
+ const firstItem = input[0];
6274
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
6275
+ input.unshift({
6276
+ type: "configuration_update",
6277
+ reasoning: { effort: reasoningEffortUpdate }
6278
+ });
6279
+ }
6280
+ }
6281
+ for (let i = 1; i < input.length; i++) {
6282
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
6283
+ throw new import_provider10.UnsupportedFunctionalityError({
6284
+ functionality: "Adjacent reasoning effort configuration updates"
6285
+ });
6286
+ }
6214
6287
  }
6215
6288
  const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
6216
6289
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -7157,7 +7230,7 @@ var OpenAIResponsesLanguageModel = class {
7157
7230
  };
7158
7231
  } else if (value.item.type === "shell_call_output") {
7159
7232
  } else if (value.item.type === "message") {
7160
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
7233
+ ongoingAnnotations.splice(0);
7161
7234
  activeMessagePhase = (_b2 = value.item.phase) != null ? _b2 : void 0;
7162
7235
  controller.enqueue({
7163
7236
  type: "text-start",