@ai-sdk/openai 4.0.0-beta.0 → 4.0.0-beta.10

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/dist/index.d.mts +69 -22
  3. package/dist/index.d.ts +69 -22
  4. package/dist/index.js +1172 -872
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1126 -821
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/internal/index.d.mts +56 -28
  9. package/dist/internal/index.d.ts +56 -28
  10. package/dist/internal/index.js +1201 -911
  11. package/dist/internal/index.js.map +1 -1
  12. package/dist/internal/index.mjs +1183 -888
  13. package/dist/internal/index.mjs.map +1 -1
  14. package/docs/03-openai.mdx +142 -3
  15. package/package.json +3 -3
  16. package/src/chat/convert-openai-chat-usage.ts +2 -2
  17. package/src/chat/convert-to-openai-chat-messages.ts +5 -5
  18. package/src/chat/map-openai-finish-reason.ts +2 -2
  19. package/src/chat/openai-chat-language-model.ts +22 -22
  20. package/src/chat/openai-chat-options.ts +5 -0
  21. package/src/chat/openai-chat-prepare-tools.ts +6 -6
  22. package/src/completion/convert-openai-completion-usage.ts +2 -2
  23. package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
  24. package/src/completion/map-openai-finish-reason.ts +2 -2
  25. package/src/completion/openai-completion-language-model.ts +20 -20
  26. package/src/embedding/openai-embedding-model.ts +5 -5
  27. package/src/image/openai-image-model.ts +9 -9
  28. package/src/openai-language-model-capabilities.ts +5 -2
  29. package/src/openai-provider.ts +21 -21
  30. package/src/openai-tools.ts +12 -1
  31. package/src/responses/convert-openai-responses-usage.ts +2 -2
  32. package/src/responses/convert-to-openai-responses-input.ts +116 -12
  33. package/src/responses/map-openai-responses-finish-reason.ts +2 -2
  34. package/src/responses/openai-responses-api.ts +87 -1
  35. package/src/responses/openai-responses-language-model.ts +168 -33
  36. package/src/responses/openai-responses-options.ts +10 -0
  37. package/src/responses/openai-responses-prepare-tools.ts +34 -9
  38. package/src/speech/openai-speech-model.ts +7 -7
  39. package/src/tool/custom.ts +0 -6
  40. package/src/tool/tool-search.ts +98 -0
  41. package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
44
44
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
45
45
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
46
46
  const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
47
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
47
+ const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
48
48
  const systemMessageMode = isReasoningModel ? "developer" : "system";
