@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.
package/dist/index.mjs CHANGED
@@ -382,6 +382,9 @@ var openaiChatResponseSchema = lazyValidator(
382
382
  message: z2.object({
383
383
  role: z2.literal("assistant").nullish(),
384
384
  content: z2.string().nullish(),
385
+ audio: z2.object({
386
+ transcript: z2.string().nullish()
387
+ }).nullish(),
385
388
  tool_calls: z2.array(
386
389
  z2.object({
387
390
  id: z2.string().nullish(),
@@ -922,7 +925,7 @@ var OpenAIChatLanguageModel = class {
922
925
  };
923
926
  }
924
927
  async doGenerate(options) {
925
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
928
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
926
929
  const { args: body, warnings } = await this.getArgs(options);
927
930
  const {
928
931
  responseHeaders,
@@ -950,19 +953,19 @@ var OpenAIChatLanguageModel = class {
950
953
  });
951
954
  }
952
955
  const content = [];
953
- const text = choice.message.content;
956
+ const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
954
957
  if (text != null && text.length > 0) {
955
958
  content.push({ type: "text", text });
956
959
  }
957
- for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
960
+ for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
958
961
  content.push({
959
962
  type: "tool-call",
960
- toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
963
+ toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
961
964
  toolName: toolCall.function.name,
962
965
  input: toolCall.function.arguments
963
966
  });
964
967
  }
965
- for (const annotation of (_c = choice.message.annotations) != null ? _c : []) {
968
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
966
969
  content.push({
967
970
  type: "source",
968
971
  sourceType: "url",
@@ -971,8 +974,8 @@ var OpenAIChatLanguageModel = class {
971
974
  title: annotation.url_citation.title
972
975
  });
973
976
  }
974
- const completionTokenDetails = (_d = response.usage) == null ? void 0 : _d.completion_tokens_details;
975
- const promptTokenDetails = (_e = response.usage) == null ? void 0 : _e.prompt_tokens_details;
977
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
978
+ const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
976
979
  const providerMetadata = { openai: {} };
977
980
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
978
981
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -985,18 +988,18 @@ var OpenAIChatLanguageModel = class {
985
988
  cacheWriteTokens: promptTokenDetails.cache_write_tokens
986
989
  };
987
990
  }
988
- if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
991
+ if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
989
992
  providerMetadata.openai.logprobs = choice.logprobs.content;
990
993
  }
991
994
  return {
992
995
  content,
993
996
  finishReason: mapOpenAIFinishReason(choice.finish_reason),
994
997
  usage: {
995
- inputTokens: (_h = (_g = response.usage) == null ? void 0 : _g.prompt_tokens) != null ? _h : void 0,
996
- outputTokens: (_j = (_i = response.usage) == null ? void 0 : _i.completion_tokens) != null ? _j : void 0,
997
- totalTokens: (_l = (_k = response.usage) == null ? void 0 : _k.total_tokens) != null ? _l : void 0,
998
- reasoningTokens: (_m = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _m : void 0,
999
- cachedInputTokens: (_n = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _n : void 0
998
+ inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
999
+ outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
1000
+ totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
1001
+ reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
1002
+ cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
1000
1003
  },
1001
1004
  request: { body },
1002
1005
  response: {
@@ -2405,6 +2408,7 @@ var openaiTools = {
2405
2408
 
2406
2409
  // src/responses/openai-responses-language-model.ts
2407
2410
  import {
2411
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
2408
2412
  APICallError
2409
2413
  } from "@ai-sdk/provider";
2410
2414
  import {
@@ -2425,7 +2429,213 @@ import {
2425
2429
  parseProviderOptions as parseProviderOptions5,
2426
2430
  validateTypes
2427
2431
  } from "@ai-sdk/provider-utils";
2432
+ import { z as z17 } from "zod/v4";
2433
+
2434
+ // src/responses/openai-responses-options.ts
2435
+ import {
2436
+ lazyValidator as lazyValidator9,
2437
+ zodSchema as zodSchema15
2438
+ } from "@ai-sdk/provider-utils";
2428
2439
  import { z as z16 } from "zod/v4";
2440
+ var TOP_LOGPROBS_MAX = 20;
2441
+ var openaiResponsesReasoningModelIds = [
2442
+ "o1",
2443
+ "o1-2024-12-17",
2444
+ "o3",
2445
+ "o3-2025-04-16",
2446
+ "o3-deep-research",
2447
+ "o3-deep-research-2025-06-26",
2448
+ "o3-mini",
2449
+ "o3-mini-2025-01-31",
2450
+ "o4-mini",
2451
+ "o4-mini-2025-04-16",
2452
+ "o4-mini-deep-research",
2453
+ "o4-mini-deep-research-2025-06-26",
2454
+ "codex-mini-latest",
2455
+ "computer-use-preview",
2456
+ "gpt-5",
2457
+ "gpt-5-2025-08-07",
2458
+ "gpt-5-codex",
2459
+ "gpt-5-mini",
2460
+ "gpt-5-mini-2025-08-07",
2461
+ "gpt-5-nano",
2462
+ "gpt-5-nano-2025-08-07",
2463
+ "gpt-5-pro",
2464
+ "gpt-5-pro-2025-10-06",
2465
+ "gpt-5.1",
2466
+ "gpt-5.1-chat-latest",
2467
+ "gpt-5.1-codex-mini",
2468
+ "gpt-5.1-codex",
2469
+ "gpt-5.1-codex-max",
2470
+ "gpt-5.2",
2471
+ "gpt-5.2-chat-latest",
2472
+ "gpt-5.2-pro",
2473
+ "gpt-5.2-codex",
2474
+ "gpt-5.3-chat-latest",
2475
+ "gpt-5.3-codex",
2476
+ "gpt-5.4",
2477
+ "gpt-5.4-2026-03-05",
2478
+ "gpt-5.4-mini",
2479
+ "gpt-5.4-mini-2026-03-17",
2480
+ "gpt-5.4-nano",
2481
+ "gpt-5.4-nano-2026-03-17",
2482
+ "gpt-5.4-pro",
2483
+ "gpt-5.4-pro-2026-03-05",
2484
+ "gpt-5.6",
2485
+ "gpt-5.6-luna",
2486
+ "gpt-5.6-sol",
2487
+ "gpt-5.6-terra",
2488
+ "gpt-6-astra",
2489
+ "gpt-6-luna",
2490
+ "gpt-6-sol"
2491
+ ];
2492
+ var openaiResponsesModelIds = [
2493
+ "gpt-4.1",
2494
+ "gpt-4.1-2025-04-14",
2495
+ "gpt-4.1-mini",
2496
+ "gpt-4.1-mini-2025-04-14",
2497
+ "gpt-4.1-nano",
2498
+ "gpt-4.1-nano-2025-04-14",
2499
+ "gpt-4o",
2500
+ "gpt-4o-2024-05-13",
2501
+ "gpt-4o-2024-08-06",
2502
+ "gpt-4o-2024-11-20",
2503
+ "gpt-4o-audio-preview",
2504
+ "gpt-4o-audio-preview-2024-10-01",
2505
+ "gpt-4o-audio-preview-2024-12-17",
2506
+ "gpt-4o-search-preview",
2507
+ "gpt-4o-search-preview-2025-03-11",
2508
+ "gpt-4o-mini-search-preview",
2509
+ "gpt-4o-mini-search-preview-2025-03-11",
2510
+ "gpt-4o-mini",
2511
+ "gpt-4o-mini-2024-07-18",
2512
+ "gpt-4-turbo",
2513
+ "gpt-4-turbo-2024-04-09",
2514
+ "gpt-4-turbo-preview",
2515
+ "gpt-4-0125-preview",
2516
+ "gpt-4-1106-preview",
2517
+ "gpt-4",
2518
+ "gpt-4-0613",
2519
+ "gpt-4.5-preview",
2520
+ "gpt-4.5-preview-2025-02-27",
2521
+ "gpt-3.5-turbo-0125",
2522
+ "gpt-3.5-turbo",
2523
+ "gpt-3.5-turbo-1106",
2524
+ "chatgpt-4o-latest",
2525
+ "gpt-5-chat-latest",
2526
+ ...openaiResponsesReasoningModelIds
2527
+ ];
2528
+ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2529
+ () => zodSchema15(
2530
+ z16.object({
2531
+ conversation: z16.string().nullish(),
2532
+ include: z16.array(
2533
+ z16.enum([
2534
+ "reasoning.encrypted_content",
2535
+ // handled internally by default, only needed for unknown reasoning models
2536
+ "file_search_call.results",
2537
+ "message.output_text.logprobs"
2538
+ ])
2539
+ ).nullish(),
2540
+ instructions: z16.string().nullish(),
2541
+ /**
2542
+ * Return the log probabilities of the tokens.
2543
+ *
2544
+ * Setting to true will return the log probabilities of the tokens that
2545
+ * were generated.
2546
+ *
2547
+ * Setting to a number will return the log probabilities of the top n
2548
+ * tokens that were generated.
2549
+ *
2550
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2551
+ * @see https://cookbook.openai.com/examples/using_logprobs
2552
+ */
2553
+ logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2554
+ /**
2555
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2556
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2557
+ * Any further attempts to call a tool by the model will be ignored.
2558
+ */
2559
+ maxToolCalls: z16.number().nullish(),
2560
+ metadata: z16.any().nullish(),
2561
+ parallelToolCalls: z16.boolean().nullish(),
2562
+ previousResponseId: z16.string().nullish(),
2563
+ promptCacheKey: z16.string().nullish(),
2564
+ /**
2565
+ * Prompt cache behavior for GPT-5.6 and later models.
2566
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2567
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2568
+ */
2569
+ promptCacheOptions: z16.object({
2570
+ mode: z16.enum(["implicit", "explicit"]).optional(),
2571
+ ttl: z16.literal("30m").optional()
2572
+ }).optional(),
2573
+ /**
2574
+ * The retention policy for the prompt cache.
2575
+ * - 'in_memory': Default. Standard prompt caching behavior.
2576
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2577
+ * Available for models before GPT-5.6 that support extended caching.
2578
+ *
2579
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2580
+ *
2581
+ * @default 'in_memory'
2582
+ */
2583
+ promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
2584
+ /**
2585
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2586
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2587
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2588
+ * Supported values vary by model.
2589
+ */
2590
+ reasoningEffort: z16.string().nullish(),
2591
+ /**
2592
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
2593
+ * without changing the request-level reasoning effort. This preserves the
2594
+ * request prefix for prompt caching.
2595
+ *
2596
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2597
+ * combined with automatic truncation.
2598
+ */
2599
+ reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2600
+ /**
2601
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
2602
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
2603
+ */
2604
+ reasoningMode: z16.enum(["standard", "pro"]).optional(),
2605
+ /**
2606
+ * Controls which available reasoning items GPT-5.6 can use.
2607
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2608
+ * turns, and `all_turns` makes compatible earlier reasoning available.
2609
+ */
2610
+ reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
2611
+ reasoningSummary: z16.string().nullish(),
2612
+ safetyIdentifier: z16.string().nullish(),
2613
+ serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
2614
+ store: z16.boolean().nullish(),
2615
+ strictJsonSchema: z16.boolean().nullish(),
2616
+ textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
2617
+ truncation: z16.enum(["auto", "disabled"]).nullish(),
2618
+ user: z16.string().nullish()
2619
+ })
2620
+ )
2621
+ );
2622
+ var openaiResponsesSystemMessageOptionsSchema = lazyValidator9(
2623
+ () => zodSchema15(
2624
+ z16.object({
2625
+ /**
2626
+ * Emit a configuration update at this position in Responses history.
2627
+ * Requires empty system message content and the same supported
2628
+ * configuration as the request-level reasoningEffortUpdate option.
2629
+ * Unsupported historical updates throw instead of being omitted.
2630
+ *
2631
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
2632
+ */
2633
+ reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2634
+ })
2635
+ )
2636
+ );
2637
+
2638
+ // src/responses/convert-to-openai-responses-input.ts
2429
2639
  function getPromptCacheBreakpoint2(providerOptions) {
2430
2640
  var _a2;
2431
2641
  return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
@@ -2437,9 +2647,11 @@ function isFileId(data, prefixes) {
2437
2647
  async function convertToOpenAIResponsesInput({
2438
2648
  prompt,
2439
2649
  systemMessageMode,
2650
+ providerOptionsName = "openai",
2440
2651
  explicitMessageItemType = false,
2441
2652
  fileIdPrefixes,
2442
2653
  store,
2654
+ configurationUpdateUnsupportedReason,
2443
2655
  hasLocalShellTool = false
2444
2656
  }) {
2445
2657
  var _a2, _b, _c, _d, _e, _f, _g, _h;
@@ -2448,6 +2660,33 @@ async function convertToOpenAIResponsesInput({
2448
2660
  for (const { role, content, providerOptions } of prompt) {
2449
2661
  switch (role) {
2450
2662
  case "system": {
2663
+ let options = await parseProviderOptions5({
2664
+ provider: providerOptionsName,
2665
+ providerOptions,
2666
+ schema: openaiResponsesSystemMessageOptionsSchema
2667
+ });
2668
+ if (options == null && providerOptionsName !== "openai") {
2669
+ options = await parseProviderOptions5({
2670
+ provider: "openai",
2671
+ providerOptions,
2672
+ schema: openaiResponsesSystemMessageOptionsSchema
2673
+ });
2674
+ }
2675
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
2676
+ if (effort != null) {
2677
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
2678
+ if (unsupportedReason != null) {
2679
+ throw new UnsupportedFunctionalityError4({
2680
+ functionality: "Message-level reasoningEffortUpdate",
2681
+ message: unsupportedReason
2682
+ });
2683
+ }
2684
+ input.push({
2685
+ type: "configuration_update",
2686
+ reasoning: { effort }
2687
+ });
2688
+ break;
2689
+ }
2451
2690
  switch (systemMessageMode) {
2452
2691
  case "system": {
2453
2692
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
@@ -2793,9 +3032,9 @@ async function convertToOpenAIResponsesInput({
2793
3032
  }
2794
3033
  return { input, warnings };
2795
3034
  }
2796
- var openaiResponsesReasoningProviderOptionsSchema = z16.object({
2797
- itemId: z16.string().nullish(),
2798
- reasoningEncryptedContent: z16.string().nullish()
3035
+ var openaiResponsesReasoningProviderOptionsSchema = z17.object({
3036
+ itemId: z17.string().nullish(),
3037
+ reasoningEncryptedContent: z17.string().nullish()
2799
3038
  });
2800
3039
 
2801
3040
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2818,290 +3057,290 @@ function mapOpenAIResponseFinishReason({
2818
3057
 
2819
3058
  // src/responses/openai-responses-api.ts
2820
3059
  import {
2821
- lazyValidator as lazyValidator9,
2822
- zodSchema as zodSchema15
3060
+ lazyValidator as lazyValidator10,
3061
+ zodSchema as zodSchema16
2823
3062
  } from "@ai-sdk/provider-utils";
2824
- import { z as z17 } from "zod/v4";
2825
- var openaiResponsesChunkSchema = lazyValidator9(
2826
- () => zodSchema15(
2827
- z17.union([
2828
- z17.object({
2829
- type: z17.literal("response.output_text.delta"),
2830
- item_id: z17.string(),
2831
- delta: z17.string(),
2832
- logprobs: z17.array(
2833
- z17.object({
2834
- token: z17.string(),
2835
- logprob: z17.number(),
2836
- top_logprobs: z17.array(
2837
- z17.object({
2838
- token: z17.string(),
2839
- logprob: z17.number()
3063
+ import { z as z18 } from "zod/v4";
3064
+ var openaiResponsesChunkSchema = lazyValidator10(
3065
+ () => zodSchema16(
3066
+ z18.union([
3067
+ z18.object({
3068
+ type: z18.literal("response.output_text.delta"),
3069
+ item_id: z18.string(),
3070
+ delta: z18.string(),
3071
+ logprobs: z18.array(
3072
+ z18.object({
3073
+ token: z18.string(),
3074
+ logprob: z18.number(),
3075
+ top_logprobs: z18.array(
3076
+ z18.object({
3077
+ token: z18.string(),
3078
+ logprob: z18.number()
2840
3079
  })
2841
3080
  )
2842
3081
  })
2843
3082
  ).nullish()
2844
3083
  }),
2845
- z17.object({
2846
- type: z17.enum(["response.completed", "response.incomplete"]),
2847
- response: z17.object({
2848
- incomplete_details: z17.object({ reason: z17.string() }).nullish(),
2849
- usage: z17.object({
2850
- input_tokens: z17.number(),
2851
- input_tokens_details: z17.object({
2852
- cached_tokens: z17.number().nullish(),
2853
- cache_write_tokens: z17.number().nullish(),
2854
- orchestration_input_tokens: z17.number().nullish(),
2855
- orchestration_input_cached_tokens: z17.number().nullish()
3084
+ z18.object({
3085
+ type: z18.enum(["response.completed", "response.incomplete"]),
3086
+ response: z18.object({
3087
+ incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3088
+ usage: z18.object({
3089
+ input_tokens: z18.number(),
3090
+ input_tokens_details: z18.object({
3091
+ cached_tokens: z18.number().nullish(),
3092
+ cache_write_tokens: z18.number().nullish(),
3093
+ orchestration_input_tokens: z18.number().nullish(),
3094
+ orchestration_input_cached_tokens: z18.number().nullish()
2856
3095
  }).nullish(),
2857
- output_tokens: z17.number(),
2858
- output_tokens_details: z17.object({
2859
- reasoning_tokens: z17.number().nullish(),
2860
- orchestration_output_tokens: z17.number().nullish()
3096
+ output_tokens: z18.number(),
3097
+ output_tokens_details: z18.object({
3098
+ reasoning_tokens: z18.number().nullish(),
3099
+ orchestration_output_tokens: z18.number().nullish()
2861
3100
  }).nullish()
2862
3101
  }),
2863
- reasoning: z17.object({
2864
- context: z17.string().nullish()
3102
+ reasoning: z18.object({
3103
+ context: z18.string().nullish()
2865
3104
  }).nullish(),
2866
- service_tier: z17.string().nullish()
3105
+ service_tier: z18.string().nullish()
2867
3106
  })
2868
3107
  }),
2869
- z17.object({
2870
- type: z17.literal("response.created"),
2871
- response: z17.object({
2872
- id: z17.string(),
2873
- created_at: z17.number(),
2874
- model: z17.string(),
2875
- service_tier: z17.string().nullish()
3108
+ z18.object({
3109
+ type: z18.literal("response.created"),
3110
+ response: z18.object({
3111
+ id: z18.string(),
3112
+ created_at: z18.number(),
3113
+ model: z18.string(),
3114
+ service_tier: z18.string().nullish()
2876
3115
  })
2877
3116
  }),
2878
- z17.object({
2879
- type: z17.literal("response.output_item.added"),
2880
- output_index: z17.number(),
2881
- item: z17.discriminatedUnion("type", [
2882
- z17.object({
2883
- type: z17.literal("message"),
2884
- id: z17.string(),
2885
- phase: z17.enum(["commentary", "final_answer"]).nullish()
3117
+ z18.object({
3118
+ type: z18.literal("response.output_item.added"),
3119
+ output_index: z18.number(),
3120
+ item: z18.discriminatedUnion("type", [
3121
+ z18.object({
3122
+ type: z18.literal("message"),
3123
+ id: z18.string(),
3124
+ phase: z18.enum(["commentary", "final_answer"]).nullish()
2886
3125
  }),
2887
- z17.object({
2888
- type: z17.literal("reasoning"),
2889
- id: z17.string(),
2890
- encrypted_content: z17.string().nullish()
3126
+ z18.object({
3127
+ type: z18.literal("reasoning"),
3128
+ id: z18.string(),
3129
+ encrypted_content: z18.string().nullish()
2891
3130
  }),
2892
- z17.object({
2893
- type: z17.literal("function_call"),
2894
- id: z17.string(),
2895
- call_id: z17.string(),
2896
- name: z17.string(),
2897
- arguments: z17.string(),
2898
- async: z17.boolean().nullish()
3131
+ z18.object({
3132
+ type: z18.literal("function_call"),
3133
+ id: z18.string(),
3134
+ call_id: z18.string(),
3135
+ name: z18.string(),
3136
+ arguments: z18.string(),
3137
+ async: z18.boolean().nullish()
2899
3138
  }),
2900
- z17.object({
2901
- type: z17.literal("web_search_call"),
2902
- id: z17.string(),
2903
- status: z17.string()
3139
+ z18.object({
3140
+ type: z18.literal("web_search_call"),
3141
+ id: z18.string(),
3142
+ status: z18.string()
2904
3143
  }),
2905
- z17.object({
2906
- type: z17.literal("computer_call"),
2907
- id: z17.string(),
2908
- status: z17.string()
3144
+ z18.object({
3145
+ type: z18.literal("computer_call"),
3146
+ id: z18.string(),
3147
+ status: z18.string()
2909
3148
  }),
2910
- z17.object({
2911
- type: z17.literal("file_search_call"),
2912
- id: z17.string()
3149
+ z18.object({
3150
+ type: z18.literal("file_search_call"),
3151
+ id: z18.string()
2913
3152
  }),
2914
- z17.object({
2915
- type: z17.literal("image_generation_call"),
2916
- id: z17.string()
3153
+ z18.object({
3154
+ type: z18.literal("image_generation_call"),
3155
+ id: z18.string()
2917
3156
  }),
2918
- z17.object({
2919
- type: z17.literal("code_interpreter_call"),
2920
- id: z17.string(),
2921
- container_id: z17.string(),
2922
- code: z17.string().nullable(),
2923
- outputs: z17.array(
2924
- z17.discriminatedUnion("type", [
2925
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2926
- z17.object({ type: z17.literal("image"), url: z17.string() })
3157
+ z18.object({
3158
+ type: z18.literal("code_interpreter_call"),
3159
+ id: z18.string(),
3160
+ container_id: z18.string(),
3161
+ code: z18.string().nullable(),
3162
+ outputs: z18.array(
3163
+ z18.discriminatedUnion("type", [
3164
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3165
+ z18.object({ type: z18.literal("image"), url: z18.string() })
2927
3166
  ])
2928
3167
  ).nullable(),
2929
- status: z17.string()
3168
+ status: z18.string()
2930
3169
  })
2931
3170
  ])
2932
3171
  }),
2933
- z17.object({
2934
- type: z17.literal("response.output_item.done"),
2935
- output_index: z17.number(),
2936
- item: z17.discriminatedUnion("type", [
2937
- z17.object({
2938
- type: z17.literal("message"),
2939
- id: z17.string(),
2940
- phase: z17.enum(["commentary", "final_answer"]).nullish()
3172
+ z18.object({
3173
+ type: z18.literal("response.output_item.done"),
3174
+ output_index: z18.number(),
3175
+ item: z18.discriminatedUnion("type", [
3176
+ z18.object({
3177
+ type: z18.literal("message"),
3178
+ id: z18.string(),
3179
+ phase: z18.enum(["commentary", "final_answer"]).nullish()
2941
3180
  }),
2942
- z17.object({
2943
- type: z17.literal("reasoning"),
2944
- id: z17.string(),
2945
- encrypted_content: z17.string().nullish()
3181
+ z18.object({
3182
+ type: z18.literal("reasoning"),
3183
+ id: z18.string(),
3184
+ encrypted_content: z18.string().nullish()
2946
3185
  }),
2947
- z17.object({
2948
- type: z17.literal("function_call"),
2949
- id: z17.string(),
2950
- call_id: z17.string(),
2951
- name: z17.string(),
2952
- arguments: z17.string(),
2953
- async: z17.boolean().nullish(),
2954
- status: z17.enum(["in_progress", "completed", "incomplete"])
3186
+ z18.object({
3187
+ type: z18.literal("function_call"),
3188
+ id: z18.string(),
3189
+ call_id: z18.string(),
3190
+ name: z18.string(),
3191
+ arguments: z18.string(),
3192
+ async: z18.boolean().nullish(),
3193
+ status: z18.enum(["in_progress", "completed", "incomplete"])
2955
3194
  }),
2956
- z17.object({
2957
- type: z17.literal("code_interpreter_call"),
2958
- id: z17.string(),
2959
- code: z17.string().nullable(),
2960
- container_id: z17.string(),
2961
- outputs: z17.array(
2962
- z17.discriminatedUnion("type", [
2963
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2964
- z17.object({ type: z17.literal("image"), url: z17.string() })
3195
+ z18.object({
3196
+ type: z18.literal("code_interpreter_call"),
3197
+ id: z18.string(),
3198
+ code: z18.string().nullable(),
3199
+ container_id: z18.string(),
3200
+ outputs: z18.array(
3201
+ z18.discriminatedUnion("type", [
3202
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3203
+ z18.object({ type: z18.literal("image"), url: z18.string() })
2965
3204
  ])
2966
3205
  ).nullable()
2967
3206
  }),
2968
- z17.object({
2969
- type: z17.literal("image_generation_call"),
2970
- id: z17.string(),
2971
- result: z17.string()
3207
+ z18.object({
3208
+ type: z18.literal("image_generation_call"),
3209
+ id: z18.string(),
3210
+ result: z18.string()
2972
3211
  }),
2973
- z17.object({
2974
- type: z17.literal("web_search_call"),
2975
- id: z17.string(),
2976
- status: z17.string(),
2977
- action: z17.discriminatedUnion("type", [
2978
- z17.object({
2979
- type: z17.literal("search"),
2980
- query: z17.string().nullish(),
2981
- sources: z17.array(
2982
- z17.discriminatedUnion("type", [
2983
- z17.object({ type: z17.literal("url"), url: z17.string() }),
2984
- z17.object({ type: z17.literal("api"), name: z17.string() })
3212
+ z18.object({
3213
+ type: z18.literal("web_search_call"),
3214
+ id: z18.string(),
3215
+ status: z18.string(),
3216
+ action: z18.discriminatedUnion("type", [
3217
+ z18.object({
3218
+ type: z18.literal("search"),
3219
+ query: z18.string().nullish(),
3220
+ sources: z18.array(
3221
+ z18.discriminatedUnion("type", [
3222
+ z18.object({ type: z18.literal("url"), url: z18.string() }),
3223
+ z18.object({ type: z18.literal("api"), name: z18.string() })
2985
3224
  ])
2986
3225
  ).nullish()
2987
3226
  }),
2988
- z17.object({
2989
- type: z17.literal("open_page"),
2990
- url: z17.string().nullish()
3227
+ z18.object({
3228
+ type: z18.literal("open_page"),
3229
+ url: z18.string().nullish()
2991
3230
  }),
2992
- z17.object({
2993
- type: z17.literal("find_in_page"),
2994
- url: z17.string().nullish(),
2995
- pattern: z17.string().nullish()
3231
+ z18.object({
3232
+ type: z18.literal("find_in_page"),
3233
+ url: z18.string().nullish(),
3234
+ pattern: z18.string().nullish()
2996
3235
  })
2997
3236
  ]).nullish()
2998
3237
  }),
2999
- z17.object({
3000
- type: z17.literal("file_search_call"),
3001
- id: z17.string(),
3002
- queries: z17.array(z17.string()),
3003
- results: z17.array(
3004
- z17.object({
3005
- attributes: z17.record(z17.string(), z17.unknown()),
3006
- file_id: z17.string(),
3007
- filename: z17.string(),
3008
- score: z17.number(),
3009
- text: z17.string()
3238
+ z18.object({
3239
+ type: z18.literal("file_search_call"),
3240
+ id: z18.string(),
3241
+ queries: z18.array(z18.string()),
3242
+ results: z18.array(
3243
+ z18.object({
3244
+ attributes: z18.record(z18.string(), z18.unknown()),
3245
+ file_id: z18.string(),
3246
+ filename: z18.string(),
3247
+ score: z18.number(),
3248
+ text: z18.string()
3010
3249
  })
3011
3250
  ).nullish()
3012
3251
  }),
3013
- z17.object({
3014
- type: z17.literal("local_shell_call"),
3015
- id: z17.string(),
3016
- call_id: z17.string(),
3017
- action: z17.object({
3018
- type: z17.literal("exec"),
3019
- command: z17.array(z17.string()),
3020
- timeout_ms: z17.number().optional(),
3021
- user: z17.string().optional(),
3022
- working_directory: z17.string().optional(),
3023
- env: z17.record(z17.string(), z17.string()).optional()
3252
+ z18.object({
3253
+ type: z18.literal("local_shell_call"),
3254
+ id: z18.string(),
3255
+ call_id: z18.string(),
3256
+ action: z18.object({
3257
+ type: z18.literal("exec"),
3258
+ command: z18.array(z18.string()),
3259
+ timeout_ms: z18.number().optional(),
3260
+ user: z18.string().optional(),
3261
+ working_directory: z18.string().optional(),
3262
+ env: z18.record(z18.string(), z18.string()).optional()
3024
3263
  })
3025
3264
  }),
3026
- z17.object({
3027
- type: z17.literal("computer_call"),
3028
- id: z17.string(),
3029
- status: z17.literal("completed")
3265
+ z18.object({
3266
+ type: z18.literal("computer_call"),
3267
+ id: z18.string(),
3268
+ status: z18.literal("completed")
3030
3269
  })
3031
3270
  ])
3032
3271
  }),
3033
- z17.object({
3034
- type: z17.literal("response.function_call_arguments.delta"),
3035
- item_id: z17.string(),
3036
- output_index: z17.number(),
3037
- delta: z17.string()
3272
+ z18.object({
3273
+ type: z18.literal("response.function_call_arguments.delta"),
3274
+ item_id: z18.string(),
3275
+ output_index: z18.number(),
3276
+ delta: z18.string()
3038
3277
  }),
3039
- z17.object({
3040
- type: z17.literal("response.image_generation_call.partial_image"),
3041
- item_id: z17.string(),
3042
- output_index: z17.number(),
3043
- partial_image_b64: z17.string()
3278
+ z18.object({
3279
+ type: z18.literal("response.image_generation_call.partial_image"),
3280
+ item_id: z18.string(),
3281
+ output_index: z18.number(),
3282
+ partial_image_b64: z18.string()
3044
3283
  }),
3045
- z17.object({
3046
- type: z17.literal("response.code_interpreter_call_code.delta"),
3047
- item_id: z17.string(),
3048
- output_index: z17.number(),
3049
- delta: z17.string()
3284
+ z18.object({
3285
+ type: z18.literal("response.code_interpreter_call_code.delta"),
3286
+ item_id: z18.string(),
3287
+ output_index: z18.number(),
3288
+ delta: z18.string()
3050
3289
  }),
3051
- z17.object({
3052
- type: z17.literal("response.code_interpreter_call_code.done"),
3053
- item_id: z17.string(),
3054
- output_index: z17.number(),
3055
- code: z17.string()
3290
+ z18.object({
3291
+ type: z18.literal("response.code_interpreter_call_code.done"),
3292
+ item_id: z18.string(),
3293
+ output_index: z18.number(),
3294
+ code: z18.string()
3056
3295
  }),
3057
- z17.object({
3058
- type: z17.literal("response.output_text.annotation.added"),
3059
- annotation: z17.discriminatedUnion("type", [
3060
- z17.object({
3061
- type: z17.literal("url_citation"),
3062
- start_index: z17.number(),
3063
- end_index: z17.number(),
3064
- url: z17.string(),
3065
- title: z17.string()
3296
+ z18.object({
3297
+ type: z18.literal("response.output_text.annotation.added"),
3298
+ annotation: z18.discriminatedUnion("type", [
3299
+ z18.object({
3300
+ type: z18.literal("url_citation"),
3301
+ start_index: z18.number(),
3302
+ end_index: z18.number(),
3303
+ url: z18.string(),
3304
+ title: z18.string()
3066
3305
  }),
3067
- z17.object({
3068
- type: z17.literal("file_citation"),
3069
- file_id: z17.string(),
3070
- filename: z17.string().nullish(),
3071
- index: z17.number().nullish(),
3072
- start_index: z17.number().nullish(),
3073
- end_index: z17.number().nullish(),
3074
- quote: z17.string().nullish()
3306
+ z18.object({
3307
+ type: z18.literal("file_citation"),
3308
+ file_id: z18.string(),
3309
+ filename: z18.string().nullish(),
3310
+ index: z18.number().nullish(),
3311
+ start_index: z18.number().nullish(),
3312
+ end_index: z18.number().nullish(),
3313
+ quote: z18.string().nullish()
3075
3314
  })
3076
3315
  ])
3077
3316
  }),
3078
- z17.object({
3079
- type: z17.literal("response.reasoning_summary_part.added"),
3080
- item_id: z17.string(),
3081
- summary_index: z17.number()
3317
+ z18.object({
3318
+ type: z18.literal("response.reasoning_summary_part.added"),
3319
+ item_id: z18.string(),
3320
+ summary_index: z18.number()
3082
3321
  }),
3083
- z17.object({
3084
- type: z17.literal("response.reasoning_summary_text.delta"),
3085
- item_id: z17.string(),
3086
- summary_index: z17.number(),
3087
- delta: z17.string()
3322
+ z18.object({
3323
+ type: z18.literal("response.reasoning_summary_text.delta"),
3324
+ item_id: z18.string(),
3325
+ summary_index: z18.number(),
3326
+ delta: z18.string()
3088
3327
  }),
3089
- z17.object({
3090
- type: z17.literal("response.reasoning_summary_part.done"),
3091
- item_id: z17.string(),
3092
- summary_index: z17.number()
3328
+ z18.object({
3329
+ type: z18.literal("response.reasoning_summary_part.done"),
3330
+ item_id: z18.string(),
3331
+ summary_index: z18.number()
3093
3332
  }),
3094
- z17.object({
3095
- type: z17.literal("error"),
3096
- sequence_number: z17.number(),
3097
- error: z17.object({
3098
- type: z17.string(),
3099
- code: z17.string(),
3100
- message: z17.string(),
3101
- param: z17.string().nullish()
3333
+ z18.object({
3334
+ type: z18.literal("error"),
3335
+ sequence_number: z18.number(),
3336
+ error: z18.object({
3337
+ type: z18.string(),
3338
+ code: z18.string(),
3339
+ message: z18.string(),
3340
+ param: z18.string().nullish()
3102
3341
  })
3103
3342
  }),
3104
- z17.object({ type: z17.string() }).loose().transform((value) => ({
3343
+ z18.object({ type: z18.string() }).loose().transform((value) => ({
3105
3344
  type: "unknown_chunk",
3106
3345
  message: value.type
3107
3346
  }))
@@ -3109,392 +3348,203 @@ var openaiResponsesChunkSchema = lazyValidator9(
3109
3348
  ])
3110
3349
  )
3111
3350
  );
3112
- var openaiResponsesResponseSchema = lazyValidator9(
3113
- () => zodSchema15(
3114
- z17.object({
3115
- id: z17.string().optional(),
3116
- created_at: z17.number().optional(),
3117
- error: z17.object({
3118
- message: z17.string(),
3119
- type: z17.string(),
3120
- param: z17.string().nullish(),
3121
- code: z17.string()
3351
+ var openaiResponsesResponseSchema = lazyValidator10(
3352
+ () => zodSchema16(
3353
+ z18.object({
3354
+ id: z18.string().optional(),
3355
+ created_at: z18.number().optional(),
3356
+ error: z18.object({
3357
+ message: z18.string(),
3358
+ type: z18.string(),
3359
+ param: z18.string().nullish(),
3360
+ code: z18.string()
3122
3361
  }).nullish(),
3123
- model: z17.string().optional(),
3124
- output: z17.array(
3125
- z17.discriminatedUnion("type", [
3126
- z17.object({
3127
- type: z17.literal("message"),
3128
- role: z17.literal("assistant"),
3129
- id: z17.string(),
3130
- phase: z17.enum(["commentary", "final_answer"]).nullish(),
3131
- content: z17.array(
3132
- z17.object({
3133
- type: z17.literal("output_text"),
3134
- text: z17.string(),
3135
- logprobs: z17.array(
3136
- z17.object({
3137
- token: z17.string(),
3138
- logprob: z17.number(),
3139
- top_logprobs: z17.array(
3140
- z17.object({
3141
- token: z17.string(),
3142
- logprob: z17.number()
3362
+ model: z18.string().optional(),
3363
+ output: z18.array(
3364
+ z18.discriminatedUnion("type", [
3365
+ z18.object({
3366
+ type: z18.literal("message"),
3367
+ role: z18.literal("assistant"),
3368
+ id: z18.string(),
3369
+ phase: z18.enum(["commentary", "final_answer"]).nullish(),
3370
+ content: z18.array(
3371
+ z18.object({
3372
+ type: z18.literal("output_text"),
3373
+ text: z18.string(),
3374
+ logprobs: z18.array(
3375
+ z18.object({
3376
+ token: z18.string(),
3377
+ logprob: z18.number(),
3378
+ top_logprobs: z18.array(
3379
+ z18.object({
3380
+ token: z18.string(),
3381
+ logprob: z18.number()
3143
3382
  })
3144
3383
  )
3145
3384
  })
3146
3385
  ).nullish(),
3147
- annotations: z17.array(
3148
- z17.discriminatedUnion("type", [
3149
- z17.object({
3150
- type: z17.literal("url_citation"),
3151
- start_index: z17.number(),
3152
- end_index: z17.number(),
3153
- url: z17.string(),
3154
- title: z17.string()
3386
+ annotations: z18.array(
3387
+ z18.discriminatedUnion("type", [
3388
+ z18.object({
3389
+ type: z18.literal("url_citation"),
3390
+ start_index: z18.number(),
3391
+ end_index: z18.number(),
3392
+ url: z18.string(),
3393
+ title: z18.string()
3155
3394
  }),
3156
- z17.object({
3157
- type: z17.literal("file_citation"),
3158
- file_id: z17.string(),
3159
- filename: z17.string().nullish(),
3160
- index: z17.number().nullish(),
3161
- start_index: z17.number().nullish(),
3162
- end_index: z17.number().nullish(),
3163
- quote: z17.string().nullish()
3395
+ z18.object({
3396
+ type: z18.literal("file_citation"),
3397
+ file_id: z18.string(),
3398
+ filename: z18.string().nullish(),
3399
+ index: z18.number().nullish(),
3400
+ start_index: z18.number().nullish(),
3401
+ end_index: z18.number().nullish(),
3402
+ quote: z18.string().nullish()
3164
3403
  }),
3165
- z17.object({
3166
- type: z17.literal("container_file_citation"),
3167
- container_id: z17.string(),
3168
- file_id: z17.string(),
3169
- filename: z17.string().nullish(),
3170
- start_index: z17.number().nullish(),
3171
- end_index: z17.number().nullish(),
3172
- index: z17.number().nullish()
3404
+ z18.object({
3405
+ type: z18.literal("container_file_citation"),
3406
+ container_id: z18.string(),
3407
+ file_id: z18.string(),
3408
+ filename: z18.string().nullish(),
3409
+ start_index: z18.number().nullish(),
3410
+ end_index: z18.number().nullish(),
3411
+ index: z18.number().nullish()
3173
3412
  }),
3174
- z17.object({
3175
- type: z17.literal("file_path"),
3176
- file_id: z17.string(),
3177
- index: z17.number().nullish()
3413
+ z18.object({
3414
+ type: z18.literal("file_path"),
3415
+ file_id: z18.string(),
3416
+ index: z18.number().nullish()
3178
3417
  })
3179
3418
  ])
3180
3419
  )
3181
3420
  })
3182
3421
  )
3183
3422
  }),
3184
- z17.object({
3185
- type: z17.literal("web_search_call"),
3186
- id: z17.string(),
3187
- status: z17.string(),
3188
- action: z17.discriminatedUnion("type", [
3189
- z17.object({
3190
- type: z17.literal("search"),
3191
- query: z17.string().nullish(),
3192
- sources: z17.array(
3193
- z17.discriminatedUnion("type", [
3194
- z17.object({ type: z17.literal("url"), url: z17.string() }),
3195
- z17.object({
3196
- type: z17.literal("api"),
3197
- name: z17.string()
3423
+ z18.object({
3424
+ type: z18.literal("web_search_call"),
3425
+ id: z18.string(),
3426
+ status: z18.string(),
3427
+ action: z18.discriminatedUnion("type", [
3428
+ z18.object({
3429
+ type: z18.literal("search"),
3430
+ query: z18.string().nullish(),
3431
+ sources: z18.array(
3432
+ z18.discriminatedUnion("type", [
3433
+ z18.object({ type: z18.literal("url"), url: z18.string() }),
3434
+ z18.object({
3435
+ type: z18.literal("api"),
3436
+ name: z18.string()
3198
3437
  })
3199
3438
  ])
3200
3439
  ).nullish()
3201
3440
  }),
3202
- z17.object({
3203
- type: z17.literal("open_page"),
3204
- url: z17.string().nullish()
3441
+ z18.object({
3442
+ type: z18.literal("open_page"),
3443
+ url: z18.string().nullish()
3205
3444
  }),
3206
- z17.object({
3207
- type: z17.literal("find_in_page"),
3208
- url: z17.string().nullish(),
3209
- pattern: z17.string().nullish()
3445
+ z18.object({
3446
+ type: z18.literal("find_in_page"),
3447
+ url: z18.string().nullish(),
3448
+ pattern: z18.string().nullish()
3210
3449
  })
3211
3450
  ]).nullish()
3212
3451
  }),
3213
- z17.object({
3214
- type: z17.literal("file_search_call"),
3215
- id: z17.string(),
3216
- queries: z17.array(z17.string()),
3217
- results: z17.array(
3218
- z17.object({
3219
- attributes: z17.record(
3220
- z17.string(),
3221
- z17.union([z17.string(), z17.number(), z17.boolean()])
3452
+ z18.object({
3453
+ type: z18.literal("file_search_call"),
3454
+ id: z18.string(),
3455
+ queries: z18.array(z18.string()),
3456
+ results: z18.array(
3457
+ z18.object({
3458
+ attributes: z18.record(
3459
+ z18.string(),
3460
+ z18.union([z18.string(), z18.number(), z18.boolean()])
3222
3461
  ),
3223
- file_id: z17.string(),
3224
- filename: z17.string(),
3225
- score: z17.number(),
3226
- text: z17.string()
3462
+ file_id: z18.string(),
3463
+ filename: z18.string(),
3464
+ score: z18.number(),
3465
+ text: z18.string()
3227
3466
  })
3228
3467
  ).nullish()
3229
3468
  }),
3230
- z17.object({
3231
- type: z17.literal("code_interpreter_call"),
3232
- id: z17.string(),
3233
- code: z17.string().nullable(),
3234
- container_id: z17.string(),
3235
- outputs: z17.array(
3236
- z17.discriminatedUnion("type", [
3237
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3238
- z17.object({ type: z17.literal("image"), url: z17.string() })
3469
+ z18.object({
3470
+ type: z18.literal("code_interpreter_call"),
3471
+ id: z18.string(),
3472
+ code: z18.string().nullable(),
3473
+ container_id: z18.string(),
3474
+ outputs: z18.array(
3475
+ z18.discriminatedUnion("type", [
3476
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3477
+ z18.object({ type: z18.literal("image"), url: z18.string() })
3239
3478
  ])
3240
3479
  ).nullable()
3241
3480
  }),
3242
- z17.object({
3243
- type: z17.literal("image_generation_call"),
3244
- id: z17.string(),
3245
- result: z17.string()
3481
+ z18.object({
3482
+ type: z18.literal("image_generation_call"),
3483
+ id: z18.string(),
3484
+ result: z18.string()
3246
3485
  }),
3247
- z17.object({
3248
- type: z17.literal("local_shell_call"),
3249
- id: z17.string(),
3250
- call_id: z17.string(),
3251
- action: z17.object({
3252
- type: z17.literal("exec"),
3253
- command: z17.array(z17.string()),
3254
- timeout_ms: z17.number().optional(),
3255
- user: z17.string().optional(),
3256
- working_directory: z17.string().optional(),
3257
- env: z17.record(z17.string(), z17.string()).optional()
3486
+ z18.object({
3487
+ type: z18.literal("local_shell_call"),
3488
+ id: z18.string(),
3489
+ call_id: z18.string(),
3490
+ action: z18.object({
3491
+ type: z18.literal("exec"),
3492
+ command: z18.array(z18.string()),
3493
+ timeout_ms: z18.number().optional(),
3494
+ user: z18.string().optional(),
3495
+ working_directory: z18.string().optional(),
3496
+ env: z18.record(z18.string(), z18.string()).optional()
3258
3497
  })
3259
3498
  }),
3260
- z17.object({
3261
- type: z17.literal("function_call"),
3262
- call_id: z17.string(),
3263
- name: z17.string(),
3264
- arguments: z17.string(),
3265
- id: z17.string(),
3266
- async: z17.boolean().nullish()
3499
+ z18.object({
3500
+ type: z18.literal("function_call"),
3501
+ call_id: z18.string(),
3502
+ name: z18.string(),
3503
+ arguments: z18.string(),
3504
+ id: z18.string(),
3505
+ async: z18.boolean().nullish()
3267
3506
  }),
3268
- z17.object({
3269
- type: z17.literal("computer_call"),
3270
- id: z17.string(),
3271
- status: z17.string().optional()
3507
+ z18.object({
3508
+ type: z18.literal("computer_call"),
3509
+ id: z18.string(),
3510
+ status: z18.string().optional()
3272
3511
  }),
3273
- z17.object({
3274
- type: z17.literal("reasoning"),
3275
- id: z17.string(),
3276
- encrypted_content: z17.string().nullish(),
3277
- summary: z17.array(
3278
- z17.object({
3279
- type: z17.literal("summary_text"),
3280
- text: z17.string()
3512
+ z18.object({
3513
+ type: z18.literal("reasoning"),
3514
+ id: z18.string(),
3515
+ encrypted_content: z18.string().nullish(),
3516
+ summary: z18.array(
3517
+ z18.object({
3518
+ type: z18.literal("summary_text"),
3519
+ text: z18.string()
3281
3520
  })
3282
3521
  )
3283
3522
  })
3284
3523
  ])
3285
3524
  ).optional(),
3286
- service_tier: z17.string().nullish(),
3287
- reasoning: z17.object({
3288
- context: z17.string().nullish()
3525
+ service_tier: z18.string().nullish(),
3526
+ reasoning: z18.object({
3527
+ context: z18.string().nullish()
3289
3528
  }).nullish(),
3290
- incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3291
- usage: z17.object({
3292
- input_tokens: z17.number(),
3293
- input_tokens_details: z17.object({
3294
- cached_tokens: z17.number().nullish(),
3295
- cache_write_tokens: z17.number().nullish(),
3296
- orchestration_input_tokens: z17.number().nullish(),
3297
- orchestration_input_cached_tokens: z17.number().nullish()
3529
+ incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3530
+ usage: z18.object({
3531
+ input_tokens: z18.number(),
3532
+ input_tokens_details: z18.object({
3533
+ cached_tokens: z18.number().nullish(),
3534
+ cache_write_tokens: z18.number().nullish(),
3535
+ orchestration_input_tokens: z18.number().nullish(),
3536
+ orchestration_input_cached_tokens: z18.number().nullish()
3298
3537
  }).nullish(),
3299
- output_tokens: z17.number(),
3300
- output_tokens_details: z17.object({
3301
- reasoning_tokens: z17.number().nullish(),
3302
- orchestration_output_tokens: z17.number().nullish()
3538
+ output_tokens: z18.number(),
3539
+ output_tokens_details: z18.object({
3540
+ reasoning_tokens: z18.number().nullish(),
3541
+ orchestration_output_tokens: z18.number().nullish()
3303
3542
  }).nullish()
3304
3543
  }).optional()
3305
3544
  })
3306
3545
  )
3307
3546
  );
3308
3547
 
3309
- // src/responses/openai-responses-options.ts
3310
- import {
3311
- lazyValidator as lazyValidator10,
3312
- zodSchema as zodSchema16
3313
- } from "@ai-sdk/provider-utils";
3314
- import { z as z18 } from "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 = lazyValidator10(
3404
- () => zodSchema16(
3405
- z18.object({
3406
- conversation: z18.string().nullish(),
3407
- include: z18.array(
3408
- z18.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: z18.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: z18.union([z18.boolean(), z18.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: z18.number().nullish(),
3435
- metadata: z18.any().nullish(),
3436
- parallelToolCalls: z18.boolean().nullish(),
3437
- previousResponseId: z18.string().nullish(),
3438
- promptCacheKey: z18.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: z18.object({
3445
- mode: z18.enum(["implicit", "explicit"]).optional(),
3446
- ttl: z18.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: z18.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: z18.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: z18.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: z18.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: z18.enum(["auto", "current_turn", "all_turns"]).optional(),
3486
- reasoningSummary: z18.string().nullish(),
3487
- safetyIdentifier: z18.string().nullish(),
3488
- serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
3489
- store: z18.boolean().nullish(),
3490
- strictJsonSchema: z18.boolean().nullish(),
3491
- textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
3492
- truncation: z18.enum(["auto", "disabled"]).nullish(),
3493
- user: z18.string().nullish()
3494
- })
3495
- )
3496
- );
3497
-
3498
3548
  // src/responses/openai-responses-prepare-tools.ts
3499
3549
  import {
3500
3550
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
@@ -3669,6 +3719,18 @@ function resolveAsyncToolOption({
3669
3719
  }
3670
3720
 
3671
3721
  // src/responses/openai-responses-language-model.ts
3722
+ function getConfigurationUpdateUnsupportedReason({
3723
+ modelCapabilities,
3724
+ options
3725
+ }) {
3726
+ if (!modelCapabilities.supportsConfigurationUpdate) {
3727
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
3728
+ }
3729
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
3730
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
3731
+ }
3732
+ return void 0;
3733
+ }
3672
3734
  var OpenAIResponsesLanguageModel = class {
3673
3735
  constructor(modelId, config) {
3674
3736
  this.specificationVersion = "v2";
@@ -3733,8 +3795,14 @@ var OpenAIResponsesLanguageModel = class {
3733
3795
  details: "conversation and previousResponseId cannot be used together"
3734
3796
  });
3735
3797
  }
3798
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
3799
+ modelCapabilities,
3800
+ options: openaiOptions
3801
+ });
3736
3802
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
3737
3803
  prompt,
3804
+ configurationUpdateUnsupportedReason,
3805
+ providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
3738
3806
  systemMessageMode: modelCapabilities.systemMessageMode,
3739
3807
  explicitMessageItemType: this.config.explicitMessageItemType,
3740
3808
  fileIdPrefixes: this.config.fileIdPrefixes,
@@ -3754,18 +3822,27 @@ var OpenAIResponsesLanguageModel = class {
3754
3822
  resolvedReasoningEffort = void 0;
3755
3823
  }
3756
3824
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
3757
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
3758
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
3825
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
3759
3826
  warnings.push({
3760
3827
  type: "unsupported-setting",
3761
3828
  setting: "reasoningEffortUpdate",
3762
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
3829
+ details: configurationUpdateUnsupportedReason
3763
3830
  });
3764
3831
  } else if (reasoningEffortUpdate != null) {
3765
- input.unshift({
3766
- type: "configuration_update",
3767
- reasoning: { effort: reasoningEffortUpdate }
3768
- });
3832
+ const firstItem = input[0];
3833
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
3834
+ input.unshift({
3835
+ type: "configuration_update",
3836
+ reasoning: { effort: reasoningEffortUpdate }
3837
+ });
3838
+ }
3839
+ }
3840
+ for (let i = 1; i < input.length; i++) {
3841
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
3842
+ throw new UnsupportedFunctionalityError6({
3843
+ functionality: "Adjacent reasoning effort configuration updates"
3844
+ });
3845
+ }
3769
3846
  }
3770
3847
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3771
3848
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
@@ -4420,7 +4497,7 @@ var OpenAIResponsesLanguageModel = class {
4420
4497
  providerExecuted: true
4421
4498
  });
4422
4499
  } else if (value.item.type === "message") {
4423
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
4500
+ ongoingAnnotations.splice(0);
4424
4501
  activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
4425
4502
  controller.enqueue({
4426
4503
  type: "text-start",
@@ -5236,7 +5313,7 @@ var OpenAITranscriptionModel = class {
5236
5313
  };
5237
5314
 
5238
5315
  // src/version.ts
5239
- var VERSION = true ? "2.0.128" : "0.0.0-test";
5316
+ var VERSION = true ? "2.0.130" : "0.0.0-test";
5240
5317
 
5241
5318
  // src/openai-provider.ts
5242
5319
  function createOpenAI(options = {}) {