@ai-sdk/openai 2.0.129 → 2.0.131

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.
@@ -1066,7 +1066,7 @@ var OpenAIChatLanguageModel = class {
1066
1066
  abortSignal: options.abortSignal,
1067
1067
  fetch: this.config.fetch
1068
1068
  });
1069
- const toolCalls = [];
1069
+ let toolCallTracker;
1070
1070
  let finishReason = "unknown";
1071
1071
  const usage = {
1072
1072
  inputTokens: void 0,
@@ -1080,10 +1080,14 @@ var OpenAIChatLanguageModel = class {
1080
1080
  stream: response.pipeThrough(
1081
1081
  new TransformStream({
1082
1082
  start(controller) {
1083
+ toolCallTracker = new import_provider_utils5.StreamingToolCallTracker(controller, {
1084
+ generateId: import_provider_utils5.generateId,
1085
+ typeValidation: "if-present"
1086
+ });
1083
1087
  controller.enqueue({ type: "stream-start", warnings });
1084
1088
  },
1085
1089
  transform(chunk, controller) {
1086
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
1090
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1087
1091
  if (options.includeRawChunks) {
1088
1092
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1089
1093
  }
@@ -1150,90 +1154,7 @@ var OpenAIChatLanguageModel = class {
1150
1154
  }
1151
1155
  if (delta.tool_calls != null) {
1152
1156
  for (const toolCallDelta of delta.tool_calls) {
1153
- const index = toolCallDelta.index;
1154
- if (toolCalls[index] == null) {
1155
- if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
1156
- throw new import_provider3.InvalidResponseDataError({
1157
- data: toolCallDelta,
1158
- message: `Expected 'function' type.`
1159
- });
1160
- }
1161
- if (toolCallDelta.id == null) {
1162
- throw new import_provider3.InvalidResponseDataError({
1163
- data: toolCallDelta,
1164
- message: `Expected 'id' to be a string.`
1165
- });
1166
- }
1167
- if (((_n = toolCallDelta.function) == null ? void 0 : _n.name) == null) {
1168
- throw new import_provider3.InvalidResponseDataError({
1169
- data: toolCallDelta,
1170
- message: `Expected 'function.name' to be a string.`
1171
- });
1172
- }
1173
- controller.enqueue({
1174
- type: "tool-input-start",
1175
- id: toolCallDelta.id,
1176
- toolName: toolCallDelta.function.name
1177
- });
1178
- toolCalls[index] = {
1179
- id: toolCallDelta.id,
1180
- type: "function",
1181
- function: {
1182
- name: toolCallDelta.function.name,
1183
- arguments: (_o = toolCallDelta.function.arguments) != null ? _o : ""
1184
- },
1185
- hasFinished: false
1186
- };
1187
- const toolCall2 = toolCalls[index];
1188
- if (((_p = toolCall2.function) == null ? void 0 : _p.name) != null && ((_q = toolCall2.function) == null ? void 0 : _q.arguments) != null) {
1189
- if (toolCall2.function.arguments.length > 0) {
1190
- controller.enqueue({
1191
- type: "tool-input-delta",
1192
- id: toolCall2.id,
1193
- delta: toolCall2.function.arguments
1194
- });
1195
- }
1196
- if ((0, import_provider_utils5.isParsableJson)(toolCall2.function.arguments)) {
1197
- controller.enqueue({
1198
- type: "tool-input-end",
1199
- id: toolCall2.id
1200
- });
1201
- controller.enqueue({
1202
- type: "tool-call",
1203
- toolCallId: (_r = toolCall2.id) != null ? _r : (0, import_provider_utils5.generateId)(),
1204
- toolName: toolCall2.function.name,
1205
- input: toolCall2.function.arguments
1206
- });
1207
- toolCall2.hasFinished = true;
1208
- }
1209
- }
1210
- continue;
1211
- }
1212
- const toolCall = toolCalls[index];
1213
- if (toolCall.hasFinished) {
1214
- continue;
1215
- }
1216
- if (((_s = toolCallDelta.function) == null ? void 0 : _s.arguments) != null) {
1217
- toolCall.function.arguments += (_u = (_t = toolCallDelta.function) == null ? void 0 : _t.arguments) != null ? _u : "";
1218
- }
1219
- controller.enqueue({
1220
- type: "tool-input-delta",
1221
- id: toolCall.id,
1222
- delta: (_v = toolCallDelta.function.arguments) != null ? _v : ""
1223
- });
1224
- if (((_w = toolCall.function) == null ? void 0 : _w.name) != null && ((_x = toolCall.function) == null ? void 0 : _x.arguments) != null && (0, import_provider_utils5.isParsableJson)(toolCall.function.arguments)) {
1225
- controller.enqueue({
1226
- type: "tool-input-end",
1227
- id: toolCall.id
1228
- });
1229
- controller.enqueue({
1230
- type: "tool-call",
1231
- toolCallId: (_y = toolCall.id) != null ? _y : (0, import_provider_utils5.generateId)(),
1232
- toolName: toolCall.function.name,
1233
- input: toolCall.function.arguments
1234
- });
1235
- toolCall.hasFinished = true;
1236
- }
1157
+ toolCallTracker.processDelta(toolCallDelta);
1237
1158
  }
1238
1159
  }
1239
1160
  if (delta.annotations != null) {
@@ -1252,6 +1173,7 @@ var OpenAIChatLanguageModel = class {
1252
1173
  if (isActiveText) {
1253
1174
  controller.enqueue({ type: "text-end", id: "0" });
1254
1175
  }
1176
+ toolCallTracker.flush();
1255
1177
  controller.enqueue({
1256
1178
  type: "finish",
1257
1179
  finishReason,
@@ -2401,30 +2323,231 @@ var import_provider_utils30 = require("@ai-sdk/provider-utils");
2401
2323
 
2402
2324
  // src/responses/convert-to-openai-responses-input.ts
2403
2325
  var import_provider6 = require("@ai-sdk/provider");
2404
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
2405
- var import_v414 = require("zod/v4");
2326
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
2327
+ var import_v415 = require("zod/v4");
2406
2328
 
2407
- // src/tool/local-shell.ts
2329
+ // src/responses/openai-responses-options.ts
2408
2330
  var import_provider_utils20 = require("@ai-sdk/provider-utils");
2409
2331
  var import_v413 = require("zod/v4");
2410
- var localShellInputSchema = (0, import_provider_utils20.lazySchema)(
2332
+ var TOP_LOGPROBS_MAX = 20;
2333
+ var openaiResponsesReasoningModelIds = [
2334
+ "o1",
2335
+ "o1-2024-12-17",
2336
+ "o3",
2337
+ "o3-2025-04-16",
2338
+ "o3-deep-research",
2339
+ "o3-deep-research-2025-06-26",
2340
+ "o3-mini",
2341
+ "o3-mini-2025-01-31",
2342
+ "o4-mini",
2343
+ "o4-mini-2025-04-16",
2344
+ "o4-mini-deep-research",
2345
+ "o4-mini-deep-research-2025-06-26",
2346
+ "codex-mini-latest",
2347
+ "computer-use-preview",
2348
+ "gpt-5",
2349
+ "gpt-5-2025-08-07",
2350
+ "gpt-5-codex",
2351
+ "gpt-5-mini",
2352
+ "gpt-5-mini-2025-08-07",
2353
+ "gpt-5-nano",
2354
+ "gpt-5-nano-2025-08-07",
2355
+ "gpt-5-pro",
2356
+ "gpt-5-pro-2025-10-06",
2357
+ "gpt-5.1",
2358
+ "gpt-5.1-chat-latest",
2359
+ "gpt-5.1-codex-mini",
2360
+ "gpt-5.1-codex",
2361
+ "gpt-5.1-codex-max",
2362
+ "gpt-5.2",
2363
+ "gpt-5.2-chat-latest",
2364
+ "gpt-5.2-pro",
2365
+ "gpt-5.2-codex",
2366
+ "gpt-5.3-chat-latest",
2367
+ "gpt-5.3-codex",
2368
+ "gpt-5.4",
2369
+ "gpt-5.4-2026-03-05",
2370
+ "gpt-5.4-mini",
2371
+ "gpt-5.4-mini-2026-03-17",
2372
+ "gpt-5.4-nano",
2373
+ "gpt-5.4-nano-2026-03-17",
2374
+ "gpt-5.4-pro",
2375
+ "gpt-5.4-pro-2026-03-05",
2376
+ "gpt-5.6",
2377
+ "gpt-5.6-luna",
2378
+ "gpt-5.6-sol",
2379
+ "gpt-5.6-terra",
2380
+ "gpt-6-astra",
2381
+ "gpt-6-luna",
2382
+ "gpt-6-sol"
2383
+ ];
2384
+ var openaiResponsesModelIds = [
2385
+ "gpt-4.1",
2386
+ "gpt-4.1-2025-04-14",
2387
+ "gpt-4.1-mini",
2388
+ "gpt-4.1-mini-2025-04-14",
2389
+ "gpt-4.1-nano",
2390
+ "gpt-4.1-nano-2025-04-14",
2391
+ "gpt-4o",
2392
+ "gpt-4o-2024-05-13",
2393
+ "gpt-4o-2024-08-06",
2394
+ "gpt-4o-2024-11-20",
2395
+ "gpt-4o-audio-preview",
2396
+ "gpt-4o-audio-preview-2024-10-01",
2397
+ "gpt-4o-audio-preview-2024-12-17",
2398
+ "gpt-4o-search-preview",
2399
+ "gpt-4o-search-preview-2025-03-11",
2400
+ "gpt-4o-mini-search-preview",
2401
+ "gpt-4o-mini-search-preview-2025-03-11",
2402
+ "gpt-4o-mini",
2403
+ "gpt-4o-mini-2024-07-18",
2404
+ "gpt-4-turbo",
2405
+ "gpt-4-turbo-2024-04-09",
2406
+ "gpt-4-turbo-preview",
2407
+ "gpt-4-0125-preview",
2408
+ "gpt-4-1106-preview",
2409
+ "gpt-4",
2410
+ "gpt-4-0613",
2411
+ "gpt-4.5-preview",
2412
+ "gpt-4.5-preview-2025-02-27",
2413
+ "gpt-3.5-turbo-0125",
2414
+ "gpt-3.5-turbo",
2415
+ "gpt-3.5-turbo-1106",
2416
+ "chatgpt-4o-latest",
2417
+ "gpt-5-chat-latest",
2418
+ ...openaiResponsesReasoningModelIds
2419
+ ];
2420
+ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils20.lazyValidator)(
2411
2421
  () => (0, import_provider_utils20.zodSchema)(
2412
2422
  import_v413.z.object({
2413
- action: import_v413.z.object({
2414
- type: import_v413.z.literal("exec"),
2415
- command: import_v413.z.array(import_v413.z.string()),
2416
- timeoutMs: import_v413.z.number().optional(),
2417
- user: import_v413.z.string().optional(),
2418
- workingDirectory: import_v413.z.string().optional(),
2419
- env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
2423
+ conversation: import_v413.z.string().nullish(),
2424
+ include: import_v413.z.array(
2425
+ import_v413.z.enum([
2426
+ "reasoning.encrypted_content",
2427
+ // handled internally by default, only needed for unknown reasoning models
2428
+ "file_search_call.results",
2429
+ "message.output_text.logprobs"
2430
+ ])
2431
+ ).nullish(),
2432
+ instructions: import_v413.z.string().nullish(),
2433
+ /**
2434
+ * Return the log probabilities of the tokens.
2435
+ *
2436
+ * Setting to true will return the log probabilities of the tokens that
2437
+ * were generated.
2438
+ *
2439
+ * Setting to a number will return the log probabilities of the top n
2440
+ * tokens that were generated.
2441
+ *
2442
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2443
+ * @see https://cookbook.openai.com/examples/using_logprobs
2444
+ */
2445
+ logprobs: import_v413.z.union([import_v413.z.boolean(), import_v413.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2446
+ /**
2447
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2448
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2449
+ * Any further attempts to call a tool by the model will be ignored.
2450
+ */
2451
+ maxToolCalls: import_v413.z.number().nullish(),
2452
+ metadata: import_v413.z.any().nullish(),
2453
+ parallelToolCalls: import_v413.z.boolean().nullish(),
2454
+ previousResponseId: import_v413.z.string().nullish(),
2455
+ promptCacheKey: import_v413.z.string().nullish(),
2456
+ /**
2457
+ * Prompt cache behavior for GPT-5.6 and later models.
2458
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2459
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2460
+ */
2461
+ promptCacheOptions: import_v413.z.object({
2462
+ mode: import_v413.z.enum(["implicit", "explicit"]).optional(),
2463
+ ttl: import_v413.z.literal("30m").optional()
2464
+ }).optional(),
2465
+ /**
2466
+ * The retention policy for the prompt cache.
2467
+ * - 'in_memory': Default. Standard prompt caching behavior.
2468
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2469
+ * Available for models before GPT-5.6 that support extended caching.
2470
+ *
2471
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2472
+ *
2473
+ * @default 'in_memory'
2474
+ */
2475
+ promptCacheRetention: import_v413.z.enum(["in_memory", "24h"]).nullish(),
2476
+ /**
2477
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2478
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2479
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2480
+ * Supported values vary by model.
2481
+ */
2482
+ reasoningEffort: import_v413.z.string().nullish(),
2483
+ /**
2484
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
2485
+ * without changing the request-level reasoning effort. This preserves the
2486
+ * request prefix for prompt caching.
2487
+ *
2488
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2489
+ * combined with automatic truncation.
2490
+ */
2491
+ reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2492
+ /**
2493
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
2494
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
2495
+ */
2496
+ reasoningMode: import_v413.z.enum(["standard", "pro"]).optional(),
2497
+ /**
2498
+ * Controls which available reasoning items GPT-5.6 can use.
2499
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2500
+ * turns, and `all_turns` makes compatible earlier reasoning available.
2501
+ */
2502
+ reasoningContext: import_v413.z.enum(["auto", "current_turn", "all_turns"]).optional(),
2503
+ reasoningSummary: import_v413.z.string().nullish(),
2504
+ safetyIdentifier: import_v413.z.string().nullish(),
2505
+ serviceTier: import_v413.z.enum(["auto", "flex", "priority", "default"]).nullish(),
2506
+ store: import_v413.z.boolean().nullish(),
2507
+ strictJsonSchema: import_v413.z.boolean().nullish(),
2508
+ textVerbosity: import_v413.z.enum(["low", "medium", "high"]).nullish(),
2509
+ truncation: import_v413.z.enum(["auto", "disabled"]).nullish(),
2510
+ user: import_v413.z.string().nullish()
2511
+ })
2512
+ )
2513
+ );
2514
+ var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils20.lazyValidator)(
2515
+ () => (0, import_provider_utils20.zodSchema)(
2516
+ import_v413.z.object({
2517
+ /**
2518
+ * Emit a configuration update at this position in Responses history.
2519
+ * Requires empty system message content and the same supported
2520
+ * configuration as the request-level reasoningEffortUpdate option.
2521
+ * Unsupported historical updates throw instead of being omitted.
2522
+ *
2523
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
2524
+ */
2525
+ reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2526
+ })
2527
+ )
2528
+ );
2529
+
2530
+ // src/tool/local-shell.ts
2531
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
2532
+ var import_v414 = require("zod/v4");
2533
+ var localShellInputSchema = (0, import_provider_utils21.lazySchema)(
2534
+ () => (0, import_provider_utils21.zodSchema)(
2535
+ import_v414.z.object({
2536
+ action: import_v414.z.object({
2537
+ type: import_v414.z.literal("exec"),
2538
+ command: import_v414.z.array(import_v414.z.string()),
2539
+ timeoutMs: import_v414.z.number().optional(),
2540
+ user: import_v414.z.string().optional(),
2541
+ workingDirectory: import_v414.z.string().optional(),
2542
+ env: import_v414.z.record(import_v414.z.string(), import_v414.z.string()).optional()
2420
2543
  })
2421
2544
  })
2422
2545
  )
2423
2546
  );
2424
- var localShellOutputSchema = (0, import_provider_utils20.lazySchema)(
2425
- () => (0, import_provider_utils20.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
2547
+ var localShellOutputSchema = (0, import_provider_utils21.lazySchema)(
2548
+ () => (0, import_provider_utils21.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
2426
2549
  );
2427
- var localShell = (0, import_provider_utils20.createProviderDefinedToolFactoryWithOutputSchema)({
2550
+ var localShell = (0, import_provider_utils21.createProviderDefinedToolFactoryWithOutputSchema)({
2428
2551
  id: "openai.local_shell",
2429
2552
  name: "local_shell",
2430
2553
  inputSchema: localShellInputSchema,
@@ -2443,9 +2566,11 @@ function isFileId(data, prefixes) {
2443
2566
  async function convertToOpenAIResponsesInput({
2444
2567
  prompt,
2445
2568
  systemMessageMode,
2569
+ providerOptionsName = "openai",
2446
2570
  explicitMessageItemType = false,
2447
2571
  fileIdPrefixes,
2448
2572
  store,
2573
+ configurationUpdateUnsupportedReason,
2449
2574
  hasLocalShellTool = false
2450
2575
  }) {
2451
2576
  var _a2, _b, _c, _d, _e, _f, _g, _h;
@@ -2454,6 +2579,33 @@ async function convertToOpenAIResponsesInput({
2454
2579
  for (const { role, content, providerOptions } of prompt) {
2455
2580
  switch (role) {
2456
2581
  case "system": {
2582
+ let options = await (0, import_provider_utils22.parseProviderOptions)({
2583
+ provider: providerOptionsName,
2584
+ providerOptions,
2585
+ schema: openaiResponsesSystemMessageOptionsSchema
2586
+ });
2587
+ if (options == null && providerOptionsName !== "openai") {
2588
+ options = await (0, import_provider_utils22.parseProviderOptions)({
2589
+ provider: "openai",
2590
+ providerOptions,
2591
+ schema: openaiResponsesSystemMessageOptionsSchema
2592
+ });
2593
+ }
2594
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
2595
+ if (effort != null) {
2596
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
2597
+ if (unsupportedReason != null) {
2598
+ throw new import_provider6.UnsupportedFunctionalityError({
2599
+ functionality: "Message-level reasoningEffortUpdate",
2600
+ message: unsupportedReason
2601
+ });
2602
+ }
2603
+ input.push({
2604
+ type: "configuration_update",
2605
+ reasoning: { effort }
2606
+ });
2607
+ break;
2608
+ }
2457
2609
  switch (systemMessageMode) {
2458
2610
  case "system": {
2459
2611
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
@@ -2529,7 +2681,7 @@ async function convertToOpenAIResponsesInput({
2529
2681
  return {
2530
2682
  type: "input_image",
2531
2683
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2532
- image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2684
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
2533
2685
  },
2534
2686
  detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
2535
2687
  ...promptCacheBreakpoint != null && {
@@ -2550,7 +2702,7 @@ async function convertToOpenAIResponsesInput({
2550
2702
  type: "input_file",
2551
2703
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2552
2704
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2553
- file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2705
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
2554
2706
  },
2555
2707
  ...promptCacheBreakpoint != null && {
2556
2708
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -2600,7 +2752,7 @@ async function convertToOpenAIResponsesInput({
2600
2752
  break;
2601
2753
  }
2602
2754
  if (hasLocalShellTool && part.toolName === "local_shell") {
2603
- const parsedInput = await (0, import_provider_utils21.validateTypes)({
2755
+ const parsedInput = await (0, import_provider_utils22.validateTypes)({
2604
2756
  value: part.input,
2605
2757
  schema: localShellInputSchema
2606
2758
  });
@@ -2642,7 +2794,7 @@ async function convertToOpenAIResponsesInput({
2642
2794
  break;
2643
2795
  }
2644
2796
  case "reasoning": {
2645
- const providerOptions2 = await (0, import_provider_utils21.parseProviderOptions)({
2797
+ const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
2646
2798
  provider: "openai",
2647
2799
  providerOptions: part.providerOptions,
2648
2800
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2706,7 +2858,7 @@ async function convertToOpenAIResponsesInput({
2706
2858
  part.providerOptions
2707
2859
  );
2708
2860
  if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2709
- const parsedOutput = await (0, import_provider_utils21.validateTypes)({
2861
+ const parsedOutput = await (0, import_provider_utils22.validateTypes)({
2710
2862
  value: output.value,
2711
2863
  schema: localShellOutputSchema
2712
2864
  });
@@ -2799,9 +2951,9 @@ async function convertToOpenAIResponsesInput({
2799
2951
  }
2800
2952
  return { input, warnings };
2801
2953
  }
2802
- var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2803
- itemId: import_v414.z.string().nullish(),
2804
- reasoningEncryptedContent: import_v414.z.string().nullish()
2954
+ var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
2955
+ itemId: import_v415.z.string().nullish(),
2956
+ reasoningEncryptedContent: import_v415.z.string().nullish()
2805
2957
  });
2806
2958
 
2807
2959
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2823,288 +2975,288 @@ function mapOpenAIResponseFinishReason({
2823
2975
  }
2824
2976
 
2825
2977
  // src/responses/openai-responses-api.ts
2826
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2827
- var import_v415 = require("zod/v4");
2828
- var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
2829
- () => (0, import_provider_utils22.zodSchema)(
2830
- import_v415.z.union([
2831
- import_v415.z.object({
2832
- type: import_v415.z.literal("response.output_text.delta"),
2833
- item_id: import_v415.z.string(),
2834
- delta: import_v415.z.string(),
2835
- logprobs: import_v415.z.array(
2836
- import_v415.z.object({
2837
- token: import_v415.z.string(),
2838
- logprob: import_v415.z.number(),
2839
- top_logprobs: import_v415.z.array(
2840
- import_v415.z.object({
2841
- token: import_v415.z.string(),
2842
- logprob: import_v415.z.number()
2978
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
2979
+ var import_v416 = require("zod/v4");
2980
+ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazyValidator)(
2981
+ () => (0, import_provider_utils23.zodSchema)(
2982
+ import_v416.z.union([
2983
+ import_v416.z.object({
2984
+ type: import_v416.z.literal("response.output_text.delta"),
2985
+ item_id: import_v416.z.string(),
2986
+ delta: import_v416.z.string(),
2987
+ logprobs: import_v416.z.array(
2988
+ import_v416.z.object({
2989
+ token: import_v416.z.string(),
2990
+ logprob: import_v416.z.number(),
2991
+ top_logprobs: import_v416.z.array(
2992
+ import_v416.z.object({
2993
+ token: import_v416.z.string(),
2994
+ logprob: import_v416.z.number()
2843
2995
  })
2844
2996
  )
2845
2997
  })
2846
2998
  ).nullish()
2847
2999
  }),
2848
- import_v415.z.object({
2849
- type: import_v415.z.enum(["response.completed", "response.incomplete"]),
2850
- response: import_v415.z.object({
2851
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
2852
- usage: import_v415.z.object({
2853
- input_tokens: import_v415.z.number(),
2854
- input_tokens_details: import_v415.z.object({
2855
- cached_tokens: import_v415.z.number().nullish(),
2856
- cache_write_tokens: import_v415.z.number().nullish(),
2857
- orchestration_input_tokens: import_v415.z.number().nullish(),
2858
- orchestration_input_cached_tokens: import_v415.z.number().nullish()
3000
+ import_v416.z.object({
3001
+ type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3002
+ response: import_v416.z.object({
3003
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3004
+ usage: import_v416.z.object({
3005
+ input_tokens: import_v416.z.number(),
3006
+ input_tokens_details: import_v416.z.object({
3007
+ cached_tokens: import_v416.z.number().nullish(),
3008
+ cache_write_tokens: import_v416.z.number().nullish(),
3009
+ orchestration_input_tokens: import_v416.z.number().nullish(),
3010
+ orchestration_input_cached_tokens: import_v416.z.number().nullish()
2859
3011
  }).nullish(),
2860
- output_tokens: import_v415.z.number(),
2861
- output_tokens_details: import_v415.z.object({
2862
- reasoning_tokens: import_v415.z.number().nullish(),
2863
- orchestration_output_tokens: import_v415.z.number().nullish()
3012
+ output_tokens: import_v416.z.number(),
3013
+ output_tokens_details: import_v416.z.object({
3014
+ reasoning_tokens: import_v416.z.number().nullish(),
3015
+ orchestration_output_tokens: import_v416.z.number().nullish()
2864
3016
  }).nullish()
2865
3017
  }),
2866
- reasoning: import_v415.z.object({
2867
- context: import_v415.z.string().nullish()
3018
+ reasoning: import_v416.z.object({
3019
+ context: import_v416.z.string().nullish()
2868
3020
  }).nullish(),
2869
- service_tier: import_v415.z.string().nullish()
3021
+ service_tier: import_v416.z.string().nullish()
2870
3022
  })
2871
3023
  }),
2872
- import_v415.z.object({
2873
- type: import_v415.z.literal("response.created"),
2874
- response: import_v415.z.object({
2875
- id: import_v415.z.string(),
2876
- created_at: import_v415.z.number(),
2877
- model: import_v415.z.string(),
2878
- service_tier: import_v415.z.string().nullish()
3024
+ import_v416.z.object({
3025
+ type: import_v416.z.literal("response.created"),
3026
+ response: import_v416.z.object({
3027
+ id: import_v416.z.string(),
3028
+ created_at: import_v416.z.number(),
3029
+ model: import_v416.z.string(),
3030
+ service_tier: import_v416.z.string().nullish()
2879
3031
  })
2880
3032
  }),
2881
- import_v415.z.object({
2882
- type: import_v415.z.literal("response.output_item.added"),
2883
- output_index: import_v415.z.number(),
2884
- item: import_v415.z.discriminatedUnion("type", [
2885
- import_v415.z.object({
2886
- type: import_v415.z.literal("message"),
2887
- id: import_v415.z.string(),
2888
- phase: import_v415.z.enum(["commentary", "final_answer"]).nullish()
3033
+ import_v416.z.object({
3034
+ type: import_v416.z.literal("response.output_item.added"),
3035
+ output_index: import_v416.z.number(),
3036
+ item: import_v416.z.discriminatedUnion("type", [
3037
+ import_v416.z.object({
3038
+ type: import_v416.z.literal("message"),
3039
+ id: import_v416.z.string(),
3040
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
2889
3041
  }),
2890
- import_v415.z.object({
2891
- type: import_v415.z.literal("reasoning"),
2892
- id: import_v415.z.string(),
2893
- encrypted_content: import_v415.z.string().nullish()
3042
+ import_v416.z.object({
3043
+ type: import_v416.z.literal("reasoning"),
3044
+ id: import_v416.z.string(),
3045
+ encrypted_content: import_v416.z.string().nullish()
2894
3046
  }),
2895
- import_v415.z.object({
2896
- type: import_v415.z.literal("function_call"),
2897
- id: import_v415.z.string(),
2898
- call_id: import_v415.z.string(),
2899
- name: import_v415.z.string(),
2900
- arguments: import_v415.z.string(),
2901
- async: import_v415.z.boolean().nullish()
3047
+ import_v416.z.object({
3048
+ type: import_v416.z.literal("function_call"),
3049
+ id: import_v416.z.string(),
3050
+ call_id: import_v416.z.string(),
3051
+ name: import_v416.z.string(),
3052
+ arguments: import_v416.z.string(),
3053
+ async: import_v416.z.boolean().nullish()
2902
3054
  }),
2903
- import_v415.z.object({
2904
- type: import_v415.z.literal("web_search_call"),
2905
- id: import_v415.z.string(),
2906
- status: import_v415.z.string()
3055
+ import_v416.z.object({
3056
+ type: import_v416.z.literal("web_search_call"),
3057
+ id: import_v416.z.string(),
3058
+ status: import_v416.z.string()
2907
3059
  }),
2908
- import_v415.z.object({
2909
- type: import_v415.z.literal("computer_call"),
2910
- id: import_v415.z.string(),
2911
- status: import_v415.z.string()
3060
+ import_v416.z.object({
3061
+ type: import_v416.z.literal("computer_call"),
3062
+ id: import_v416.z.string(),
3063
+ status: import_v416.z.string()
2912
3064
  }),
2913
- import_v415.z.object({
2914
- type: import_v415.z.literal("file_search_call"),
2915
- id: import_v415.z.string()
3065
+ import_v416.z.object({
3066
+ type: import_v416.z.literal("file_search_call"),
3067
+ id: import_v416.z.string()
2916
3068
  }),
2917
- import_v415.z.object({
2918
- type: import_v415.z.literal("image_generation_call"),
2919
- id: import_v415.z.string()
3069
+ import_v416.z.object({
3070
+ type: import_v416.z.literal("image_generation_call"),
3071
+ id: import_v416.z.string()
2920
3072
  }),
2921
- import_v415.z.object({
2922
- type: import_v415.z.literal("code_interpreter_call"),
2923
- id: import_v415.z.string(),
2924
- container_id: import_v415.z.string(),
2925
- code: import_v415.z.string().nullable(),
2926
- outputs: import_v415.z.array(
2927
- import_v415.z.discriminatedUnion("type", [
2928
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
2929
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
3073
+ import_v416.z.object({
3074
+ type: import_v416.z.literal("code_interpreter_call"),
3075
+ id: import_v416.z.string(),
3076
+ container_id: import_v416.z.string(),
3077
+ code: import_v416.z.string().nullable(),
3078
+ outputs: import_v416.z.array(
3079
+ import_v416.z.discriminatedUnion("type", [
3080
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3081
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2930
3082
  ])
2931
3083
  ).nullable(),
2932
- status: import_v415.z.string()
3084
+ status: import_v416.z.string()
2933
3085
  })
2934
3086
  ])
2935
3087
  }),
2936
- import_v415.z.object({
2937
- type: import_v415.z.literal("response.output_item.done"),
2938
- output_index: import_v415.z.number(),
2939
- item: import_v415.z.discriminatedUnion("type", [
2940
- import_v415.z.object({
2941
- type: import_v415.z.literal("message"),
2942
- id: import_v415.z.string(),
2943
- phase: import_v415.z.enum(["commentary", "final_answer"]).nullish()
3088
+ import_v416.z.object({
3089
+ type: import_v416.z.literal("response.output_item.done"),
3090
+ output_index: import_v416.z.number(),
3091
+ item: import_v416.z.discriminatedUnion("type", [
3092
+ import_v416.z.object({
3093
+ type: import_v416.z.literal("message"),
3094
+ id: import_v416.z.string(),
3095
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
2944
3096
  }),
2945
- import_v415.z.object({
2946
- type: import_v415.z.literal("reasoning"),
2947
- id: import_v415.z.string(),
2948
- encrypted_content: import_v415.z.string().nullish()
3097
+ import_v416.z.object({
3098
+ type: import_v416.z.literal("reasoning"),
3099
+ id: import_v416.z.string(),
3100
+ encrypted_content: import_v416.z.string().nullish()
2949
3101
  }),
2950
- import_v415.z.object({
2951
- type: import_v415.z.literal("function_call"),
2952
- id: import_v415.z.string(),
2953
- call_id: import_v415.z.string(),
2954
- name: import_v415.z.string(),
2955
- arguments: import_v415.z.string(),
2956
- async: import_v415.z.boolean().nullish(),
2957
- status: import_v415.z.enum(["in_progress", "completed", "incomplete"])
3102
+ import_v416.z.object({
3103
+ type: import_v416.z.literal("function_call"),
3104
+ id: import_v416.z.string(),
3105
+ call_id: import_v416.z.string(),
3106
+ name: import_v416.z.string(),
3107
+ arguments: import_v416.z.string(),
3108
+ async: import_v416.z.boolean().nullish(),
3109
+ status: import_v416.z.enum(["in_progress", "completed", "incomplete"])
2958
3110
  }),
2959
- import_v415.z.object({
2960
- type: import_v415.z.literal("code_interpreter_call"),
2961
- id: import_v415.z.string(),
2962
- code: import_v415.z.string().nullable(),
2963
- container_id: import_v415.z.string(),
2964
- outputs: import_v415.z.array(
2965
- import_v415.z.discriminatedUnion("type", [
2966
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
2967
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
3111
+ import_v416.z.object({
3112
+ type: import_v416.z.literal("code_interpreter_call"),
3113
+ id: import_v416.z.string(),
3114
+ code: import_v416.z.string().nullable(),
3115
+ container_id: import_v416.z.string(),
3116
+ outputs: import_v416.z.array(
3117
+ import_v416.z.discriminatedUnion("type", [
3118
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3119
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2968
3120
  ])
2969
3121
  ).nullable()
2970
3122
  }),
2971
- import_v415.z.object({
2972
- type: import_v415.z.literal("image_generation_call"),
2973
- id: import_v415.z.string(),
2974
- result: import_v415.z.string()
3123
+ import_v416.z.object({
3124
+ type: import_v416.z.literal("image_generation_call"),
3125
+ id: import_v416.z.string(),
3126
+ result: import_v416.z.string()
2975
3127
  }),
2976
- import_v415.z.object({
2977
- type: import_v415.z.literal("web_search_call"),
2978
- id: import_v415.z.string(),
2979
- status: import_v415.z.string(),
2980
- action: import_v415.z.discriminatedUnion("type", [
2981
- import_v415.z.object({
2982
- type: import_v415.z.literal("search"),
2983
- query: import_v415.z.string().nullish(),
2984
- sources: import_v415.z.array(
2985
- import_v415.z.discriminatedUnion("type", [
2986
- import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
2987
- import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
3128
+ import_v416.z.object({
3129
+ type: import_v416.z.literal("web_search_call"),
3130
+ id: import_v416.z.string(),
3131
+ status: import_v416.z.string(),
3132
+ action: import_v416.z.discriminatedUnion("type", [
3133
+ import_v416.z.object({
3134
+ type: import_v416.z.literal("search"),
3135
+ query: import_v416.z.string().nullish(),
3136
+ sources: import_v416.z.array(
3137
+ import_v416.z.discriminatedUnion("type", [
3138
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
3139
+ import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2988
3140
  ])
2989
3141
  ).nullish()
2990
3142
  }),
2991
- import_v415.z.object({
2992
- type: import_v415.z.literal("open_page"),
2993
- url: import_v415.z.string().nullish()
3143
+ import_v416.z.object({
3144
+ type: import_v416.z.literal("open_page"),
3145
+ url: import_v416.z.string().nullish()
2994
3146
  }),
2995
- import_v415.z.object({
2996
- type: import_v415.z.literal("find_in_page"),
2997
- url: import_v415.z.string().nullish(),
2998
- pattern: import_v415.z.string().nullish()
3147
+ import_v416.z.object({
3148
+ type: import_v416.z.literal("find_in_page"),
3149
+ url: import_v416.z.string().nullish(),
3150
+ pattern: import_v416.z.string().nullish()
2999
3151
  })
3000
3152
  ]).nullish()
3001
3153
  }),
3002
- import_v415.z.object({
3003
- type: import_v415.z.literal("file_search_call"),
3004
- id: import_v415.z.string(),
3005
- queries: import_v415.z.array(import_v415.z.string()),
3006
- results: import_v415.z.array(
3007
- import_v415.z.object({
3008
- attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
3009
- file_id: import_v415.z.string(),
3010
- filename: import_v415.z.string(),
3011
- score: import_v415.z.number(),
3012
- text: import_v415.z.string()
3154
+ import_v416.z.object({
3155
+ type: import_v416.z.literal("file_search_call"),
3156
+ id: import_v416.z.string(),
3157
+ queries: import_v416.z.array(import_v416.z.string()),
3158
+ results: import_v416.z.array(
3159
+ import_v416.z.object({
3160
+ attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
3161
+ file_id: import_v416.z.string(),
3162
+ filename: import_v416.z.string(),
3163
+ score: import_v416.z.number(),
3164
+ text: import_v416.z.string()
3013
3165
  })
3014
3166
  ).nullish()
3015
3167
  }),
3016
- import_v415.z.object({
3017
- type: import_v415.z.literal("local_shell_call"),
3018
- id: import_v415.z.string(),
3019
- call_id: import_v415.z.string(),
3020
- action: import_v415.z.object({
3021
- type: import_v415.z.literal("exec"),
3022
- command: import_v415.z.array(import_v415.z.string()),
3023
- timeout_ms: import_v415.z.number().optional(),
3024
- user: import_v415.z.string().optional(),
3025
- working_directory: import_v415.z.string().optional(),
3026
- env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
3168
+ import_v416.z.object({
3169
+ type: import_v416.z.literal("local_shell_call"),
3170
+ id: import_v416.z.string(),
3171
+ call_id: import_v416.z.string(),
3172
+ action: import_v416.z.object({
3173
+ type: import_v416.z.literal("exec"),
3174
+ command: import_v416.z.array(import_v416.z.string()),
3175
+ timeout_ms: import_v416.z.number().optional(),
3176
+ user: import_v416.z.string().optional(),
3177
+ working_directory: import_v416.z.string().optional(),
3178
+ env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
3027
3179
  })
3028
3180
  }),
3029
- import_v415.z.object({
3030
- type: import_v415.z.literal("computer_call"),
3031
- id: import_v415.z.string(),
3032
- status: import_v415.z.literal("completed")
3181
+ import_v416.z.object({
3182
+ type: import_v416.z.literal("computer_call"),
3183
+ id: import_v416.z.string(),
3184
+ status: import_v416.z.literal("completed")
3033
3185
  })
3034
3186
  ])
3035
3187
  }),
3036
- import_v415.z.object({
3037
- type: import_v415.z.literal("response.function_call_arguments.delta"),
3038
- item_id: import_v415.z.string(),
3039
- output_index: import_v415.z.number(),
3040
- delta: import_v415.z.string()
3188
+ import_v416.z.object({
3189
+ type: import_v416.z.literal("response.function_call_arguments.delta"),
3190
+ item_id: import_v416.z.string(),
3191
+ output_index: import_v416.z.number(),
3192
+ delta: import_v416.z.string()
3041
3193
  }),
3042
- import_v415.z.object({
3043
- type: import_v415.z.literal("response.image_generation_call.partial_image"),
3044
- item_id: import_v415.z.string(),
3045
- output_index: import_v415.z.number(),
3046
- partial_image_b64: import_v415.z.string()
3194
+ import_v416.z.object({
3195
+ type: import_v416.z.literal("response.image_generation_call.partial_image"),
3196
+ item_id: import_v416.z.string(),
3197
+ output_index: import_v416.z.number(),
3198
+ partial_image_b64: import_v416.z.string()
3047
3199
  }),
3048
- import_v415.z.object({
3049
- type: import_v415.z.literal("response.code_interpreter_call_code.delta"),
3050
- item_id: import_v415.z.string(),
3051
- output_index: import_v415.z.number(),
3052
- delta: import_v415.z.string()
3200
+ import_v416.z.object({
3201
+ type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
3202
+ item_id: import_v416.z.string(),
3203
+ output_index: import_v416.z.number(),
3204
+ delta: import_v416.z.string()
3053
3205
  }),
3054
- import_v415.z.object({
3055
- type: import_v415.z.literal("response.code_interpreter_call_code.done"),
3056
- item_id: import_v415.z.string(),
3057
- output_index: import_v415.z.number(),
3058
- code: import_v415.z.string()
3206
+ import_v416.z.object({
3207
+ type: import_v416.z.literal("response.code_interpreter_call_code.done"),
3208
+ item_id: import_v416.z.string(),
3209
+ output_index: import_v416.z.number(),
3210
+ code: import_v416.z.string()
3059
3211
  }),
3060
- import_v415.z.object({
3061
- type: import_v415.z.literal("response.output_text.annotation.added"),
3062
- annotation: import_v415.z.discriminatedUnion("type", [
3063
- import_v415.z.object({
3064
- type: import_v415.z.literal("url_citation"),
3065
- start_index: import_v415.z.number(),
3066
- end_index: import_v415.z.number(),
3067
- url: import_v415.z.string(),
3068
- title: import_v415.z.string()
3212
+ import_v416.z.object({
3213
+ type: import_v416.z.literal("response.output_text.annotation.added"),
3214
+ annotation: import_v416.z.discriminatedUnion("type", [
3215
+ import_v416.z.object({
3216
+ type: import_v416.z.literal("url_citation"),
3217
+ start_index: import_v416.z.number(),
3218
+ end_index: import_v416.z.number(),
3219
+ url: import_v416.z.string(),
3220
+ title: import_v416.z.string()
3069
3221
  }),
3070
- import_v415.z.object({
3071
- type: import_v415.z.literal("file_citation"),
3072
- file_id: import_v415.z.string(),
3073
- filename: import_v415.z.string().nullish(),
3074
- index: import_v415.z.number().nullish(),
3075
- start_index: import_v415.z.number().nullish(),
3076
- end_index: import_v415.z.number().nullish(),
3077
- quote: import_v415.z.string().nullish()
3222
+ import_v416.z.object({
3223
+ type: import_v416.z.literal("file_citation"),
3224
+ file_id: import_v416.z.string(),
3225
+ filename: import_v416.z.string().nullish(),
3226
+ index: import_v416.z.number().nullish(),
3227
+ start_index: import_v416.z.number().nullish(),
3228
+ end_index: import_v416.z.number().nullish(),
3229
+ quote: import_v416.z.string().nullish()
3078
3230
  })
3079
3231
  ])
3080
3232
  }),
3081
- import_v415.z.object({
3082
- type: import_v415.z.literal("response.reasoning_summary_part.added"),
3083
- item_id: import_v415.z.string(),
3084
- summary_index: import_v415.z.number()
3233
+ import_v416.z.object({
3234
+ type: import_v416.z.literal("response.reasoning_summary_part.added"),
3235
+ item_id: import_v416.z.string(),
3236
+ summary_index: import_v416.z.number()
3085
3237
  }),
3086
- import_v415.z.object({
3087
- type: import_v415.z.literal("response.reasoning_summary_text.delta"),
3088
- item_id: import_v415.z.string(),
3089
- summary_index: import_v415.z.number(),
3090
- delta: import_v415.z.string()
3238
+ import_v416.z.object({
3239
+ type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3240
+ item_id: import_v416.z.string(),
3241
+ summary_index: import_v416.z.number(),
3242
+ delta: import_v416.z.string()
3091
3243
  }),
3092
- import_v415.z.object({
3093
- type: import_v415.z.literal("response.reasoning_summary_part.done"),
3094
- item_id: import_v415.z.string(),
3095
- summary_index: import_v415.z.number()
3244
+ import_v416.z.object({
3245
+ type: import_v416.z.literal("response.reasoning_summary_part.done"),
3246
+ item_id: import_v416.z.string(),
3247
+ summary_index: import_v416.z.number()
3096
3248
  }),
3097
- import_v415.z.object({
3098
- type: import_v415.z.literal("error"),
3099
- sequence_number: import_v415.z.number(),
3100
- error: import_v415.z.object({
3101
- type: import_v415.z.string(),
3102
- code: import_v415.z.string(),
3103
- message: import_v415.z.string(),
3104
- param: import_v415.z.string().nullish()
3249
+ import_v416.z.object({
3250
+ type: import_v416.z.literal("error"),
3251
+ sequence_number: import_v416.z.number(),
3252
+ error: import_v416.z.object({
3253
+ type: import_v416.z.string(),
3254
+ code: import_v416.z.string(),
3255
+ message: import_v416.z.string(),
3256
+ param: import_v416.z.string().nullish()
3105
3257
  })
3106
3258
  }),
3107
- import_v415.z.object({ type: import_v415.z.string() }).loose().transform((value) => ({
3259
+ import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
3108
3260
  type: "unknown_chunk",
3109
3261
  message: value.type
3110
3262
  }))
@@ -3112,389 +3264,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
3112
3264
  ])
3113
3265
  )
3114
3266
  );
3115
- var openaiResponsesResponseSchema = (0, import_provider_utils22.lazyValidator)(
3116
- () => (0, import_provider_utils22.zodSchema)(
3117
- import_v415.z.object({
3118
- id: import_v415.z.string().optional(),
3119
- created_at: import_v415.z.number().optional(),
3120
- error: import_v415.z.object({
3121
- message: import_v415.z.string(),
3122
- type: import_v415.z.string(),
3123
- param: import_v415.z.string().nullish(),
3124
- code: import_v415.z.string()
3267
+ var openaiResponsesResponseSchema = (0, import_provider_utils23.lazyValidator)(
3268
+ () => (0, import_provider_utils23.zodSchema)(
3269
+ import_v416.z.object({
3270
+ id: import_v416.z.string().optional(),
3271
+ created_at: import_v416.z.number().optional(),
3272
+ error: import_v416.z.object({
3273
+ message: import_v416.z.string(),
3274
+ type: import_v416.z.string(),
3275
+ param: import_v416.z.string().nullish(),
3276
+ code: import_v416.z.string()
3125
3277
  }).nullish(),
3126
- model: import_v415.z.string().optional(),
3127
- output: import_v415.z.array(
3128
- import_v415.z.discriminatedUnion("type", [
3129
- import_v415.z.object({
3130
- type: import_v415.z.literal("message"),
3131
- role: import_v415.z.literal("assistant"),
3132
- id: import_v415.z.string(),
3133
- phase: import_v415.z.enum(["commentary", "final_answer"]).nullish(),
3134
- content: import_v415.z.array(
3135
- import_v415.z.object({
3136
- type: import_v415.z.literal("output_text"),
3137
- text: import_v415.z.string(),
3138
- logprobs: import_v415.z.array(
3139
- import_v415.z.object({
3140
- token: import_v415.z.string(),
3141
- logprob: import_v415.z.number(),
3142
- top_logprobs: import_v415.z.array(
3143
- import_v415.z.object({
3144
- token: import_v415.z.string(),
3145
- logprob: import_v415.z.number()
3278
+ model: import_v416.z.string().optional(),
3279
+ output: import_v416.z.array(
3280
+ import_v416.z.discriminatedUnion("type", [
3281
+ import_v416.z.object({
3282
+ type: import_v416.z.literal("message"),
3283
+ role: import_v416.z.literal("assistant"),
3284
+ id: import_v416.z.string(),
3285
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish(),
3286
+ content: import_v416.z.array(
3287
+ import_v416.z.object({
3288
+ type: import_v416.z.literal("output_text"),
3289
+ text: import_v416.z.string(),
3290
+ logprobs: import_v416.z.array(
3291
+ import_v416.z.object({
3292
+ token: import_v416.z.string(),
3293
+ logprob: import_v416.z.number(),
3294
+ top_logprobs: import_v416.z.array(
3295
+ import_v416.z.object({
3296
+ token: import_v416.z.string(),
3297
+ logprob: import_v416.z.number()
3146
3298
  })
3147
3299
  )
3148
3300
  })
3149
3301
  ).nullish(),
3150
- annotations: import_v415.z.array(
3151
- import_v415.z.discriminatedUnion("type", [
3152
- import_v415.z.object({
3153
- type: import_v415.z.literal("url_citation"),
3154
- start_index: import_v415.z.number(),
3155
- end_index: import_v415.z.number(),
3156
- url: import_v415.z.string(),
3157
- title: import_v415.z.string()
3302
+ annotations: import_v416.z.array(
3303
+ import_v416.z.discriminatedUnion("type", [
3304
+ import_v416.z.object({
3305
+ type: import_v416.z.literal("url_citation"),
3306
+ start_index: import_v416.z.number(),
3307
+ end_index: import_v416.z.number(),
3308
+ url: import_v416.z.string(),
3309
+ title: import_v416.z.string()
3158
3310
  }),
3159
- import_v415.z.object({
3160
- type: import_v415.z.literal("file_citation"),
3161
- file_id: import_v415.z.string(),
3162
- filename: import_v415.z.string().nullish(),
3163
- index: import_v415.z.number().nullish(),
3164
- start_index: import_v415.z.number().nullish(),
3165
- end_index: import_v415.z.number().nullish(),
3166
- quote: import_v415.z.string().nullish()
3311
+ import_v416.z.object({
3312
+ type: import_v416.z.literal("file_citation"),
3313
+ file_id: import_v416.z.string(),
3314
+ filename: import_v416.z.string().nullish(),
3315
+ index: import_v416.z.number().nullish(),
3316
+ start_index: import_v416.z.number().nullish(),
3317
+ end_index: import_v416.z.number().nullish(),
3318
+ quote: import_v416.z.string().nullish()
3167
3319
  }),
3168
- import_v415.z.object({
3169
- type: import_v415.z.literal("container_file_citation"),
3170
- container_id: import_v415.z.string(),
3171
- file_id: import_v415.z.string(),
3172
- filename: import_v415.z.string().nullish(),
3173
- start_index: import_v415.z.number().nullish(),
3174
- end_index: import_v415.z.number().nullish(),
3175
- index: import_v415.z.number().nullish()
3320
+ import_v416.z.object({
3321
+ type: import_v416.z.literal("container_file_citation"),
3322
+ container_id: import_v416.z.string(),
3323
+ file_id: import_v416.z.string(),
3324
+ filename: import_v416.z.string().nullish(),
3325
+ start_index: import_v416.z.number().nullish(),
3326
+ end_index: import_v416.z.number().nullish(),
3327
+ index: import_v416.z.number().nullish()
3176
3328
  }),
3177
- import_v415.z.object({
3178
- type: import_v415.z.literal("file_path"),
3179
- file_id: import_v415.z.string(),
3180
- index: import_v415.z.number().nullish()
3329
+ import_v416.z.object({
3330
+ type: import_v416.z.literal("file_path"),
3331
+ file_id: import_v416.z.string(),
3332
+ index: import_v416.z.number().nullish()
3181
3333
  })
3182
3334
  ])
3183
3335
  )
3184
3336
  })
3185
3337
  )
3186
3338
  }),
3187
- import_v415.z.object({
3188
- type: import_v415.z.literal("web_search_call"),
3189
- id: import_v415.z.string(),
3190
- status: import_v415.z.string(),
3191
- action: import_v415.z.discriminatedUnion("type", [
3192
- import_v415.z.object({
3193
- type: import_v415.z.literal("search"),
3194
- query: import_v415.z.string().nullish(),
3195
- sources: import_v415.z.array(
3196
- import_v415.z.discriminatedUnion("type", [
3197
- import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
3198
- import_v415.z.object({
3199
- type: import_v415.z.literal("api"),
3200
- name: import_v415.z.string()
3339
+ import_v416.z.object({
3340
+ type: import_v416.z.literal("web_search_call"),
3341
+ id: import_v416.z.string(),
3342
+ status: import_v416.z.string(),
3343
+ action: import_v416.z.discriminatedUnion("type", [
3344
+ import_v416.z.object({
3345
+ type: import_v416.z.literal("search"),
3346
+ query: import_v416.z.string().nullish(),
3347
+ sources: import_v416.z.array(
3348
+ import_v416.z.discriminatedUnion("type", [
3349
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
3350
+ import_v416.z.object({
3351
+ type: import_v416.z.literal("api"),
3352
+ name: import_v416.z.string()
3201
3353
  })
3202
3354
  ])
3203
3355
  ).nullish()
3204
3356
  }),
3205
- import_v415.z.object({
3206
- type: import_v415.z.literal("open_page"),
3207
- url: import_v415.z.string().nullish()
3357
+ import_v416.z.object({
3358
+ type: import_v416.z.literal("open_page"),
3359
+ url: import_v416.z.string().nullish()
3208
3360
  }),
3209
- import_v415.z.object({
3210
- type: import_v415.z.literal("find_in_page"),
3211
- url: import_v415.z.string().nullish(),
3212
- pattern: import_v415.z.string().nullish()
3361
+ import_v416.z.object({
3362
+ type: import_v416.z.literal("find_in_page"),
3363
+ url: import_v416.z.string().nullish(),
3364
+ pattern: import_v416.z.string().nullish()
3213
3365
  })
3214
3366
  ]).nullish()
3215
3367
  }),
3216
- import_v415.z.object({
3217
- type: import_v415.z.literal("file_search_call"),
3218
- id: import_v415.z.string(),
3219
- queries: import_v415.z.array(import_v415.z.string()),
3220
- results: import_v415.z.array(
3221
- import_v415.z.object({
3222
- attributes: import_v415.z.record(
3223
- import_v415.z.string(),
3224
- import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
3368
+ import_v416.z.object({
3369
+ type: import_v416.z.literal("file_search_call"),
3370
+ id: import_v416.z.string(),
3371
+ queries: import_v416.z.array(import_v416.z.string()),
3372
+ results: import_v416.z.array(
3373
+ import_v416.z.object({
3374
+ attributes: import_v416.z.record(
3375
+ import_v416.z.string(),
3376
+ import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
3225
3377
  ),
3226
- file_id: import_v415.z.string(),
3227
- filename: import_v415.z.string(),
3228
- score: import_v415.z.number(),
3229
- text: import_v415.z.string()
3378
+ file_id: import_v416.z.string(),
3379
+ filename: import_v416.z.string(),
3380
+ score: import_v416.z.number(),
3381
+ text: import_v416.z.string()
3230
3382
  })
3231
3383
  ).nullish()
3232
3384
  }),
3233
- import_v415.z.object({
3234
- type: import_v415.z.literal("code_interpreter_call"),
3235
- id: import_v415.z.string(),
3236
- code: import_v415.z.string().nullable(),
3237
- container_id: import_v415.z.string(),
3238
- outputs: import_v415.z.array(
3239
- import_v415.z.discriminatedUnion("type", [
3240
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
3241
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
3385
+ import_v416.z.object({
3386
+ type: import_v416.z.literal("code_interpreter_call"),
3387
+ id: import_v416.z.string(),
3388
+ code: import_v416.z.string().nullable(),
3389
+ container_id: import_v416.z.string(),
3390
+ outputs: import_v416.z.array(
3391
+ import_v416.z.discriminatedUnion("type", [
3392
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3393
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3242
3394
  ])
3243
3395
  ).nullable()
3244
3396
  }),
3245
- import_v415.z.object({
3246
- type: import_v415.z.literal("image_generation_call"),
3247
- id: import_v415.z.string(),
3248
- result: import_v415.z.string()
3397
+ import_v416.z.object({
3398
+ type: import_v416.z.literal("image_generation_call"),
3399
+ id: import_v416.z.string(),
3400
+ result: import_v416.z.string()
3249
3401
  }),
3250
- import_v415.z.object({
3251
- type: import_v415.z.literal("local_shell_call"),
3252
- id: import_v415.z.string(),
3253
- call_id: import_v415.z.string(),
3254
- action: import_v415.z.object({
3255
- type: import_v415.z.literal("exec"),
3256
- command: import_v415.z.array(import_v415.z.string()),
3257
- timeout_ms: import_v415.z.number().optional(),
3258
- user: import_v415.z.string().optional(),
3259
- working_directory: import_v415.z.string().optional(),
3260
- env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
3402
+ import_v416.z.object({
3403
+ type: import_v416.z.literal("local_shell_call"),
3404
+ id: import_v416.z.string(),
3405
+ call_id: import_v416.z.string(),
3406
+ action: import_v416.z.object({
3407
+ type: import_v416.z.literal("exec"),
3408
+ command: import_v416.z.array(import_v416.z.string()),
3409
+ timeout_ms: import_v416.z.number().optional(),
3410
+ user: import_v416.z.string().optional(),
3411
+ working_directory: import_v416.z.string().optional(),
3412
+ env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
3261
3413
  })
3262
3414
  }),
3263
- import_v415.z.object({
3264
- type: import_v415.z.literal("function_call"),
3265
- call_id: import_v415.z.string(),
3266
- name: import_v415.z.string(),
3267
- arguments: import_v415.z.string(),
3268
- id: import_v415.z.string(),
3269
- async: import_v415.z.boolean().nullish()
3415
+ import_v416.z.object({
3416
+ type: import_v416.z.literal("function_call"),
3417
+ call_id: import_v416.z.string(),
3418
+ name: import_v416.z.string(),
3419
+ arguments: import_v416.z.string(),
3420
+ id: import_v416.z.string(),
3421
+ async: import_v416.z.boolean().nullish()
3270
3422
  }),
3271
- import_v415.z.object({
3272
- type: import_v415.z.literal("computer_call"),
3273
- id: import_v415.z.string(),
3274
- status: import_v415.z.string().optional()
3423
+ import_v416.z.object({
3424
+ type: import_v416.z.literal("computer_call"),
3425
+ id: import_v416.z.string(),
3426
+ status: import_v416.z.string().optional()
3275
3427
  }),
3276
- import_v415.z.object({
3277
- type: import_v415.z.literal("reasoning"),
3278
- id: import_v415.z.string(),
3279
- encrypted_content: import_v415.z.string().nullish(),
3280
- summary: import_v415.z.array(
3281
- import_v415.z.object({
3282
- type: import_v415.z.literal("summary_text"),
3283
- text: import_v415.z.string()
3428
+ import_v416.z.object({
3429
+ type: import_v416.z.literal("reasoning"),
3430
+ id: import_v416.z.string(),
3431
+ encrypted_content: import_v416.z.string().nullish(),
3432
+ summary: import_v416.z.array(
3433
+ import_v416.z.object({
3434
+ type: import_v416.z.literal("summary_text"),
3435
+ text: import_v416.z.string()
3284
3436
  })
3285
3437
  )
3286
3438
  })
3287
3439
  ])
3288
3440
  ).optional(),
3289
- service_tier: import_v415.z.string().nullish(),
3290
- reasoning: import_v415.z.object({
3291
- context: import_v415.z.string().nullish()
3441
+ service_tier: import_v416.z.string().nullish(),
3442
+ reasoning: import_v416.z.object({
3443
+ context: import_v416.z.string().nullish()
3292
3444
  }).nullish(),
3293
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
3294
- usage: import_v415.z.object({
3295
- input_tokens: import_v415.z.number(),
3296
- input_tokens_details: import_v415.z.object({
3297
- cached_tokens: import_v415.z.number().nullish(),
3298
- cache_write_tokens: import_v415.z.number().nullish(),
3299
- orchestration_input_tokens: import_v415.z.number().nullish(),
3300
- orchestration_input_cached_tokens: import_v415.z.number().nullish()
3445
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3446
+ usage: import_v416.z.object({
3447
+ input_tokens: import_v416.z.number(),
3448
+ input_tokens_details: import_v416.z.object({
3449
+ cached_tokens: import_v416.z.number().nullish(),
3450
+ cache_write_tokens: import_v416.z.number().nullish(),
3451
+ orchestration_input_tokens: import_v416.z.number().nullish(),
3452
+ orchestration_input_cached_tokens: import_v416.z.number().nullish()
3301
3453
  }).nullish(),
3302
- output_tokens: import_v415.z.number(),
3303
- output_tokens_details: import_v415.z.object({
3304
- reasoning_tokens: import_v415.z.number().nullish(),
3305
- orchestration_output_tokens: import_v415.z.number().nullish()
3454
+ output_tokens: import_v416.z.number(),
3455
+ output_tokens_details: import_v416.z.object({
3456
+ reasoning_tokens: import_v416.z.number().nullish(),
3457
+ orchestration_output_tokens: import_v416.z.number().nullish()
3306
3458
  }).nullish()
3307
3459
  }).optional()
3308
3460
  })
3309
3461
  )
3310
3462
  );
3311
3463
 
3312
- // src/responses/openai-responses-options.ts
3313
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
3314
- var import_v416 = require("zod/v4");
3315
- var TOP_LOGPROBS_MAX = 20;
3316
- var openaiResponsesReasoningModelIds = [
3317
- "o1",
3318
- "o1-2024-12-17",
3319
- "o3",
3320
- "o3-2025-04-16",
3321
- "o3-deep-research",
3322
- "o3-deep-research-2025-06-26",
3323
- "o3-mini",
3324
- "o3-mini-2025-01-31",
3325
- "o4-mini",
3326
- "o4-mini-2025-04-16",
3327
- "o4-mini-deep-research",
3328
- "o4-mini-deep-research-2025-06-26",
3329
- "codex-mini-latest",
3330
- "computer-use-preview",
3331
- "gpt-5",
3332
- "gpt-5-2025-08-07",
3333
- "gpt-5-codex",
3334
- "gpt-5-mini",
3335
- "gpt-5-mini-2025-08-07",
3336
- "gpt-5-nano",
3337
- "gpt-5-nano-2025-08-07",
3338
- "gpt-5-pro",
3339
- "gpt-5-pro-2025-10-06",
3340
- "gpt-5.1",
3341
- "gpt-5.1-chat-latest",
3342
- "gpt-5.1-codex-mini",
3343
- "gpt-5.1-codex",
3344
- "gpt-5.1-codex-max",
3345
- "gpt-5.2",
3346
- "gpt-5.2-chat-latest",
3347
- "gpt-5.2-pro",
3348
- "gpt-5.2-codex",
3349
- "gpt-5.3-chat-latest",
3350
- "gpt-5.3-codex",
3351
- "gpt-5.4",
3352
- "gpt-5.4-2026-03-05",
3353
- "gpt-5.4-mini",
3354
- "gpt-5.4-mini-2026-03-17",
3355
- "gpt-5.4-nano",
3356
- "gpt-5.4-nano-2026-03-17",
3357
- "gpt-5.4-pro",
3358
- "gpt-5.4-pro-2026-03-05",
3359
- "gpt-5.6",
3360
- "gpt-5.6-luna",
3361
- "gpt-5.6-sol",
3362
- "gpt-5.6-terra",
3363
- "gpt-6-astra",
3364
- "gpt-6-luna",
3365
- "gpt-6-sol"
3366
- ];
3367
- var openaiResponsesModelIds = [
3368
- "gpt-4.1",
3369
- "gpt-4.1-2025-04-14",
3370
- "gpt-4.1-mini",
3371
- "gpt-4.1-mini-2025-04-14",
3372
- "gpt-4.1-nano",
3373
- "gpt-4.1-nano-2025-04-14",
3374
- "gpt-4o",
3375
- "gpt-4o-2024-05-13",
3376
- "gpt-4o-2024-08-06",
3377
- "gpt-4o-2024-11-20",
3378
- "gpt-4o-audio-preview",
3379
- "gpt-4o-audio-preview-2024-10-01",
3380
- "gpt-4o-audio-preview-2024-12-17",
3381
- "gpt-4o-search-preview",
3382
- "gpt-4o-search-preview-2025-03-11",
3383
- "gpt-4o-mini-search-preview",
3384
- "gpt-4o-mini-search-preview-2025-03-11",
3385
- "gpt-4o-mini",
3386
- "gpt-4o-mini-2024-07-18",
3387
- "gpt-4-turbo",
3388
- "gpt-4-turbo-2024-04-09",
3389
- "gpt-4-turbo-preview",
3390
- "gpt-4-0125-preview",
3391
- "gpt-4-1106-preview",
3392
- "gpt-4",
3393
- "gpt-4-0613",
3394
- "gpt-4.5-preview",
3395
- "gpt-4.5-preview-2025-02-27",
3396
- "gpt-3.5-turbo-0125",
3397
- "gpt-3.5-turbo",
3398
- "gpt-3.5-turbo-1106",
3399
- "chatgpt-4o-latest",
3400
- "gpt-5-chat-latest",
3401
- ...openaiResponsesReasoningModelIds
3402
- ];
3403
- var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
3404
- () => (0, import_provider_utils23.zodSchema)(
3405
- import_v416.z.object({
3406
- conversation: import_v416.z.string().nullish(),
3407
- include: import_v416.z.array(
3408
- import_v416.z.enum([
3409
- "reasoning.encrypted_content",
3410
- // handled internally by default, only needed for unknown reasoning models
3411
- "file_search_call.results",
3412
- "message.output_text.logprobs"
3413
- ])
3414
- ).nullish(),
3415
- instructions: import_v416.z.string().nullish(),
3416
- /**
3417
- * Return the log probabilities of the tokens.
3418
- *
3419
- * Setting to true will return the log probabilities of the tokens that
3420
- * were generated.
3421
- *
3422
- * Setting to a number will return the log probabilities of the top n
3423
- * tokens that were generated.
3424
- *
3425
- * @see https://platform.openai.com/docs/api-reference/responses/create
3426
- * @see https://cookbook.openai.com/examples/using_logprobs
3427
- */
3428
- logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3429
- /**
3430
- * The maximum number of total calls to built-in tools that can be processed in a response.
3431
- * This maximum number applies across all built-in tool calls, not per individual tool.
3432
- * Any further attempts to call a tool by the model will be ignored.
3433
- */
3434
- maxToolCalls: import_v416.z.number().nullish(),
3435
- metadata: import_v416.z.any().nullish(),
3436
- parallelToolCalls: import_v416.z.boolean().nullish(),
3437
- previousResponseId: import_v416.z.string().nullish(),
3438
- promptCacheKey: import_v416.z.string().nullish(),
3439
- /**
3440
- * Prompt cache behavior for GPT-5.6 and later models.
3441
- * `mode` controls whether OpenAI also places an implicit breakpoint.
3442
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3443
- */
3444
- promptCacheOptions: import_v416.z.object({
3445
- mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
3446
- ttl: import_v416.z.literal("30m").optional()
3447
- }).optional(),
3448
- /**
3449
- * The retention policy for the prompt cache.
3450
- * - 'in_memory': Default. Standard prompt caching behavior.
3451
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
3452
- * Available for models before GPT-5.6 that support extended caching.
3453
- *
3454
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
3455
- *
3456
- * @default 'in_memory'
3457
- */
3458
- promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
3459
- /**
3460
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
3461
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
3462
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
3463
- * Supported values vary by model.
3464
- */
3465
- reasoningEffort: import_v416.z.string().nullish(),
3466
- /**
3467
- * Updates the reasoning effort for GPT-6 and later models starting with this response
3468
- * without changing the request-level reasoning effort. This preserves the
3469
- * request prefix for prompt caching.
3470
- *
3471
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3472
- * combined with automatic truncation.
3473
- */
3474
- reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3475
- /**
3476
- * Controls how much model work GPT-5.6 performs before returning a final answer.
3477
- * `standard` is the default. `pro` increases quality, latency, and token usage.
3478
- */
3479
- reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
3480
- /**
3481
- * Controls which available reasoning items GPT-5.6 can use.
3482
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
3483
- * turns, and `all_turns` makes compatible earlier reasoning available.
3484
- */
3485
- reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
3486
- reasoningSummary: import_v416.z.string().nullish(),
3487
- safetyIdentifier: import_v416.z.string().nullish(),
3488
- serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
3489
- store: import_v416.z.boolean().nullish(),
3490
- strictJsonSchema: import_v416.z.boolean().nullish(),
3491
- textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
3492
- truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
3493
- user: import_v416.z.string().nullish()
3494
- })
3495
- )
3496
- );
3497
-
3498
3464
  // src/responses/openai-responses-prepare-tools.ts
3499
3465
  var import_provider7 = require("@ai-sdk/provider");
3500
3466
 
@@ -3906,6 +3872,18 @@ function resolveAsyncToolOption({
3906
3872
  }
3907
3873
 
3908
3874
  // src/responses/openai-responses-language-model.ts
3875
+ function getConfigurationUpdateUnsupportedReason({
3876
+ modelCapabilities,
3877
+ options
3878
+ }) {
3879
+ if (!modelCapabilities.supportsConfigurationUpdate) {
3880
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
3881
+ }
3882
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
3883
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
3884
+ }
3885
+ return void 0;
3886
+ }
3909
3887
  var OpenAIResponsesLanguageModel = class {
3910
3888
  constructor(modelId, config) {
3911
3889
  this.specificationVersion = "v2";
@@ -3970,8 +3948,14 @@ var OpenAIResponsesLanguageModel = class {
3970
3948
  details: "conversation and previousResponseId cannot be used together"
3971
3949
  });
3972
3950
  }
3951
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
3952
+ modelCapabilities,
3953
+ options: openaiOptions
3954
+ });
3973
3955
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
3974
3956
  prompt,
3957
+ configurationUpdateUnsupportedReason,
3958
+ providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
3975
3959
  systemMessageMode: modelCapabilities.systemMessageMode,
3976
3960
  explicitMessageItemType: this.config.explicitMessageItemType,
3977
3961
  fileIdPrefixes: this.config.fileIdPrefixes,
@@ -3991,18 +3975,27 @@ var OpenAIResponsesLanguageModel = class {
3991
3975
  resolvedReasoningEffort = void 0;
3992
3976
  }
3993
3977
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
3994
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
3995
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
3978
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
3996
3979
  warnings.push({
3997
3980
  type: "unsupported-setting",
3998
3981
  setting: "reasoningEffortUpdate",
3999
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
3982
+ details: configurationUpdateUnsupportedReason
4000
3983
  });
4001
3984
  } else if (reasoningEffortUpdate != null) {
4002
- input.unshift({
4003
- type: "configuration_update",
4004
- reasoning: { effort: reasoningEffortUpdate }
4005
- });
3985
+ const firstItem = input[0];
3986
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
3987
+ input.unshift({
3988
+ type: "configuration_update",
3989
+ reasoning: { effort: reasoningEffortUpdate }
3990
+ });
3991
+ }
3992
+ }
3993
+ for (let i = 1; i < input.length; i++) {
3994
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
3995
+ throw new import_provider8.UnsupportedFunctionalityError({
3996
+ functionality: "Adjacent reasoning effort configuration updates"
3997
+ });
3998
+ }
4006
3999
  }
4007
4000
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
4008
4001
  let include = openaiOptions == null ? void 0 : openaiOptions.include;