@ai-sdk/openai 2.0.128 → 2.0.130

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.
@@ -374,6 +374,9 @@ var openaiChatResponseSchema = lazyValidator(
374
374
  message: z2.object({
375
375
  role: z2.literal("assistant").nullish(),
376
376
  content: z2.string().nullish(),
377
+ audio: z2.object({
378
+ transcript: z2.string().nullish()
379
+ }).nullish(),
377
380
  tool_calls: z2.array(
378
381
  z2.object({
379
382
  id: z2.string().nullish(),
@@ -914,7 +917,7 @@ var OpenAIChatLanguageModel = class {
914
917
  };
915
918
  }
916
919
  async doGenerate(options) {
917
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
920
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
918
921
  const { args: body, warnings } = await this.getArgs(options);
919
922
  const {
920
923
  responseHeaders,
@@ -942,19 +945,19 @@ var OpenAIChatLanguageModel = class {
942
945
  });
943
946
  }
944
947
  const content = [];
945
- const text = choice.message.content;
948
+ const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
946
949
  if (text != null && text.length > 0) {
947
950
  content.push({ type: "text", text });
948
951
  }
949
- for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
952
+ for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
950
953
  content.push({
951
954
  type: "tool-call",
952
- toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
955
+ toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
953
956
  toolName: toolCall.function.name,
954
957
  input: toolCall.function.arguments
955
958
  });
956
959
  }
957
- for (const annotation of (_c = choice.message.annotations) != null ? _c : []) {
960
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
958
961
  content.push({
959
962
  type: "source",
960
963
  sourceType: "url",
@@ -963,8 +966,8 @@ var OpenAIChatLanguageModel = class {
963
966
  title: annotation.url_citation.title
964
967
  });
965
968
  }
966
- const completionTokenDetails = (_d = response.usage) == null ? void 0 : _d.completion_tokens_details;
967
- const promptTokenDetails = (_e = response.usage) == null ? void 0 : _e.prompt_tokens_details;
969
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
970
+ const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
968
971
  const providerMetadata = { openai: {} };
969
972
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
970
973
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -977,18 +980,18 @@ var OpenAIChatLanguageModel = class {
977
980
  cacheWriteTokens: promptTokenDetails.cache_write_tokens
978
981
  };
979
982
  }
980
- if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
983
+ if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
981
984
  providerMetadata.openai.logprobs = choice.logprobs.content;
982
985
  }
983
986
  return {
984
987
  content,
985
988
  finishReason: mapOpenAIFinishReason(choice.finish_reason),
986
989
  usage: {
987
- inputTokens: (_h = (_g = response.usage) == null ? void 0 : _g.prompt_tokens) != null ? _h : void 0,
988
- outputTokens: (_j = (_i = response.usage) == null ? void 0 : _i.completion_tokens) != null ? _j : void 0,
989
- totalTokens: (_l = (_k = response.usage) == null ? void 0 : _k.total_tokens) != null ? _l : void 0,
990
- reasoningTokens: (_m = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _m : void 0,
991
- cachedInputTokens: (_n = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _n : void 0
990
+ inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
991
+ outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
992
+ totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
993
+ reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
994
+ cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
992
995
  },
993
996
  request: { body },
994
997
  response: {
@@ -2406,6 +2409,7 @@ var OpenAISpeechModel = class {
2406
2409
 
2407
2410
  // src/responses/openai-responses-language-model.ts
2408
2411
  import {
2412
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
2409
2413
  APICallError
2410
2414
  } from "@ai-sdk/provider";
2411
2415
  import {
@@ -2426,31 +2430,235 @@ import {
2426
2430
  parseProviderOptions as parseProviderOptions7,
2427
2431
  validateTypes
2428
2432
  } from "@ai-sdk/provider-utils";
2429
- import { z as z14 } from "zod/v4";
2433
+ import { z as z15 } from "zod/v4";
2430
2434
 
2431
- // src/tool/local-shell.ts
2435
+ // src/responses/openai-responses-options.ts
2432
2436
  import {
2433
- createProviderDefinedToolFactoryWithOutputSchema,
2434
- lazySchema,
2437
+ lazyValidator as lazyValidator12,
2435
2438
  zodSchema as zodSchema12
2436
2439
  } from "@ai-sdk/provider-utils";
2437
2440
  import { z as z13 } from "zod/v4";
2438
- var localShellInputSchema = lazySchema(
2441
+ var TOP_LOGPROBS_MAX = 20;
2442
+ var openaiResponsesReasoningModelIds = [
2443
+ "o1",
2444
+ "o1-2024-12-17",
2445
+ "o3",
2446
+ "o3-2025-04-16",
2447
+ "o3-deep-research",
2448
+ "o3-deep-research-2025-06-26",
2449
+ "o3-mini",
2450
+ "o3-mini-2025-01-31",
2451
+ "o4-mini",
2452
+ "o4-mini-2025-04-16",
2453
+ "o4-mini-deep-research",
2454
+ "o4-mini-deep-research-2025-06-26",
2455
+ "codex-mini-latest",
2456
+ "computer-use-preview",
2457
+ "gpt-5",
2458
+ "gpt-5-2025-08-07",
2459
+ "gpt-5-codex",
2460
+ "gpt-5-mini",
2461
+ "gpt-5-mini-2025-08-07",
2462
+ "gpt-5-nano",
2463
+ "gpt-5-nano-2025-08-07",
2464
+ "gpt-5-pro",
2465
+ "gpt-5-pro-2025-10-06",
2466
+ "gpt-5.1",
2467
+ "gpt-5.1-chat-latest",
2468
+ "gpt-5.1-codex-mini",
2469
+ "gpt-5.1-codex",
2470
+ "gpt-5.1-codex-max",
2471
+ "gpt-5.2",
2472
+ "gpt-5.2-chat-latest",
2473
+ "gpt-5.2-pro",
2474
+ "gpt-5.2-codex",
2475
+ "gpt-5.3-chat-latest",
2476
+ "gpt-5.3-codex",
2477
+ "gpt-5.4",
2478
+ "gpt-5.4-2026-03-05",
2479
+ "gpt-5.4-mini",
2480
+ "gpt-5.4-mini-2026-03-17",
2481
+ "gpt-5.4-nano",
2482
+ "gpt-5.4-nano-2026-03-17",
2483
+ "gpt-5.4-pro",
2484
+ "gpt-5.4-pro-2026-03-05",
2485
+ "gpt-5.6",
2486
+ "gpt-5.6-luna",
2487
+ "gpt-5.6-sol",
2488
+ "gpt-5.6-terra",
2489
+ "gpt-6-astra",
2490
+ "gpt-6-luna",
2491
+ "gpt-6-sol"
2492
+ ];
2493
+ var openaiResponsesModelIds = [
2494
+ "gpt-4.1",
2495
+ "gpt-4.1-2025-04-14",
2496
+ "gpt-4.1-mini",
2497
+ "gpt-4.1-mini-2025-04-14",
2498
+ "gpt-4.1-nano",
2499
+ "gpt-4.1-nano-2025-04-14",
2500
+ "gpt-4o",
2501
+ "gpt-4o-2024-05-13",
2502
+ "gpt-4o-2024-08-06",
2503
+ "gpt-4o-2024-11-20",
2504
+ "gpt-4o-audio-preview",
2505
+ "gpt-4o-audio-preview-2024-10-01",
2506
+ "gpt-4o-audio-preview-2024-12-17",
2507
+ "gpt-4o-search-preview",
2508
+ "gpt-4o-search-preview-2025-03-11",
2509
+ "gpt-4o-mini-search-preview",
2510
+ "gpt-4o-mini-search-preview-2025-03-11",
2511
+ "gpt-4o-mini",
2512
+ "gpt-4o-mini-2024-07-18",
2513
+ "gpt-4-turbo",
2514
+ "gpt-4-turbo-2024-04-09",
2515
+ "gpt-4-turbo-preview",
2516
+ "gpt-4-0125-preview",
2517
+ "gpt-4-1106-preview",
2518
+ "gpt-4",
2519
+ "gpt-4-0613",
2520
+ "gpt-4.5-preview",
2521
+ "gpt-4.5-preview-2025-02-27",
2522
+ "gpt-3.5-turbo-0125",
2523
+ "gpt-3.5-turbo",
2524
+ "gpt-3.5-turbo-1106",
2525
+ "chatgpt-4o-latest",
2526
+ "gpt-5-chat-latest",
2527
+ ...openaiResponsesReasoningModelIds
2528
+ ];
2529
+ var openaiResponsesProviderOptionsSchema = lazyValidator12(
2439
2530
  () => zodSchema12(
2440
2531
  z13.object({
2441
- action: z13.object({
2442
- type: z13.literal("exec"),
2443
- command: z13.array(z13.string()),
2444
- timeoutMs: z13.number().optional(),
2445
- user: z13.string().optional(),
2446
- workingDirectory: z13.string().optional(),
2447
- env: z13.record(z13.string(), z13.string()).optional()
2532
+ conversation: z13.string().nullish(),
2533
+ include: z13.array(
2534
+ z13.enum([
2535
+ "reasoning.encrypted_content",
2536
+ // handled internally by default, only needed for unknown reasoning models
2537
+ "file_search_call.results",
2538
+ "message.output_text.logprobs"
2539
+ ])
2540
+ ).nullish(),
2541
+ instructions: z13.string().nullish(),
2542
+ /**
2543
+ * Return the log probabilities of the tokens.
2544
+ *
2545
+ * Setting to true will return the log probabilities of the tokens that
2546
+ * were generated.
2547
+ *
2548
+ * Setting to a number will return the log probabilities of the top n
2549
+ * tokens that were generated.
2550
+ *
2551
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2552
+ * @see https://cookbook.openai.com/examples/using_logprobs
2553
+ */
2554
+ logprobs: z13.union([z13.boolean(), z13.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2555
+ /**
2556
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2557
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2558
+ * Any further attempts to call a tool by the model will be ignored.
2559
+ */
2560
+ maxToolCalls: z13.number().nullish(),
2561
+ metadata: z13.any().nullish(),
2562
+ parallelToolCalls: z13.boolean().nullish(),
2563
+ previousResponseId: z13.string().nullish(),
2564
+ promptCacheKey: z13.string().nullish(),
2565
+ /**
2566
+ * Prompt cache behavior for GPT-5.6 and later models.
2567
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2568
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2569
+ */
2570
+ promptCacheOptions: z13.object({
2571
+ mode: z13.enum(["implicit", "explicit"]).optional(),
2572
+ ttl: z13.literal("30m").optional()
2573
+ }).optional(),
2574
+ /**
2575
+ * The retention policy for the prompt cache.
2576
+ * - 'in_memory': Default. Standard prompt caching behavior.
2577
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2578
+ * Available for models before GPT-5.6 that support extended caching.
2579
+ *
2580
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2581
+ *
2582
+ * @default 'in_memory'
2583
+ */
2584
+ promptCacheRetention: z13.enum(["in_memory", "24h"]).nullish(),
2585
+ /**
2586
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2587
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2588
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2589
+ * Supported values vary by model.
2590
+ */
2591
+ reasoningEffort: z13.string().nullish(),
2592
+ /**
2593
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
2594
+ * without changing the request-level reasoning effort. This preserves the
2595
+ * request prefix for prompt caching.
2596
+ *
2597
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2598
+ * combined with automatic truncation.
2599
+ */
2600
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2601
+ /**
2602
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
2603
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
2604
+ */
2605
+ reasoningMode: z13.enum(["standard", "pro"]).optional(),
2606
+ /**
2607
+ * Controls which available reasoning items GPT-5.6 can use.
2608
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2609
+ * turns, and `all_turns` makes compatible earlier reasoning available.
2610
+ */
2611
+ reasoningContext: z13.enum(["auto", "current_turn", "all_turns"]).optional(),
2612
+ reasoningSummary: z13.string().nullish(),
2613
+ safetyIdentifier: z13.string().nullish(),
2614
+ serviceTier: z13.enum(["auto", "flex", "priority", "default"]).nullish(),
2615
+ store: z13.boolean().nullish(),
2616
+ strictJsonSchema: z13.boolean().nullish(),
2617
+ textVerbosity: z13.enum(["low", "medium", "high"]).nullish(),
2618
+ truncation: z13.enum(["auto", "disabled"]).nullish(),
2619
+ user: z13.string().nullish()
2620
+ })
2621
+ )
2622
+ );
2623
+ var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
2624
+ () => zodSchema12(
2625
+ z13.object({
2626
+ /**
2627
+ * Emit a configuration update at this position in Responses history.
2628
+ * Requires empty system message content and the same supported
2629
+ * configuration as the request-level reasoningEffortUpdate option.
2630
+ * Unsupported historical updates throw instead of being omitted.
2631
+ *
2632
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
2633
+ */
2634
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2635
+ })
2636
+ )
2637
+ );
2638
+
2639
+ // src/tool/local-shell.ts
2640
+ import {
2641
+ createProviderDefinedToolFactoryWithOutputSchema,
2642
+ lazySchema,
2643
+ zodSchema as zodSchema13
2644
+ } from "@ai-sdk/provider-utils";
2645
+ import { z as z14 } from "zod/v4";
2646
+ var localShellInputSchema = lazySchema(
2647
+ () => zodSchema13(
2648
+ z14.object({
2649
+ action: z14.object({
2650
+ type: z14.literal("exec"),
2651
+ command: z14.array(z14.string()),
2652
+ timeoutMs: z14.number().optional(),
2653
+ user: z14.string().optional(),
2654
+ workingDirectory: z14.string().optional(),
2655
+ env: z14.record(z14.string(), z14.string()).optional()
2448
2656
  })
2449
2657
  })
2450
2658
  )
2451
2659
  );
2452
2660
  var localShellOutputSchema = lazySchema(
2453
- () => zodSchema12(z13.object({ output: z13.string() }))
2661
+ () => zodSchema13(z14.object({ output: z14.string() }))
2454
2662
  );
2455
2663
  var localShell = createProviderDefinedToolFactoryWithOutputSchema({
2456
2664
  id: "openai.local_shell",
@@ -2471,9 +2679,11 @@ function isFileId(data, prefixes) {
2471
2679
  async function convertToOpenAIResponsesInput({
2472
2680
  prompt,
2473
2681
  systemMessageMode,
2682
+ providerOptionsName = "openai",
2474
2683
  explicitMessageItemType = false,
2475
2684
  fileIdPrefixes,
2476
2685
  store,
2686
+ configurationUpdateUnsupportedReason,
2477
2687
  hasLocalShellTool = false
2478
2688
  }) {
2479
2689
  var _a2, _b, _c, _d, _e, _f, _g, _h;
@@ -2482,6 +2692,33 @@ async function convertToOpenAIResponsesInput({
2482
2692
  for (const { role, content, providerOptions } of prompt) {
2483
2693
  switch (role) {
2484
2694
  case "system": {
2695
+ let options = await parseProviderOptions7({
2696
+ provider: providerOptionsName,
2697
+ providerOptions,
2698
+ schema: openaiResponsesSystemMessageOptionsSchema
2699
+ });
2700
+ if (options == null && providerOptionsName !== "openai") {
2701
+ options = await parseProviderOptions7({
2702
+ provider: "openai",
2703
+ providerOptions,
2704
+ schema: openaiResponsesSystemMessageOptionsSchema
2705
+ });
2706
+ }
2707
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
2708
+ if (effort != null) {
2709
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
2710
+ if (unsupportedReason != null) {
2711
+ throw new UnsupportedFunctionalityError4({
2712
+ functionality: "Message-level reasoningEffortUpdate",
2713
+ message: unsupportedReason
2714
+ });
2715
+ }
2716
+ input.push({
2717
+ type: "configuration_update",
2718
+ reasoning: { effort }
2719
+ });
2720
+ break;
2721
+ }
2485
2722
  switch (systemMessageMode) {
2486
2723
  case "system": {
2487
2724
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
@@ -2827,9 +3064,9 @@ async function convertToOpenAIResponsesInput({
2827
3064
  }
2828
3065
  return { input, warnings };
2829
3066
  }
2830
- var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2831
- itemId: z14.string().nullish(),
2832
- reasoningEncryptedContent: z14.string().nullish()
3067
+ var openaiResponsesReasoningProviderOptionsSchema = z15.object({
3068
+ itemId: z15.string().nullish(),
3069
+ reasoningEncryptedContent: z15.string().nullish()
2833
3070
  });
2834
3071
 
2835
3072
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2852,290 +3089,290 @@ function mapOpenAIResponseFinishReason({
2852
3089
 
2853
3090
  // src/responses/openai-responses-api.ts
2854
3091
  import {
2855
- lazyValidator as lazyValidator12,
2856
- zodSchema as zodSchema13
3092
+ lazyValidator as lazyValidator13,
3093
+ zodSchema as zodSchema14
2857
3094
  } from "@ai-sdk/provider-utils";
2858
- import { z as z15 } from "zod/v4";
2859
- var openaiResponsesChunkSchema = lazyValidator12(
2860
- () => zodSchema13(
2861
- z15.union([
2862
- z15.object({
2863
- type: z15.literal("response.output_text.delta"),
2864
- item_id: z15.string(),
2865
- delta: z15.string(),
2866
- logprobs: z15.array(
2867
- z15.object({
2868
- token: z15.string(),
2869
- logprob: z15.number(),
2870
- top_logprobs: z15.array(
2871
- z15.object({
2872
- token: z15.string(),
2873
- logprob: z15.number()
3095
+ import { z as z16 } from "zod/v4";
3096
+ var openaiResponsesChunkSchema = lazyValidator13(
3097
+ () => zodSchema14(
3098
+ z16.union([
3099
+ z16.object({
3100
+ type: z16.literal("response.output_text.delta"),
3101
+ item_id: z16.string(),
3102
+ delta: z16.string(),
3103
+ logprobs: z16.array(
3104
+ z16.object({
3105
+ token: z16.string(),
3106
+ logprob: z16.number(),
3107
+ top_logprobs: z16.array(
3108
+ z16.object({
3109
+ token: z16.string(),
3110
+ logprob: z16.number()
2874
3111
  })
2875
3112
  )
2876
3113
  })
2877
3114
  ).nullish()
2878
3115
  }),
2879
- z15.object({
2880
- type: z15.enum(["response.completed", "response.incomplete"]),
2881
- response: z15.object({
2882
- incomplete_details: z15.object({ reason: z15.string() }).nullish(),
2883
- usage: z15.object({
2884
- input_tokens: z15.number(),
2885
- input_tokens_details: z15.object({
2886
- cached_tokens: z15.number().nullish(),
2887
- cache_write_tokens: z15.number().nullish(),
2888
- orchestration_input_tokens: z15.number().nullish(),
2889
- orchestration_input_cached_tokens: z15.number().nullish()
3116
+ z16.object({
3117
+ type: z16.enum(["response.completed", "response.incomplete"]),
3118
+ response: z16.object({
3119
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3120
+ usage: z16.object({
3121
+ input_tokens: z16.number(),
3122
+ input_tokens_details: z16.object({
3123
+ cached_tokens: z16.number().nullish(),
3124
+ cache_write_tokens: z16.number().nullish(),
3125
+ orchestration_input_tokens: z16.number().nullish(),
3126
+ orchestration_input_cached_tokens: z16.number().nullish()
2890
3127
  }).nullish(),
2891
- output_tokens: z15.number(),
2892
- output_tokens_details: z15.object({
2893
- reasoning_tokens: z15.number().nullish(),
2894
- orchestration_output_tokens: z15.number().nullish()
3128
+ output_tokens: z16.number(),
3129
+ output_tokens_details: z16.object({
3130
+ reasoning_tokens: z16.number().nullish(),
3131
+ orchestration_output_tokens: z16.number().nullish()
2895
3132
  }).nullish()
2896
3133
  }),
2897
- reasoning: z15.object({
2898
- context: z15.string().nullish()
3134
+ reasoning: z16.object({
3135
+ context: z16.string().nullish()
2899
3136
  }).nullish(),
2900
- service_tier: z15.string().nullish()
3137
+ service_tier: z16.string().nullish()
2901
3138
  })
2902
3139
  }),
2903
- z15.object({
2904
- type: z15.literal("response.created"),
2905
- response: z15.object({
2906
- id: z15.string(),
2907
- created_at: z15.number(),
2908
- model: z15.string(),
2909
- service_tier: z15.string().nullish()
3140
+ z16.object({
3141
+ type: z16.literal("response.created"),
3142
+ response: z16.object({
3143
+ id: z16.string(),
3144
+ created_at: z16.number(),
3145
+ model: z16.string(),
3146
+ service_tier: z16.string().nullish()
2910
3147
  })
2911
3148
  }),
2912
- z15.object({
2913
- type: z15.literal("response.output_item.added"),
2914
- output_index: z15.number(),
2915
- item: z15.discriminatedUnion("type", [
2916
- z15.object({
2917
- type: z15.literal("message"),
2918
- id: z15.string(),
2919
- phase: z15.enum(["commentary", "final_answer"]).nullish()
3149
+ z16.object({
3150
+ type: z16.literal("response.output_item.added"),
3151
+ output_index: z16.number(),
3152
+ item: z16.discriminatedUnion("type", [
3153
+ z16.object({
3154
+ type: z16.literal("message"),
3155
+ id: z16.string(),
3156
+ phase: z16.enum(["commentary", "final_answer"]).nullish()
2920
3157
  }),
2921
- z15.object({
2922
- type: z15.literal("reasoning"),
2923
- id: z15.string(),
2924
- encrypted_content: z15.string().nullish()
3158
+ z16.object({
3159
+ type: z16.literal("reasoning"),
3160
+ id: z16.string(),
3161
+ encrypted_content: z16.string().nullish()
2925
3162
  }),
2926
- z15.object({
2927
- type: z15.literal("function_call"),
2928
- id: z15.string(),
2929
- call_id: z15.string(),
2930
- name: z15.string(),
2931
- arguments: z15.string(),
2932
- async: z15.boolean().nullish()
3163
+ z16.object({
3164
+ type: z16.literal("function_call"),
3165
+ id: z16.string(),
3166
+ call_id: z16.string(),
3167
+ name: z16.string(),
3168
+ arguments: z16.string(),
3169
+ async: z16.boolean().nullish()
2933
3170
  }),
2934
- z15.object({
2935
- type: z15.literal("web_search_call"),
2936
- id: z15.string(),
2937
- status: z15.string()
3171
+ z16.object({
3172
+ type: z16.literal("web_search_call"),
3173
+ id: z16.string(),
3174
+ status: z16.string()
2938
3175
  }),
2939
- z15.object({
2940
- type: z15.literal("computer_call"),
2941
- id: z15.string(),
2942
- status: z15.string()
3176
+ z16.object({
3177
+ type: z16.literal("computer_call"),
3178
+ id: z16.string(),
3179
+ status: z16.string()
2943
3180
  }),
2944
- z15.object({
2945
- type: z15.literal("file_search_call"),
2946
- id: z15.string()
3181
+ z16.object({
3182
+ type: z16.literal("file_search_call"),
3183
+ id: z16.string()
2947
3184
  }),
2948
- z15.object({
2949
- type: z15.literal("image_generation_call"),
2950
- id: z15.string()
3185
+ z16.object({
3186
+ type: z16.literal("image_generation_call"),
3187
+ id: z16.string()
2951
3188
  }),
2952
- z15.object({
2953
- type: z15.literal("code_interpreter_call"),
2954
- id: z15.string(),
2955
- container_id: z15.string(),
2956
- code: z15.string().nullable(),
2957
- outputs: z15.array(
2958
- z15.discriminatedUnion("type", [
2959
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2960
- z15.object({ type: z15.literal("image"), url: z15.string() })
3189
+ z16.object({
3190
+ type: z16.literal("code_interpreter_call"),
3191
+ id: z16.string(),
3192
+ container_id: z16.string(),
3193
+ code: z16.string().nullable(),
3194
+ outputs: z16.array(
3195
+ z16.discriminatedUnion("type", [
3196
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3197
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2961
3198
  ])
2962
3199
  ).nullable(),
2963
- status: z15.string()
3200
+ status: z16.string()
2964
3201
  })
2965
3202
  ])
2966
3203
  }),
2967
- z15.object({
2968
- type: z15.literal("response.output_item.done"),
2969
- output_index: z15.number(),
2970
- item: z15.discriminatedUnion("type", [
2971
- z15.object({
2972
- type: z15.literal("message"),
2973
- id: z15.string(),
2974
- phase: z15.enum(["commentary", "final_answer"]).nullish()
3204
+ z16.object({
3205
+ type: z16.literal("response.output_item.done"),
3206
+ output_index: z16.number(),
3207
+ item: z16.discriminatedUnion("type", [
3208
+ z16.object({
3209
+ type: z16.literal("message"),
3210
+ id: z16.string(),
3211
+ phase: z16.enum(["commentary", "final_answer"]).nullish()
2975
3212
  }),
2976
- z15.object({
2977
- type: z15.literal("reasoning"),
2978
- id: z15.string(),
2979
- encrypted_content: z15.string().nullish()
3213
+ z16.object({
3214
+ type: z16.literal("reasoning"),
3215
+ id: z16.string(),
3216
+ encrypted_content: z16.string().nullish()
2980
3217
  }),
2981
- z15.object({
2982
- type: z15.literal("function_call"),
2983
- id: z15.string(),
2984
- call_id: z15.string(),
2985
- name: z15.string(),
2986
- arguments: z15.string(),
2987
- async: z15.boolean().nullish(),
2988
- status: z15.enum(["in_progress", "completed", "incomplete"])
3218
+ z16.object({
3219
+ type: z16.literal("function_call"),
3220
+ id: z16.string(),
3221
+ call_id: z16.string(),
3222
+ name: z16.string(),
3223
+ arguments: z16.string(),
3224
+ async: z16.boolean().nullish(),
3225
+ status: z16.enum(["in_progress", "completed", "incomplete"])
2989
3226
  }),
2990
- z15.object({
2991
- type: z15.literal("code_interpreter_call"),
2992
- id: z15.string(),
2993
- code: z15.string().nullable(),
2994
- container_id: z15.string(),
2995
- outputs: z15.array(
2996
- z15.discriminatedUnion("type", [
2997
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2998
- z15.object({ type: z15.literal("image"), url: z15.string() })
3227
+ z16.object({
3228
+ type: z16.literal("code_interpreter_call"),
3229
+ id: z16.string(),
3230
+ code: z16.string().nullable(),
3231
+ container_id: z16.string(),
3232
+ outputs: z16.array(
3233
+ z16.discriminatedUnion("type", [
3234
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3235
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2999
3236
  ])
3000
3237
  ).nullable()
3001
3238
  }),
3002
- z15.object({
3003
- type: z15.literal("image_generation_call"),
3004
- id: z15.string(),
3005
- result: z15.string()
3239
+ z16.object({
3240
+ type: z16.literal("image_generation_call"),
3241
+ id: z16.string(),
3242
+ result: z16.string()
3006
3243
  }),
3007
- z15.object({
3008
- type: z15.literal("web_search_call"),
3009
- id: z15.string(),
3010
- status: z15.string(),
3011
- action: z15.discriminatedUnion("type", [
3012
- z15.object({
3013
- type: z15.literal("search"),
3014
- query: z15.string().nullish(),
3015
- sources: z15.array(
3016
- z15.discriminatedUnion("type", [
3017
- z15.object({ type: z15.literal("url"), url: z15.string() }),
3018
- z15.object({ type: z15.literal("api"), name: z15.string() })
3244
+ z16.object({
3245
+ type: z16.literal("web_search_call"),
3246
+ id: z16.string(),
3247
+ status: z16.string(),
3248
+ action: z16.discriminatedUnion("type", [
3249
+ z16.object({
3250
+ type: z16.literal("search"),
3251
+ query: z16.string().nullish(),
3252
+ sources: z16.array(
3253
+ z16.discriminatedUnion("type", [
3254
+ z16.object({ type: z16.literal("url"), url: z16.string() }),
3255
+ z16.object({ type: z16.literal("api"), name: z16.string() })
3019
3256
  ])
3020
3257
  ).nullish()
3021
3258
  }),
3022
- z15.object({
3023
- type: z15.literal("open_page"),
3024
- url: z15.string().nullish()
3259
+ z16.object({
3260
+ type: z16.literal("open_page"),
3261
+ url: z16.string().nullish()
3025
3262
  }),
3026
- z15.object({
3027
- type: z15.literal("find_in_page"),
3028
- url: z15.string().nullish(),
3029
- pattern: z15.string().nullish()
3263
+ z16.object({
3264
+ type: z16.literal("find_in_page"),
3265
+ url: z16.string().nullish(),
3266
+ pattern: z16.string().nullish()
3030
3267
  })
3031
3268
  ]).nullish()
3032
3269
  }),
3033
- z15.object({
3034
- type: z15.literal("file_search_call"),
3035
- id: z15.string(),
3036
- queries: z15.array(z15.string()),
3037
- results: z15.array(
3038
- z15.object({
3039
- attributes: z15.record(z15.string(), z15.unknown()),
3040
- file_id: z15.string(),
3041
- filename: z15.string(),
3042
- score: z15.number(),
3043
- text: z15.string()
3270
+ z16.object({
3271
+ type: z16.literal("file_search_call"),
3272
+ id: z16.string(),
3273
+ queries: z16.array(z16.string()),
3274
+ results: z16.array(
3275
+ z16.object({
3276
+ attributes: z16.record(z16.string(), z16.unknown()),
3277
+ file_id: z16.string(),
3278
+ filename: z16.string(),
3279
+ score: z16.number(),
3280
+ text: z16.string()
3044
3281
  })
3045
3282
  ).nullish()
3046
3283
  }),
3047
- z15.object({
3048
- type: z15.literal("local_shell_call"),
3049
- id: z15.string(),
3050
- call_id: z15.string(),
3051
- action: z15.object({
3052
- type: z15.literal("exec"),
3053
- command: z15.array(z15.string()),
3054
- timeout_ms: z15.number().optional(),
3055
- user: z15.string().optional(),
3056
- working_directory: z15.string().optional(),
3057
- env: z15.record(z15.string(), z15.string()).optional()
3284
+ z16.object({
3285
+ type: z16.literal("local_shell_call"),
3286
+ id: z16.string(),
3287
+ call_id: z16.string(),
3288
+ action: z16.object({
3289
+ type: z16.literal("exec"),
3290
+ command: z16.array(z16.string()),
3291
+ timeout_ms: z16.number().optional(),
3292
+ user: z16.string().optional(),
3293
+ working_directory: z16.string().optional(),
3294
+ env: z16.record(z16.string(), z16.string()).optional()
3058
3295
  })
3059
3296
  }),
3060
- z15.object({
3061
- type: z15.literal("computer_call"),
3062
- id: z15.string(),
3063
- status: z15.literal("completed")
3297
+ z16.object({
3298
+ type: z16.literal("computer_call"),
3299
+ id: z16.string(),
3300
+ status: z16.literal("completed")
3064
3301
  })
3065
3302
  ])
3066
3303
  }),
3067
- z15.object({
3068
- type: z15.literal("response.function_call_arguments.delta"),
3069
- item_id: z15.string(),
3070
- output_index: z15.number(),
3071
- delta: z15.string()
3304
+ z16.object({
3305
+ type: z16.literal("response.function_call_arguments.delta"),
3306
+ item_id: z16.string(),
3307
+ output_index: z16.number(),
3308
+ delta: z16.string()
3072
3309
  }),
3073
- z15.object({
3074
- type: z15.literal("response.image_generation_call.partial_image"),
3075
- item_id: z15.string(),
3076
- output_index: z15.number(),
3077
- partial_image_b64: z15.string()
3310
+ z16.object({
3311
+ type: z16.literal("response.image_generation_call.partial_image"),
3312
+ item_id: z16.string(),
3313
+ output_index: z16.number(),
3314
+ partial_image_b64: z16.string()
3078
3315
  }),
3079
- z15.object({
3080
- type: z15.literal("response.code_interpreter_call_code.delta"),
3081
- item_id: z15.string(),
3082
- output_index: z15.number(),
3083
- delta: z15.string()
3316
+ z16.object({
3317
+ type: z16.literal("response.code_interpreter_call_code.delta"),
3318
+ item_id: z16.string(),
3319
+ output_index: z16.number(),
3320
+ delta: z16.string()
3084
3321
  }),
3085
- z15.object({
3086
- type: z15.literal("response.code_interpreter_call_code.done"),
3087
- item_id: z15.string(),
3088
- output_index: z15.number(),
3089
- code: z15.string()
3322
+ z16.object({
3323
+ type: z16.literal("response.code_interpreter_call_code.done"),
3324
+ item_id: z16.string(),
3325
+ output_index: z16.number(),
3326
+ code: z16.string()
3090
3327
  }),
3091
- z15.object({
3092
- type: z15.literal("response.output_text.annotation.added"),
3093
- annotation: z15.discriminatedUnion("type", [
3094
- z15.object({
3095
- type: z15.literal("url_citation"),
3096
- start_index: z15.number(),
3097
- end_index: z15.number(),
3098
- url: z15.string(),
3099
- title: z15.string()
3328
+ z16.object({
3329
+ type: z16.literal("response.output_text.annotation.added"),
3330
+ annotation: z16.discriminatedUnion("type", [
3331
+ z16.object({
3332
+ type: z16.literal("url_citation"),
3333
+ start_index: z16.number(),
3334
+ end_index: z16.number(),
3335
+ url: z16.string(),
3336
+ title: z16.string()
3100
3337
  }),
3101
- z15.object({
3102
- type: z15.literal("file_citation"),
3103
- file_id: z15.string(),
3104
- filename: z15.string().nullish(),
3105
- index: z15.number().nullish(),
3106
- start_index: z15.number().nullish(),
3107
- end_index: z15.number().nullish(),
3108
- quote: z15.string().nullish()
3338
+ z16.object({
3339
+ type: z16.literal("file_citation"),
3340
+ file_id: z16.string(),
3341
+ filename: z16.string().nullish(),
3342
+ index: z16.number().nullish(),
3343
+ start_index: z16.number().nullish(),
3344
+ end_index: z16.number().nullish(),
3345
+ quote: z16.string().nullish()
3109
3346
  })
3110
3347
  ])
3111
3348
  }),
3112
- z15.object({
3113
- type: z15.literal("response.reasoning_summary_part.added"),
3114
- item_id: z15.string(),
3115
- summary_index: z15.number()
3349
+ z16.object({
3350
+ type: z16.literal("response.reasoning_summary_part.added"),
3351
+ item_id: z16.string(),
3352
+ summary_index: z16.number()
3116
3353
  }),
3117
- z15.object({
3118
- type: z15.literal("response.reasoning_summary_text.delta"),
3119
- item_id: z15.string(),
3120
- summary_index: z15.number(),
3121
- delta: z15.string()
3354
+ z16.object({
3355
+ type: z16.literal("response.reasoning_summary_text.delta"),
3356
+ item_id: z16.string(),
3357
+ summary_index: z16.number(),
3358
+ delta: z16.string()
3122
3359
  }),
3123
- z15.object({
3124
- type: z15.literal("response.reasoning_summary_part.done"),
3125
- item_id: z15.string(),
3126
- summary_index: z15.number()
3360
+ z16.object({
3361
+ type: z16.literal("response.reasoning_summary_part.done"),
3362
+ item_id: z16.string(),
3363
+ summary_index: z16.number()
3127
3364
  }),
3128
- z15.object({
3129
- type: z15.literal("error"),
3130
- sequence_number: z15.number(),
3131
- error: z15.object({
3132
- type: z15.string(),
3133
- code: z15.string(),
3134
- message: z15.string(),
3135
- param: z15.string().nullish()
3365
+ z16.object({
3366
+ type: z16.literal("error"),
3367
+ sequence_number: z16.number(),
3368
+ error: z16.object({
3369
+ type: z16.string(),
3370
+ code: z16.string(),
3371
+ message: z16.string(),
3372
+ param: z16.string().nullish()
3136
3373
  })
3137
3374
  }),
3138
- z15.object({ type: z15.string() }).loose().transform((value) => ({
3375
+ z16.object({ type: z16.string() }).loose().transform((value) => ({
3139
3376
  type: "unknown_chunk",
3140
3377
  message: value.type
3141
3378
  }))
@@ -3143,392 +3380,203 @@ var openaiResponsesChunkSchema = lazyValidator12(
3143
3380
  ])
3144
3381
  )
3145
3382
  );
3146
- var openaiResponsesResponseSchema = lazyValidator12(
3147
- () => zodSchema13(
3148
- z15.object({
3149
- id: z15.string().optional(),
3150
- created_at: z15.number().optional(),
3151
- error: z15.object({
3152
- message: z15.string(),
3153
- type: z15.string(),
3154
- param: z15.string().nullish(),
3155
- code: z15.string()
3383
+ var openaiResponsesResponseSchema = lazyValidator13(
3384
+ () => zodSchema14(
3385
+ z16.object({
3386
+ id: z16.string().optional(),
3387
+ created_at: z16.number().optional(),
3388
+ error: z16.object({
3389
+ message: z16.string(),
3390
+ type: z16.string(),
3391
+ param: z16.string().nullish(),
3392
+ code: z16.string()
3156
3393
  }).nullish(),
3157
- model: z15.string().optional(),
3158
- output: z15.array(
3159
- z15.discriminatedUnion("type", [
3160
- z15.object({
3161
- type: z15.literal("message"),
3162
- role: z15.literal("assistant"),
3163
- id: z15.string(),
3164
- phase: z15.enum(["commentary", "final_answer"]).nullish(),
3165
- content: z15.array(
3166
- z15.object({
3167
- type: z15.literal("output_text"),
3168
- text: z15.string(),
3169
- logprobs: z15.array(
3170
- z15.object({
3171
- token: z15.string(),
3172
- logprob: z15.number(),
3173
- top_logprobs: z15.array(
3174
- z15.object({
3175
- token: z15.string(),
3176
- logprob: z15.number()
3394
+ model: z16.string().optional(),
3395
+ output: z16.array(
3396
+ z16.discriminatedUnion("type", [
3397
+ z16.object({
3398
+ type: z16.literal("message"),
3399
+ role: z16.literal("assistant"),
3400
+ id: z16.string(),
3401
+ phase: z16.enum(["commentary", "final_answer"]).nullish(),
3402
+ content: z16.array(
3403
+ z16.object({
3404
+ type: z16.literal("output_text"),
3405
+ text: z16.string(),
3406
+ logprobs: z16.array(
3407
+ z16.object({
3408
+ token: z16.string(),
3409
+ logprob: z16.number(),
3410
+ top_logprobs: z16.array(
3411
+ z16.object({
3412
+ token: z16.string(),
3413
+ logprob: z16.number()
3177
3414
  })
3178
3415
  )
3179
3416
  })
3180
3417
  ).nullish(),
3181
- annotations: z15.array(
3182
- z15.discriminatedUnion("type", [
3183
- z15.object({
3184
- type: z15.literal("url_citation"),
3185
- start_index: z15.number(),
3186
- end_index: z15.number(),
3187
- url: z15.string(),
3188
- title: z15.string()
3418
+ annotations: z16.array(
3419
+ z16.discriminatedUnion("type", [
3420
+ z16.object({
3421
+ type: z16.literal("url_citation"),
3422
+ start_index: z16.number(),
3423
+ end_index: z16.number(),
3424
+ url: z16.string(),
3425
+ title: z16.string()
3189
3426
  }),
3190
- z15.object({
3191
- type: z15.literal("file_citation"),
3192
- file_id: z15.string(),
3193
- filename: z15.string().nullish(),
3194
- index: z15.number().nullish(),
3195
- start_index: z15.number().nullish(),
3196
- end_index: z15.number().nullish(),
3197
- quote: z15.string().nullish()
3427
+ z16.object({
3428
+ type: z16.literal("file_citation"),
3429
+ file_id: z16.string(),
3430
+ filename: z16.string().nullish(),
3431
+ index: z16.number().nullish(),
3432
+ start_index: z16.number().nullish(),
3433
+ end_index: z16.number().nullish(),
3434
+ quote: z16.string().nullish()
3198
3435
  }),
3199
- z15.object({
3200
- type: z15.literal("container_file_citation"),
3201
- container_id: z15.string(),
3202
- file_id: z15.string(),
3203
- filename: z15.string().nullish(),
3204
- start_index: z15.number().nullish(),
3205
- end_index: z15.number().nullish(),
3206
- index: z15.number().nullish()
3436
+ z16.object({
3437
+ type: z16.literal("container_file_citation"),
3438
+ container_id: z16.string(),
3439
+ file_id: z16.string(),
3440
+ filename: z16.string().nullish(),
3441
+ start_index: z16.number().nullish(),
3442
+ end_index: z16.number().nullish(),
3443
+ index: z16.number().nullish()
3207
3444
  }),
3208
- z15.object({
3209
- type: z15.literal("file_path"),
3210
- file_id: z15.string(),
3211
- index: z15.number().nullish()
3445
+ z16.object({
3446
+ type: z16.literal("file_path"),
3447
+ file_id: z16.string(),
3448
+ index: z16.number().nullish()
3212
3449
  })
3213
3450
  ])
3214
3451
  )
3215
3452
  })
3216
3453
  )
3217
3454
  }),
3218
- z15.object({
3219
- type: z15.literal("web_search_call"),
3220
- id: z15.string(),
3221
- status: z15.string(),
3222
- action: z15.discriminatedUnion("type", [
3223
- z15.object({
3224
- type: z15.literal("search"),
3225
- query: z15.string().nullish(),
3226
- sources: z15.array(
3227
- z15.discriminatedUnion("type", [
3228
- z15.object({ type: z15.literal("url"), url: z15.string() }),
3229
- z15.object({
3230
- type: z15.literal("api"),
3231
- name: z15.string()
3455
+ z16.object({
3456
+ type: z16.literal("web_search_call"),
3457
+ id: z16.string(),
3458
+ status: z16.string(),
3459
+ action: z16.discriminatedUnion("type", [
3460
+ z16.object({
3461
+ type: z16.literal("search"),
3462
+ query: z16.string().nullish(),
3463
+ sources: z16.array(
3464
+ z16.discriminatedUnion("type", [
3465
+ z16.object({ type: z16.literal("url"), url: z16.string() }),
3466
+ z16.object({
3467
+ type: z16.literal("api"),
3468
+ name: z16.string()
3232
3469
  })
3233
3470
  ])
3234
3471
  ).nullish()
3235
3472
  }),
3236
- z15.object({
3237
- type: z15.literal("open_page"),
3238
- url: z15.string().nullish()
3473
+ z16.object({
3474
+ type: z16.literal("open_page"),
3475
+ url: z16.string().nullish()
3239
3476
  }),
3240
- z15.object({
3241
- type: z15.literal("find_in_page"),
3242
- url: z15.string().nullish(),
3243
- pattern: z15.string().nullish()
3477
+ z16.object({
3478
+ type: z16.literal("find_in_page"),
3479
+ url: z16.string().nullish(),
3480
+ pattern: z16.string().nullish()
3244
3481
  })
3245
3482
  ]).nullish()
3246
3483
  }),
3247
- z15.object({
3248
- type: z15.literal("file_search_call"),
3249
- id: z15.string(),
3250
- queries: z15.array(z15.string()),
3251
- results: z15.array(
3252
- z15.object({
3253
- attributes: z15.record(
3254
- z15.string(),
3255
- z15.union([z15.string(), z15.number(), z15.boolean()])
3484
+ z16.object({
3485
+ type: z16.literal("file_search_call"),
3486
+ id: z16.string(),
3487
+ queries: z16.array(z16.string()),
3488
+ results: z16.array(
3489
+ z16.object({
3490
+ attributes: z16.record(
3491
+ z16.string(),
3492
+ z16.union([z16.string(), z16.number(), z16.boolean()])
3256
3493
  ),
3257
- file_id: z15.string(),
3258
- filename: z15.string(),
3259
- score: z15.number(),
3260
- text: z15.string()
3494
+ file_id: z16.string(),
3495
+ filename: z16.string(),
3496
+ score: z16.number(),
3497
+ text: z16.string()
3261
3498
  })
3262
3499
  ).nullish()
3263
3500
  }),
3264
- z15.object({
3265
- type: z15.literal("code_interpreter_call"),
3266
- id: z15.string(),
3267
- code: z15.string().nullable(),
3268
- container_id: z15.string(),
3269
- outputs: z15.array(
3270
- z15.discriminatedUnion("type", [
3271
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
3272
- z15.object({ type: z15.literal("image"), url: z15.string() })
3501
+ z16.object({
3502
+ type: z16.literal("code_interpreter_call"),
3503
+ id: z16.string(),
3504
+ code: z16.string().nullable(),
3505
+ container_id: z16.string(),
3506
+ outputs: z16.array(
3507
+ z16.discriminatedUnion("type", [
3508
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3509
+ z16.object({ type: z16.literal("image"), url: z16.string() })
3273
3510
  ])
3274
3511
  ).nullable()
3275
3512
  }),
3276
- z15.object({
3277
- type: z15.literal("image_generation_call"),
3278
- id: z15.string(),
3279
- result: z15.string()
3513
+ z16.object({
3514
+ type: z16.literal("image_generation_call"),
3515
+ id: z16.string(),
3516
+ result: z16.string()
3280
3517
  }),
3281
- z15.object({
3282
- type: z15.literal("local_shell_call"),
3283
- id: z15.string(),
3284
- call_id: z15.string(),
3285
- action: z15.object({
3286
- type: z15.literal("exec"),
3287
- command: z15.array(z15.string()),
3288
- timeout_ms: z15.number().optional(),
3289
- user: z15.string().optional(),
3290
- working_directory: z15.string().optional(),
3291
- env: z15.record(z15.string(), z15.string()).optional()
3518
+ z16.object({
3519
+ type: z16.literal("local_shell_call"),
3520
+ id: z16.string(),
3521
+ call_id: z16.string(),
3522
+ action: z16.object({
3523
+ type: z16.literal("exec"),
3524
+ command: z16.array(z16.string()),
3525
+ timeout_ms: z16.number().optional(),
3526
+ user: z16.string().optional(),
3527
+ working_directory: z16.string().optional(),
3528
+ env: z16.record(z16.string(), z16.string()).optional()
3292
3529
  })
3293
3530
  }),
3294
- z15.object({
3295
- type: z15.literal("function_call"),
3296
- call_id: z15.string(),
3297
- name: z15.string(),
3298
- arguments: z15.string(),
3299
- id: z15.string(),
3300
- async: z15.boolean().nullish()
3531
+ z16.object({
3532
+ type: z16.literal("function_call"),
3533
+ call_id: z16.string(),
3534
+ name: z16.string(),
3535
+ arguments: z16.string(),
3536
+ id: z16.string(),
3537
+ async: z16.boolean().nullish()
3301
3538
  }),
3302
- z15.object({
3303
- type: z15.literal("computer_call"),
3304
- id: z15.string(),
3305
- status: z15.string().optional()
3539
+ z16.object({
3540
+ type: z16.literal("computer_call"),
3541
+ id: z16.string(),
3542
+ status: z16.string().optional()
3306
3543
  }),
3307
- z15.object({
3308
- type: z15.literal("reasoning"),
3309
- id: z15.string(),
3310
- encrypted_content: z15.string().nullish(),
3311
- summary: z15.array(
3312
- z15.object({
3313
- type: z15.literal("summary_text"),
3314
- text: z15.string()
3544
+ z16.object({
3545
+ type: z16.literal("reasoning"),
3546
+ id: z16.string(),
3547
+ encrypted_content: z16.string().nullish(),
3548
+ summary: z16.array(
3549
+ z16.object({
3550
+ type: z16.literal("summary_text"),
3551
+ text: z16.string()
3315
3552
  })
3316
3553
  )
3317
3554
  })
3318
3555
  ])
3319
3556
  ).optional(),
3320
- service_tier: z15.string().nullish(),
3321
- reasoning: z15.object({
3322
- context: z15.string().nullish()
3557
+ service_tier: z16.string().nullish(),
3558
+ reasoning: z16.object({
3559
+ context: z16.string().nullish()
3323
3560
  }).nullish(),
3324
- incomplete_details: z15.object({ reason: z15.string() }).nullish(),
3325
- usage: z15.object({
3326
- input_tokens: z15.number(),
3327
- input_tokens_details: z15.object({
3328
- cached_tokens: z15.number().nullish(),
3329
- cache_write_tokens: z15.number().nullish(),
3330
- orchestration_input_tokens: z15.number().nullish(),
3331
- orchestration_input_cached_tokens: z15.number().nullish()
3561
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3562
+ usage: z16.object({
3563
+ input_tokens: z16.number(),
3564
+ input_tokens_details: z16.object({
3565
+ cached_tokens: z16.number().nullish(),
3566
+ cache_write_tokens: z16.number().nullish(),
3567
+ orchestration_input_tokens: z16.number().nullish(),
3568
+ orchestration_input_cached_tokens: z16.number().nullish()
3332
3569
  }).nullish(),
3333
- output_tokens: z15.number(),
3334
- output_tokens_details: z15.object({
3335
- reasoning_tokens: z15.number().nullish(),
3336
- orchestration_output_tokens: z15.number().nullish()
3570
+ output_tokens: z16.number(),
3571
+ output_tokens_details: z16.object({
3572
+ reasoning_tokens: z16.number().nullish(),
3573
+ orchestration_output_tokens: z16.number().nullish()
3337
3574
  }).nullish()
3338
3575
  }).optional()
3339
3576
  })
3340
3577
  )
3341
3578
  );
3342
3579
 
3343
- // src/responses/openai-responses-options.ts
3344
- import {
3345
- lazyValidator as lazyValidator13,
3346
- zodSchema as zodSchema14
3347
- } from "@ai-sdk/provider-utils";
3348
- import { z as z16 } from "zod/v4";
3349
- var TOP_LOGPROBS_MAX = 20;
3350
- var openaiResponsesReasoningModelIds = [
3351
- "o1",
3352
- "o1-2024-12-17",
3353
- "o3",
3354
- "o3-2025-04-16",
3355
- "o3-deep-research",
3356
- "o3-deep-research-2025-06-26",
3357
- "o3-mini",
3358
- "o3-mini-2025-01-31",
3359
- "o4-mini",
3360
- "o4-mini-2025-04-16",
3361
- "o4-mini-deep-research",
3362
- "o4-mini-deep-research-2025-06-26",
3363
- "codex-mini-latest",
3364
- "computer-use-preview",
3365
- "gpt-5",
3366
- "gpt-5-2025-08-07",
3367
- "gpt-5-codex",
3368
- "gpt-5-mini",
3369
- "gpt-5-mini-2025-08-07",
3370
- "gpt-5-nano",
3371
- "gpt-5-nano-2025-08-07",
3372
- "gpt-5-pro",
3373
- "gpt-5-pro-2025-10-06",
3374
- "gpt-5.1",
3375
- "gpt-5.1-chat-latest",
3376
- "gpt-5.1-codex-mini",
3377
- "gpt-5.1-codex",
3378
- "gpt-5.1-codex-max",
3379
- "gpt-5.2",
3380
- "gpt-5.2-chat-latest",
3381
- "gpt-5.2-pro",
3382
- "gpt-5.2-codex",
3383
- "gpt-5.3-chat-latest",
3384
- "gpt-5.3-codex",
3385
- "gpt-5.4",
3386
- "gpt-5.4-2026-03-05",
3387
- "gpt-5.4-mini",
3388
- "gpt-5.4-mini-2026-03-17",
3389
- "gpt-5.4-nano",
3390
- "gpt-5.4-nano-2026-03-17",
3391
- "gpt-5.4-pro",
3392
- "gpt-5.4-pro-2026-03-05",
3393
- "gpt-5.6",
3394
- "gpt-5.6-luna",
3395
- "gpt-5.6-sol",
3396
- "gpt-5.6-terra",
3397
- "gpt-6-astra",
3398
- "gpt-6-luna",
3399
- "gpt-6-sol"
3400
- ];
3401
- var openaiResponsesModelIds = [
3402
- "gpt-4.1",
3403
- "gpt-4.1-2025-04-14",
3404
- "gpt-4.1-mini",
3405
- "gpt-4.1-mini-2025-04-14",
3406
- "gpt-4.1-nano",
3407
- "gpt-4.1-nano-2025-04-14",
3408
- "gpt-4o",
3409
- "gpt-4o-2024-05-13",
3410
- "gpt-4o-2024-08-06",
3411
- "gpt-4o-2024-11-20",
3412
- "gpt-4o-audio-preview",
3413
- "gpt-4o-audio-preview-2024-10-01",
3414
- "gpt-4o-audio-preview-2024-12-17",
3415
- "gpt-4o-search-preview",
3416
- "gpt-4o-search-preview-2025-03-11",
3417
- "gpt-4o-mini-search-preview",
3418
- "gpt-4o-mini-search-preview-2025-03-11",
3419
- "gpt-4o-mini",
3420
- "gpt-4o-mini-2024-07-18",
3421
- "gpt-4-turbo",
3422
- "gpt-4-turbo-2024-04-09",
3423
- "gpt-4-turbo-preview",
3424
- "gpt-4-0125-preview",
3425
- "gpt-4-1106-preview",
3426
- "gpt-4",
3427
- "gpt-4-0613",
3428
- "gpt-4.5-preview",
3429
- "gpt-4.5-preview-2025-02-27",
3430
- "gpt-3.5-turbo-0125",
3431
- "gpt-3.5-turbo",
3432
- "gpt-3.5-turbo-1106",
3433
- "chatgpt-4o-latest",
3434
- "gpt-5-chat-latest",
3435
- ...openaiResponsesReasoningModelIds
3436
- ];
3437
- var openaiResponsesProviderOptionsSchema = lazyValidator13(
3438
- () => zodSchema14(
3439
- z16.object({
3440
- conversation: z16.string().nullish(),
3441
- include: z16.array(
3442
- z16.enum([
3443
- "reasoning.encrypted_content",
3444
- // handled internally by default, only needed for unknown reasoning models
3445
- "file_search_call.results",
3446
- "message.output_text.logprobs"
3447
- ])
3448
- ).nullish(),
3449
- instructions: z16.string().nullish(),
3450
- /**
3451
- * Return the log probabilities of the tokens.
3452
- *
3453
- * Setting to true will return the log probabilities of the tokens that
3454
- * were generated.
3455
- *
3456
- * Setting to a number will return the log probabilities of the top n
3457
- * tokens that were generated.
3458
- *
3459
- * @see https://platform.openai.com/docs/api-reference/responses/create
3460
- * @see https://cookbook.openai.com/examples/using_logprobs
3461
- */
3462
- logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3463
- /**
3464
- * The maximum number of total calls to built-in tools that can be processed in a response.
3465
- * This maximum number applies across all built-in tool calls, not per individual tool.
3466
- * Any further attempts to call a tool by the model will be ignored.
3467
- */
3468
- maxToolCalls: z16.number().nullish(),
3469
- metadata: z16.any().nullish(),
3470
- parallelToolCalls: z16.boolean().nullish(),
3471
- previousResponseId: z16.string().nullish(),
3472
- promptCacheKey: z16.string().nullish(),
3473
- /**
3474
- * Prompt cache behavior for GPT-5.6 and later models.
3475
- * `mode` controls whether OpenAI also places an implicit breakpoint.
3476
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3477
- */
3478
- promptCacheOptions: z16.object({
3479
- mode: z16.enum(["implicit", "explicit"]).optional(),
3480
- ttl: z16.literal("30m").optional()
3481
- }).optional(),
3482
- /**
3483
- * The retention policy for the prompt cache.
3484
- * - 'in_memory': Default. Standard prompt caching behavior.
3485
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
3486
- * Available for models before GPT-5.6 that support extended caching.
3487
- *
3488
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
3489
- *
3490
- * @default 'in_memory'
3491
- */
3492
- promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
3493
- /**
3494
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
3495
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
3496
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
3497
- * Supported values vary by model.
3498
- */
3499
- reasoningEffort: z16.string().nullish(),
3500
- /**
3501
- * Updates the reasoning effort for GPT-6 and later models starting with this response
3502
- * without changing the request-level reasoning effort. This preserves the
3503
- * request prefix for prompt caching.
3504
- *
3505
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3506
- * combined with automatic truncation.
3507
- */
3508
- reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3509
- /**
3510
- * Controls how much model work GPT-5.6 performs before returning a final answer.
3511
- * `standard` is the default. `pro` increases quality, latency, and token usage.
3512
- */
3513
- reasoningMode: z16.enum(["standard", "pro"]).optional(),
3514
- /**
3515
- * Controls which available reasoning items GPT-5.6 can use.
3516
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
3517
- * turns, and `all_turns` makes compatible earlier reasoning available.
3518
- */
3519
- reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
3520
- reasoningSummary: z16.string().nullish(),
3521
- safetyIdentifier: z16.string().nullish(),
3522
- serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
3523
- store: z16.boolean().nullish(),
3524
- strictJsonSchema: z16.boolean().nullish(),
3525
- textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3526
- truncation: z16.enum(["auto", "disabled"]).nullish(),
3527
- user: z16.string().nullish()
3528
- })
3529
- )
3530
- );
3531
-
3532
3580
  // src/responses/openai-responses-prepare-tools.ts
3533
3581
  import {
3534
3582
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
@@ -3962,6 +4010,18 @@ function resolveAsyncToolOption({
3962
4010
  }
3963
4011
 
3964
4012
  // src/responses/openai-responses-language-model.ts
4013
+ function getConfigurationUpdateUnsupportedReason({
4014
+ modelCapabilities,
4015
+ options
4016
+ }) {
4017
+ if (!modelCapabilities.supportsConfigurationUpdate) {
4018
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
4019
+ }
4020
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
4021
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
4022
+ }
4023
+ return void 0;
4024
+ }
3965
4025
  var OpenAIResponsesLanguageModel = class {
3966
4026
  constructor(modelId, config) {
3967
4027
  this.specificationVersion = "v2";
@@ -4026,8 +4086,14 @@ var OpenAIResponsesLanguageModel = class {
4026
4086
  details: "conversation and previousResponseId cannot be used together"
4027
4087
  });
4028
4088
  }
4089
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
4090
+ modelCapabilities,
4091
+ options: openaiOptions
4092
+ });
4029
4093
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
4030
4094
  prompt,
4095
+ configurationUpdateUnsupportedReason,
4096
+ providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
4031
4097
  systemMessageMode: modelCapabilities.systemMessageMode,
4032
4098
  explicitMessageItemType: this.config.explicitMessageItemType,
4033
4099
  fileIdPrefixes: this.config.fileIdPrefixes,
@@ -4047,18 +4113,27 @@ var OpenAIResponsesLanguageModel = class {
4047
4113
  resolvedReasoningEffort = void 0;
4048
4114
  }
4049
4115
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
4050
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
4051
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
4116
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
4052
4117
  warnings.push({
4053
4118
  type: "unsupported-setting",
4054
4119
  setting: "reasoningEffortUpdate",
4055
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
4120
+ details: configurationUpdateUnsupportedReason
4056
4121
  });
4057
4122
  } else if (reasoningEffortUpdate != null) {
4058
- input.unshift({
4059
- type: "configuration_update",
4060
- reasoning: { effort: reasoningEffortUpdate }
4061
- });
4123
+ const firstItem = input[0];
4124
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
4125
+ input.unshift({
4126
+ type: "configuration_update",
4127
+ reasoning: { effort: reasoningEffortUpdate }
4128
+ });
4129
+ }
4130
+ }
4131
+ for (let i = 1; i < input.length; i++) {
4132
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
4133
+ throw new UnsupportedFunctionalityError6({
4134
+ functionality: "Adjacent reasoning effort configuration updates"
4135
+ });
4136
+ }
4062
4137
  }
4063
4138
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
4064
4139
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -4713,7 +4788,7 @@ var OpenAIResponsesLanguageModel = class {
4713
4788
  providerExecuted: true
4714
4789
  });
4715
4790
  } else if (value.item.type === "message") {
4716
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
4791
+ ongoingAnnotations.splice(0);
4717
4792
  activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
4718
4793
  controller.enqueue({
4719
4794
  type: "text-start",