49
49
  return {
50
50
  supportsFlexProcessing,
@@ -639,7 +639,7 @@ function prepareChatTools({
639
639
  // src/chat/openai-chat-language-model.ts
640
640
  var OpenAIChatLanguageModel = class {
641
641
  constructor(modelId, config) {
642
- this.specificationVersion = "v3";
642
+ this.specificationVersion = "v4";
643
643
  this.supportedUrls = {
644
644
  "image/*": [/^https?:\/\/.*$/]
645
645
  };
@@ -1383,7 +1383,7 @@ var openaiLanguageModelCompletionOptions = lazySchema4(
1383
1383
  // src/completion/openai-completion-language-model.ts
1384
1384
  var OpenAICompletionLanguageModel = class {
1385
1385
  constructor(modelId, config) {
1386
- this.specificationVersion = "v3";
1386
+ this.specificationVersion = "v4";
1387
1387
  this.supportedUrls = {
1388
1388
  // No URLs are supported for completion models.
1389
1389
  };
@@ -1655,7 +1655,7 @@ var openaiTextEmbeddingResponseSchema = lazySchema6(
1655
1655
  // src/embedding/openai-embedding-model.ts
1656
1656
  var OpenAIEmbeddingModel = class {
1657
1657
  constructor(modelId, config) {
1658
- this.specificationVersion = "v3";
1658
+ this.specificationVersion = "v4";
1659
1659
  this.maxEmbeddingsPerCall = 2048;
1660
1660
  this.supportsParallelCalls = true;
1661
1661
  this.modelId = modelId;
@@ -1784,7 +1784,7 @@ var OpenAIImageModel = class {
1784
1784
  constructor(modelId, config) {
1785
1785
  this.modelId = modelId;
1786
1786
  this.config = config;
1787
- this.specificationVersion = "v3";
1787
+ this.specificationVersion = "v4";
1788
1788
  }
1789
1789
  get maxImagesPerCall() {
1790
1790
  var _a;
@@ -2076,7 +2076,6 @@ import { z as z11 } from "zod/v4";
2076
2076
  var customArgsSchema = lazySchema10(
2077
2077
  () => zodSchema10(
2078
2078
  z11.object({
2079
- name: z11.string(),
2080
2079
  description: z11.string().optional(),
2081
2080
  format: z11.union([
2082
2081
  z11.object({
@@ -2321,74 +2320,56 @@ var shell = createProviderToolFactoryWithOutputSchema6({
2321
2320
  outputSchema: shellOutputSchema
2322
2321
  });
2323
2322
 
2324
- // src/tool/web-search.ts
2323
+ // src/tool/tool-search.ts
2325
2324
  import {
2326
2325
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2327
2326
  lazySchema as lazySchema15,
2328
2327
  zodSchema as zodSchema15
2329
2328
  } from "@ai-sdk/provider-utils";
2330
2329
  import { z as z16 } from "zod/v4";
2331
- var webSearchArgsSchema = lazySchema15(
2330
+ var toolSearchArgsSchema = lazySchema15(
2332
2331
  () => zodSchema15(
2333
2332
  z16.object({
2334
- externalWebAccess: z16.boolean().optional(),
2335
- filters: z16.object({ allowedDomains: z16.array(z16.string()).optional() }).optional(),
2336
- searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
2337
- userLocation: z16.object({
2338
- type: z16.literal("approximate"),
2339
- country: z16.string().optional(),
2340
- city: z16.string().optional(),
2341
- region: z16.string().optional(),
2342
- timezone: z16.string().optional()
2343
- }).optional()
2333
+ execution: z16.enum(["server", "client"]).optional(),
2334
+ description: z16.string().optional(),
2335
+ parameters: z16.record(z16.string(), z16.unknown()).optional()
2344
2336
  })
2345
2337
  )
2346
2338
  );
2347
- var webSearchInputSchema = lazySchema15(() => zodSchema15(z16.object({})));
2348
- var webSearchOutputSchema = lazySchema15(
2339
+ var toolSearchInputSchema = lazySchema15(
2349
2340
  () => zodSchema15(
2350
2341
  z16.object({
2351
- action: z16.discriminatedUnion("type", [
2352
- z16.object({
2353
- type: z16.literal("search"),
2354
- query: z16.string().optional()
2355
- }),
2356
- z16.object({
2357
- type: z16.literal("openPage"),
2358
- url: z16.string().nullish()
2359
- }),
2360
- z16.object({
2361
- type: z16.literal("findInPage"),
2362
- url: z16.string().nullish(),
2363
- pattern: z16.string().nullish()
2364
- })
2365
- ]).optional(),
2366
- sources: z16.array(
2367
- z16.discriminatedUnion("type", [
2368
- z16.object({ type: z16.literal("url"), url: z16.string() }),
2369
- z16.object({ type: z16.literal("api"), name: z16.string() })
2370
- ])
2371
- ).optional()
2342
+ arguments: z16.unknown().optional(),
2343
+ call_id: z16.string().nullish()
2372
2344
  })
2373
2345
  )
2374
2346
  );
2375
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2376
- id: "openai.web_search",
2377
- inputSchema: webSearchInputSchema,
2378
- outputSchema: webSearchOutputSchema
2347
+ var toolSearchOutputSchema = lazySchema15(
2348
+ () => zodSchema15(
2349
+ z16.object({
2350
+ tools: z16.array(z16.record(z16.string(), z16.unknown()))
2351
+ })
2352
+ )
2353
+ );
2354
+ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2355
+ id: "openai.tool_search",
2356
+ inputSchema: toolSearchInputSchema,
2357
+ outputSchema: toolSearchOutputSchema
2379
2358
  });
2380
- var webSearch = (args = {}) => webSearchToolFactory(args);
2359
+ var toolSearch = (args = {}) => toolSearchToolFactory(args);
2381
2360
 
2382
- // src/tool/web-search-preview.ts
2361
+ // src/tool/web-search.ts
2383
2362
  import {
2384
2363
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2385
2364
  lazySchema as lazySchema16,
2386
2365
  zodSchema as zodSchema16
2387
2366
  } from "@ai-sdk/provider-utils";
2388
2367
  import { z as z17 } from "zod/v4";
2389
- var webSearchPreviewArgsSchema = lazySchema16(
2368
+ var webSearchArgsSchema = lazySchema16(
2390
2369
  () => zodSchema16(
2391
2370
  z17.object({
2371
+ externalWebAccess: z17.boolean().optional(),
2372
+ filters: z17.object({ allowedDomains: z17.array(z17.string()).optional() }).optional(),
2392
2373
  searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
2393
2374
  userLocation: z17.object({
2394
2375
  type: z17.literal("approximate"),
@@ -2400,10 +2381,8 @@ var webSearchPreviewArgsSchema = lazySchema16(
2400
2381
  })
2401
2382
  )
2402
2383
  );
2403
- var webSearchPreviewInputSchema = lazySchema16(
2404
- () => zodSchema16(z17.object({}))
2405
- );
2406
- var webSearchPreviewOutputSchema = lazySchema16(
2384
+ var webSearchInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
2385
+ var webSearchOutputSchema = lazySchema16(
2407
2386
  () => zodSchema16(
2408
2387
  z17.object({
2409
2388
  action: z17.discriminatedUnion("type", [
@@ -2420,77 +2399,135 @@ var webSearchPreviewOutputSchema = lazySchema16(
2420
2399
  url: z17.string().nullish(),
2421
2400
  pattern: z17.string().nullish()
2422
2401
  })
2423
- ]).optional()
2402
+ ]).optional(),
2403
+ sources: z17.array(
2404
+ z17.discriminatedUnion("type", [
2405
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
2406
+ z17.object({ type: z17.literal("api"), name: z17.string() })
2407
+ ])
2408
+ ).optional()
2424
2409
  })
2425
2410
  )
2426
2411
  );
2427
- var webSearchPreview = createProviderToolFactoryWithOutputSchema8({
2428
- id: "openai.web_search_preview",
2429
- inputSchema: webSearchPreviewInputSchema,
2430
- outputSchema: webSearchPreviewOutputSchema
2412
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
2413
+ id: "openai.web_search",
2414
+ inputSchema: webSearchInputSchema,
2415
+ outputSchema: webSearchOutputSchema
2431
2416
  });
2417
+ var webSearch = (args = {}) => webSearchToolFactory(args);
2432
2418
 
2433
- // src/tool/mcp.ts
2419
+ // src/tool/web-search-preview.ts
2434
2420
  import {
2435
2421
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2436
2422
  lazySchema as lazySchema17,
2437
2423
  zodSchema as zodSchema17
2438
2424
  } from "@ai-sdk/provider-utils";
2439
2425
  import { z as z18 } from "zod/v4";
2440
- var jsonValueSchema = z18.lazy(
2441
- () => z18.union([
2442
- z18.string(),
2443
- z18.number(),
2444
- z18.boolean(),
2445
- z18.null(),
2446
- z18.array(jsonValueSchema),
2447
- z18.record(z18.string(), jsonValueSchema)
2448
- ])
2426
+ var webSearchPreviewArgsSchema = lazySchema17(
2427
+ () => zodSchema17(
2428
+ z18.object({
2429
+ searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
2430
+ userLocation: z18.object({
2431
+ type: z18.literal("approximate"),
2432
+ country: z18.string().optional(),
2433
+ city: z18.string().optional(),
2434
+ region: z18.string().optional(),
2435
+ timezone: z18.string().optional()
2436
+ }).optional()
2437
+ })
2438
+ )
2439
+ );
2440
+ var webSearchPreviewInputSchema = lazySchema17(
2441
+ () => zodSchema17(z18.object({}))
2449
2442
  );
2450
- var mcpArgsSchema = lazySchema17(
2443
+ var webSearchPreviewOutputSchema = lazySchema17(
2451
2444
  () => zodSchema17(
2452
2445
  z18.object({
2453
- serverLabel: z18.string(),
2454
- allowedTools: z18.union([
2455
- z18.array(z18.string()),
2446
+ action: z18.discriminatedUnion("type", [
2447
+ z18.object({
2448
+ type: z18.literal("search"),
2449
+ query: z18.string().optional()
2450
+ }),
2456
2451
  z18.object({
2457
- readOnly: z18.boolean().optional(),
2458
- toolNames: z18.array(z18.string()).optional()
2452
+ type: z18.literal("openPage"),
2453
+ url: z18.string().nullish()
2454
+ }),
2455
+ z18.object({
2456
+ type: z18.literal("findInPage"),
2457
+ url: z18.string().nullish(),
2458
+ pattern: z18.string().nullish()
2459
+ })
2460
+ ]).optional()
2461
+ })
2462
+ )
2463
+ );
2464
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
2465
+ id: "openai.web_search_preview",
2466
+ inputSchema: webSearchPreviewInputSchema,
2467
+ outputSchema: webSearchPreviewOutputSchema
2468
+ });
2469
+
2470
+ // src/tool/mcp.ts
2471
+ import {
2472
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
2473
+ lazySchema as lazySchema18,
2474
+ zodSchema as zodSchema18
2475
+ } from "@ai-sdk/provider-utils";
2476
+ import { z as z19 } from "zod/v4";
2477
+ var jsonValueSchema = z19.lazy(
2478
+ () => z19.union([
2479
+ z19.string(),
2480
+ z19.number(),
2481
+ z19.boolean(),
2482
+ z19.null(),
2483
+ z19.array(jsonValueSchema),
2484
+ z19.record(z19.string(), jsonValueSchema)
2485
+ ])
2486
+ );
2487
+ var mcpArgsSchema = lazySchema18(
2488
+ () => zodSchema18(
2489
+ z19.object({
2490
+ serverLabel: z19.string(),
2491
+ allowedTools: z19.union([
2492
+ z19.array(z19.string()),
2493
+ z19.object({
2494
+ readOnly: z19.boolean().optional(),
2495
+ toolNames: z19.array(z19.string()).optional()
2459
2496
  })
2460
2497
  ]).optional(),
2461
- authorization: z18.string().optional(),
2462
- connectorId: z18.string().optional(),
2463
- headers: z18.record(z18.string(), z18.string()).optional(),
2464
- requireApproval: z18.union([
2465
- z18.enum(["always", "never"]),
2466
- z18.object({
2467
- never: z18.object({
2468
- toolNames: z18.array(z18.string()).optional()
2498
+ authorization: z19.string().optional(),
2499
+ connectorId: z19.string().optional(),
2500
+ headers: z19.record(z19.string(), z19.string()).optional(),
2501
+ requireApproval: z19.union([
2502
+ z19.enum(["always", "never"]),
2503
+ z19.object({
2504
+ never: z19.object({
2505
+ toolNames: z19.array(z19.string()).optional()
2469
2506
  }).optional()
2470
2507
  })
2471
2508
  ]).optional(),
2472
- serverDescription: z18.string().optional(),
2473
- serverUrl: z18.string().optional()
2509
+ serverDescription: z19.string().optional(),
2510
+ serverUrl: z19.string().optional()
2474
2511
  }).refine(
2475
2512
  (v) => v.serverUrl != null || v.connectorId != null,
2476
2513
  "One of serverUrl or connectorId must be provided."
2477
2514
  )
2478
2515
  )
2479
2516
  );
2480
- var mcpInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
2481
- var mcpOutputSchema = lazySchema17(
2482
- () => zodSchema17(
2483
- z18.object({
2484
- type: z18.literal("call"),
2485
- serverLabel: z18.string(),
2486
- name: z18.string(),
2487
- arguments: z18.string(),
2488
- output: z18.string().nullish(),
2489
- error: z18.union([z18.string(), jsonValueSchema]).optional()
2517
+ var mcpInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
2518
+ var mcpOutputSchema = lazySchema18(
2519
+ () => zodSchema18(
2520
+ z19.object({
2521
+ type: z19.literal("call"),
2522
+ serverLabel: z19.string(),
2523
+ name: z19.string(),
2524
+ arguments: z19.string(),
2525
+ output: z19.string().nullish(),
2526
+ error: z19.union([z19.string(), jsonValueSchema]).optional()
2490
2527
  })
2491
2528
  )
2492
2529
  );
2493
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
2530
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema10({
2494
2531
  id: "openai.mcp",
2495
2532
  inputSchema: mcpInputSchema,
2496
2533
  outputSchema: mcpOutputSchema
@@ -2512,7 +2549,6 @@ var openaiTools = {
2512
2549
  * Lark syntax). The model returns a `custom_tool_call` output item whose
2513
2550
  * `input` field is a string matching the specified grammar.
2514
2551
  *
2515
- * @param name - The name of the custom tool.
2516
2552
  * @param description - An optional description of the tool.
2517
2553
  * @param format - The output format constraint (grammar type, syntax, and definition).
2518
2554
  */
@@ -2602,7 +2638,17 @@ var openaiTools = {
2602
2638
  * @param serverDescription - Optional description of the server.
2603
2639
  * @param serverUrl - URL for the MCP server.
2604
2640
  */
2605
- mcp
2641
+ mcp,
2642
+ /**
2643
+ * Tool search allows the model to dynamically search for and load deferred
2644
+ * tools into the model's context as needed. This helps reduce overall token
2645
+ * usage, cost, and latency by only loading tools when the model needs them.
2646
+ *
2647
+ * To use tool search, mark functions or namespaces with `defer_loading: true`
2648
+ * in the tools array. The model will use tool search to load these tools
2649
+ * when it determines they are needed.
2650
+ */
2651
+ toolSearch
2606
2652
  };
2607
2653
 
2608
2654
  // src/responses/openai-responses-language-model.ts
@@ -2665,10 +2711,11 @@ import {
2665
2711
  import {
2666
2712
  convertToBase64 as convertToBase642,
2667
2713
  isNonNullable,
2714
+ parseJSON,
2668
2715
  parseProviderOptions as parseProviderOptions4,
2669
2716
  validateTypes
2670
2717
  } from "@ai-sdk/provider-utils";
2671
- import { z as z19 } from "zod/v4";
2718
+ import { z as z20 } from "zod/v4";
2672
2719
  function isFileId(data, prefixes) {
2673
2720
  if (!prefixes) return false;
2674
2721
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2686,8 +2733,8 @@ async function convertToOpenAIResponsesInput({
2686
2733
  hasApplyPatchTool = false,
2687
2734
  customProviderToolNames
2688
2735
  }) {
2689
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2690
- const input = [];
2736
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2737
+ let input = [];
2691
2738
  const warnings = [];
2692
2739
  const processedApprovalIds = /* @__PURE__ */ new Set();
2693
2740
  for (const { role, content } of prompt) {
@@ -2790,6 +2837,32 @@ async function convertToOpenAIResponsesInput({
2790
2837
  if (hasConversation && id != null) {
2791
2838
  break;
2792
2839
  }
2840
+ const resolvedToolName = toolNameMapping.toProviderToolName(
2841
+ part.toolName
2842
+ );
2843
+ if (resolvedToolName === "tool_search") {
2844
+ if (store && id != null) {
2845
+ input.push({ type: "item_reference", id });
2846
+ break;
2847
+ }
2848
+ const parsedInput = typeof part.input === "string" ? await parseJSON({
2849
+ text: part.input,
2850
+ schema: toolSearchInputSchema
2851
+ }) : await validateTypes({
2852
+ value: part.input,
2853
+ schema: toolSearchInputSchema
2854
+ });
2855
+ const execution = parsedInput.call_id != null ? "client" : "server";
2856
+ input.push({
2857
+ type: "tool_search_call",
2858
+ id: id != null ? id : part.toolCallId,
2859
+ execution,
2860
+ call_id: (_g = parsedInput.call_id) != null ? _g : null,
2861
+ status: "completed",
2862
+ arguments: parsedInput.arguments
2863
+ });
2864
+ break;
2865
+ }
2793
2866
  if (part.providerExecuted) {
2794
2867
  if (store && id != null) {
2795
2868
  input.push({ type: "item_reference", id });
@@ -2800,9 +2873,6 @@ async function convertToOpenAIResponsesInput({
2800
2873
  input.push({ type: "item_reference", id });
2801
2874
  break;
2802
2875
  }
2803
- const resolvedToolName = toolNameMapping.toProviderToolName(
2804
- part.toolName
2805
- );
2806
2876
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2807
2877
  const parsedInput = await validateTypes({
2808
2878
  value: part.input,
@@ -2885,6 +2955,26 @@ async function convertToOpenAIResponsesInput({
2885
2955
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
2886
2956
  part.toolName
2887
2957
  );
2958
+ if (resolvedResultToolName === "tool_search") {
2959
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2960
+ if (store) {
2961
+ input.push({ type: "item_reference", id: itemId });
2962
+ } else if (part.output.type === "json") {
2963
+ const parsedOutput = await validateTypes({
2964
+ value: part.output.value,
2965
+ schema: toolSearchOutputSchema
2966
+ });
2967
+ input.push({
2968
+ type: "tool_search_output",
2969
+ id: itemId,
2970
+ execution: "server",
2971
+ call_id: null,
2972
+ status: "completed",
2973
+ tools: parsedOutput.tools
2974
+ });
2975
+ }
2976
+ break;
2977
+ }
2888
2978
  if (hasShellTool && resolvedResultToolName === "shell") {
2889
2979
  if (part.output.type === "json") {
2890
2980
  const parsedOutput = await validateTypes({
@@ -2907,7 +2997,7 @@ async function convertToOpenAIResponsesInput({
2907
2997
  break;
2908
2998
  }
2909
2999
  if (store) {
2910
- const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
3000
+ const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
2911
3001
  input.push({ type: "item_reference", id: itemId });
2912
3002
  } else {
2913
3003
  warnings.push({
@@ -3017,7 +3107,7 @@ async function convertToOpenAIResponsesInput({
3017
3107
  }
3018
3108
  const output = part.output;
3019
3109
  if (output.type === "execution-denied") {
3020
- const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
3110
+ const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
3021
3111
  if (approvalId) {
3022
3112
  continue;
3023
3113
  }
@@ -3025,6 +3115,20 @@ async function convertToOpenAIResponsesInput({
3025
3115
  const resolvedToolName = toolNameMapping.toProviderToolName(
3026
3116
  part.toolName
3027
3117
  );
3118
+ if (resolvedToolName === "tool_search" && output.type === "json") {
3119
+ const parsedOutput = await validateTypes({
3120
+ value: output.value,
3121
+ schema: toolSearchOutputSchema
3122
+ });
3123
+ input.push({
3124
+ type: "tool_search_output",
3125
+ execution: "client",
3126
+ call_id: part.toolCallId,
3127
+ status: "completed",
3128
+ tools: parsedOutput.tools
3129
+ });
3130
+ continue;
3131
+ }
3028
3132
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3029
3133
  const parsedOutput = await validateTypes({
3030
3134
  value: output.value,
@@ -3077,7 +3181,7 @@ async function convertToOpenAIResponsesInput({
3077
3181
  outputValue = output.value;
3078
3182
  break;
3079
3183
  case "execution-denied":
3080
- outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3184
+ outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
3081
3185
  break;
3082
3186
  case "json":
3083
3187
  case "error-json":
@@ -3131,7 +3235,7 @@ async function convertToOpenAIResponsesInput({
3131
3235
  contentValue = output.value;
3132
3236
  break;
3133
3237
  case "execution-denied":
3134
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3238
+ contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
3135
3239
  break;
3136
3240
  case "json":
3137
3241
  case "error-json":
@@ -3188,11 +3292,22 @@ async function convertToOpenAIResponsesInput({
3188
3292
  }
3189
3293
  }
3190
3294
  }
3295
+ if (!store && input.some(
3296
+ (item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
3297
+ )) {
3298
+ warnings.push({
3299
+ type: "other",
3300
+ message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
3301
+ });
3302
+ input = input.filter(
3303
+ (item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
3304
+ );
3305
+ }
3191
3306
  return { input, warnings };
3192
3307
  }
3193
- var openaiResponsesReasoningProviderOptionsSchema = z19.object({
3194
- itemId: z19.string().nullish(),
3195
- reasoningEncryptedContent: z19.string().nullish()
3308
+ var openaiResponsesReasoningProviderOptionsSchema = z20.object({
3309
+ itemId: z20.string().nullish(),
3310
+ reasoningEncryptedContent: z20.string().nullish()
3196
3311
  });
3197
3312
 
3198
3313
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3214,483 +3329,525 @@ function mapOpenAIResponseFinishReason({
3214
3329
  }
3215
3330
 
3216
3331
  // src/responses/openai-responses-api.ts
3217
- import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
3218
- import { z as z20 } from "zod/v4";
3219
- var openaiResponsesChunkSchema = lazySchema18(
3220
- () => zodSchema18(
3221
- z20.union([
3222
- z20.object({
3223
- type: z20.literal("response.output_text.delta"),
3224
- item_id: z20.string(),
3225
- delta: z20.string(),
3226
- logprobs: z20.array(
3227
- z20.object({
3228
- token: z20.string(),
3229
- logprob: z20.number(),
3230
- top_logprobs: z20.array(
3231
- z20.object({
3232
- token: z20.string(),
3233
- logprob: z20.number()
3332
+ import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3333
+ import { z as z21 } from "zod/v4";
3334
+ var jsonValueSchema2 = z21.lazy(
3335
+ () => z21.union([
3336
+ z21.string(),
3337
+ z21.number(),
3338
+ z21.boolean(),
3339
+ z21.null(),
3340
+ z21.array(jsonValueSchema2),
3341
+ z21.record(z21.string(), jsonValueSchema2.optional())
3342
+ ])
3343
+ );
3344
+ var openaiResponsesChunkSchema = lazySchema19(
3345
+ () => zodSchema19(
3346
+ z21.union([
3347
+ z21.object({
3348
+ type: z21.literal("response.output_text.delta"),
3349
+ item_id: z21.string(),
3350
+ delta: z21.string(),
3351
+ logprobs: z21.array(
3352
+ z21.object({
3353
+ token: z21.string(),
3354
+ logprob: z21.number(),
3355
+ top_logprobs: z21.array(
3356
+ z21.object({
3357
+ token: z21.string(),
3358
+ logprob: z21.number()
3234
3359
  })
3235
3360
  )
3236
3361
  })
3237
3362
  ).nullish()
3238
3363
  }),
3239
- z20.object({
3240
- type: z20.enum(["response.completed", "response.incomplete"]),
3241
- response: z20.object({
3242
- incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3243
- usage: z20.object({
3244
- input_tokens: z20.number(),
3245
- input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3246
- output_tokens: z20.number(),
3247
- output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
3364
+ z21.object({
3365
+ type: z21.enum(["response.completed", "response.incomplete"]),
3366
+ response: z21.object({
3367
+ incomplete_details: z21.object({ reason: z21.string() }).nullish(),
3368
+ usage: z21.object({
3369
+ input_tokens: z21.number(),
3370
+ input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
3371
+ output_tokens: z21.number(),
3372
+ output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3248
3373
  }),
3249
- service_tier: z20.string().nullish()
3374
+ service_tier: z21.string().nullish()
3250
3375
  })
3251
3376
  }),
3252
- z20.object({
3253
- type: z20.literal("response.created"),
3254
- response: z20.object({
3255
- id: z20.string(),
3256
- created_at: z20.number(),
3257
- model: z20.string(),
3258
- service_tier: z20.string().nullish()
3377
+ z21.object({
3378
+ type: z21.literal("response.created"),
3379
+ response: z21.object({
3380
+ id: z21.string(),
3381
+ created_at: z21.number(),
3382
+ model: z21.string(),
3383
+ service_tier: z21.string().nullish()
3259
3384
  })
3260
3385
  }),
3261
- z20.object({
3262
- type: z20.literal("response.output_item.added"),
3263
- output_index: z20.number(),
3264
- item: z20.discriminatedUnion("type", [
3265
- z20.object({
3266
- type: z20.literal("message"),
3267
- id: z20.string(),
3268
- phase: z20.enum(["commentary", "final_answer"]).nullish()
3386
+ z21.object({
3387
+ type: z21.literal("response.output_item.added"),
3388
+ output_index: z21.number(),
3389
+ item: z21.discriminatedUnion("type", [
3390
+ z21.object({
3391
+ type: z21.literal("message"),
3392
+ id: z21.string(),
3393
+ phase: z21.enum(["commentary", "final_answer"]).nullish()
3269
3394
  }),
3270
- z20.object({
3271
- type: z20.literal("reasoning"),
3272
- id: z20.string(),
3273
- encrypted_content: z20.string().nullish()
3395
+ z21.object({
3396
+ type: z21.literal("reasoning"),
3397
+ id: z21.string(),
3398
+ encrypted_content: z21.string().nullish()
3274
3399
  }),
3275
- z20.object({
3276
- type: z20.literal("function_call"),
3277
- id: z20.string(),
3278
- call_id: z20.string(),
3279
- name: z20.string(),
3280
- arguments: z20.string()
3400
+ z21.object({
3401
+ type: z21.literal("function_call"),
3402
+ id: z21.string(),
3403
+ call_id: z21.string(),
3404
+ name: z21.string(),
3405
+ arguments: z21.string()
3281
3406
  }),
3282
- z20.object({
3283
- type: z20.literal("web_search_call"),
3284
- id: z20.string(),
3285
- status: z20.string()
3407
+ z21.object({
3408
+ type: z21.literal("web_search_call"),
3409
+ id: z21.string(),
3410
+ status: z21.string()
3286
3411
  }),
3287
- z20.object({
3288
- type: z20.literal("computer_call"),
3289
- id: z20.string(),
3290
- status: z20.string()
3412
+ z21.object({
3413
+ type: z21.literal("computer_call"),
3414
+ id: z21.string(),
3415
+ status: z21.string()
3291
3416
  }),
3292
- z20.object({
3293
- type: z20.literal("file_search_call"),
3294
- id: z20.string()
3417
+ z21.object({
3418
+ type: z21.literal("file_search_call"),
3419
+ id: z21.string()
3295
3420
  }),
3296
- z20.object({
3297
- type: z20.literal("image_generation_call"),
3298
- id: z20.string()
3421
+ z21.object({
3422
+ type: z21.literal("image_generation_call"),
3423
+ id: z21.string()
3299
3424
  }),
3300
- z20.object({
3301
- type: z20.literal("code_interpreter_call"),
3302
- id: z20.string(),
3303
- container_id: z20.string(),
3304
- code: z20.string().nullable(),
3305
- outputs: z20.array(
3306
- z20.discriminatedUnion("type", [
3307
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3308
- z20.object({ type: z20.literal("image"), url: z20.string() })
3425
+ z21.object({
3426
+ type: z21.literal("code_interpreter_call"),
3427
+ id: z21.string(),
3428
+ container_id: z21.string(),
3429
+ code: z21.string().nullable(),
3430
+ outputs: z21.array(
3431
+ z21.discriminatedUnion("type", [
3432
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3433
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3309
3434
  ])
3310
3435
  ).nullable(),
3311
- status: z20.string()
3436
+ status: z21.string()
3312
3437
  }),
3313
- z20.object({
3314
- type: z20.literal("mcp_call"),
3315
- id: z20.string(),
3316
- status: z20.string(),
3317
- approval_request_id: z20.string().nullish()
3438
+ z21.object({
3439
+ type: z21.literal("mcp_call"),
3440
+ id: z21.string(),
3441
+ status: z21.string(),
3442
+ approval_request_id: z21.string().nullish()
3318
3443
  }),
3319
- z20.object({
3320
- type: z20.literal("mcp_list_tools"),
3321
- id: z20.string()
3444
+ z21.object({
3445
+ type: z21.literal("mcp_list_tools"),
3446
+ id: z21.string()
3322
3447
  }),
3323
- z20.object({
3324
- type: z20.literal("mcp_approval_request"),
3325
- id: z20.string()
3448
+ z21.object({
3449
+ type: z21.literal("mcp_approval_request"),
3450
+ id: z21.string()
3326
3451
  }),
3327
- z20.object({
3328
- type: z20.literal("apply_patch_call"),
3329
- id: z20.string(),
3330
- call_id: z20.string(),
3331
- status: z20.enum(["in_progress", "completed"]),
3332
- operation: z20.discriminatedUnion("type", [
3333
- z20.object({
3334
- type: z20.literal("create_file"),
3335
- path: z20.string(),
3336
- diff: z20.string()
3452
+ z21.object({
3453
+ type: z21.literal("apply_patch_call"),
3454
+ id: z21.string(),
3455
+ call_id: z21.string(),
3456
+ status: z21.enum(["in_progress", "completed"]),
3457
+ operation: z21.discriminatedUnion("type", [
3458
+ z21.object({
3459
+ type: z21.literal("create_file"),
3460
+ path: z21.string(),
3461
+ diff: z21.string()
3337
3462
  }),
3338
- z20.object({
3339
- type: z20.literal("delete_file"),
3340
- path: z20.string()
3463
+ z21.object({
3464
+ type: z21.literal("delete_file"),
3465
+ path: z21.string()
3341
3466
  }),
3342
- z20.object({
3343
- type: z20.literal("update_file"),
3344
- path: z20.string(),
3345
- diff: z20.string()
3467
+ z21.object({
3468
+ type: z21.literal("update_file"),
3469
+ path: z21.string(),
3470
+ diff: z21.string()
3346
3471
  })
3347
3472
  ])
3348
3473
  }),
3349
- z20.object({
3350
- type: z20.literal("custom_tool_call"),
3351
- id: z20.string(),
3352
- call_id: z20.string(),
3353
- name: z20.string(),
3354
- input: z20.string()
3474
+ z21.object({
3475
+ type: z21.literal("custom_tool_call"),
3476
+ id: z21.string(),
3477
+ call_id: z21.string(),
3478
+ name: z21.string(),
3479
+ input: z21.string()
3355
3480
  }),
3356
- z20.object({
3357
- type: z20.literal("shell_call"),
3358
- id: z20.string(),
3359
- call_id: z20.string(),
3360
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3361
- action: z20.object({
3362
- commands: z20.array(z20.string())
3481
+ z21.object({
3482
+ type: z21.literal("shell_call"),
3483
+ id: z21.string(),
3484
+ call_id: z21.string(),
3485
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3486
+ action: z21.object({
3487
+ commands: z21.array(z21.string())
3363
3488
  })
3364
3489
  }),
3365
- z20.object({
3366
- type: z20.literal("shell_call_output"),
3367
- id: z20.string(),
3368
- call_id: z20.string(),
3369
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3370
- output: z20.array(
3371
- z20.object({
3372
- stdout: z20.string(),
3373
- stderr: z20.string(),
3374
- outcome: z20.discriminatedUnion("type", [
3375
- z20.object({ type: z20.literal("timeout") }),
3376
- z20.object({
3377
- type: z20.literal("exit"),
3378
- exit_code: z20.number()
3490
+ z21.object({
3491
+ type: z21.literal("shell_call_output"),
3492
+ id: z21.string(),
3493
+ call_id: z21.string(),
3494
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3495
+ output: z21.array(
3496
+ z21.object({
3497
+ stdout: z21.string(),
3498
+ stderr: z21.string(),
3499
+ outcome: z21.discriminatedUnion("type", [
3500
+ z21.object({ type: z21.literal("timeout") }),
3501
+ z21.object({
3502
+ type: z21.literal("exit"),
3503
+ exit_code: z21.number()
3379
3504
  })
3380
3505
  ])
3381
3506
  })
3382
3507
  )
3508
+ }),
3509
+ z21.object({
3510
+ type: z21.literal("tool_search_call"),
3511
+ id: z21.string(),
3512
+ execution: z21.enum(["server", "client"]),
3513
+ call_id: z21.string().nullable(),
3514
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3515
+ arguments: z21.unknown()
3516
+ }),
3517
+ z21.object({
3518
+ type: z21.literal("tool_search_output"),
3519
+ id: z21.string(),
3520
+ execution: z21.enum(["server", "client"]),
3521
+ call_id: z21.string().nullable(),
3522
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3523
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3383
3524
  })
3384
3525
  ])
3385
3526
  }),
3386
- z20.object({
3387
- type: z20.literal("response.output_item.done"),
3388
- output_index: z20.number(),
3389
- item: z20.discriminatedUnion("type", [
3390
- z20.object({
3391
- type: z20.literal("message"),
3392
- id: z20.string(),
3393
- phase: z20.enum(["commentary", "final_answer"]).nullish()
3527
+ z21.object({
3528
+ type: z21.literal("response.output_item.done"),
3529
+ output_index: z21.number(),
3530
+ item: z21.discriminatedUnion("type", [
3531
+ z21.object({
3532
+ type: z21.literal("message"),
3533
+ id: z21.string(),
3534
+ phase: z21.enum(["commentary", "final_answer"]).nullish()
3394
3535
  }),
3395
- z20.object({
3396
- type: z20.literal("reasoning"),
3397
- id: z20.string(),
3398
- encrypted_content: z20.string().nullish()
3536
+ z21.object({
3537
+ type: z21.literal("reasoning"),
3538
+ id: z21.string(),
3539
+ encrypted_content: z21.string().nullish()
3399
3540
  }),
3400
- z20.object({
3401
- type: z20.literal("function_call"),
3402
- id: z20.string(),
3403
- call_id: z20.string(),
3404
- name: z20.string(),
3405
- arguments: z20.string(),
3406
- status: z20.literal("completed")
3541
+ z21.object({
3542
+ type: z21.literal("function_call"),
3543
+ id: z21.string(),
3544
+ call_id: z21.string(),
3545
+ name: z21.string(),
3546
+ arguments: z21.string(),
3547
+ status: z21.literal("completed")
3407
3548
  }),
3408
- z20.object({
3409
- type: z20.literal("custom_tool_call"),
3410
- id: z20.string(),
3411
- call_id: z20.string(),
3412
- name: z20.string(),
3413
- input: z20.string(),
3414
- status: z20.literal("completed")
3549
+ z21.object({
3550
+ type: z21.literal("custom_tool_call"),
3551
+ id: z21.string(),
3552
+ call_id: z21.string(),
3553
+ name: z21.string(),
3554
+ input: z21.string(),
3555
+ status: z21.literal("completed")
3415
3556
  }),
3416
- z20.object({
3417
- type: z20.literal("code_interpreter_call"),
3418
- id: z20.string(),
3419
- code: z20.string().nullable(),
3420
- container_id: z20.string(),
3421
- outputs: z20.array(
3422
- z20.discriminatedUnion("type", [
3423
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3424
- z20.object({ type: z20.literal("image"), url: z20.string() })
3557
+ z21.object({
3558
+ type: z21.literal("code_interpreter_call"),
3559
+ id: z21.string(),
3560
+ code: z21.string().nullable(),
3561
+ container_id: z21.string(),
3562
+ outputs: z21.array(
3563
+ z21.discriminatedUnion("type", [
3564
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3565
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3425
3566
  ])
3426
3567
  ).nullable()
3427
3568
  }),
3428
- z20.object({
3429
- type: z20.literal("image_generation_call"),
3430
- id: z20.string(),
3431
- result: z20.string()
3569
+ z21.object({
3570
+ type: z21.literal("image_generation_call"),
3571
+ id: z21.string(),
3572
+ result: z21.string()
3432
3573
  }),
3433
- z20.object({
3434
- type: z20.literal("web_search_call"),
3435
- id: z20.string(),
3436
- status: z20.string(),
3437
- action: z20.discriminatedUnion("type", [
3438
- z20.object({
3439
- type: z20.literal("search"),
3440
- query: z20.string().nullish(),
3441
- sources: z20.array(
3442
- z20.discriminatedUnion("type", [
3443
- z20.object({ type: z20.literal("url"), url: z20.string() }),
3444
- z20.object({ type: z20.literal("api"), name: z20.string() })
3574
+ z21.object({
3575
+ type: z21.literal("web_search_call"),
3576
+ id: z21.string(),
3577
+ status: z21.string(),
3578
+ action: z21.discriminatedUnion("type", [
3579
+ z21.object({
3580
+ type: z21.literal("search"),
3581
+ query: z21.string().nullish(),
3582
+ sources: z21.array(
3583
+ z21.discriminatedUnion("type", [
3584
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3585
+ z21.object({ type: z21.literal("api"), name: z21.string() })
3445
3586
  ])
3446
3587
  ).nullish()
3447
3588
  }),
3448
- z20.object({
3449
- type: z20.literal("open_page"),
3450
- url: z20.string().nullish()
3589
+ z21.object({
3590
+ type: z21.literal("open_page"),
3591
+ url: z21.string().nullish()
3451
3592
  }),
3452
- z20.object({
3453
- type: z20.literal("find_in_page"),
3454
- url: z20.string().nullish(),
3455
- pattern: z20.string().nullish()
3593
+ z21.object({
3594
+ type: z21.literal("find_in_page"),
3595
+ url: z21.string().nullish(),
3596
+ pattern: z21.string().nullish()
3456
3597
  })
3457
3598
  ]).nullish()
3458
3599
  }),
3459
- z20.object({
3460
- type: z20.literal("file_search_call"),
3461
- id: z20.string(),
3462
- queries: z20.array(z20.string()),
3463
- results: z20.array(
3464
- z20.object({
3465
- attributes: z20.record(
3466
- z20.string(),
3467
- z20.union([z20.string(), z20.number(), z20.boolean()])
3600
+ z21.object({
3601
+ type: z21.literal("file_search_call"),
3602
+ id: z21.string(),
3603
+ queries: z21.array(z21.string()),
3604
+ results: z21.array(
3605
+ z21.object({
3606
+ attributes: z21.record(
3607
+ z21.string(),
3608
+ z21.union([z21.string(), z21.number(), z21.boolean()])
3468
3609
  ),
3469
- file_id: z20.string(),
3470
- filename: z20.string(),
3471
- score: z20.number(),
3472
- text: z20.string()
3610
+ file_id: z21.string(),
3611
+ filename: z21.string(),
3612
+ score: z21.number(),
3613
+ text: z21.string()
3473
3614
  })
3474
3615
  ).nullish()
3475
3616
  }),
3476
- z20.object({
3477
- type: z20.literal("local_shell_call"),
3478
- id: z20.string(),
3479
- call_id: z20.string(),
3480
- action: z20.object({
3481
- type: z20.literal("exec"),
3482
- command: z20.array(z20.string()),
3483
- timeout_ms: z20.number().optional(),
3484
- user: z20.string().optional(),
3485
- working_directory: z20.string().optional(),
3486
- env: z20.record(z20.string(), z20.string()).optional()
3617
+ z21.object({
3618
+ type: z21.literal("local_shell_call"),
3619
+ id: z21.string(),
3620
+ call_id: z21.string(),
3621
+ action: z21.object({
3622
+ type: z21.literal("exec"),
3623
+ command: z21.array(z21.string()),
3624
+ timeout_ms: z21.number().optional(),
3625
+ user: z21.string().optional(),
3626
+ working_directory: z21.string().optional(),
3627
+ env: z21.record(z21.string(), z21.string()).optional()
3487
3628
  })
3488
3629
  }),
3489
- z20.object({
3490
- type: z20.literal("computer_call"),
3491
- id: z20.string(),
3492
- status: z20.literal("completed")
3630
+ z21.object({
3631
+ type: z21.literal("computer_call"),
3632
+ id: z21.string(),
3633
+ status: z21.literal("completed")
3493
3634
  }),
3494
- z20.object({
3495
- type: z20.literal("mcp_call"),
3496
- id: z20.string(),
3497
- status: z20.string(),
3498
- arguments: z20.string(),
3499
- name: z20.string(),
3500
- server_label: z20.string(),
3501
- output: z20.string().nullish(),
3502
- error: z20.union([
3503
- z20.string(),
3504
- z20.object({
3505
- type: z20.string().optional(),
3506
- code: z20.union([z20.number(), z20.string()]).optional(),
3507
- message: z20.string().optional()
3635
+ z21.object({
3636
+ type: z21.literal("mcp_call"),
3637
+ id: z21.string(),
3638
+ status: z21.string(),
3639
+ arguments: z21.string(),
3640
+ name: z21.string(),
3641
+ server_label: z21.string(),
3642
+ output: z21.string().nullish(),
3643
+ error: z21.union([
3644
+ z21.string(),
3645
+ z21.object({
3646
+ type: z21.string().optional(),
3647
+ code: z21.union([z21.number(), z21.string()]).optional(),
3648
+ message: z21.string().optional()
3508
3649
  }).loose()
3509
3650
  ]).nullish(),
3510
- approval_request_id: z20.string().nullish()
3651
+ approval_request_id: z21.string().nullish()
3511
3652
  }),
3512
- z20.object({
3513
- type: z20.literal("mcp_list_tools"),
3514
- id: z20.string(),
3515
- server_label: z20.string(),
3516
- tools: z20.array(
3517
- z20.object({
3518
- name: z20.string(),
3519
- description: z20.string().optional(),
3520
- input_schema: z20.any(),
3521
- annotations: z20.record(z20.string(), z20.unknown()).optional()
3653
+ z21.object({
3654
+ type: z21.literal("mcp_list_tools"),
3655
+ id: z21.string(),
3656
+ server_label: z21.string(),
3657
+ tools: z21.array(
3658
+ z21.object({
3659
+ name: z21.string(),
3660
+ description: z21.string().optional(),
3661
+ input_schema: z21.any(),
3662
+ annotations: z21.record(z21.string(), z21.unknown()).optional()
3522
3663
  })
3523
3664
  ),
3524
- error: z20.union([
3525
- z20.string(),
3526
- z20.object({
3527
- type: z20.string().optional(),
3528
- code: z20.union([z20.number(), z20.string()]).optional(),
3529
- message: z20.string().optional()
3665
+ error: z21.union([
3666
+ z21.string(),
3667
+ z21.object({
3668
+ type: z21.string().optional(),
3669
+ code: z21.union([z21.number(), z21.string()]).optional(),
3670
+ message: z21.string().optional()
3530
3671
  }).loose()
3531
3672
  ]).optional()
3532
3673
  }),
3533
- z20.object({
3534
- type: z20.literal("mcp_approval_request"),
3535
- id: z20.string(),
3536
- server_label: z20.string(),
3537
- name: z20.string(),
3538
- arguments: z20.string(),
3539
- approval_request_id: z20.string().optional()
3674
+ z21.object({
3675
+ type: z21.literal("mcp_approval_request"),
3676
+ id: z21.string(),
3677
+ server_label: z21.string(),
3678
+ name: z21.string(),
3679
+ arguments: z21.string(),
3680
+ approval_request_id: z21.string().optional()
3540
3681
  }),
3541
- z20.object({
3542
- type: z20.literal("apply_patch_call"),
3543
- id: z20.string(),
3544
- call_id: z20.string(),
3545
- status: z20.enum(["in_progress", "completed"]),
3546
- operation: z20.discriminatedUnion("type", [
3547
- z20.object({
3548
- type: z20.literal("create_file"),
3549
- path: z20.string(),
3550
- diff: z20.string()
3682
+ z21.object({
3683
+ type: z21.literal("apply_patch_call"),
3684
+ id: z21.string(),
3685
+ call_id: z21.string(),
3686
+ status: z21.enum(["in_progress", "completed"]),
3687
+ operation: z21.discriminatedUnion("type", [
3688
+ z21.object({
3689
+ type: z21.literal("create_file"),
3690
+ path: z21.string(),
3691
+ diff: z21.string()
3551
3692
  }),
3552
- z20.object({
3553
- type: z20.literal("delete_file"),
3554
- path: z20.string()
3693
+ z21.object({
3694
+ type: z21.literal("delete_file"),
3695
+ path: z21.string()
3555
3696
  }),
3556
- z20.object({
3557
- type: z20.literal("update_file"),
3558
- path: z20.string(),
3559
- diff: z20.string()
3697
+ z21.object({
3698
+ type: z21.literal("update_file"),
3699
+ path: z21.string(),
3700
+ diff: z21.string()
3560
3701
  })
3561
3702
  ])
3562
3703
  }),
3563
- z20.object({
3564
- type: z20.literal("shell_call"),
3565
- id: z20.string(),
3566
- call_id: z20.string(),
3567
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3568
- action: z20.object({
3569
- commands: z20.array(z20.string())
3704
+ z21.object({
3705
+ type: z21.literal("shell_call"),
3706
+ id: z21.string(),
3707
+ call_id: z21.string(),
3708
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3709
+ action: z21.object({
3710
+ commands: z21.array(z21.string())
3570
3711
  })
3571
3712
  }),
3572
- z20.object({
3573
- type: z20.literal("shell_call_output"),
3574
- id: z20.string(),
3575
- call_id: z20.string(),
3576
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3577
- output: z20.array(
3578
- z20.object({
3579
- stdout: z20.string(),
3580
- stderr: z20.string(),
3581
- outcome: z20.discriminatedUnion("type", [
3582
- z20.object({ type: z20.literal("timeout") }),
3583
- z20.object({
3584
- type: z20.literal("exit"),
3585
- exit_code: z20.number()
3713
+ z21.object({
3714
+ type: z21.literal("shell_call_output"),
3715
+ id: z21.string(),
3716
+ call_id: z21.string(),
3717
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3718
+ output: z21.array(
3719
+ z21.object({
3720
+ stdout: z21.string(),
3721
+ stderr: z21.string(),
3722
+ outcome: z21.discriminatedUnion("type", [
3723
+ z21.object({ type: z21.literal("timeout") }),
3724
+ z21.object({
3725
+ type: z21.literal("exit"),
3726
+ exit_code: z21.number()
3586
3727
  })
3587
3728
  ])
3588
3729
  })
3589
3730
  )
3731
+ }),
3732
+ z21.object({
3733
+ type: z21.literal("tool_search_call"),
3734
+ id: z21.string(),
3735
+ execution: z21.enum(["server", "client"]),
3736
+ call_id: z21.string().nullable(),
3737
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3738
+ arguments: z21.unknown()
3739
+ }),
3740
+ z21.object({
3741
+ type: z21.literal("tool_search_output"),
3742
+ id: z21.string(),
3743
+ execution: z21.enum(["server", "client"]),
3744
+ call_id: z21.string().nullable(),
3745
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3746
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3590
3747
  })
3591
3748
  ])
3592
3749
  }),
3593
- z20.object({
3594
- type: z20.literal("response.function_call_arguments.delta"),
3595
- item_id: z20.string(),
3596
- output_index: z20.number(),
3597
- delta: z20.string()
3750
+ z21.object({
3751
+ type: z21.literal("response.function_call_arguments.delta"),
3752
+ item_id: z21.string(),
3753
+ output_index: z21.number(),
3754
+ delta: z21.string()
3598
3755
  }),
3599
- z20.object({
3600
- type: z20.literal("response.custom_tool_call_input.delta"),
3601
- item_id: z20.string(),
3602
- output_index: z20.number(),
3603
- delta: z20.string()
3756
+ z21.object({
3757
+ type: z21.literal("response.custom_tool_call_input.delta"),
3758
+ item_id: z21.string(),
3759
+ output_index: z21.number(),
3760
+ delta: z21.string()
3604
3761
  }),
3605
- z20.object({
3606
- type: z20.literal("response.image_generation_call.partial_image"),
3607
- item_id: z20.string(),
3608
- output_index: z20.number(),
3609
- partial_image_b64: z20.string()
3762
+ z21.object({
3763
+ type: z21.literal("response.image_generation_call.partial_image"),
3764
+ item_id: z21.string(),
3765
+ output_index: z21.number(),
3766
+ partial_image_b64: z21.string()
3610
3767
  }),
3611
- z20.object({
3612
- type: z20.literal("response.code_interpreter_call_code.delta"),
3613
- item_id: z20.string(),
3614
- output_index: z20.number(),
3615
- delta: z20.string()
3768
+ z21.object({
3769
+ type: z21.literal("response.code_interpreter_call_code.delta"),
3770
+ item_id: z21.string(),
3771
+ output_index: z21.number(),
3772
+ delta: z21.string()
3616
3773
  }),
3617
- z20.object({
3618
- type: z20.literal("response.code_interpreter_call_code.done"),
3619
- item_id: z20.string(),
3620
- output_index: z20.number(),
3621
- code: z20.string()
3774
+ z21.object({
3775
+ type: z21.literal("response.code_interpreter_call_code.done"),
3776
+ item_id: z21.string(),
3777
+ output_index: z21.number(),
3778
+ code: z21.string()
3622
3779
  }),
3623
- z20.object({
3624
- type: z20.literal("response.output_text.annotation.added"),
3625
- annotation: z20.discriminatedUnion("type", [
3626
- z20.object({
3627
- type: z20.literal("url_citation"),
3628
- start_index: z20.number(),
3629
- end_index: z20.number(),
3630
- url: z20.string(),
3631
- title: z20.string()
3780
+ z21.object({
3781
+ type: z21.literal("response.output_text.annotation.added"),
3782
+ annotation: z21.discriminatedUnion("type", [
3783
+ z21.object({
3784
+ type: z21.literal("url_citation"),
3785
+ start_index: z21.number(),
3786
+ end_index: z21.number(),
3787
+ url: z21.string(),
3788
+ title: z21.string()
3632
3789
  }),
3633
- z20.object({
3634
- type: z20.literal("file_citation"),
3635
- file_id: z20.string(),
3636
- filename: z20.string(),
3637
- index: z20.number()
3790
+ z21.object({
3791
+ type: z21.literal("file_citation"),
3792
+ file_id: z21.string(),
3793
+ filename: z21.string(),
3794
+ index: z21.number()
3638
3795
  }),
3639
- z20.object({
3640
- type: z20.literal("container_file_citation"),
3641
- container_id: z20.string(),
3642
- file_id: z20.string(),
3643
- filename: z20.string(),
3644
- start_index: z20.number(),
3645
- end_index: z20.number()
3796
+ z21.object({
3797
+ type: z21.literal("container_file_citation"),
3798
+ container_id: z21.string(),
3799
+ file_id: z21.string(),
3800
+ filename: z21.string(),
3801
+ start_index: z21.number(),
3802
+ end_index: z21.number()
3646
3803
  }),
3647
- z20.object({
3648
- type: z20.literal("file_path"),
3649
- file_id: z20.string(),
3650
- index: z20.number()
3804
+ z21.object({
3805
+ type: z21.literal("file_path"),
3806
+ file_id: z21.string(),
3807
+ index: z21.number()
3651
3808
  })
3652
3809
  ])
3653
3810
  }),
3654
- z20.object({
3655
- type: z20.literal("response.reasoning_summary_part.added"),
3656
- item_id: z20.string(),
3657
- summary_index: z20.number()
3811
+ z21.object({
3812
+ type: z21.literal("response.reasoning_summary_part.added"),
3813
+ item_id: z21.string(),
3814
+ summary_index: z21.number()
3658
3815
  }),
3659
- z20.object({
3660
- type: z20.literal("response.reasoning_summary_text.delta"),
3661
- item_id: z20.string(),
3662
- summary_index: z20.number(),
3663
- delta: z20.string()
3816
+ z21.object({
3817
+ type: z21.literal("response.reasoning_summary_text.delta"),
3818
+ item_id: z21.string(),
3819
+ summary_index: z21.number(),
3820
+ delta: z21.string()
3664
3821
  }),
3665
- z20.object({
3666
- type: z20.literal("response.reasoning_summary_part.done"),
3667
- item_id: z20.string(),
3668
- summary_index: z20.number()
3822
+ z21.object({
3823
+ type: z21.literal("response.reasoning_summary_part.done"),
3824
+ item_id: z21.string(),
3825
+ summary_index: z21.number()
3669
3826
  }),
3670
- z20.object({
3671
- type: z20.literal("response.apply_patch_call_operation_diff.delta"),
3672
- item_id: z20.string(),
3673
- output_index: z20.number(),
3674
- delta: z20.string(),
3675
- obfuscation: z20.string().nullish()
3827
+ z21.object({
3828
+ type: z21.literal("response.apply_patch_call_operation_diff.delta"),
3829
+ item_id: z21.string(),
3830
+ output_index: z21.number(),
3831
+ delta: z21.string(),
3832
+ obfuscation: z21.string().nullish()
3676
3833
  }),
3677
- z20.object({
3678
- type: z20.literal("response.apply_patch_call_operation_diff.done"),
3679
- item_id: z20.string(),
3680
- output_index: z20.number(),
3681
- diff: z20.string()
3834
+ z21.object({
3835
+ type: z21.literal("response.apply_patch_call_operation_diff.done"),
3836
+ item_id: z21.string(),
3837
+ output_index: z21.number(),
3838
+ diff: z21.string()
3682
3839
  }),
3683
- z20.object({
3684
- type: z20.literal("error"),
3685
- sequence_number: z20.number(),
3686
- error: z20.object({
3687
- type: z20.string(),
3688
- code: z20.string(),
3689
- message: z20.string(),
3690
- param: z20.string().nullish()
3840
+ z21.object({
3841
+ type: z21.literal("error"),
3842
+ sequence_number: z21.number(),
3843
+ error: z21.object({
3844
+ type: z21.string(),
3845
+ code: z21.string(),
3846
+ message: z21.string(),
3847
+ param: z21.string().nullish()
3691
3848
  })
3692
3849
  }),
3693
- z20.object({ type: z20.string() }).loose().transform((value) => ({
3850
+ z21.object({ type: z21.string() }).loose().transform((value) => ({
3694
3851
  type: "unknown_chunk",
3695
3852
  message: value.type
3696
3853
  }))
@@ -3698,294 +3855,310 @@ var openaiResponsesChunkSchema = lazySchema18(
3698
3855
  ])
3699
3856
  )
3700
3857
  );
3701
- var openaiResponsesResponseSchema = lazySchema18(
3702
- () => zodSchema18(
3703
- z20.object({
3704
- id: z20.string().optional(),
3705
- created_at: z20.number().optional(),
3706
- error: z20.object({
3707
- message: z20.string(),
3708
- type: z20.string(),
3709
- param: z20.string().nullish(),
3710
- code: z20.string()
3858
+ var openaiResponsesResponseSchema = lazySchema19(
3859
+ () => zodSchema19(
3860
+ z21.object({
3861
+ id: z21.string().optional(),
3862
+ created_at: z21.number().optional(),
3863
+ error: z21.object({
3864
+ message: z21.string(),
3865
+ type: z21.string(),
3866
+ param: z21.string().nullish(),
3867
+ code: z21.string()
3711
3868
  }).nullish(),
3712
- model: z20.string().optional(),
3713
- output: z20.array(
3714
- z20.discriminatedUnion("type", [
3715
- z20.object({
3716
- type: z20.literal("message"),
3717
- role: z20.literal("assistant"),
3718
- id: z20.string(),
3719
- phase: z20.enum(["commentary", "final_answer"]).nullish(),
3720
- content: z20.array(
3721
- z20.object({
3722
- type: z20.literal("output_text"),
3723
- text: z20.string(),
3724
- logprobs: z20.array(
3725
- z20.object({
3726
- token: z20.string(),
3727
- logprob: z20.number(),
3728
- top_logprobs: z20.array(
3729
- z20.object({
3730
- token: z20.string(),
3731
- logprob: z20.number()
3869
+ model: z21.string().optional(),
3870
+ output: z21.array(
3871
+ z21.discriminatedUnion("type", [
3872
+ z21.object({
3873
+ type: z21.literal("message"),
3874
+ role: z21.literal("assistant"),
3875
+ id: z21.string(),
3876
+ phase: z21.enum(["commentary", "final_answer"]).nullish(),
3877
+ content: z21.array(
3878
+ z21.object({
3879
+ type: z21.literal("output_text"),
3880
+ text: z21.string(),
3881
+ logprobs: z21.array(
3882
+ z21.object({
3883
+ token: z21.string(),
3884
+ logprob: z21.number(),
3885
+ top_logprobs: z21.array(
3886
+ z21.object({
3887
+ token: z21.string(),
3888
+ logprob: z21.number()
3732
3889
  })
3733
3890
  )
3734
3891
  })
3735
3892
  ).nullish(),
3736
- annotations: z20.array(
3737
- z20.discriminatedUnion("type", [
3738
- z20.object({
3739
- type: z20.literal("url_citation"),
3740
- start_index: z20.number(),
3741
- end_index: z20.number(),
3742
- url: z20.string(),
3743
- title: z20.string()
3893
+ annotations: z21.array(
3894
+ z21.discriminatedUnion("type", [
3895
+ z21.object({
3896
+ type: z21.literal("url_citation"),
3897
+ start_index: z21.number(),
3898
+ end_index: z21.number(),
3899
+ url: z21.string(),
3900
+ title: z21.string()
3744
3901
  }),
3745
- z20.object({
3746
- type: z20.literal("file_citation"),
3747
- file_id: z20.string(),
3748
- filename: z20.string(),
3749
- index: z20.number()
3902
+ z21.object({
3903
+ type: z21.literal("file_citation"),
3904
+ file_id: z21.string(),
3905
+ filename: z21.string(),
3906
+ index: z21.number()
3750
3907
  }),
3751
- z20.object({
3752
- type: z20.literal("container_file_citation"),
3753
- container_id: z20.string(),
3754
- file_id: z20.string(),
3755
- filename: z20.string(),
3756
- start_index: z20.number(),
3757
- end_index: z20.number()
3908
+ z21.object({
3909
+ type: z21.literal("container_file_citation"),
3910
+ container_id: z21.string(),
3911
+ file_id: z21.string(),
3912
+ filename: z21.string(),
3913
+ start_index: z21.number(),
3914
+ end_index: z21.number()
3758
3915
  }),
3759
- z20.object({
3760
- type: z20.literal("file_path"),
3761
- file_id: z20.string(),
3762
- index: z20.number()
3916
+ z21.object({
3917
+ type: z21.literal("file_path"),
3918
+ file_id: z21.string(),
3919
+ index: z21.number()
3763
3920
  })
3764
3921
  ])
3765
3922
  )
3766
3923
  })
3767
3924
  )
3768
3925
  }),
3769
- z20.object({
3770
- type: z20.literal("web_search_call"),
3771
- id: z20.string(),
3772
- status: z20.string(),
3773
- action: z20.discriminatedUnion("type", [
3774
- z20.object({
3775
- type: z20.literal("search"),
3776
- query: z20.string().nullish(),
3777
- sources: z20.array(
3778
- z20.discriminatedUnion("type", [
3779
- z20.object({ type: z20.literal("url"), url: z20.string() }),
3780
- z20.object({
3781
- type: z20.literal("api"),
3782
- name: z20.string()
3926
+ z21.object({
3927
+ type: z21.literal("web_search_call"),
3928
+ id: z21.string(),
3929
+ status: z21.string(),
3930
+ action: z21.discriminatedUnion("type", [
3931
+ z21.object({
3932
+ type: z21.literal("search"),
3933
+ query: z21.string().nullish(),
3934
+ sources: z21.array(
3935
+ z21.discriminatedUnion("type", [
3936
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3937
+ z21.object({
3938
+ type: z21.literal("api"),
3939
+ name: z21.string()
3783
3940
  })
3784
3941
  ])
3785
3942
  ).nullish()
3786
3943
  }),
3787
- z20.object({
3788
- type: z20.literal("open_page"),
3789
- url: z20.string().nullish()
3944
+ z21.object({
3945
+ type: z21.literal("open_page"),
3946
+ url: z21.string().nullish()
3790
3947
  }),
3791
- z20.object({
3792
- type: z20.literal("find_in_page"),
3793
- url: z20.string().nullish(),
3794
- pattern: z20.string().nullish()
3948
+ z21.object({
3949
+ type: z21.literal("find_in_page"),
3950
+ url: z21.string().nullish(),
3951
+ pattern: z21.string().nullish()
3795
3952
  })
3796
3953
  ]).nullish()
3797
3954
  }),
3798
- z20.object({
3799
- type: z20.literal("file_search_call"),
3800
- id: z20.string(),
3801
- queries: z20.array(z20.string()),
3802
- results: z20.array(
3803
- z20.object({
3804
- attributes: z20.record(
3805
- z20.string(),
3806
- z20.union([z20.string(), z20.number(), z20.boolean()])
3955
+ z21.object({
3956
+ type: z21.literal("file_search_call"),
3957
+ id: z21.string(),
3958
+ queries: z21.array(z21.string()),
3959
+ results: z21.array(
3960
+ z21.object({
3961
+ attributes: z21.record(
3962
+ z21.string(),
3963
+ z21.union([z21.string(), z21.number(), z21.boolean()])
3807
3964
  ),
3808
- file_id: z20.string(),
3809
- filename: z20.string(),
3810
- score: z20.number(),
3811
- text: z20.string()
3965
+ file_id: z21.string(),
3966
+ filename: z21.string(),
3967
+ score: z21.number(),
3968
+ text: z21.string()
3812
3969
  })
3813
3970
  ).nullish()
3814
3971
  }),
3815
- z20.object({
3816
- type: z20.literal("code_interpreter_call"),
3817
- id: z20.string(),
3818
- code: z20.string().nullable(),
3819
- container_id: z20.string(),
3820
- outputs: z20.array(
3821
- z20.discriminatedUnion("type", [
3822
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3823
- z20.object({ type: z20.literal("image"), url: z20.string() })
3972
+ z21.object({
3973
+ type: z21.literal("code_interpreter_call"),
3974
+ id: z21.string(),
3975
+ code: z21.string().nullable(),
3976
+ container_id: z21.string(),
3977
+ outputs: z21.array(
3978
+ z21.discriminatedUnion("type", [
3979
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3980
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3824
3981
  ])
3825
3982
  ).nullable()
3826
3983
  }),
3827
- z20.object({
3828
- type: z20.literal("image_generation_call"),
3829
- id: z20.string(),
3830
- result: z20.string()
3984
+ z21.object({
3985
+ type: z21.literal("image_generation_call"),
3986
+ id: z21.string(),
3987
+ result: z21.string()
3831
3988
  }),
3832
- z20.object({
3833
- type: z20.literal("local_shell_call"),
3834
- id: z20.string(),
3835
- call_id: z20.string(),
3836
- action: z20.object({
3837
- type: z20.literal("exec"),
3838
- command: z20.array(z20.string()),
3839
- timeout_ms: z20.number().optional(),
3840
- user: z20.string().optional(),
3841
- working_directory: z20.string().optional(),
3842
- env: z20.record(z20.string(), z20.string()).optional()
3989
+ z21.object({
3990
+ type: z21.literal("local_shell_call"),
3991
+ id: z21.string(),
3992
+ call_id: z21.string(),
3993
+ action: z21.object({
3994
+ type: z21.literal("exec"),
3995
+ command: z21.array(z21.string()),
3996
+ timeout_ms: z21.number().optional(),
3997
+ user: z21.string().optional(),
3998
+ working_directory: z21.string().optional(),
3999
+ env: z21.record(z21.string(), z21.string()).optional()
3843
4000
  })
3844
4001
  }),
3845
- z20.object({
3846
- type: z20.literal("function_call"),
3847
- call_id: z20.string(),
3848
- name: z20.string(),
3849
- arguments: z20.string(),
3850
- id: z20.string()
4002
+ z21.object({
4003
+ type: z21.literal("function_call"),
4004
+ call_id: z21.string(),
4005
+ name: z21.string(),
4006
+ arguments: z21.string(),
4007
+ id: z21.string()
3851
4008
  }),
3852
- z20.object({
3853
- type: z20.literal("custom_tool_call"),
3854
- call_id: z20.string(),
3855
- name: z20.string(),
3856
- input: z20.string(),
3857
- id: z20.string()
4009
+ z21.object({
4010
+ type: z21.literal("custom_tool_call"),
4011
+ call_id: z21.string(),
4012
+ name: z21.string(),
4013
+ input: z21.string(),
4014
+ id: z21.string()
3858
4015
  }),
3859
- z20.object({
3860
- type: z20.literal("computer_call"),
3861
- id: z20.string(),
3862
- status: z20.string().optional()
4016
+ z21.object({
4017
+ type: z21.literal("computer_call"),
4018
+ id: z21.string(),
4019
+ status: z21.string().optional()
3863
4020
  }),
3864
- z20.object({
3865
- type: z20.literal("reasoning"),
3866
- id: z20.string(),
3867
- encrypted_content: z20.string().nullish(),
3868
- summary: z20.array(
3869
- z20.object({
3870
- type: z20.literal("summary_text"),
3871
- text: z20.string()
4021
+ z21.object({
4022
+ type: z21.literal("reasoning"),
4023
+ id: z21.string(),
4024
+ encrypted_content: z21.string().nullish(),
4025
+ summary: z21.array(
4026
+ z21.object({
4027
+ type: z21.literal("summary_text"),
4028
+ text: z21.string()
3872
4029
  })
3873
4030
  )
3874
4031
  }),
3875
- z20.object({
3876
- type: z20.literal("mcp_call"),
3877
- id: z20.string(),
3878
- status: z20.string(),
3879
- arguments: z20.string(),
3880
- name: z20.string(),
3881
- server_label: z20.string(),
3882
- output: z20.string().nullish(),
3883
- error: z20.union([
3884
- z20.string(),
3885
- z20.object({
3886
- type: z20.string().optional(),
3887
- code: z20.union([z20.number(), z20.string()]).optional(),
3888
- message: z20.string().optional()
4032
+ z21.object({
4033
+ type: z21.literal("mcp_call"),
4034
+ id: z21.string(),
4035
+ status: z21.string(),
4036
+ arguments: z21.string(),
4037
+ name: z21.string(),
4038
+ server_label: z21.string(),
4039
+ output: z21.string().nullish(),
4040
+ error: z21.union([
4041
+ z21.string(),
4042
+ z21.object({
4043
+ type: z21.string().optional(),
4044
+ code: z21.union([z21.number(), z21.string()]).optional(),
4045
+ message: z21.string().optional()
3889
4046
  }).loose()
3890
4047
  ]).nullish(),
3891
- approval_request_id: z20.string().nullish()
4048
+ approval_request_id: z21.string().nullish()
3892
4049
  }),
3893
- z20.object({
3894
- type: z20.literal("mcp_list_tools"),
3895
- id: z20.string(),
3896
- server_label: z20.string(),
3897
- tools: z20.array(
3898
- z20.object({
3899
- name: z20.string(),
3900
- description: z20.string().optional(),
3901
- input_schema: z20.any(),
3902
- annotations: z20.record(z20.string(), z20.unknown()).optional()
4050
+ z21.object({
4051
+ type: z21.literal("mcp_list_tools"),
4052
+ id: z21.string(),
4053
+ server_label: z21.string(),
4054
+ tools: z21.array(
4055
+ z21.object({
4056
+ name: z21.string(),
4057
+ description: z21.string().optional(),
4058
+ input_schema: z21.any(),
4059
+ annotations: z21.record(z21.string(), z21.unknown()).optional()
3903
4060
  })
3904
4061
  ),
3905
- error: z20.union([
3906
- z20.string(),
3907
- z20.object({
3908
- type: z20.string().optional(),
3909
- code: z20.union([z20.number(), z20.string()]).optional(),
3910
- message: z20.string().optional()
4062
+ error: z21.union([
4063
+ z21.string(),
4064
+ z21.object({
4065
+ type: z21.string().optional(),
4066
+ code: z21.union([z21.number(), z21.string()]).optional(),
4067
+ message: z21.string().optional()
3911
4068
  }).loose()
3912
4069
  ]).optional()
3913
4070
  }),
3914
- z20.object({
3915
- type: z20.literal("mcp_approval_request"),
3916
- id: z20.string(),
3917
- server_label: z20.string(),
3918
- name: z20.string(),
3919
- arguments: z20.string(),
3920
- approval_request_id: z20.string().optional()
4071
+ z21.object({
4072
+ type: z21.literal("mcp_approval_request"),
4073
+ id: z21.string(),
4074
+ server_label: z21.string(),
4075
+ name: z21.string(),
4076
+ arguments: z21.string(),
4077
+ approval_request_id: z21.string().optional()
3921
4078
  }),
3922
- z20.object({
3923
- type: z20.literal("apply_patch_call"),
3924
- id: z20.string(),
3925
- call_id: z20.string(),
3926
- status: z20.enum(["in_progress", "completed"]),
3927
- operation: z20.discriminatedUnion("type", [
3928
- z20.object({
3929
- type: z20.literal("create_file"),
3930
- path: z20.string(),
3931
- diff: z20.string()
4079
+ z21.object({
4080
+ type: z21.literal("apply_patch_call"),
4081
+ id: z21.string(),
4082
+ call_id: z21.string(),
4083
+ status: z21.enum(["in_progress", "completed"]),
4084
+ operation: z21.discriminatedUnion("type", [
4085
+ z21.object({
4086
+ type: z21.literal("create_file"),
4087
+ path: z21.string(),
4088
+ diff: z21.string()
3932
4089
  }),
3933
- z20.object({
3934
- type: z20.literal("delete_file"),
3935
- path: z20.string()
4090
+ z21.object({
4091
+ type: z21.literal("delete_file"),
4092
+ path: z21.string()
3936
4093
  }),
3937
- z20.object({
3938
- type: z20.literal("update_file"),
3939
- path: z20.string(),
3940
- diff: z20.string()
4094
+ z21.object({
4095
+ type: z21.literal("update_file"),
4096
+ path: z21.string(),
4097
+ diff: z21.string()
3941
4098
  })
3942
4099
  ])
3943
4100
  }),
3944
- z20.object({
3945
- type: z20.literal("shell_call"),
3946
- id: z20.string(),
3947
- call_id: z20.string(),
3948
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3949
- action: z20.object({
3950
- commands: z20.array(z20.string())
4101
+ z21.object({
4102
+ type: z21.literal("shell_call"),
4103
+ id: z21.string(),
4104
+ call_id: z21.string(),
4105
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4106
+ action: z21.object({
4107
+ commands: z21.array(z21.string())
3951
4108
  })
3952
4109
  }),
3953
- z20.object({
3954
- type: z20.literal("shell_call_output"),
3955
- id: z20.string(),
3956
- call_id: z20.string(),
3957
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3958
- output: z20.array(
3959
- z20.object({
3960
- stdout: z20.string(),
3961
- stderr: z20.string(),
3962
- outcome: z20.discriminatedUnion("type", [
3963
- z20.object({ type: z20.literal("timeout") }),
3964
- z20.object({
3965
- type: z20.literal("exit"),
3966
- exit_code: z20.number()
4110
+ z21.object({
4111
+ type: z21.literal("shell_call_output"),
4112
+ id: z21.string(),
4113
+ call_id: z21.string(),
4114
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4115
+ output: z21.array(
4116
+ z21.object({
4117
+ stdout: z21.string(),
4118
+ stderr: z21.string(),
4119
+ outcome: z21.discriminatedUnion("type", [
4120
+ z21.object({ type: z21.literal("timeout") }),
4121
+ z21.object({
4122
+ type: z21.literal("exit"),
4123
+ exit_code: z21.number()
3967
4124
  })
3968
4125
  ])
3969
4126
  })
3970
4127
  )
4128
+ }),
4129
+ z21.object({
4130
+ type: z21.literal("tool_search_call"),
4131
+ id: z21.string(),
4132
+ execution: z21.enum(["server", "client"]),
4133
+ call_id: z21.string().nullable(),
4134
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4135
+ arguments: z21.unknown()
4136
+ }),
4137
+ z21.object({
4138
+ type: z21.literal("tool_search_output"),
4139
+ id: z21.string(),
4140
+ execution: z21.enum(["server", "client"]),
4141
+ call_id: z21.string().nullable(),
4142
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4143
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3971
4144
  })
3972
4145
  ])
3973
4146
  ).optional(),
3974
- service_tier: z20.string().nullish(),
3975
- incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3976
- usage: z20.object({
3977
- input_tokens: z20.number(),
3978
- input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3979
- output_tokens: z20.number(),
3980
- output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
4147
+ service_tier: z21.string().nullish(),
4148
+ incomplete_details: z21.object({ reason: z21.string() }).nullish(),
4149
+ usage: z21.object({
4150
+ input_tokens: z21.number(),
4151
+ input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
4152
+ output_tokens: z21.number(),
4153
+ output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3981
4154
  }).optional()
3982
4155
  })
3983
4156
  )
3984
4157
  );
3985
4158
 
3986
4159
  // src/responses/openai-responses-options.ts
3987
- import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3988
- import { z as z21 } from "zod/v4";
4160
+ import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
4161
+ import { z as z22 } from "zod/v4";
3989
4162
  var TOP_LOGPROBS_MAX = 20;
3990
4163
  var openaiResponsesReasoningModelIds = [
3991
4164
  "o1",
@@ -4014,7 +4187,12 @@ var openaiResponsesReasoningModelIds = [
4014
4187
  "gpt-5.2-chat-latest",
4015
4188
  "gpt-5.2-pro",
4016
4189
  "gpt-5.2-codex",
4017
- "gpt-5.3-codex"
4190
+ "gpt-5.3-chat-latest",
4191
+ "gpt-5.3-codex",
4192
+ "gpt-5.4",
4193
+ "gpt-5.4-2026-03-05",
4194
+ "gpt-5.4-pro",
4195
+ "gpt-5.4-pro-2026-03-05"
4018
4196
  ];
4019
4197
  var openaiResponsesModelIds = [
4020
4198
  "gpt-4.1",
@@ -4041,9 +4219,9 @@ var openaiResponsesModelIds = [
4041
4219
  "gpt-5-chat-latest",
4042
4220
  ...openaiResponsesReasoningModelIds
4043
4221
  ];
4044
- var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4045
- () => zodSchema19(
4046
- z21.object({
4222
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4223
+ () => zodSchema20(
4224
+ z22.object({
4047
4225
  /**
4048
4226
  * The ID of the OpenAI Conversation to continue.
4049
4227
  * You must create a conversation first via the OpenAI API.
@@ -4051,13 +4229,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4051
4229
  * Defaults to `undefined`.
4052
4230
  * @see https://platform.openai.com/docs/api-reference/conversations/create
4053
4231
  */
4054
- conversation: z21.string().nullish(),
4232
+ conversation: z22.string().nullish(),
4055
4233
  /**
4056
4234
  * The set of extra fields to include in the response (advanced, usually not needed).
4057
4235
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
4058
4236
  */
4059
- include: z21.array(
4060
- z21.enum([
4237
+ include: z22.array(
4238
+ z22.enum([
4061
4239
  "reasoning.encrypted_content",
4062
4240
  // handled internally by default, only needed for unknown reasoning models
4063
4241
  "file_search_call.results",
@@ -4069,7 +4247,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4069
4247
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
4070
4248
  * Defaults to `undefined`.
4071
4249
  */
4072
- instructions: z21.string().nullish(),
4250
+ instructions: z22.string().nullish(),
4073
4251
  /**
4074
4252
  * Return the log probabilities of the tokens. Including logprobs will increase
4075
4253
  * the response size and can slow down response times. However, it can
@@ -4084,30 +4262,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4084
4262
  * @see https://platform.openai.com/docs/api-reference/responses/create
4085
4263
  * @see https://cookbook.openai.com/examples/using_logprobs
4086
4264
  */
4087
- logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4265
+ logprobs: z22.union([z22.boolean(), z22.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4088
4266
  /**
4089
4267
  * The maximum number of total calls to built-in tools that can be processed in a response.
4090
4268
  * This maximum number applies across all built-in tool calls, not per individual tool.
4091
4269
  * Any further attempts to call a tool by the model will be ignored.
4092
4270
  */
4093
- maxToolCalls: z21.number().nullish(),
4271
+ maxToolCalls: z22.number().nullish(),
4094
4272
  /**
4095
4273
  * Additional metadata to store with the generation.
4096
4274
  */
4097
- metadata: z21.any().nullish(),
4275
+ metadata: z22.any().nullish(),
4098
4276
  /**
4099
4277
  * Whether to use parallel tool calls. Defaults to `true`.
4100
4278
  */
4101
- parallelToolCalls: z21.boolean().nullish(),
4279
+ parallelToolCalls: z22.boolean().nullish(),
4102
4280
  /**
4103
4281
  * The ID of the previous response. You can use it to continue a conversation.
4104
4282
  * Defaults to `undefined`.
4105
4283
  */
4106
- previousResponseId: z21.string().nullish(),
4284
+ previousResponseId: z22.string().nullish(),
4107
4285
  /**
4108
4286
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
4109
4287
  */
4110
- promptCacheKey: z21.string().nullish(),
4288
+ promptCacheKey: z22.string().nullish(),
4111
4289
  /**
4112
4290
  * The retention policy for the prompt cache.
4113
4291
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4116,7 +4294,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4116
4294
  *
4117
4295
  * @default 'in_memory'
4118
4296
  */
4119
- promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
4297
+ promptCacheRetention: z22.enum(["in_memory", "24h"]).nullish(),
4120
4298
  /**
4121
4299
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4122
4300
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4127,17 +4305,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4127
4305
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4128
4306
  * an error.
4129
4307
  */
4130
- reasoningEffort: z21.string().nullish(),
4308
+ reasoningEffort: z22.string().nullish(),
4131
4309
  /**
4132
4310
  * Controls reasoning summary output from the model.
4133
4311
  * Set to "auto" to automatically receive the richest level available,
4134
4312
  * or "detailed" for comprehensive summaries.
4135
4313
  */
4136
- reasoningSummary: z21.string().nullish(),
4314
+ reasoningSummary: z22.string().nullish(),
4137
4315
  /**
4138
4316
  * The identifier for safety monitoring and tracking.
4139
4317
  */
4140
- safetyIdentifier: z21.string().nullish(),
4318
+ safetyIdentifier: z22.string().nullish(),
4141
4319
  /**
4142
4320
  * Service tier for the request.
4143
4321
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4145,34 +4323,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4145
4323
  *
4146
4324
  * Defaults to 'auto'.
4147
4325
  */
4148
- serviceTier: z21.enum(["auto", "flex", "priority", "default"]).nullish(),
4326
+ serviceTier: z22.enum(["auto", "flex", "priority", "default"]).nullish(),
4149
4327
  /**
4150
4328
  * Whether to store the generation. Defaults to `true`.
4151
4329
  */
4152
- store: z21.boolean().nullish(),
4330
+ store: z22.boolean().nullish(),
4153
4331
  /**
4154
4332
  * Whether to use strict JSON schema validation.
4155
4333
  * Defaults to `true`.
4156
4334
  */
4157
- strictJsonSchema: z21.boolean().nullish(),
4335
+ strictJsonSchema: z22.boolean().nullish(),
4158
4336
  /**
4159
4337
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4160
4338
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4161
4339
  * Valid values: 'low', 'medium', 'high'.
4162
4340
  */
4163
- textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
4341
+ textVerbosity: z22.enum(["low", "medium", "high"]).nullish(),
4164
4342
  /**
4165
4343
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4166
4344
  * 'disabled' turns truncation off.
4167
4345
  */
4168
- truncation: z21.enum(["auto", "disabled"]).nullish(),
4346
+ truncation: z22.enum(["auto", "disabled"]).nullish(),
4169
4347
  /**
4170
4348
  * A unique identifier representing your end-user, which can help OpenAI to
4171
4349
  * monitor and detect abuse.
4172
4350
  * Defaults to `undefined`.
4173
4351
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4174
4352
  */
4175
- user: z21.string().nullish(),
4353
+ user: z22.string().nullish(),
4176
4354
  /**
4177
4355
  * Override the system message mode for this model.
4178
4356
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4181,7 +4359,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4181
4359
  *
4182
4360
  * If not specified, the mode is automatically determined based on the model.
4183
4361
  */
4184
- systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
4362
+ systemMessageMode: z22.enum(["system", "developer", "remove"]).optional(),
4185
4363
  /**
4186
4364
  * Force treating this model as a reasoning model.
4187
4365
  *
@@ -4191,7 +4369,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4191
4369
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4192
4370
  * and defaults `systemMessageMode` to `developer` unless overridden.
4193
4371
  */
4194
- forceReasoning: z21.boolean().optional()
4372
+ forceReasoning: z22.boolean().optional()
4195
4373
  })
4196
4374
  )
4197
4375
  );
@@ -4207,7 +4385,7 @@ async function prepareResponsesTools({
4207
4385
  toolNameMapping,
4208
4386
  customProviderToolNames
4209
4387
  }) {
4210
- var _a;
4388
+ var _a, _b;
4211
4389
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4212
4390
  const toolWarnings = [];
4213
4391
  if (tools == null) {
@@ -4217,15 +4395,19 @@ async function prepareResponsesTools({
4217
4395
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4218
4396
  for (const tool of tools) {
4219
4397
  switch (tool.type) {
4220
- case "function":
4398
+ case "function": {
4399
+ const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4400
+ const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4221
4401
  openaiTools2.push({
4222
4402
  type: "function",
4223
4403
  name: tool.name,
4224
4404
  description: tool.description,
4225
4405
  parameters: tool.inputSchema,
4226
- ...tool.strict != null ? { strict: tool.strict } : {}
4406
+ ...tool.strict != null ? { strict: tool.strict } : {},
4407
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4227
4408
  });
4228
4409
  break;
4410
+ }
4229
4411
  case "provider": {
4230
4412
  switch (tool.id) {
4231
4413
  case "openai.file_search": {
@@ -4363,11 +4545,24 @@ async function prepareResponsesTools({
4363
4545
  });
4364
4546
  openaiTools2.push({
4365
4547
  type: "custom",
4366
- name: args.name,
4548
+ name: tool.name,
4367
4549
  description: args.description,
4368
4550
  format: args.format
4369
4551
  });
4370
- resolvedCustomProviderToolNames.add(args.name);
4552
+ resolvedCustomProviderToolNames.add(tool.name);
4553
+ break;
4554
+ }
4555
+ case "openai.tool_search": {
4556
+ const args = await validateTypes2({
4557
+ value: tool.args,
4558
+ schema: toolSearchArgsSchema
4559
+ });
4560
+ openaiTools2.push({
4561
+ type: "tool_search",
4562
+ ...args.execution != null ? { execution: args.execution } : {},
4563
+ ...args.description != null ? { description: args.description } : {},
4564
+ ...args.parameters != null ? { parameters: args.parameters } : {}
4565
+ });
4371
4566
  break;
4372
4567
  }
4373
4568
  }
@@ -4391,7 +4586,7 @@ async function prepareResponsesTools({
4391
4586
  case "required":
4392
4587
  return { tools: openaiTools2, toolChoice: type, toolWarnings };
4393
4588
  case "tool": {
4394
- const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4589
+ const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
4395
4590
  return {
4396
4591
  tools: openaiTools2,
4397
4592
  toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
@@ -4471,7 +4666,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
4471
4666
  }
4472
4667
  var OpenAIResponsesLanguageModel = class {
4473
4668
  constructor(modelId, config) {
4474
- this.specificationVersion = "v3";
4669
+ this.specificationVersion = "v4";
4475
4670
  this.supportedUrls = {
4476
4671
  "image/*": [/^https?:\/\/.*$/],
4477
4672
  "application/pdf": [/^https?:\/\/.*$/]
@@ -4547,9 +4742,9 @@ var OpenAIResponsesLanguageModel = class {
4547
4742
  "openai.web_search": "web_search",
4548
4743
  "openai.web_search_preview": "web_search_preview",
4549
4744
  "openai.mcp": "mcp",
4550
- "openai.apply_patch": "apply_patch"
4551
- },
4552
- resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
4745
+ "openai.apply_patch": "apply_patch",
4746
+ "openai.tool_search": "tool_search"
4747
+ }
4553
4748
  });
4554
4749
  const customProviderToolNames = /* @__PURE__ */ new Set();
4555
4750
  const {
@@ -4725,7 +4920,7 @@ var OpenAIResponsesLanguageModel = class {
4725
4920
  };
4726
4921
  }
4727
4922
  async doGenerate(options) {
4728
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
4923
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
4729
4924
  const {
4730
4925
  args: body,
4731
4926
  warnings,
@@ -4768,6 +4963,7 @@ var OpenAIResponsesLanguageModel = class {
4768
4963
  const content = [];
4769
4964
  const logprobs = [];
4770
4965
  let hasFunctionCall = false;
4966
+ const hostedToolSearchCallIds = [];
4771
4967
  for (const part of response.output) {
4772
4968
  switch (part.type) {
4773
4969
  case "reasoning": {
@@ -4806,6 +5002,46 @@ var OpenAIResponsesLanguageModel = class {
4806
5002
  });
4807
5003
  break;
4808
5004
  }
5005
+ case "tool_search_call": {
5006
+ const toolCallId = (_b = part.call_id) != null ? _b : part.id;
5007
+ const isHosted = part.execution === "server";
5008
+ if (isHosted) {
5009
+ hostedToolSearchCallIds.push(toolCallId);
5010
+ }
5011
+ content.push({
5012
+ type: "tool-call",
5013
+ toolCallId,
5014
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5015
+ input: JSON.stringify({
5016
+ arguments: part.arguments,
5017
+ call_id: part.call_id
5018
+ }),
5019
+ ...isHosted ? { providerExecuted: true } : {},
5020
+ providerMetadata: {
5021
+ [providerOptionsName]: {
5022
+ itemId: part.id
5023
+ }
5024
+ }
5025
+ });
5026
+ break;
5027
+ }
5028
+ case "tool_search_output": {
5029
+ const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
5030
+ content.push({
5031
+ type: "tool-result",
5032
+ toolCallId,
5033
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5034
+ result: {
5035
+ tools: part.tools
5036
+ },
5037
+ providerMetadata: {
5038
+ [providerOptionsName]: {
5039
+ itemId: part.id
5040
+ }
5041
+ }
5042
+ });
5043
+ break;
5044
+ }
4809
5045
  case "local_shell_call": {
4810
5046
  content.push({
4811
5047
  type: "tool-call",
@@ -4861,7 +5097,7 @@ var OpenAIResponsesLanguageModel = class {
4861
5097
  }
4862
5098
  case "message": {
4863
5099
  for (const contentPart of part.content) {
4864
- if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
5100
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
4865
5101
  logprobs.push(contentPart.logprobs);
4866
5102
  }
4867
5103
  const providerMetadata2 = {
@@ -4883,7 +5119,7 @@ var OpenAIResponsesLanguageModel = class {
4883
5119
  content.push({
4884
5120
  type: "source",
4885
5121
  sourceType: "url",
4886
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : generateId2(),
5122
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
4887
5123
  url: annotation.url,
4888
5124
  title: annotation.title
4889
5125
  });
@@ -4891,7 +5127,7 @@ var OpenAIResponsesLanguageModel = class {
4891
5127
  content.push({
4892
5128
  type: "source",
4893
5129
  sourceType: "document",
4894
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
5130
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
4895
5131
  mediaType: "text/plain",
4896
5132
  title: annotation.filename,
4897
5133
  filename: annotation.filename,
@@ -4907,7 +5143,7 @@ var OpenAIResponsesLanguageModel = class {
4907
5143
  content.push({
4908
5144
  type: "source",
4909
5145
  sourceType: "document",
4910
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
5146
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
4911
5147
  mediaType: "text/plain",
4912
5148
  title: annotation.filename,
4913
5149
  filename: annotation.filename,
@@ -4923,7 +5159,7 @@ var OpenAIResponsesLanguageModel = class {
4923
5159
  content.push({
4924
5160
  type: "source",
4925
5161
  sourceType: "document",
4926
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
5162
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
4927
5163
  mediaType: "application/octet-stream",
4928
5164
  title: annotation.file_id,
4929
5165
  filename: annotation.file_id,
@@ -4992,7 +5228,7 @@ var OpenAIResponsesLanguageModel = class {
4992
5228
  break;
4993
5229
  }
4994
5230
  case "mcp_call": {
4995
- const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
5231
+ const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
4996
5232
  const toolName = `mcp.${part.name}`;
4997
5233
  content.push({
4998
5234
  type: "tool-call",
@@ -5026,8 +5262,8 @@ var OpenAIResponsesLanguageModel = class {
5026
5262
  break;
5027
5263
  }
5028
5264
  case "mcp_approval_request": {
5029
- const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
5030
- const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2();
5265
+ const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5266
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
5031
5267
  const toolName = `mcp.${part.name}`;
5032
5268
  content.push({
5033
5269
  type: "tool-call",
@@ -5077,13 +5313,13 @@ var OpenAIResponsesLanguageModel = class {
5077
5313
  toolName: toolNameMapping.toCustomToolName("file_search"),
5078
5314
  result: {
5079
5315
  queries: part.queries,
5080
- results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
5316
+ results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
5081
5317
  attributes: result.attributes,
5082
5318
  fileId: result.file_id,
5083
5319
  filename: result.filename,
5084
5320
  score: result.score,
5085
5321
  text: result.text
5086
- }))) != null ? _v : null
5322
+ }))) != null ? _y : null
5087
5323
  }
5088
5324
  });
5089
5325
  break;
@@ -5140,10 +5376,10 @@ var OpenAIResponsesLanguageModel = class {
5140
5376
  content,
5141
5377
  finishReason: {
5142
5378
  unified: mapOpenAIResponseFinishReason({
5143
- finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
5379
+ finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
5144
5380
  hasFunctionCall
5145
5381
  }),
5146
- raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
5382
+ raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
5147
5383
  },
5148
5384
  usage: convertOpenAIResponsesUsage(usage),
5149
5385
  request: { body },
@@ -5201,6 +5437,7 @@ var OpenAIResponsesLanguageModel = class {
5201
5437
  let hasFunctionCall = false;
5202
5438
  const activeReasoning = {};
5203
5439
  let serviceTier;
5440
+ const hostedToolSearchCallIds = [];
5204
5441
  return {
5205
5442
  stream: response.pipeThrough(
5206
5443
  new TransformStream({
@@ -5208,7 +5445,7 @@ var OpenAIResponsesLanguageModel = class {
5208
5445
  controller.enqueue({ type: "stream-start", warnings });
5209
5446
  },
5210
5447
  transform(chunk, controller) {
5211
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
5448
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
5212
5449
  if (options.includeRawChunks) {
5213
5450
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5214
5451
  }
@@ -5316,6 +5553,24 @@ var OpenAIResponsesLanguageModel = class {
5316
5553
  input: "{}",
5317
5554
  providerExecuted: true
5318
5555
  });
5556
+ } else if (value.item.type === "tool_search_call") {
5557
+ const toolCallId = value.item.id;
5558
+ const toolName = toolNameMapping.toCustomToolName("tool_search");
5559
+ const isHosted = value.item.execution === "server";
5560
+ ongoingToolCalls[value.output_index] = {
5561
+ toolName,
5562
+ toolCallId,
5563
+ toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
5564
+ };
5565
+ if (isHosted) {
5566
+ controller.enqueue({
5567
+ type: "tool-input-start",
5568
+ id: toolCallId,
5569
+ toolName,
5570
+ providerExecuted: true
5571
+ });
5572
+ }
5573
+ } else if (value.item.type === "tool_search_output") {
5319
5574
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
5320
5575
  } else if (value.item.type === "apply_patch_call") {
5321
5576
  const { call_id: callId, operation } = value.item;
@@ -5362,7 +5617,7 @@ var OpenAIResponsesLanguageModel = class {
5362
5617
  } else if (value.item.type === "shell_call_output") {
5363
5618
  } else if (value.item.type === "message") {
5364
5619
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5365
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5620
+ activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
5366
5621
  controller.enqueue({
5367
5622
  type: "text-start",
5368
5623
  id: value.item.id,
@@ -5386,14 +5641,14 @@ var OpenAIResponsesLanguageModel = class {
5386
5641
  providerMetadata: {
5387
5642
  [providerOptionsName]: {
5388
5643
  itemId: value.item.id,
5389
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5644
+ reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
5390
5645
  }
5391
5646
  }
5392
5647
  });
5393
5648
  }
5394
5649
  } else if (isResponseOutputItemDoneChunk(value)) {
5395
5650
  if (value.item.type === "message") {
5396
- const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5651
+ const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
5397
5652
  activeMessagePhase = void 0;
5398
5653
  controller.enqueue({
5399
5654
  type: "text-end",
@@ -5487,13 +5742,13 @@ var OpenAIResponsesLanguageModel = class {
5487
5742
  toolName: toolNameMapping.toCustomToolName("file_search"),
5488
5743
  result: {
5489
5744
  queries: value.item.queries,
5490
- results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
5745
+ results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
5491
5746
  attributes: result.attributes,
5492
5747
  fileId: result.file_id,
5493
5748
  filename: result.filename,
5494
5749
  score: result.score,
5495
5750
  text: result.text
5496
- }))) != null ? _e : null
5751
+ }))) != null ? _f : null
5497
5752
  }
5498
5753
  });
5499
5754
  } else if (value.item.type === "code_interpreter_call") {
@@ -5515,12 +5770,62 @@ var OpenAIResponsesLanguageModel = class {
5515
5770
  result: value.item.result
5516
5771
  }
5517
5772
  });
5773
+ } else if (value.item.type === "tool_search_call") {
5774
+ const toolCall = ongoingToolCalls[value.output_index];
5775
+ const isHosted = value.item.execution === "server";
5776
+ if (toolCall != null) {
5777
+ const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
5778
+ if (isHosted) {
5779
+ hostedToolSearchCallIds.push(toolCallId);
5780
+ } else {
5781
+ controller.enqueue({
5782
+ type: "tool-input-start",
5783
+ id: toolCallId,
5784
+ toolName: toolCall.toolName
5785
+ });
5786
+ }
5787
+ controller.enqueue({
5788
+ type: "tool-input-end",
5789
+ id: toolCallId
5790
+ });
5791
+ controller.enqueue({
5792
+ type: "tool-call",
5793
+ toolCallId,
5794
+ toolName: toolCall.toolName,
5795
+ input: JSON.stringify({
5796
+ arguments: value.item.arguments,
5797
+ call_id: isHosted ? null : toolCallId
5798
+ }),
5799
+ ...isHosted ? { providerExecuted: true } : {},
5800
+ providerMetadata: {
5801
+ [providerOptionsName]: {
5802
+ itemId: value.item.id
5803
+ }
5804
+ }
5805
+ });
5806
+ }
5807
+ ongoingToolCalls[value.output_index] = void 0;
5808
+ } else if (value.item.type === "tool_search_output") {
5809
+ const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
5810
+ controller.enqueue({
5811
+ type: "tool-result",
5812
+ toolCallId,
5813
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5814
+ result: {
5815
+ tools: value.item.tools
5816
+ },
5817
+ providerMetadata: {
5818
+ [providerOptionsName]: {
5819
+ itemId: value.item.id
5820
+ }
5821
+ }
5822
+ });
5518
5823
  } else if (value.item.type === "mcp_call") {
5519
5824
  ongoingToolCalls[value.output_index] = void 0;
5520
- const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5521
- const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
5825
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
5826
+ const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
5522
5827
  approvalRequestId
5523
- )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
5828
+ )) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
5524
5829
  const toolName = `mcp.${value.item.name}`;
5525
5830
  controller.enqueue({
5526
5831
  type: "tool-call",
@@ -5590,8 +5895,8 @@ var OpenAIResponsesLanguageModel = class {
5590
5895
  ongoingToolCalls[value.output_index] = void 0;
5591
5896
  } else if (value.item.type === "mcp_approval_request") {
5592
5897
  ongoingToolCalls[value.output_index] = void 0;
5593
- const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId2();
5594
- const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
5898
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
5899
+ const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
5595
5900
  approvalRequestIdToDummyToolCallIdFromStream.set(
5596
5901
  approvalRequestId,
5597
5902
  dummyToolCallId
@@ -5680,7 +5985,7 @@ var OpenAIResponsesLanguageModel = class {
5680
5985
  providerMetadata: {
5681
5986
  [providerOptionsName]: {
5682
5987
  itemId: value.item.id,
5683
- reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
5988
+ reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
5684
5989
  }
5685
5990
  }
5686
5991
  });
@@ -5793,7 +6098,7 @@ var OpenAIResponsesLanguageModel = class {
5793
6098
  id: value.item_id,
5794
6099
  delta: value.delta
5795
6100
  });
5796
- if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
6101
+ if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
5797
6102
  logprobs.push(value.logprobs);
5798
6103
  }
5799
6104
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -5822,7 +6127,7 @@ var OpenAIResponsesLanguageModel = class {
5822
6127
  providerMetadata: {
5823
6128
  [providerOptionsName]: {
5824
6129
  itemId: value.item_id,
5825
- reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
6130
+ reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
5826
6131
  }
5827
6132
  }
5828
6133
  });
@@ -5856,10 +6161,10 @@ var OpenAIResponsesLanguageModel = class {
5856
6161
  } else if (isResponseFinishedChunk(value)) {
5857
6162
  finishReason = {
5858
6163
  unified: mapOpenAIResponseFinishReason({
5859
- finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
6164
+ finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
5860
6165
  hasFunctionCall
5861
6166
  }),
5862
- raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
6167
+ raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
5863
6168
  };
5864
6169
  usage = value.response.usage;
5865
6170
  if (typeof value.response.service_tier === "string") {
@@ -5871,7 +6176,7 @@ var OpenAIResponsesLanguageModel = class {
5871
6176
  controller.enqueue({
5872
6177
  type: "source",
5873
6178
  sourceType: "url",
5874
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2(),
6179
+ id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
5875
6180
  url: value.annotation.url,
5876
6181
  title: value.annotation.title
5877
6182
  });
@@ -5879,7 +6184,7 @@ var OpenAIResponsesLanguageModel = class {
5879
6184
  controller.enqueue({
5880
6185
  type: "source",
5881
6186
  sourceType: "document",
5882
- id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId2(),
6187
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
5883
6188
  mediaType: "text/plain",
5884
6189
  title: value.annotation.filename,
5885
6190
  filename: value.annotation.filename,
@@ -5895,7 +6200,7 @@ var OpenAIResponsesLanguageModel = class {
5895
6200
  controller.enqueue({
5896
6201
  type: "source",
5897
6202
  sourceType: "document",
5898
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
6203
+ id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
5899
6204
  mediaType: "text/plain",
5900
6205
  title: value.annotation.filename,
5901
6206
  filename: value.annotation.filename,
@@ -5911,7 +6216,7 @@ var OpenAIResponsesLanguageModel = class {
5911
6216
  controller.enqueue({
5912
6217
  type: "source",
5913
6218
  sourceType: "document",
5914
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
6219
+ id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
5915
6220
  mediaType: "application/octet-stream",
5916
6221
  title: value.annotation.file_id,
5917
6222
  filename: value.annotation.file_id,
@@ -6029,13 +6334,13 @@ import {
6029
6334
  } from "@ai-sdk/provider-utils";
6030
6335
 
6031
6336
  // src/speech/openai-speech-options.ts
6032
- import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
6033
- import { z as z22 } from "zod/v4";
6034
- var openaiSpeechModelOptionsSchema = lazySchema20(
6035
- () => zodSchema20(
6036
- z22.object({
6037
- instructions: z22.string().nullish(),
6038
- speed: z22.number().min(0.25).max(4).default(1).nullish()
6337
+ import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6338
+ import { z as z23 } from "zod/v4";
6339
+ var openaiSpeechModelOptionsSchema = lazySchema21(
6340
+ () => zodSchema21(
6341
+ z23.object({
6342
+ instructions: z23.string().nullish(),
6343
+ speed: z23.number().min(0.25).max(4).default(1).nullish()
6039
6344
  })
6040
6345
  )
6041
6346
  );
@@ -6045,7 +6350,7 @@ var OpenAISpeechModel = class {
6045
6350
  constructor(modelId, config) {
6046
6351
  this.modelId = modelId;
6047
6352
  this.config = config;
6048
- this.specificationVersion = "v3";
6353
+ this.specificationVersion = "v4";
6049
6354
  }
6050
6355
  get provider() {
6051
6356
  return this.config.provider;
@@ -6152,33 +6457,33 @@ import {
6152
6457
  } from "@ai-sdk/provider-utils";
6153
6458
 
6154
6459
  // src/transcription/openai-transcription-api.ts
6155
- import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6156
- import { z as z23 } from "zod/v4";
6157
- var openaiTranscriptionResponseSchema = lazySchema21(
6158
- () => zodSchema21(
6159
- z23.object({
6160
- text: z23.string(),
6161
- language: z23.string().nullish(),
6162
- duration: z23.number().nullish(),
6163
- words: z23.array(
6164
- z23.object({
6165
- word: z23.string(),
6166
- start: z23.number(),
6167
- end: z23.number()
6460
+ import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6461
+ import { z as z24 } from "zod/v4";
6462
+ var openaiTranscriptionResponseSchema = lazySchema22(
6463
+ () => zodSchema22(
6464
+ z24.object({
6465
+ text: z24.string(),
6466
+ language: z24.string().nullish(),
6467
+ duration: z24.number().nullish(),
6468
+ words: z24.array(
6469
+ z24.object({
6470
+ word: z24.string(),
6471
+ start: z24.number(),
6472
+ end: z24.number()
6168
6473
  })
6169
6474
  ).nullish(),
6170
- segments: z23.array(
6171
- z23.object({
6172
- id: z23.number(),
6173
- seek: z23.number(),
6174
- start: z23.number(),
6175
- end: z23.number(),
6176
- text: z23.string(),
6177
- tokens: z23.array(z23.number()),
6178
- temperature: z23.number(),
6179
- avg_logprob: z23.number(),
6180
- compression_ratio: z23.number(),
6181
- no_speech_prob: z23.number()
6475
+ segments: z24.array(
6476
+ z24.object({
6477
+ id: z24.number(),
6478
+ seek: z24.number(),
6479
+ start: z24.number(),
6480
+ end: z24.number(),
6481
+ text: z24.string(),
6482
+ tokens: z24.array(z24.number()),
6483
+ temperature: z24.number(),
6484
+ avg_logprob: z24.number(),
6485
+ compression_ratio: z24.number(),
6486
+ no_speech_prob: z24.number()
6182
6487
  })
6183
6488
  ).nullish()
6184
6489
  })
@@ -6186,33 +6491,33 @@ var openaiTranscriptionResponseSchema = lazySchema21(
6186
6491
  );
6187
6492
 
6188
6493
  // src/transcription/openai-transcription-options.ts
6189
- import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6190
- import { z as z24 } from "zod/v4";
6191
- var openAITranscriptionModelOptions = lazySchema22(
6192
- () => zodSchema22(
6193
- z24.object({
6494
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
6495
+ import { z as z25 } from "zod/v4";
6496
+ var openAITranscriptionModelOptions = lazySchema23(
6497
+ () => zodSchema23(
6498
+ z25.object({
6194
6499
  /**
6195
6500
  * Additional information to include in the transcription response.
6196
6501
  */
6197
- include: z24.array(z24.string()).optional(),
6502
+ include: z25.array(z25.string()).optional(),
6198
6503
  /**
6199
6504
  * The language of the input audio in ISO-639-1 format.
6200
6505
  */
6201
- language: z24.string().optional(),
6506
+ language: z25.string().optional(),
6202
6507
  /**
6203
6508
  * An optional text to guide the model's style or continue a previous audio segment.
6204
6509
  */
6205
- prompt: z24.string().optional(),
6510
+ prompt: z25.string().optional(),
6206
6511
  /**
6207
6512
  * The sampling temperature, between 0 and 1.
6208
6513
  * @default 0
6209
6514
  */
6210
- temperature: z24.number().min(0).max(1).default(0).optional(),
6515
+ temperature: z25.number().min(0).max(1).default(0).optional(),
6211
6516
  /**
6212
6517
  * The timestamp granularities to populate for this transcription.
6213
6518
  * @default ['segment']
6214
6519
  */
6215
- timestampGranularities: z24.array(z24.enum(["word", "segment"])).default(["segment"]).optional()
6520
+ timestampGranularities: z25.array(z25.enum(["word", "segment"])).default(["segment"]).optional()
6216
6521
  })
6217
6522
  )
6218
6523
  );
@@ -6281,7 +6586,7 @@ var OpenAITranscriptionModel = class {
6281
6586
  constructor(modelId, config) {
6282
6587
  this.modelId = modelId;
6283
6588
  this.config = config;
6284
- this.specificationVersion = "v3";
6589
+ this.specificationVersion = "v4";
6285
6590
  }
6286
6591
  get provider() {
6287
6592
  return this.config.provider;
@@ -6385,7 +6690,7 @@ var OpenAITranscriptionModel = class {
6385
6690
  };
6386
6691
 
6387
6692
  // src/version.ts
6388
- var VERSION = true ? "4.0.0-beta.0" : "0.0.0-test";
6693
+ var VERSION = true ? "4.0.0-beta.10" : "0.0.0-test";
6389
6694
 
6390
6695
  // src/openai-provider.ts
6391
6696
  function createOpenAI(options = {}) {
@@ -6466,7 +6771,7 @@ function createOpenAI(options = {}) {
6466
6771
  const provider = function(modelId) {
6467
6772
  return createLanguageModel(modelId);
6468
6773
  };
6469
- provider.specificationVersion = "v3";
6774
+ provider.specificationVersion = "v4";
6470
6775
  provider.languageModel = createLanguageModel;
6471
6776
  provider.chat = createChatModel;
6472
6777
  provider.completion = createCompletionModel;