@ai-sdk/openai 3.0.44 → 3.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -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") || modelId.startsWith("gpt-5.4");
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,
@@ -2321,74 +2321,56 @@ var shell = createProviderToolFactoryWithOutputSchema6({
2321
2321
  outputSchema: shellOutputSchema
2322
2322
  });
2323
2323
 
2324
- // src/tool/web-search.ts
2324
+ // src/tool/tool-search.ts
2325
2325
  import {
2326
2326
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2327
2327
  lazySchema as lazySchema15,
2328
2328
  zodSchema as zodSchema15
2329
2329
  } from "@ai-sdk/provider-utils";
2330
2330
  import { z as z16 } from "zod/v4";
2331
- var webSearchArgsSchema = lazySchema15(
2331
+ var toolSearchArgsSchema = lazySchema15(
2332
2332
  () => zodSchema15(
2333
2333
  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()
2334
+ execution: z16.enum(["server", "client"]).optional(),
2335
+ description: z16.string().optional(),
2336
+ parameters: z16.record(z16.string(), z16.unknown()).optional()
2344
2337
  })
2345
2338
  )
2346
2339
  );
2347
- var webSearchInputSchema = lazySchema15(() => zodSchema15(z16.object({})));
2348
- var webSearchOutputSchema = lazySchema15(
2340
+ var toolSearchInputSchema = lazySchema15(
2349
2341
  () => zodSchema15(
2350
2342
  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()
2343
+ arguments: z16.unknown().optional(),
2344
+ call_id: z16.string().nullish()
2372
2345
  })
2373
2346
  )
2374
2347
  );
2375
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2376
- id: "openai.web_search",
2377
- inputSchema: webSearchInputSchema,
2378
- outputSchema: webSearchOutputSchema
2348
+ var toolSearchOutputSchema = lazySchema15(
2349
+ () => zodSchema15(
2350
+ z16.object({
2351
+ tools: z16.array(z16.record(z16.string(), z16.unknown()))
2352
+ })
2353
+ )
2354
+ );
2355
+ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2356
+ id: "openai.tool_search",
2357
+ inputSchema: toolSearchInputSchema,
2358
+ outputSchema: toolSearchOutputSchema
2379
2359
  });
2380
- var webSearch = (args = {}) => webSearchToolFactory(args);
2360
+ var toolSearch = (args = {}) => toolSearchToolFactory(args);
2381
2361
 
2382
- // src/tool/web-search-preview.ts
2362
+ // src/tool/web-search.ts
2383
2363
  import {
2384
2364
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2385
2365
  lazySchema as lazySchema16,
2386
2366
  zodSchema as zodSchema16
2387
2367
  } from "@ai-sdk/provider-utils";
2388
2368
  import { z as z17 } from "zod/v4";
2389
- var webSearchPreviewArgsSchema = lazySchema16(
2369
+ var webSearchArgsSchema = lazySchema16(
2390
2370
  () => zodSchema16(
2391
2371
  z17.object({
2372
+ externalWebAccess: z17.boolean().optional(),
2373
+ filters: z17.object({ allowedDomains: z17.array(z17.string()).optional() }).optional(),
2392
2374
  searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
2393
2375
  userLocation: z17.object({
2394
2376
  type: z17.literal("approximate"),
@@ -2400,10 +2382,8 @@ var webSearchPreviewArgsSchema = lazySchema16(
2400
2382
  })
2401
2383
  )
2402
2384
  );
2403
- var webSearchPreviewInputSchema = lazySchema16(
2404
- () => zodSchema16(z17.object({}))
2405
- );
2406
- var webSearchPreviewOutputSchema = lazySchema16(
2385
+ var webSearchInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
2386
+ var webSearchOutputSchema = lazySchema16(
2407
2387
  () => zodSchema16(
2408
2388
  z17.object({
2409
2389
  action: z17.discriminatedUnion("type", [
@@ -2420,77 +2400,135 @@ var webSearchPreviewOutputSchema = lazySchema16(
2420
2400
  url: z17.string().nullish(),
2421
2401
  pattern: z17.string().nullish()
2422
2402
  })
2423
- ]).optional()
2403
+ ]).optional(),
2404
+ sources: z17.array(
2405
+ z17.discriminatedUnion("type", [
2406
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
2407
+ z17.object({ type: z17.literal("api"), name: z17.string() })
2408
+ ])
2409
+ ).optional()
2424
2410
  })
2425
2411
  )
2426
2412
  );
2427
- var webSearchPreview = createProviderToolFactoryWithOutputSchema8({
2428
- id: "openai.web_search_preview",
2429
- inputSchema: webSearchPreviewInputSchema,
2430
- outputSchema: webSearchPreviewOutputSchema
2413
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
2414
+ id: "openai.web_search",
2415
+ inputSchema: webSearchInputSchema,
2416
+ outputSchema: webSearchOutputSchema
2431
2417
  });
2418
+ var webSearch = (args = {}) => webSearchToolFactory(args);
2432
2419
 
2433
- // src/tool/mcp.ts
2420
+ // src/tool/web-search-preview.ts
2434
2421
  import {
2435
2422
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2436
2423
  lazySchema as lazySchema17,
2437
2424
  zodSchema as zodSchema17
2438
2425
  } from "@ai-sdk/provider-utils";
2439
2426
  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
- ])
2427
+ var webSearchPreviewArgsSchema = lazySchema17(
2428
+ () => zodSchema17(
2429
+ z18.object({
2430
+ searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
2431
+ userLocation: z18.object({
2432
+ type: z18.literal("approximate"),
2433
+ country: z18.string().optional(),
2434
+ city: z18.string().optional(),
2435
+ region: z18.string().optional(),
2436
+ timezone: z18.string().optional()
2437
+ }).optional()
2438
+ })
2439
+ )
2449
2440
  );
2450
- var mcpArgsSchema = lazySchema17(
2441
+ var webSearchPreviewInputSchema = lazySchema17(
2442
+ () => zodSchema17(z18.object({}))
2443
+ );
2444
+ var webSearchPreviewOutputSchema = lazySchema17(
2451
2445
  () => zodSchema17(
2452
2446
  z18.object({
2453
- serverLabel: z18.string(),
2454
- allowedTools: z18.union([
2455
- z18.array(z18.string()),
2447
+ action: z18.discriminatedUnion("type", [
2448
+ z18.object({
2449
+ type: z18.literal("search"),
2450
+ query: z18.string().optional()
2451
+ }),
2452
+ z18.object({
2453
+ type: z18.literal("openPage"),
2454
+ url: z18.string().nullish()
2455
+ }),
2456
2456
  z18.object({
2457
- readOnly: z18.boolean().optional(),
2458
- toolNames: z18.array(z18.string()).optional()
2457
+ type: z18.literal("findInPage"),
2458
+ url: z18.string().nullish(),
2459
+ pattern: z18.string().nullish()
2460
+ })
2461
+ ]).optional()
2462
+ })
2463
+ )
2464
+ );
2465
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
2466
+ id: "openai.web_search_preview",
2467
+ inputSchema: webSearchPreviewInputSchema,
2468
+ outputSchema: webSearchPreviewOutputSchema
2469
+ });
2470
+
2471
+ // src/tool/mcp.ts
2472
+ import {
2473
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
2474
+ lazySchema as lazySchema18,
2475
+ zodSchema as zodSchema18
2476
+ } from "@ai-sdk/provider-utils";
2477
+ import { z as z19 } from "zod/v4";
2478
+ var jsonValueSchema = z19.lazy(
2479
+ () => z19.union([
2480
+ z19.string(),
2481
+ z19.number(),
2482
+ z19.boolean(),
2483
+ z19.null(),
2484
+ z19.array(jsonValueSchema),
2485
+ z19.record(z19.string(), jsonValueSchema)
2486
+ ])
2487
+ );
2488
+ var mcpArgsSchema = lazySchema18(
2489
+ () => zodSchema18(
2490
+ z19.object({
2491
+ serverLabel: z19.string(),
2492
+ allowedTools: z19.union([
2493
+ z19.array(z19.string()),
2494
+ z19.object({
2495
+ readOnly: z19.boolean().optional(),
2496
+ toolNames: z19.array(z19.string()).optional()
2459
2497
  })
2460
2498
  ]).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()
2499
+ authorization: z19.string().optional(),
2500
+ connectorId: z19.string().optional(),
2501
+ headers: z19.record(z19.string(), z19.string()).optional(),
2502
+ requireApproval: z19.union([
2503
+ z19.enum(["always", "never"]),
2504
+ z19.object({
2505
+ never: z19.object({
2506
+ toolNames: z19.array(z19.string()).optional()
2469
2507
  }).optional()
2470
2508
  })
2471
2509
  ]).optional(),
2472
- serverDescription: z18.string().optional(),
2473
- serverUrl: z18.string().optional()
2510
+ serverDescription: z19.string().optional(),
2511
+ serverUrl: z19.string().optional()
2474
2512
  }).refine(
2475
2513
  (v) => v.serverUrl != null || v.connectorId != null,
2476
2514
  "One of serverUrl or connectorId must be provided."
2477
2515
  )
2478
2516
  )
2479
2517
  );
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()
2518
+ var mcpInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
2519
+ var mcpOutputSchema = lazySchema18(
2520
+ () => zodSchema18(
2521
+ z19.object({
2522
+ type: z19.literal("call"),
2523
+ serverLabel: z19.string(),
2524
+ name: z19.string(),
2525
+ arguments: z19.string(),
2526
+ output: z19.string().nullish(),
2527
+ error: z19.union([z19.string(), jsonValueSchema]).optional()
2490
2528
  })
2491
2529
  )
2492
2530
  );
2493
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
2531
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema10({
2494
2532
  id: "openai.mcp",
2495
2533
  inputSchema: mcpInputSchema,
2496
2534
  outputSchema: mcpOutputSchema
@@ -2602,7 +2640,17 @@ var openaiTools = {
2602
2640
  * @param serverDescription - Optional description of the server.
2603
2641
  * @param serverUrl - URL for the MCP server.
2604
2642
  */
2605
- mcp
2643
+ mcp,
2644
+ /**
2645
+ * Tool search allows the model to dynamically search for and load deferred
2646
+ * tools into the model's context as needed. This helps reduce overall token
2647
+ * usage, cost, and latency by only loading tools when the model needs them.
2648
+ *
2649
+ * To use tool search, mark functions or namespaces with `defer_loading: true`
2650
+ * in the tools array. The model will use tool search to load these tools
2651
+ * when it determines they are needed.
2652
+ */
2653
+ toolSearch
2606
2654
  };
2607
2655
 
2608
2656
  // src/responses/openai-responses-language-model.ts
@@ -2665,10 +2713,11 @@ import {
2665
2713
  import {
2666
2714
  convertToBase64 as convertToBase642,
2667
2715
  isNonNullable,
2716
+ parseJSON,
2668
2717
  parseProviderOptions as parseProviderOptions4,
2669
2718
  validateTypes
2670
2719
  } from "@ai-sdk/provider-utils";
2671
- import { z as z19 } from "zod/v4";
2720
+ import { z as z20 } from "zod/v4";
2672
2721
  function isFileId(data, prefixes) {
2673
2722
  if (!prefixes) return false;
2674
2723
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2686,7 +2735,7 @@ async function convertToOpenAIResponsesInput({
2686
2735
  hasApplyPatchTool = false,
2687
2736
  customProviderToolNames
2688
2737
  }) {
2689
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2738
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2690
2739
  let input = [];
2691
2740
  const warnings = [];
2692
2741
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -2790,6 +2839,32 @@ async function convertToOpenAIResponsesInput({
2790
2839
  if (hasConversation && id != null) {
2791
2840
  break;
2792
2841
  }
2842
+ const resolvedToolName = toolNameMapping.toProviderToolName(
2843
+ part.toolName
2844
+ );
2845
+ if (resolvedToolName === "tool_search") {
2846
+ if (store && id != null) {
2847
+ input.push({ type: "item_reference", id });
2848
+ break;
2849
+ }
2850
+ const parsedInput = typeof part.input === "string" ? await parseJSON({
2851
+ text: part.input,
2852
+ schema: toolSearchInputSchema
2853
+ }) : await validateTypes({
2854
+ value: part.input,
2855
+ schema: toolSearchInputSchema
2856
+ });
2857
+ const execution = parsedInput.call_id != null ? "client" : "server";
2858
+ input.push({
2859
+ type: "tool_search_call",
2860
+ id: id != null ? id : part.toolCallId,
2861
+ execution,
2862
+ call_id: (_g = parsedInput.call_id) != null ? _g : null,
2863
+ status: "completed",
2864
+ arguments: parsedInput.arguments
2865
+ });
2866
+ break;
2867
+ }
2793
2868
  if (part.providerExecuted) {
2794
2869
  if (store && id != null) {
2795
2870
  input.push({ type: "item_reference", id });
@@ -2800,9 +2875,6 @@ async function convertToOpenAIResponsesInput({
2800
2875
  input.push({ type: "item_reference", id });
2801
2876
  break;
2802
2877
  }
2803
- const resolvedToolName = toolNameMapping.toProviderToolName(
2804
- part.toolName
2805
- );
2806
2878
  if (hasLocalShellTool && resolvedToolName === "local_shell") {
2807
2879
  const parsedInput = await validateTypes({
2808
2880
  value: part.input,
@@ -2885,6 +2957,26 @@ async function convertToOpenAIResponsesInput({
2885
2957
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
2886
2958
  part.toolName
2887
2959
  );
2960
+ if (resolvedResultToolName === "tool_search") {
2961
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2962
+ if (store) {
2963
+ input.push({ type: "item_reference", id: itemId });
2964
+ } else if (part.output.type === "json") {
2965
+ const parsedOutput = await validateTypes({
2966
+ value: part.output.value,
2967
+ schema: toolSearchOutputSchema
2968
+ });
2969
+ input.push({
2970
+ type: "tool_search_output",
2971
+ id: itemId,
2972
+ execution: "server",
2973
+ call_id: null,
2974
+ status: "completed",
2975
+ tools: parsedOutput.tools
2976
+ });
2977
+ }
2978
+ break;
2979
+ }
2888
2980
  if (hasShellTool && resolvedResultToolName === "shell") {
2889
2981
  if (part.output.type === "json") {
2890
2982
  const parsedOutput = await validateTypes({
@@ -2907,7 +2999,7 @@ async function convertToOpenAIResponsesInput({
2907
2999
  break;
2908
3000
  }
2909
3001
  if (store) {
2910
- const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
3002
+ const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
2911
3003
  input.push({ type: "item_reference", id: itemId });
2912
3004
  } else {
2913
3005
  warnings.push({
@@ -3017,7 +3109,7 @@ async function convertToOpenAIResponsesInput({
3017
3109
  }
3018
3110
  const output = part.output;
3019
3111
  if (output.type === "execution-denied") {
3020
- const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
3112
+ const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
3021
3113
  if (approvalId) {
3022
3114
  continue;
3023
3115
  }
@@ -3025,6 +3117,20 @@ async function convertToOpenAIResponsesInput({
3025
3117
  const resolvedToolName = toolNameMapping.toProviderToolName(
3026
3118
  part.toolName
3027
3119
  );
3120
+ if (resolvedToolName === "tool_search" && output.type === "json") {
3121
+ const parsedOutput = await validateTypes({
3122
+ value: output.value,
3123
+ schema: toolSearchOutputSchema
3124
+ });
3125
+ input.push({
3126
+ type: "tool_search_output",
3127
+ execution: "client",
3128
+ call_id: part.toolCallId,
3129
+ status: "completed",
3130
+ tools: parsedOutput.tools
3131
+ });
3132
+ continue;
3133
+ }
3028
3134
  if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
3029
3135
  const parsedOutput = await validateTypes({
3030
3136
  value: output.value,
@@ -3077,7 +3183,7 @@ async function convertToOpenAIResponsesInput({
3077
3183
  outputValue = output.value;
3078
3184
  break;
3079
3185
  case "execution-denied":
3080
- outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3186
+ outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
3081
3187
  break;
3082
3188
  case "json":
3083
3189
  case "error-json":
@@ -3131,7 +3237,7 @@ async function convertToOpenAIResponsesInput({
3131
3237
  contentValue = output.value;
3132
3238
  break;
3133
3239
  case "execution-denied":
3134
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3240
+ contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
3135
3241
  break;
3136
3242
  case "json":
3137
3243
  case "error-json":
@@ -3201,9 +3307,9 @@ async function convertToOpenAIResponsesInput({
3201
3307
  }
3202
3308
  return { input, warnings };
3203
3309
  }
3204
- var openaiResponsesReasoningProviderOptionsSchema = z19.object({
3205
- itemId: z19.string().nullish(),
3206
- reasoningEncryptedContent: z19.string().nullish()
3310
+ var openaiResponsesReasoningProviderOptionsSchema = z20.object({
3311
+ itemId: z20.string().nullish(),
3312
+ reasoningEncryptedContent: z20.string().nullish()
3207
3313
  });
3208
3314
 
3209
3315
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3225,483 +3331,525 @@ function mapOpenAIResponseFinishReason({
3225
3331
  }
3226
3332
 
3227
3333
  // src/responses/openai-responses-api.ts
3228
- import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
3229
- import { z as z20 } from "zod/v4";
3230
- var openaiResponsesChunkSchema = lazySchema18(
3231
- () => zodSchema18(
3232
- z20.union([
3233
- z20.object({
3234
- type: z20.literal("response.output_text.delta"),
3235
- item_id: z20.string(),
3236
- delta: z20.string(),
3237
- logprobs: z20.array(
3238
- z20.object({
3239
- token: z20.string(),
3240
- logprob: z20.number(),
3241
- top_logprobs: z20.array(
3242
- z20.object({
3243
- token: z20.string(),
3244
- logprob: z20.number()
3334
+ import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3335
+ import { z as z21 } from "zod/v4";
3336
+ var jsonValueSchema2 = z21.lazy(
3337
+ () => z21.union([
3338
+ z21.string(),
3339
+ z21.number(),
3340
+ z21.boolean(),
3341
+ z21.null(),
3342
+ z21.array(jsonValueSchema2),
3343
+ z21.record(z21.string(), jsonValueSchema2.optional())
3344
+ ])
3345
+ );
3346
+ var openaiResponsesChunkSchema = lazySchema19(
3347
+ () => zodSchema19(
3348
+ z21.union([
3349
+ z21.object({
3350
+ type: z21.literal("response.output_text.delta"),
3351
+ item_id: z21.string(),
3352
+ delta: z21.string(),
3353
+ logprobs: z21.array(
3354
+ z21.object({
3355
+ token: z21.string(),
3356
+ logprob: z21.number(),
3357
+ top_logprobs: z21.array(
3358
+ z21.object({
3359
+ token: z21.string(),
3360
+ logprob: z21.number()
3245
3361
  })
3246
3362
  )
3247
3363
  })
3248
3364
  ).nullish()
3249
3365
  }),
3250
- z20.object({
3251
- type: z20.enum(["response.completed", "response.incomplete"]),
3252
- response: z20.object({
3253
- incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3254
- usage: z20.object({
3255
- input_tokens: z20.number(),
3256
- input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3257
- output_tokens: z20.number(),
3258
- output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
3366
+ z21.object({
3367
+ type: z21.enum(["response.completed", "response.incomplete"]),
3368
+ response: z21.object({
3369
+ incomplete_details: z21.object({ reason: z21.string() }).nullish(),
3370
+ usage: z21.object({
3371
+ input_tokens: z21.number(),
3372
+ input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
3373
+ output_tokens: z21.number(),
3374
+ output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3259
3375
  }),
3260
- service_tier: z20.string().nullish()
3376
+ service_tier: z21.string().nullish()
3261
3377
  })
3262
3378
  }),
3263
- z20.object({
3264
- type: z20.literal("response.created"),
3265
- response: z20.object({
3266
- id: z20.string(),
3267
- created_at: z20.number(),
3268
- model: z20.string(),
3269
- service_tier: z20.string().nullish()
3379
+ z21.object({
3380
+ type: z21.literal("response.created"),
3381
+ response: z21.object({
3382
+ id: z21.string(),
3383
+ created_at: z21.number(),
3384
+ model: z21.string(),
3385
+ service_tier: z21.string().nullish()
3270
3386
  })
3271
3387
  }),
3272
- z20.object({
3273
- type: z20.literal("response.output_item.added"),
3274
- output_index: z20.number(),
3275
- item: z20.discriminatedUnion("type", [
3276
- z20.object({
3277
- type: z20.literal("message"),
3278
- id: z20.string(),
3279
- phase: z20.enum(["commentary", "final_answer"]).nullish()
3388
+ z21.object({
3389
+ type: z21.literal("response.output_item.added"),
3390
+ output_index: z21.number(),
3391
+ item: z21.discriminatedUnion("type", [
3392
+ z21.object({
3393
+ type: z21.literal("message"),
3394
+ id: z21.string(),
3395
+ phase: z21.enum(["commentary", "final_answer"]).nullish()
3280
3396
  }),
3281
- z20.object({
3282
- type: z20.literal("reasoning"),
3283
- id: z20.string(),
3284
- encrypted_content: z20.string().nullish()
3397
+ z21.object({
3398
+ type: z21.literal("reasoning"),
3399
+ id: z21.string(),
3400
+ encrypted_content: z21.string().nullish()
3285
3401
  }),
3286
- z20.object({
3287
- type: z20.literal("function_call"),
3288
- id: z20.string(),
3289
- call_id: z20.string(),
3290
- name: z20.string(),
3291
- arguments: z20.string()
3402
+ z21.object({
3403
+ type: z21.literal("function_call"),
3404
+ id: z21.string(),
3405
+ call_id: z21.string(),
3406
+ name: z21.string(),
3407
+ arguments: z21.string()
3292
3408
  }),
3293
- z20.object({
3294
- type: z20.literal("web_search_call"),
3295
- id: z20.string(),
3296
- status: z20.string()
3409
+ z21.object({
3410
+ type: z21.literal("web_search_call"),
3411
+ id: z21.string(),
3412
+ status: z21.string()
3297
3413
  }),
3298
- z20.object({
3299
- type: z20.literal("computer_call"),
3300
- id: z20.string(),
3301
- status: z20.string()
3414
+ z21.object({
3415
+ type: z21.literal("computer_call"),
3416
+ id: z21.string(),
3417
+ status: z21.string()
3302
3418
  }),
3303
- z20.object({
3304
- type: z20.literal("file_search_call"),
3305
- id: z20.string()
3419
+ z21.object({
3420
+ type: z21.literal("file_search_call"),
3421
+ id: z21.string()
3306
3422
  }),
3307
- z20.object({
3308
- type: z20.literal("image_generation_call"),
3309
- id: z20.string()
3423
+ z21.object({
3424
+ type: z21.literal("image_generation_call"),
3425
+ id: z21.string()
3310
3426
  }),
3311
- z20.object({
3312
- type: z20.literal("code_interpreter_call"),
3313
- id: z20.string(),
3314
- container_id: z20.string(),
3315
- code: z20.string().nullable(),
3316
- outputs: z20.array(
3317
- z20.discriminatedUnion("type", [
3318
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3319
- z20.object({ type: z20.literal("image"), url: z20.string() })
3427
+ z21.object({
3428
+ type: z21.literal("code_interpreter_call"),
3429
+ id: z21.string(),
3430
+ container_id: z21.string(),
3431
+ code: z21.string().nullable(),
3432
+ outputs: z21.array(
3433
+ z21.discriminatedUnion("type", [
3434
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3435
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3320
3436
  ])
3321
3437
  ).nullable(),
3322
- status: z20.string()
3438
+ status: z21.string()
3323
3439
  }),
3324
- z20.object({
3325
- type: z20.literal("mcp_call"),
3326
- id: z20.string(),
3327
- status: z20.string(),
3328
- approval_request_id: z20.string().nullish()
3440
+ z21.object({
3441
+ type: z21.literal("mcp_call"),
3442
+ id: z21.string(),
3443
+ status: z21.string(),
3444
+ approval_request_id: z21.string().nullish()
3329
3445
  }),
3330
- z20.object({
3331
- type: z20.literal("mcp_list_tools"),
3332
- id: z20.string()
3446
+ z21.object({
3447
+ type: z21.literal("mcp_list_tools"),
3448
+ id: z21.string()
3333
3449
  }),
3334
- z20.object({
3335
- type: z20.literal("mcp_approval_request"),
3336
- id: z20.string()
3450
+ z21.object({
3451
+ type: z21.literal("mcp_approval_request"),
3452
+ id: z21.string()
3337
3453
  }),
3338
- z20.object({
3339
- type: z20.literal("apply_patch_call"),
3340
- id: z20.string(),
3341
- call_id: z20.string(),
3342
- status: z20.enum(["in_progress", "completed"]),
3343
- operation: z20.discriminatedUnion("type", [
3344
- z20.object({
3345
- type: z20.literal("create_file"),
3346
- path: z20.string(),
3347
- diff: z20.string()
3454
+ z21.object({
3455
+ type: z21.literal("apply_patch_call"),
3456
+ id: z21.string(),
3457
+ call_id: z21.string(),
3458
+ status: z21.enum(["in_progress", "completed"]),
3459
+ operation: z21.discriminatedUnion("type", [
3460
+ z21.object({
3461
+ type: z21.literal("create_file"),
3462
+ path: z21.string(),
3463
+ diff: z21.string()
3348
3464
  }),
3349
- z20.object({
3350
- type: z20.literal("delete_file"),
3351
- path: z20.string()
3465
+ z21.object({
3466
+ type: z21.literal("delete_file"),
3467
+ path: z21.string()
3352
3468
  }),
3353
- z20.object({
3354
- type: z20.literal("update_file"),
3355
- path: z20.string(),
3356
- diff: z20.string()
3469
+ z21.object({
3470
+ type: z21.literal("update_file"),
3471
+ path: z21.string(),
3472
+ diff: z21.string()
3357
3473
  })
3358
3474
  ])
3359
3475
  }),
3360
- z20.object({
3361
- type: z20.literal("custom_tool_call"),
3362
- id: z20.string(),
3363
- call_id: z20.string(),
3364
- name: z20.string(),
3365
- input: z20.string()
3476
+ z21.object({
3477
+ type: z21.literal("custom_tool_call"),
3478
+ id: z21.string(),
3479
+ call_id: z21.string(),
3480
+ name: z21.string(),
3481
+ input: z21.string()
3366
3482
  }),
3367
- z20.object({
3368
- type: z20.literal("shell_call"),
3369
- id: z20.string(),
3370
- call_id: z20.string(),
3371
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3372
- action: z20.object({
3373
- commands: z20.array(z20.string())
3483
+ z21.object({
3484
+ type: z21.literal("shell_call"),
3485
+ id: z21.string(),
3486
+ call_id: z21.string(),
3487
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3488
+ action: z21.object({
3489
+ commands: z21.array(z21.string())
3374
3490
  })
3375
3491
  }),
3376
- z20.object({
3377
- type: z20.literal("shell_call_output"),
3378
- id: z20.string(),
3379
- call_id: z20.string(),
3380
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3381
- output: z20.array(
3382
- z20.object({
3383
- stdout: z20.string(),
3384
- stderr: z20.string(),
3385
- outcome: z20.discriminatedUnion("type", [
3386
- z20.object({ type: z20.literal("timeout") }),
3387
- z20.object({
3388
- type: z20.literal("exit"),
3389
- exit_code: z20.number()
3492
+ z21.object({
3493
+ type: z21.literal("shell_call_output"),
3494
+ id: z21.string(),
3495
+ call_id: z21.string(),
3496
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3497
+ output: z21.array(
3498
+ z21.object({
3499
+ stdout: z21.string(),
3500
+ stderr: z21.string(),
3501
+ outcome: z21.discriminatedUnion("type", [
3502
+ z21.object({ type: z21.literal("timeout") }),
3503
+ z21.object({
3504
+ type: z21.literal("exit"),
3505
+ exit_code: z21.number()
3390
3506
  })
3391
3507
  ])
3392
3508
  })
3393
3509
  )
3510
+ }),
3511
+ z21.object({
3512
+ type: z21.literal("tool_search_call"),
3513
+ id: z21.string(),
3514
+ execution: z21.enum(["server", "client"]),
3515
+ call_id: z21.string().nullable(),
3516
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3517
+ arguments: z21.unknown()
3518
+ }),
3519
+ z21.object({
3520
+ type: z21.literal("tool_search_output"),
3521
+ id: z21.string(),
3522
+ execution: z21.enum(["server", "client"]),
3523
+ call_id: z21.string().nullable(),
3524
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3525
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3394
3526
  })
3395
3527
  ])
3396
3528
  }),
3397
- z20.object({
3398
- type: z20.literal("response.output_item.done"),
3399
- output_index: z20.number(),
3400
- item: z20.discriminatedUnion("type", [
3401
- z20.object({
3402
- type: z20.literal("message"),
3403
- id: z20.string(),
3404
- phase: z20.enum(["commentary", "final_answer"]).nullish()
3529
+ z21.object({
3530
+ type: z21.literal("response.output_item.done"),
3531
+ output_index: z21.number(),
3532
+ item: z21.discriminatedUnion("type", [
3533
+ z21.object({
3534
+ type: z21.literal("message"),
3535
+ id: z21.string(),
3536
+ phase: z21.enum(["commentary", "final_answer"]).nullish()
3405
3537
  }),
3406
- z20.object({
3407
- type: z20.literal("reasoning"),
3408
- id: z20.string(),
3409
- encrypted_content: z20.string().nullish()
3538
+ z21.object({
3539
+ type: z21.literal("reasoning"),
3540
+ id: z21.string(),
3541
+ encrypted_content: z21.string().nullish()
3410
3542
  }),
3411
- z20.object({
3412
- type: z20.literal("function_call"),
3413
- id: z20.string(),
3414
- call_id: z20.string(),
3415
- name: z20.string(),
3416
- arguments: z20.string(),
3417
- status: z20.literal("completed")
3543
+ z21.object({
3544
+ type: z21.literal("function_call"),
3545
+ id: z21.string(),
3546
+ call_id: z21.string(),
3547
+ name: z21.string(),
3548
+ arguments: z21.string(),
3549
+ status: z21.literal("completed")
3418
3550
  }),
3419
- z20.object({
3420
- type: z20.literal("custom_tool_call"),
3421
- id: z20.string(),
3422
- call_id: z20.string(),
3423
- name: z20.string(),
3424
- input: z20.string(),
3425
- status: z20.literal("completed")
3551
+ z21.object({
3552
+ type: z21.literal("custom_tool_call"),
3553
+ id: z21.string(),
3554
+ call_id: z21.string(),
3555
+ name: z21.string(),
3556
+ input: z21.string(),
3557
+ status: z21.literal("completed")
3426
3558
  }),
3427
- z20.object({
3428
- type: z20.literal("code_interpreter_call"),
3429
- id: z20.string(),
3430
- code: z20.string().nullable(),
3431
- container_id: z20.string(),
3432
- outputs: z20.array(
3433
- z20.discriminatedUnion("type", [
3434
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3435
- z20.object({ type: z20.literal("image"), url: z20.string() })
3559
+ z21.object({
3560
+ type: z21.literal("code_interpreter_call"),
3561
+ id: z21.string(),
3562
+ code: z21.string().nullable(),
3563
+ container_id: z21.string(),
3564
+ outputs: z21.array(
3565
+ z21.discriminatedUnion("type", [
3566
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3567
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3436
3568
  ])
3437
3569
  ).nullable()
3438
3570
  }),
3439
- z20.object({
3440
- type: z20.literal("image_generation_call"),
3441
- id: z20.string(),
3442
- result: z20.string()
3571
+ z21.object({
3572
+ type: z21.literal("image_generation_call"),
3573
+ id: z21.string(),
3574
+ result: z21.string()
3443
3575
  }),
3444
- z20.object({
3445
- type: z20.literal("web_search_call"),
3446
- id: z20.string(),
3447
- status: z20.string(),
3448
- action: z20.discriminatedUnion("type", [
3449
- z20.object({
3450
- type: z20.literal("search"),
3451
- query: z20.string().nullish(),
3452
- sources: z20.array(
3453
- z20.discriminatedUnion("type", [
3454
- z20.object({ type: z20.literal("url"), url: z20.string() }),
3455
- z20.object({ type: z20.literal("api"), name: z20.string() })
3576
+ z21.object({
3577
+ type: z21.literal("web_search_call"),
3578
+ id: z21.string(),
3579
+ status: z21.string(),
3580
+ action: z21.discriminatedUnion("type", [
3581
+ z21.object({
3582
+ type: z21.literal("search"),
3583
+ query: z21.string().nullish(),
3584
+ sources: z21.array(
3585
+ z21.discriminatedUnion("type", [
3586
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3587
+ z21.object({ type: z21.literal("api"), name: z21.string() })
3456
3588
  ])
3457
3589
  ).nullish()
3458
3590
  }),
3459
- z20.object({
3460
- type: z20.literal("open_page"),
3461
- url: z20.string().nullish()
3591
+ z21.object({
3592
+ type: z21.literal("open_page"),
3593
+ url: z21.string().nullish()
3462
3594
  }),
3463
- z20.object({
3464
- type: z20.literal("find_in_page"),
3465
- url: z20.string().nullish(),
3466
- pattern: z20.string().nullish()
3595
+ z21.object({
3596
+ type: z21.literal("find_in_page"),
3597
+ url: z21.string().nullish(),
3598
+ pattern: z21.string().nullish()
3467
3599
  })
3468
3600
  ]).nullish()
3469
3601
  }),
3470
- z20.object({
3471
- type: z20.literal("file_search_call"),
3472
- id: z20.string(),
3473
- queries: z20.array(z20.string()),
3474
- results: z20.array(
3475
- z20.object({
3476
- attributes: z20.record(
3477
- z20.string(),
3478
- z20.union([z20.string(), z20.number(), z20.boolean()])
3602
+ z21.object({
3603
+ type: z21.literal("file_search_call"),
3604
+ id: z21.string(),
3605
+ queries: z21.array(z21.string()),
3606
+ results: z21.array(
3607
+ z21.object({
3608
+ attributes: z21.record(
3609
+ z21.string(),
3610
+ z21.union([z21.string(), z21.number(), z21.boolean()])
3479
3611
  ),
3480
- file_id: z20.string(),
3481
- filename: z20.string(),
3482
- score: z20.number(),
3483
- text: z20.string()
3612
+ file_id: z21.string(),
3613
+ filename: z21.string(),
3614
+ score: z21.number(),
3615
+ text: z21.string()
3484
3616
  })
3485
3617
  ).nullish()
3486
3618
  }),
3487
- z20.object({
3488
- type: z20.literal("local_shell_call"),
3489
- id: z20.string(),
3490
- call_id: z20.string(),
3491
- action: z20.object({
3492
- type: z20.literal("exec"),
3493
- command: z20.array(z20.string()),
3494
- timeout_ms: z20.number().optional(),
3495
- user: z20.string().optional(),
3496
- working_directory: z20.string().optional(),
3497
- env: z20.record(z20.string(), z20.string()).optional()
3619
+ z21.object({
3620
+ type: z21.literal("local_shell_call"),
3621
+ id: z21.string(),
3622
+ call_id: z21.string(),
3623
+ action: z21.object({
3624
+ type: z21.literal("exec"),
3625
+ command: z21.array(z21.string()),
3626
+ timeout_ms: z21.number().optional(),
3627
+ user: z21.string().optional(),
3628
+ working_directory: z21.string().optional(),
3629
+ env: z21.record(z21.string(), z21.string()).optional()
3498
3630
  })
3499
3631
  }),
3500
- z20.object({
3501
- type: z20.literal("computer_call"),
3502
- id: z20.string(),
3503
- status: z20.literal("completed")
3632
+ z21.object({
3633
+ type: z21.literal("computer_call"),
3634
+ id: z21.string(),
3635
+ status: z21.literal("completed")
3504
3636
  }),
3505
- z20.object({
3506
- type: z20.literal("mcp_call"),
3507
- id: z20.string(),
3508
- status: z20.string(),
3509
- arguments: z20.string(),
3510
- name: z20.string(),
3511
- server_label: z20.string(),
3512
- output: z20.string().nullish(),
3513
- error: z20.union([
3514
- z20.string(),
3515
- z20.object({
3516
- type: z20.string().optional(),
3517
- code: z20.union([z20.number(), z20.string()]).optional(),
3518
- message: z20.string().optional()
3637
+ z21.object({
3638
+ type: z21.literal("mcp_call"),
3639
+ id: z21.string(),
3640
+ status: z21.string(),
3641
+ arguments: z21.string(),
3642
+ name: z21.string(),
3643
+ server_label: z21.string(),
3644
+ output: z21.string().nullish(),
3645
+ error: z21.union([
3646
+ z21.string(),
3647
+ z21.object({
3648
+ type: z21.string().optional(),
3649
+ code: z21.union([z21.number(), z21.string()]).optional(),
3650
+ message: z21.string().optional()
3519
3651
  }).loose()
3520
3652
  ]).nullish(),
3521
- approval_request_id: z20.string().nullish()
3653
+ approval_request_id: z21.string().nullish()
3522
3654
  }),
3523
- z20.object({
3524
- type: z20.literal("mcp_list_tools"),
3525
- id: z20.string(),
3526
- server_label: z20.string(),
3527
- tools: z20.array(
3528
- z20.object({
3529
- name: z20.string(),
3530
- description: z20.string().optional(),
3531
- input_schema: z20.any(),
3532
- annotations: z20.record(z20.string(), z20.unknown()).optional()
3655
+ z21.object({
3656
+ type: z21.literal("mcp_list_tools"),
3657
+ id: z21.string(),
3658
+ server_label: z21.string(),
3659
+ tools: z21.array(
3660
+ z21.object({
3661
+ name: z21.string(),
3662
+ description: z21.string().optional(),
3663
+ input_schema: z21.any(),
3664
+ annotations: z21.record(z21.string(), z21.unknown()).optional()
3533
3665
  })
3534
3666
  ),
3535
- error: z20.union([
3536
- z20.string(),
3537
- z20.object({
3538
- type: z20.string().optional(),
3539
- code: z20.union([z20.number(), z20.string()]).optional(),
3540
- message: z20.string().optional()
3667
+ error: z21.union([
3668
+ z21.string(),
3669
+ z21.object({
3670
+ type: z21.string().optional(),
3671
+ code: z21.union([z21.number(), z21.string()]).optional(),
3672
+ message: z21.string().optional()
3541
3673
  }).loose()
3542
3674
  ]).optional()
3543
3675
  }),
3544
- z20.object({
3545
- type: z20.literal("mcp_approval_request"),
3546
- id: z20.string(),
3547
- server_label: z20.string(),
3548
- name: z20.string(),
3549
- arguments: z20.string(),
3550
- approval_request_id: z20.string().optional()
3676
+ z21.object({
3677
+ type: z21.literal("mcp_approval_request"),
3678
+ id: z21.string(),
3679
+ server_label: z21.string(),
3680
+ name: z21.string(),
3681
+ arguments: z21.string(),
3682
+ approval_request_id: z21.string().optional()
3551
3683
  }),
3552
- z20.object({
3553
- type: z20.literal("apply_patch_call"),
3554
- id: z20.string(),
3555
- call_id: z20.string(),
3556
- status: z20.enum(["in_progress", "completed"]),
3557
- operation: z20.discriminatedUnion("type", [
3558
- z20.object({
3559
- type: z20.literal("create_file"),
3560
- path: z20.string(),
3561
- diff: z20.string()
3684
+ z21.object({
3685
+ type: z21.literal("apply_patch_call"),
3686
+ id: z21.string(),
3687
+ call_id: z21.string(),
3688
+ status: z21.enum(["in_progress", "completed"]),
3689
+ operation: z21.discriminatedUnion("type", [
3690
+ z21.object({
3691
+ type: z21.literal("create_file"),
3692
+ path: z21.string(),
3693
+ diff: z21.string()
3562
3694
  }),
3563
- z20.object({
3564
- type: z20.literal("delete_file"),
3565
- path: z20.string()
3695
+ z21.object({
3696
+ type: z21.literal("delete_file"),
3697
+ path: z21.string()
3566
3698
  }),
3567
- z20.object({
3568
- type: z20.literal("update_file"),
3569
- path: z20.string(),
3570
- diff: z20.string()
3699
+ z21.object({
3700
+ type: z21.literal("update_file"),
3701
+ path: z21.string(),
3702
+ diff: z21.string()
3571
3703
  })
3572
3704
  ])
3573
3705
  }),
3574
- z20.object({
3575
- type: z20.literal("shell_call"),
3576
- id: z20.string(),
3577
- call_id: z20.string(),
3578
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3579
- action: z20.object({
3580
- commands: z20.array(z20.string())
3706
+ z21.object({
3707
+ type: z21.literal("shell_call"),
3708
+ id: z21.string(),
3709
+ call_id: z21.string(),
3710
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3711
+ action: z21.object({
3712
+ commands: z21.array(z21.string())
3581
3713
  })
3582
3714
  }),
3583
- z20.object({
3584
- type: z20.literal("shell_call_output"),
3585
- id: z20.string(),
3586
- call_id: z20.string(),
3587
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3588
- output: z20.array(
3589
- z20.object({
3590
- stdout: z20.string(),
3591
- stderr: z20.string(),
3592
- outcome: z20.discriminatedUnion("type", [
3593
- z20.object({ type: z20.literal("timeout") }),
3594
- z20.object({
3595
- type: z20.literal("exit"),
3596
- exit_code: z20.number()
3715
+ z21.object({
3716
+ type: z21.literal("shell_call_output"),
3717
+ id: z21.string(),
3718
+ call_id: z21.string(),
3719
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3720
+ output: z21.array(
3721
+ z21.object({
3722
+ stdout: z21.string(),
3723
+ stderr: z21.string(),
3724
+ outcome: z21.discriminatedUnion("type", [
3725
+ z21.object({ type: z21.literal("timeout") }),
3726
+ z21.object({
3727
+ type: z21.literal("exit"),
3728
+ exit_code: z21.number()
3597
3729
  })
3598
3730
  ])
3599
3731
  })
3600
3732
  )
3733
+ }),
3734
+ z21.object({
3735
+ type: z21.literal("tool_search_call"),
3736
+ id: z21.string(),
3737
+ execution: z21.enum(["server", "client"]),
3738
+ call_id: z21.string().nullable(),
3739
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3740
+ arguments: z21.unknown()
3741
+ }),
3742
+ z21.object({
3743
+ type: z21.literal("tool_search_output"),
3744
+ id: z21.string(),
3745
+ execution: z21.enum(["server", "client"]),
3746
+ call_id: z21.string().nullable(),
3747
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
3748
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3601
3749
  })
3602
3750
  ])
3603
3751
  }),
3604
- z20.object({
3605
- type: z20.literal("response.function_call_arguments.delta"),
3606
- item_id: z20.string(),
3607
- output_index: z20.number(),
3608
- delta: z20.string()
3752
+ z21.object({
3753
+ type: z21.literal("response.function_call_arguments.delta"),
3754
+ item_id: z21.string(),
3755
+ output_index: z21.number(),
3756
+ delta: z21.string()
3609
3757
  }),
3610
- z20.object({
3611
- type: z20.literal("response.custom_tool_call_input.delta"),
3612
- item_id: z20.string(),
3613
- output_index: z20.number(),
3614
- delta: z20.string()
3758
+ z21.object({
3759
+ type: z21.literal("response.custom_tool_call_input.delta"),
3760
+ item_id: z21.string(),
3761
+ output_index: z21.number(),
3762
+ delta: z21.string()
3615
3763
  }),
3616
- z20.object({
3617
- type: z20.literal("response.image_generation_call.partial_image"),
3618
- item_id: z20.string(),
3619
- output_index: z20.number(),
3620
- partial_image_b64: z20.string()
3764
+ z21.object({
3765
+ type: z21.literal("response.image_generation_call.partial_image"),
3766
+ item_id: z21.string(),
3767
+ output_index: z21.number(),
3768
+ partial_image_b64: z21.string()
3621
3769
  }),
3622
- z20.object({
3623
- type: z20.literal("response.code_interpreter_call_code.delta"),
3624
- item_id: z20.string(),
3625
- output_index: z20.number(),
3626
- delta: z20.string()
3770
+ z21.object({
3771
+ type: z21.literal("response.code_interpreter_call_code.delta"),
3772
+ item_id: z21.string(),
3773
+ output_index: z21.number(),
3774
+ delta: z21.string()
3627
3775
  }),
3628
- z20.object({
3629
- type: z20.literal("response.code_interpreter_call_code.done"),
3630
- item_id: z20.string(),
3631
- output_index: z20.number(),
3632
- code: z20.string()
3776
+ z21.object({
3777
+ type: z21.literal("response.code_interpreter_call_code.done"),
3778
+ item_id: z21.string(),
3779
+ output_index: z21.number(),
3780
+ code: z21.string()
3633
3781
  }),
3634
- z20.object({
3635
- type: z20.literal("response.output_text.annotation.added"),
3636
- annotation: z20.discriminatedUnion("type", [
3637
- z20.object({
3638
- type: z20.literal("url_citation"),
3639
- start_index: z20.number(),
3640
- end_index: z20.number(),
3641
- url: z20.string(),
3642
- title: z20.string()
3782
+ z21.object({
3783
+ type: z21.literal("response.output_text.annotation.added"),
3784
+ annotation: z21.discriminatedUnion("type", [
3785
+ z21.object({
3786
+ type: z21.literal("url_citation"),
3787
+ start_index: z21.number(),
3788
+ end_index: z21.number(),
3789
+ url: z21.string(),
3790
+ title: z21.string()
3643
3791
  }),
3644
- z20.object({
3645
- type: z20.literal("file_citation"),
3646
- file_id: z20.string(),
3647
- filename: z20.string(),
3648
- index: z20.number()
3792
+ z21.object({
3793
+ type: z21.literal("file_citation"),
3794
+ file_id: z21.string(),
3795
+ filename: z21.string(),
3796
+ index: z21.number()
3649
3797
  }),
3650
- z20.object({
3651
- type: z20.literal("container_file_citation"),
3652
- container_id: z20.string(),
3653
- file_id: z20.string(),
3654
- filename: z20.string(),
3655
- start_index: z20.number(),
3656
- end_index: z20.number()
3798
+ z21.object({
3799
+ type: z21.literal("container_file_citation"),
3800
+ container_id: z21.string(),
3801
+ file_id: z21.string(),
3802
+ filename: z21.string(),
3803
+ start_index: z21.number(),
3804
+ end_index: z21.number()
3657
3805
  }),
3658
- z20.object({
3659
- type: z20.literal("file_path"),
3660
- file_id: z20.string(),
3661
- index: z20.number()
3806
+ z21.object({
3807
+ type: z21.literal("file_path"),
3808
+ file_id: z21.string(),
3809
+ index: z21.number()
3662
3810
  })
3663
3811
  ])
3664
3812
  }),
3665
- z20.object({
3666
- type: z20.literal("response.reasoning_summary_part.added"),
3667
- item_id: z20.string(),
3668
- summary_index: z20.number()
3813
+ z21.object({
3814
+ type: z21.literal("response.reasoning_summary_part.added"),
3815
+ item_id: z21.string(),
3816
+ summary_index: z21.number()
3669
3817
  }),
3670
- z20.object({
3671
- type: z20.literal("response.reasoning_summary_text.delta"),
3672
- item_id: z20.string(),
3673
- summary_index: z20.number(),
3674
- delta: z20.string()
3818
+ z21.object({
3819
+ type: z21.literal("response.reasoning_summary_text.delta"),
3820
+ item_id: z21.string(),
3821
+ summary_index: z21.number(),
3822
+ delta: z21.string()
3675
3823
  }),
3676
- z20.object({
3677
- type: z20.literal("response.reasoning_summary_part.done"),
3678
- item_id: z20.string(),
3679
- summary_index: z20.number()
3824
+ z21.object({
3825
+ type: z21.literal("response.reasoning_summary_part.done"),
3826
+ item_id: z21.string(),
3827
+ summary_index: z21.number()
3680
3828
  }),
3681
- z20.object({
3682
- type: z20.literal("response.apply_patch_call_operation_diff.delta"),
3683
- item_id: z20.string(),
3684
- output_index: z20.number(),
3685
- delta: z20.string(),
3686
- obfuscation: z20.string().nullish()
3829
+ z21.object({
3830
+ type: z21.literal("response.apply_patch_call_operation_diff.delta"),
3831
+ item_id: z21.string(),
3832
+ output_index: z21.number(),
3833
+ delta: z21.string(),
3834
+ obfuscation: z21.string().nullish()
3687
3835
  }),
3688
- z20.object({
3689
- type: z20.literal("response.apply_patch_call_operation_diff.done"),
3690
- item_id: z20.string(),
3691
- output_index: z20.number(),
3692
- diff: z20.string()
3836
+ z21.object({
3837
+ type: z21.literal("response.apply_patch_call_operation_diff.done"),
3838
+ item_id: z21.string(),
3839
+ output_index: z21.number(),
3840
+ diff: z21.string()
3693
3841
  }),
3694
- z20.object({
3695
- type: z20.literal("error"),
3696
- sequence_number: z20.number(),
3697
- error: z20.object({
3698
- type: z20.string(),
3699
- code: z20.string(),
3700
- message: z20.string(),
3701
- param: z20.string().nullish()
3842
+ z21.object({
3843
+ type: z21.literal("error"),
3844
+ sequence_number: z21.number(),
3845
+ error: z21.object({
3846
+ type: z21.string(),
3847
+ code: z21.string(),
3848
+ message: z21.string(),
3849
+ param: z21.string().nullish()
3702
3850
  })
3703
3851
  }),
3704
- z20.object({ type: z20.string() }).loose().transform((value) => ({
3852
+ z21.object({ type: z21.string() }).loose().transform((value) => ({
3705
3853
  type: "unknown_chunk",
3706
3854
  message: value.type
3707
3855
  }))
@@ -3709,294 +3857,310 @@ var openaiResponsesChunkSchema = lazySchema18(
3709
3857
  ])
3710
3858
  )
3711
3859
  );
3712
- var openaiResponsesResponseSchema = lazySchema18(
3713
- () => zodSchema18(
3714
- z20.object({
3715
- id: z20.string().optional(),
3716
- created_at: z20.number().optional(),
3717
- error: z20.object({
3718
- message: z20.string(),
3719
- type: z20.string(),
3720
- param: z20.string().nullish(),
3721
- code: z20.string()
3860
+ var openaiResponsesResponseSchema = lazySchema19(
3861
+ () => zodSchema19(
3862
+ z21.object({
3863
+ id: z21.string().optional(),
3864
+ created_at: z21.number().optional(),
3865
+ error: z21.object({
3866
+ message: z21.string(),
3867
+ type: z21.string(),
3868
+ param: z21.string().nullish(),
3869
+ code: z21.string()
3722
3870
  }).nullish(),
3723
- model: z20.string().optional(),
3724
- output: z20.array(
3725
- z20.discriminatedUnion("type", [
3726
- z20.object({
3727
- type: z20.literal("message"),
3728
- role: z20.literal("assistant"),
3729
- id: z20.string(),
3730
- phase: z20.enum(["commentary", "final_answer"]).nullish(),
3731
- content: z20.array(
3732
- z20.object({
3733
- type: z20.literal("output_text"),
3734
- text: z20.string(),
3735
- logprobs: z20.array(
3736
- z20.object({
3737
- token: z20.string(),
3738
- logprob: z20.number(),
3739
- top_logprobs: z20.array(
3740
- z20.object({
3741
- token: z20.string(),
3742
- logprob: z20.number()
3871
+ model: z21.string().optional(),
3872
+ output: z21.array(
3873
+ z21.discriminatedUnion("type", [
3874
+ z21.object({
3875
+ type: z21.literal("message"),
3876
+ role: z21.literal("assistant"),
3877
+ id: z21.string(),
3878
+ phase: z21.enum(["commentary", "final_answer"]).nullish(),
3879
+ content: z21.array(
3880
+ z21.object({
3881
+ type: z21.literal("output_text"),
3882
+ text: z21.string(),
3883
+ logprobs: z21.array(
3884
+ z21.object({
3885
+ token: z21.string(),
3886
+ logprob: z21.number(),
3887
+ top_logprobs: z21.array(
3888
+ z21.object({
3889
+ token: z21.string(),
3890
+ logprob: z21.number()
3743
3891
  })
3744
3892
  )
3745
3893
  })
3746
3894
  ).nullish(),
3747
- annotations: z20.array(
3748
- z20.discriminatedUnion("type", [
3749
- z20.object({
3750
- type: z20.literal("url_citation"),
3751
- start_index: z20.number(),
3752
- end_index: z20.number(),
3753
- url: z20.string(),
3754
- title: z20.string()
3895
+ annotations: z21.array(
3896
+ z21.discriminatedUnion("type", [
3897
+ z21.object({
3898
+ type: z21.literal("url_citation"),
3899
+ start_index: z21.number(),
3900
+ end_index: z21.number(),
3901
+ url: z21.string(),
3902
+ title: z21.string()
3755
3903
  }),
3756
- z20.object({
3757
- type: z20.literal("file_citation"),
3758
- file_id: z20.string(),
3759
- filename: z20.string(),
3760
- index: z20.number()
3904
+ z21.object({
3905
+ type: z21.literal("file_citation"),
3906
+ file_id: z21.string(),
3907
+ filename: z21.string(),
3908
+ index: z21.number()
3761
3909
  }),
3762
- z20.object({
3763
- type: z20.literal("container_file_citation"),
3764
- container_id: z20.string(),
3765
- file_id: z20.string(),
3766
- filename: z20.string(),
3767
- start_index: z20.number(),
3768
- end_index: z20.number()
3910
+ z21.object({
3911
+ type: z21.literal("container_file_citation"),
3912
+ container_id: z21.string(),
3913
+ file_id: z21.string(),
3914
+ filename: z21.string(),
3915
+ start_index: z21.number(),
3916
+ end_index: z21.number()
3769
3917
  }),
3770
- z20.object({
3771
- type: z20.literal("file_path"),
3772
- file_id: z20.string(),
3773
- index: z20.number()
3918
+ z21.object({
3919
+ type: z21.literal("file_path"),
3920
+ file_id: z21.string(),
3921
+ index: z21.number()
3774
3922
  })
3775
3923
  ])
3776
3924
  )
3777
3925
  })
3778
3926
  )
3779
3927
  }),
3780
- z20.object({
3781
- type: z20.literal("web_search_call"),
3782
- id: z20.string(),
3783
- status: z20.string(),
3784
- action: z20.discriminatedUnion("type", [
3785
- z20.object({
3786
- type: z20.literal("search"),
3787
- query: z20.string().nullish(),
3788
- sources: z20.array(
3789
- z20.discriminatedUnion("type", [
3790
- z20.object({ type: z20.literal("url"), url: z20.string() }),
3791
- z20.object({
3792
- type: z20.literal("api"),
3793
- name: z20.string()
3928
+ z21.object({
3929
+ type: z21.literal("web_search_call"),
3930
+ id: z21.string(),
3931
+ status: z21.string(),
3932
+ action: z21.discriminatedUnion("type", [
3933
+ z21.object({
3934
+ type: z21.literal("search"),
3935
+ query: z21.string().nullish(),
3936
+ sources: z21.array(
3937
+ z21.discriminatedUnion("type", [
3938
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3939
+ z21.object({
3940
+ type: z21.literal("api"),
3941
+ name: z21.string()
3794
3942
  })
3795
3943
  ])
3796
3944
  ).nullish()
3797
3945
  }),
3798
- z20.object({
3799
- type: z20.literal("open_page"),
3800
- url: z20.string().nullish()
3946
+ z21.object({
3947
+ type: z21.literal("open_page"),
3948
+ url: z21.string().nullish()
3801
3949
  }),
3802
- z20.object({
3803
- type: z20.literal("find_in_page"),
3804
- url: z20.string().nullish(),
3805
- pattern: z20.string().nullish()
3950
+ z21.object({
3951
+ type: z21.literal("find_in_page"),
3952
+ url: z21.string().nullish(),
3953
+ pattern: z21.string().nullish()
3806
3954
  })
3807
3955
  ]).nullish()
3808
3956
  }),
3809
- z20.object({
3810
- type: z20.literal("file_search_call"),
3811
- id: z20.string(),
3812
- queries: z20.array(z20.string()),
3813
- results: z20.array(
3814
- z20.object({
3815
- attributes: z20.record(
3816
- z20.string(),
3817
- z20.union([z20.string(), z20.number(), z20.boolean()])
3957
+ z21.object({
3958
+ type: z21.literal("file_search_call"),
3959
+ id: z21.string(),
3960
+ queries: z21.array(z21.string()),
3961
+ results: z21.array(
3962
+ z21.object({
3963
+ attributes: z21.record(
3964
+ z21.string(),
3965
+ z21.union([z21.string(), z21.number(), z21.boolean()])
3818
3966
  ),
3819
- file_id: z20.string(),
3820
- filename: z20.string(),
3821
- score: z20.number(),
3822
- text: z20.string()
3967
+ file_id: z21.string(),
3968
+ filename: z21.string(),
3969
+ score: z21.number(),
3970
+ text: z21.string()
3823
3971
  })
3824
3972
  ).nullish()
3825
3973
  }),
3826
- z20.object({
3827
- type: z20.literal("code_interpreter_call"),
3828
- id: z20.string(),
3829
- code: z20.string().nullable(),
3830
- container_id: z20.string(),
3831
- outputs: z20.array(
3832
- z20.discriminatedUnion("type", [
3833
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3834
- z20.object({ type: z20.literal("image"), url: z20.string() })
3974
+ z21.object({
3975
+ type: z21.literal("code_interpreter_call"),
3976
+ id: z21.string(),
3977
+ code: z21.string().nullable(),
3978
+ container_id: z21.string(),
3979
+ outputs: z21.array(
3980
+ z21.discriminatedUnion("type", [
3981
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3982
+ z21.object({ type: z21.literal("image"), url: z21.string() })
3835
3983
  ])
3836
3984
  ).nullable()
3837
3985
  }),
3838
- z20.object({
3839
- type: z20.literal("image_generation_call"),
3840
- id: z20.string(),
3841
- result: z20.string()
3986
+ z21.object({
3987
+ type: z21.literal("image_generation_call"),
3988
+ id: z21.string(),
3989
+ result: z21.string()
3842
3990
  }),
3843
- z20.object({
3844
- type: z20.literal("local_shell_call"),
3845
- id: z20.string(),
3846
- call_id: z20.string(),
3847
- action: z20.object({
3848
- type: z20.literal("exec"),
3849
- command: z20.array(z20.string()),
3850
- timeout_ms: z20.number().optional(),
3851
- user: z20.string().optional(),
3852
- working_directory: z20.string().optional(),
3853
- env: z20.record(z20.string(), z20.string()).optional()
3991
+ z21.object({
3992
+ type: z21.literal("local_shell_call"),
3993
+ id: z21.string(),
3994
+ call_id: z21.string(),
3995
+ action: z21.object({
3996
+ type: z21.literal("exec"),
3997
+ command: z21.array(z21.string()),
3998
+ timeout_ms: z21.number().optional(),
3999
+ user: z21.string().optional(),
4000
+ working_directory: z21.string().optional(),
4001
+ env: z21.record(z21.string(), z21.string()).optional()
3854
4002
  })
3855
4003
  }),
3856
- z20.object({
3857
- type: z20.literal("function_call"),
3858
- call_id: z20.string(),
3859
- name: z20.string(),
3860
- arguments: z20.string(),
3861
- id: z20.string()
4004
+ z21.object({
4005
+ type: z21.literal("function_call"),
4006
+ call_id: z21.string(),
4007
+ name: z21.string(),
4008
+ arguments: z21.string(),
4009
+ id: z21.string()
3862
4010
  }),
3863
- z20.object({
3864
- type: z20.literal("custom_tool_call"),
3865
- call_id: z20.string(),
3866
- name: z20.string(),
3867
- input: z20.string(),
3868
- id: z20.string()
4011
+ z21.object({
4012
+ type: z21.literal("custom_tool_call"),
4013
+ call_id: z21.string(),
4014
+ name: z21.string(),
4015
+ input: z21.string(),
4016
+ id: z21.string()
3869
4017
  }),
3870
- z20.object({
3871
- type: z20.literal("computer_call"),
3872
- id: z20.string(),
3873
- status: z20.string().optional()
4018
+ z21.object({
4019
+ type: z21.literal("computer_call"),
4020
+ id: z21.string(),
4021
+ status: z21.string().optional()
3874
4022
  }),
3875
- z20.object({
3876
- type: z20.literal("reasoning"),
3877
- id: z20.string(),
3878
- encrypted_content: z20.string().nullish(),
3879
- summary: z20.array(
3880
- z20.object({
3881
- type: z20.literal("summary_text"),
3882
- text: z20.string()
4023
+ z21.object({
4024
+ type: z21.literal("reasoning"),
4025
+ id: z21.string(),
4026
+ encrypted_content: z21.string().nullish(),
4027
+ summary: z21.array(
4028
+ z21.object({
4029
+ type: z21.literal("summary_text"),
4030
+ text: z21.string()
3883
4031
  })
3884
4032
  )
3885
4033
  }),
3886
- z20.object({
3887
- type: z20.literal("mcp_call"),
3888
- id: z20.string(),
3889
- status: z20.string(),
3890
- arguments: z20.string(),
3891
- name: z20.string(),
3892
- server_label: z20.string(),
3893
- output: z20.string().nullish(),
3894
- error: z20.union([
3895
- z20.string(),
3896
- z20.object({
3897
- type: z20.string().optional(),
3898
- code: z20.union([z20.number(), z20.string()]).optional(),
3899
- message: z20.string().optional()
4034
+ z21.object({
4035
+ type: z21.literal("mcp_call"),
4036
+ id: z21.string(),
4037
+ status: z21.string(),
4038
+ arguments: z21.string(),
4039
+ name: z21.string(),
4040
+ server_label: z21.string(),
4041
+ output: z21.string().nullish(),
4042
+ error: z21.union([
4043
+ z21.string(),
4044
+ z21.object({
4045
+ type: z21.string().optional(),
4046
+ code: z21.union([z21.number(), z21.string()]).optional(),
4047
+ message: z21.string().optional()
3900
4048
  }).loose()
3901
4049
  ]).nullish(),
3902
- approval_request_id: z20.string().nullish()
4050
+ approval_request_id: z21.string().nullish()
3903
4051
  }),
3904
- z20.object({
3905
- type: z20.literal("mcp_list_tools"),
3906
- id: z20.string(),
3907
- server_label: z20.string(),
3908
- tools: z20.array(
3909
- z20.object({
3910
- name: z20.string(),
3911
- description: z20.string().optional(),
3912
- input_schema: z20.any(),
3913
- annotations: z20.record(z20.string(), z20.unknown()).optional()
4052
+ z21.object({
4053
+ type: z21.literal("mcp_list_tools"),
4054
+ id: z21.string(),
4055
+ server_label: z21.string(),
4056
+ tools: z21.array(
4057
+ z21.object({
4058
+ name: z21.string(),
4059
+ description: z21.string().optional(),
4060
+ input_schema: z21.any(),
4061
+ annotations: z21.record(z21.string(), z21.unknown()).optional()
3914
4062
  })
3915
4063
  ),
3916
- error: z20.union([
3917
- z20.string(),
3918
- z20.object({
3919
- type: z20.string().optional(),
3920
- code: z20.union([z20.number(), z20.string()]).optional(),
3921
- message: z20.string().optional()
4064
+ error: z21.union([
4065
+ z21.string(),
4066
+ z21.object({
4067
+ type: z21.string().optional(),
4068
+ code: z21.union([z21.number(), z21.string()]).optional(),
4069
+ message: z21.string().optional()
3922
4070
  }).loose()
3923
4071
  ]).optional()
3924
4072
  }),
3925
- z20.object({
3926
- type: z20.literal("mcp_approval_request"),
3927
- id: z20.string(),
3928
- server_label: z20.string(),
3929
- name: z20.string(),
3930
- arguments: z20.string(),
3931
- approval_request_id: z20.string().optional()
4073
+ z21.object({
4074
+ type: z21.literal("mcp_approval_request"),
4075
+ id: z21.string(),
4076
+ server_label: z21.string(),
4077
+ name: z21.string(),
4078
+ arguments: z21.string(),
4079
+ approval_request_id: z21.string().optional()
3932
4080
  }),
3933
- z20.object({
3934
- type: z20.literal("apply_patch_call"),
3935
- id: z20.string(),
3936
- call_id: z20.string(),
3937
- status: z20.enum(["in_progress", "completed"]),
3938
- operation: z20.discriminatedUnion("type", [
3939
- z20.object({
3940
- type: z20.literal("create_file"),
3941
- path: z20.string(),
3942
- diff: z20.string()
4081
+ z21.object({
4082
+ type: z21.literal("apply_patch_call"),
4083
+ id: z21.string(),
4084
+ call_id: z21.string(),
4085
+ status: z21.enum(["in_progress", "completed"]),
4086
+ operation: z21.discriminatedUnion("type", [
4087
+ z21.object({
4088
+ type: z21.literal("create_file"),
4089
+ path: z21.string(),
4090
+ diff: z21.string()
3943
4091
  }),
3944
- z20.object({
3945
- type: z20.literal("delete_file"),
3946
- path: z20.string()
4092
+ z21.object({
4093
+ type: z21.literal("delete_file"),
4094
+ path: z21.string()
3947
4095
  }),
3948
- z20.object({
3949
- type: z20.literal("update_file"),
3950
- path: z20.string(),
3951
- diff: z20.string()
4096
+ z21.object({
4097
+ type: z21.literal("update_file"),
4098
+ path: z21.string(),
4099
+ diff: z21.string()
3952
4100
  })
3953
4101
  ])
3954
4102
  }),
3955
- z20.object({
3956
- type: z20.literal("shell_call"),
3957
- id: z20.string(),
3958
- call_id: z20.string(),
3959
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3960
- action: z20.object({
3961
- commands: z20.array(z20.string())
4103
+ z21.object({
4104
+ type: z21.literal("shell_call"),
4105
+ id: z21.string(),
4106
+ call_id: z21.string(),
4107
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4108
+ action: z21.object({
4109
+ commands: z21.array(z21.string())
3962
4110
  })
3963
4111
  }),
3964
- z20.object({
3965
- type: z20.literal("shell_call_output"),
3966
- id: z20.string(),
3967
- call_id: z20.string(),
3968
- status: z20.enum(["in_progress", "completed", "incomplete"]),
3969
- output: z20.array(
3970
- z20.object({
3971
- stdout: z20.string(),
3972
- stderr: z20.string(),
3973
- outcome: z20.discriminatedUnion("type", [
3974
- z20.object({ type: z20.literal("timeout") }),
3975
- z20.object({
3976
- type: z20.literal("exit"),
3977
- exit_code: z20.number()
4112
+ z21.object({
4113
+ type: z21.literal("shell_call_output"),
4114
+ id: z21.string(),
4115
+ call_id: z21.string(),
4116
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4117
+ output: z21.array(
4118
+ z21.object({
4119
+ stdout: z21.string(),
4120
+ stderr: z21.string(),
4121
+ outcome: z21.discriminatedUnion("type", [
4122
+ z21.object({ type: z21.literal("timeout") }),
4123
+ z21.object({
4124
+ type: z21.literal("exit"),
4125
+ exit_code: z21.number()
3978
4126
  })
3979
4127
  ])
3980
4128
  })
3981
4129
  )
4130
+ }),
4131
+ z21.object({
4132
+ type: z21.literal("tool_search_call"),
4133
+ id: z21.string(),
4134
+ execution: z21.enum(["server", "client"]),
4135
+ call_id: z21.string().nullable(),
4136
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4137
+ arguments: z21.unknown()
4138
+ }),
4139
+ z21.object({
4140
+ type: z21.literal("tool_search_output"),
4141
+ id: z21.string(),
4142
+ execution: z21.enum(["server", "client"]),
4143
+ call_id: z21.string().nullable(),
4144
+ status: z21.enum(["in_progress", "completed", "incomplete"]),
4145
+ tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3982
4146
  })
3983
4147
  ])
3984
4148
  ).optional(),
3985
- service_tier: z20.string().nullish(),
3986
- incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3987
- usage: z20.object({
3988
- input_tokens: z20.number(),
3989
- input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3990
- output_tokens: z20.number(),
3991
- output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
4149
+ service_tier: z21.string().nullish(),
4150
+ incomplete_details: z21.object({ reason: z21.string() }).nullish(),
4151
+ usage: z21.object({
4152
+ input_tokens: z21.number(),
4153
+ input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
4154
+ output_tokens: z21.number(),
4155
+ output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3992
4156
  }).optional()
3993
4157
  })
3994
4158
  )
3995
4159
  );
3996
4160
 
3997
4161
  // src/responses/openai-responses-options.ts
3998
- import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3999
- import { z as z21 } from "zod/v4";
4162
+ import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
4163
+ import { z as z22 } from "zod/v4";
4000
4164
  var TOP_LOGPROBS_MAX = 20;
4001
4165
  var openaiResponsesReasoningModelIds = [
4002
4166
  "o1",
@@ -4025,11 +4189,12 @@ var openaiResponsesReasoningModelIds = [
4025
4189
  "gpt-5.2-chat-latest",
4026
4190
  "gpt-5.2-pro",
4027
4191
  "gpt-5.2-codex",
4192
+ "gpt-5.3-chat-latest",
4193
+ "gpt-5.3-codex",
4028
4194
  "gpt-5.4",
4029
4195
  "gpt-5.4-2026-03-05",
4030
4196
  "gpt-5.4-pro",
4031
- "gpt-5.4-pro-2026-03-05",
4032
- "gpt-5.3-codex"
4197
+ "gpt-5.4-pro-2026-03-05"
4033
4198
  ];
4034
4199
  var openaiResponsesModelIds = [
4035
4200
  "gpt-4.1",
@@ -4056,9 +4221,9 @@ var openaiResponsesModelIds = [
4056
4221
  "gpt-5-chat-latest",
4057
4222
  ...openaiResponsesReasoningModelIds
4058
4223
  ];
4059
- var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4060
- () => zodSchema19(
4061
- z21.object({
4224
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4225
+ () => zodSchema20(
4226
+ z22.object({
4062
4227
  /**
4063
4228
  * The ID of the OpenAI Conversation to continue.
4064
4229
  * You must create a conversation first via the OpenAI API.
@@ -4066,13 +4231,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4066
4231
  * Defaults to `undefined`.
4067
4232
  * @see https://platform.openai.com/docs/api-reference/conversations/create
4068
4233
  */
4069
- conversation: z21.string().nullish(),
4234
+ conversation: z22.string().nullish(),
4070
4235
  /**
4071
4236
  * The set of extra fields to include in the response (advanced, usually not needed).
4072
4237
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
4073
4238
  */
4074
- include: z21.array(
4075
- z21.enum([
4239
+ include: z22.array(
4240
+ z22.enum([
4076
4241
  "reasoning.encrypted_content",
4077
4242
  // handled internally by default, only needed for unknown reasoning models
4078
4243
  "file_search_call.results",
@@ -4084,7 +4249,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4084
4249
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
4085
4250
  * Defaults to `undefined`.
4086
4251
  */
4087
- instructions: z21.string().nullish(),
4252
+ instructions: z22.string().nullish(),
4088
4253
  /**
4089
4254
  * Return the log probabilities of the tokens. Including logprobs will increase
4090
4255
  * the response size and can slow down response times. However, it can
@@ -4099,30 +4264,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4099
4264
  * @see https://platform.openai.com/docs/api-reference/responses/create
4100
4265
  * @see https://cookbook.openai.com/examples/using_logprobs
4101
4266
  */
4102
- logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4267
+ logprobs: z22.union([z22.boolean(), z22.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4103
4268
  /**
4104
4269
  * The maximum number of total calls to built-in tools that can be processed in a response.
4105
4270
  * This maximum number applies across all built-in tool calls, not per individual tool.
4106
4271
  * Any further attempts to call a tool by the model will be ignored.
4107
4272
  */
4108
- maxToolCalls: z21.number().nullish(),
4273
+ maxToolCalls: z22.number().nullish(),
4109
4274
  /**
4110
4275
  * Additional metadata to store with the generation.
4111
4276
  */
4112
- metadata: z21.any().nullish(),
4277
+ metadata: z22.any().nullish(),
4113
4278
  /**
4114
4279
  * Whether to use parallel tool calls. Defaults to `true`.
4115
4280
  */
4116
- parallelToolCalls: z21.boolean().nullish(),
4281
+ parallelToolCalls: z22.boolean().nullish(),
4117
4282
  /**
4118
4283
  * The ID of the previous response. You can use it to continue a conversation.
4119
4284
  * Defaults to `undefined`.
4120
4285
  */
4121
- previousResponseId: z21.string().nullish(),
4286
+ previousResponseId: z22.string().nullish(),
4122
4287
  /**
4123
4288
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
4124
4289
  */
4125
- promptCacheKey: z21.string().nullish(),
4290
+ promptCacheKey: z22.string().nullish(),
4126
4291
  /**
4127
4292
  * The retention policy for the prompt cache.
4128
4293
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4131,7 +4296,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4131
4296
  *
4132
4297
  * @default 'in_memory'
4133
4298
  */
4134
- promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
4299
+ promptCacheRetention: z22.enum(["in_memory", "24h"]).nullish(),
4135
4300
  /**
4136
4301
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4137
4302
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4142,17 +4307,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4142
4307
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4143
4308
  * an error.
4144
4309
  */
4145
- reasoningEffort: z21.string().nullish(),
4310
+ reasoningEffort: z22.string().nullish(),
4146
4311
  /**
4147
4312
  * Controls reasoning summary output from the model.
4148
4313
  * Set to "auto" to automatically receive the richest level available,
4149
4314
  * or "detailed" for comprehensive summaries.
4150
4315
  */
4151
- reasoningSummary: z21.string().nullish(),
4316
+ reasoningSummary: z22.string().nullish(),
4152
4317
  /**
4153
4318
  * The identifier for safety monitoring and tracking.
4154
4319
  */
4155
- safetyIdentifier: z21.string().nullish(),
4320
+ safetyIdentifier: z22.string().nullish(),
4156
4321
  /**
4157
4322
  * Service tier for the request.
4158
4323
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4160,34 +4325,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4160
4325
  *
4161
4326
  * Defaults to 'auto'.
4162
4327
  */
4163
- serviceTier: z21.enum(["auto", "flex", "priority", "default"]).nullish(),
4328
+ serviceTier: z22.enum(["auto", "flex", "priority", "default"]).nullish(),
4164
4329
  /**
4165
4330
  * Whether to store the generation. Defaults to `true`.
4166
4331
  */
4167
- store: z21.boolean().nullish(),
4332
+ store: z22.boolean().nullish(),
4168
4333
  /**
4169
4334
  * Whether to use strict JSON schema validation.
4170
4335
  * Defaults to `true`.
4171
4336
  */
4172
- strictJsonSchema: z21.boolean().nullish(),
4337
+ strictJsonSchema: z22.boolean().nullish(),
4173
4338
  /**
4174
4339
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4175
4340
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4176
4341
  * Valid values: 'low', 'medium', 'high'.
4177
4342
  */
4178
- textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
4343
+ textVerbosity: z22.enum(["low", "medium", "high"]).nullish(),
4179
4344
  /**
4180
4345
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4181
4346
  * 'disabled' turns truncation off.
4182
4347
  */
4183
- truncation: z21.enum(["auto", "disabled"]).nullish(),
4348
+ truncation: z22.enum(["auto", "disabled"]).nullish(),
4184
4349
  /**
4185
4350
  * A unique identifier representing your end-user, which can help OpenAI to
4186
4351
  * monitor and detect abuse.
4187
4352
  * Defaults to `undefined`.
4188
4353
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4189
4354
  */
4190
- user: z21.string().nullish(),
4355
+ user: z22.string().nullish(),
4191
4356
  /**
4192
4357
  * Override the system message mode for this model.
4193
4358
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4196,7 +4361,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4196
4361
  *
4197
4362
  * If not specified, the mode is automatically determined based on the model.
4198
4363
  */
4199
- systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
4364
+ systemMessageMode: z22.enum(["system", "developer", "remove"]).optional(),
4200
4365
  /**
4201
4366
  * Force treating this model as a reasoning model.
4202
4367
  *
@@ -4206,7 +4371,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4206
4371
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4207
4372
  * and defaults `systemMessageMode` to `developer` unless overridden.
4208
4373
  */
4209
- forceReasoning: z21.boolean().optional()
4374
+ forceReasoning: z22.boolean().optional()
4210
4375
  })
4211
4376
  )
4212
4377
  );
@@ -4222,7 +4387,7 @@ async function prepareResponsesTools({
4222
4387
  toolNameMapping,
4223
4388
  customProviderToolNames
4224
4389
  }) {
4225
- var _a;
4390
+ var _a, _b;
4226
4391
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4227
4392
  const toolWarnings = [];
4228
4393
  if (tools == null) {
@@ -4232,15 +4397,19 @@ async function prepareResponsesTools({
4232
4397
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4233
4398
  for (const tool of tools) {
4234
4399
  switch (tool.type) {
4235
- case "function":
4400
+ case "function": {
4401
+ const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4402
+ const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4236
4403
  openaiTools2.push({
4237
4404
  type: "function",
4238
4405
  name: tool.name,
4239
4406
  description: tool.description,
4240
4407
  parameters: tool.inputSchema,
4241
- ...tool.strict != null ? { strict: tool.strict } : {}
4408
+ ...tool.strict != null ? { strict: tool.strict } : {},
4409
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4242
4410
  });
4243
4411
  break;
4412
+ }
4244
4413
  case "provider": {
4245
4414
  switch (tool.id) {
4246
4415
  case "openai.file_search": {
@@ -4385,6 +4554,19 @@ async function prepareResponsesTools({
4385
4554
  resolvedCustomProviderToolNames.add(args.name);
4386
4555
  break;
4387
4556
  }
4557
+ case "openai.tool_search": {
4558
+ const args = await validateTypes2({
4559
+ value: tool.args,
4560
+ schema: toolSearchArgsSchema
4561
+ });
4562
+ openaiTools2.push({
4563
+ type: "tool_search",
4564
+ ...args.execution != null ? { execution: args.execution } : {},
4565
+ ...args.description != null ? { description: args.description } : {},
4566
+ ...args.parameters != null ? { parameters: args.parameters } : {}
4567
+ });
4568
+ break;
4569
+ }
4388
4570
  }
4389
4571
  break;
4390
4572
  }
@@ -4406,7 +4588,7 @@ async function prepareResponsesTools({
4406
4588
  case "required":
4407
4589
  return { tools: openaiTools2, toolChoice: type, toolWarnings };
4408
4590
  case "tool": {
4409
- const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4591
+ const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
4410
4592
  return {
4411
4593
  tools: openaiTools2,
4412
4594
  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 },
@@ -4562,7 +4744,8 @@ var OpenAIResponsesLanguageModel = class {
4562
4744
  "openai.web_search": "web_search",
4563
4745
  "openai.web_search_preview": "web_search_preview",
4564
4746
  "openai.mcp": "mcp",
4565
- "openai.apply_patch": "apply_patch"
4747
+ "openai.apply_patch": "apply_patch",
4748
+ "openai.tool_search": "tool_search"
4566
4749
  },
4567
4750
  resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
4568
4751
  });
@@ -4740,7 +4923,7 @@ var OpenAIResponsesLanguageModel = class {
4740
4923
  };
4741
4924
  }
4742
4925
  async doGenerate(options) {
4743
- 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;
4926
+ 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;
4744
4927
  const {
4745
4928
  args: body,
4746
4929
  warnings,
@@ -4783,6 +4966,7 @@ var OpenAIResponsesLanguageModel = class {
4783
4966
  const content = [];
4784
4967
  const logprobs = [];
4785
4968
  let hasFunctionCall = false;
4969
+ const hostedToolSearchCallIds = [];
4786
4970
  for (const part of response.output) {
4787
4971
  switch (part.type) {
4788
4972
  case "reasoning": {
@@ -4821,6 +5005,46 @@ var OpenAIResponsesLanguageModel = class {
4821
5005
  });
4822
5006
  break;
4823
5007
  }
5008
+ case "tool_search_call": {
5009
+ const toolCallId = (_b = part.call_id) != null ? _b : part.id;
5010
+ const isHosted = part.execution === "server";
5011
+ if (isHosted) {
5012
+ hostedToolSearchCallIds.push(toolCallId);
5013
+ }
5014
+ content.push({
5015
+ type: "tool-call",
5016
+ toolCallId,
5017
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5018
+ input: JSON.stringify({
5019
+ arguments: part.arguments,
5020
+ call_id: part.call_id
5021
+ }),
5022
+ ...isHosted ? { providerExecuted: true } : {},
5023
+ providerMetadata: {
5024
+ [providerOptionsName]: {
5025
+ itemId: part.id
5026
+ }
5027
+ }
5028
+ });
5029
+ break;
5030
+ }
5031
+ case "tool_search_output": {
5032
+ const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
5033
+ content.push({
5034
+ type: "tool-result",
5035
+ toolCallId,
5036
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5037
+ result: {
5038
+ tools: part.tools
5039
+ },
5040
+ providerMetadata: {
5041
+ [providerOptionsName]: {
5042
+ itemId: part.id
5043
+ }
5044
+ }
5045
+ });
5046
+ break;
5047
+ }
4824
5048
  case "local_shell_call": {
4825
5049
  content.push({
4826
5050
  type: "tool-call",
@@ -4876,7 +5100,7 @@ var OpenAIResponsesLanguageModel = class {
4876
5100
  }
4877
5101
  case "message": {
4878
5102
  for (const contentPart of part.content) {
4879
- if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
5103
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
4880
5104
  logprobs.push(contentPart.logprobs);
4881
5105
  }
4882
5106
  const providerMetadata2 = {
@@ -4898,7 +5122,7 @@ var OpenAIResponsesLanguageModel = class {
4898
5122
  content.push({
4899
5123
  type: "source",
4900
5124
  sourceType: "url",
4901
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : generateId2(),
5125
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
4902
5126
  url: annotation.url,
4903
5127
  title: annotation.title
4904
5128
  });
@@ -4906,7 +5130,7 @@ var OpenAIResponsesLanguageModel = class {
4906
5130
  content.push({
4907
5131
  type: "source",
4908
5132
  sourceType: "document",
4909
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
5133
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
4910
5134
  mediaType: "text/plain",
4911
5135
  title: annotation.filename,
4912
5136
  filename: annotation.filename,
@@ -4922,7 +5146,7 @@ var OpenAIResponsesLanguageModel = class {
4922
5146
  content.push({
4923
5147
  type: "source",
4924
5148
  sourceType: "document",
4925
- id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
5149
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
4926
5150
  mediaType: "text/plain",
4927
5151
  title: annotation.filename,
4928
5152
  filename: annotation.filename,
@@ -4938,7 +5162,7 @@ var OpenAIResponsesLanguageModel = class {
4938
5162
  content.push({
4939
5163
  type: "source",
4940
5164
  sourceType: "document",
4941
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
5165
+ id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
4942
5166
  mediaType: "application/octet-stream",
4943
5167
  title: annotation.file_id,
4944
5168
  filename: annotation.file_id,
@@ -5007,7 +5231,7 @@ var OpenAIResponsesLanguageModel = class {
5007
5231
  break;
5008
5232
  }
5009
5233
  case "mcp_call": {
5010
- const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
5234
+ const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
5011
5235
  const toolName = `mcp.${part.name}`;
5012
5236
  content.push({
5013
5237
  type: "tool-call",
@@ -5041,8 +5265,8 @@ var OpenAIResponsesLanguageModel = class {
5041
5265
  break;
5042
5266
  }
5043
5267
  case "mcp_approval_request": {
5044
- const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
5045
- const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2();
5268
+ const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
5269
+ const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
5046
5270
  const toolName = `mcp.${part.name}`;
5047
5271
  content.push({
5048
5272
  type: "tool-call",
@@ -5092,13 +5316,13 @@ var OpenAIResponsesLanguageModel = class {
5092
5316
  toolName: toolNameMapping.toCustomToolName("file_search"),
5093
5317
  result: {
5094
5318
  queries: part.queries,
5095
- results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
5319
+ results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
5096
5320
  attributes: result.attributes,
5097
5321
  fileId: result.file_id,
5098
5322
  filename: result.filename,
5099
5323
  score: result.score,
5100
5324
  text: result.text
5101
- }))) != null ? _v : null
5325
+ }))) != null ? _y : null
5102
5326
  }
5103
5327
  });
5104
5328
  break;
@@ -5155,10 +5379,10 @@ var OpenAIResponsesLanguageModel = class {
5155
5379
  content,
5156
5380
  finishReason: {
5157
5381
  unified: mapOpenAIResponseFinishReason({
5158
- finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
5382
+ finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
5159
5383
  hasFunctionCall
5160
5384
  }),
5161
- raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
5385
+ raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
5162
5386
  },
5163
5387
  usage: convertOpenAIResponsesUsage(usage),
5164
5388
  request: { body },
@@ -5216,6 +5440,7 @@ var OpenAIResponsesLanguageModel = class {
5216
5440
  let hasFunctionCall = false;
5217
5441
  const activeReasoning = {};
5218
5442
  let serviceTier;
5443
+ const hostedToolSearchCallIds = [];
5219
5444
  return {
5220
5445
  stream: response.pipeThrough(
5221
5446
  new TransformStream({
@@ -5223,7 +5448,7 @@ var OpenAIResponsesLanguageModel = class {
5223
5448
  controller.enqueue({ type: "stream-start", warnings });
5224
5449
  },
5225
5450
  transform(chunk, controller) {
5226
- 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;
5451
+ 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;
5227
5452
  if (options.includeRawChunks) {
5228
5453
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5229
5454
  }
@@ -5331,6 +5556,24 @@ var OpenAIResponsesLanguageModel = class {
5331
5556
  input: "{}",
5332
5557
  providerExecuted: true
5333
5558
  });
5559
+ } else if (value.item.type === "tool_search_call") {
5560
+ const toolCallId = value.item.id;
5561
+ const toolName = toolNameMapping.toCustomToolName("tool_search");
5562
+ const isHosted = value.item.execution === "server";
5563
+ ongoingToolCalls[value.output_index] = {
5564
+ toolName,
5565
+ toolCallId,
5566
+ toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
5567
+ };
5568
+ if (isHosted) {
5569
+ controller.enqueue({
5570
+ type: "tool-input-start",
5571
+ id: toolCallId,
5572
+ toolName,
5573
+ providerExecuted: true
5574
+ });
5575
+ }
5576
+ } else if (value.item.type === "tool_search_output") {
5334
5577
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
5335
5578
  } else if (value.item.type === "apply_patch_call") {
5336
5579
  const { call_id: callId, operation } = value.item;
@@ -5377,7 +5620,7 @@ var OpenAIResponsesLanguageModel = class {
5377
5620
  } else if (value.item.type === "shell_call_output") {
5378
5621
  } else if (value.item.type === "message") {
5379
5622
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5380
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5623
+ activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
5381
5624
  controller.enqueue({
5382
5625
  type: "text-start",
5383
5626
  id: value.item.id,
@@ -5401,14 +5644,14 @@ var OpenAIResponsesLanguageModel = class {
5401
5644
  providerMetadata: {
5402
5645
  [providerOptionsName]: {
5403
5646
  itemId: value.item.id,
5404
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5647
+ reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
5405
5648
  }
5406
5649
  }
5407
5650
  });
5408
5651
  }
5409
5652
  } else if (isResponseOutputItemDoneChunk(value)) {
5410
5653
  if (value.item.type === "message") {
5411
- const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5654
+ const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
5412
5655
  activeMessagePhase = void 0;
5413
5656
  controller.enqueue({
5414
5657
  type: "text-end",
@@ -5502,13 +5745,13 @@ var OpenAIResponsesLanguageModel = class {
5502
5745
  toolName: toolNameMapping.toCustomToolName("file_search"),
5503
5746
  result: {
5504
5747
  queries: value.item.queries,
5505
- results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
5748
+ results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
5506
5749
  attributes: result.attributes,
5507
5750
  fileId: result.file_id,
5508
5751
  filename: result.filename,
5509
5752
  score: result.score,
5510
5753
  text: result.text
5511
- }))) != null ? _e : null
5754
+ }))) != null ? _f : null
5512
5755
  }
5513
5756
  });
5514
5757
  } else if (value.item.type === "code_interpreter_call") {
@@ -5530,12 +5773,62 @@ var OpenAIResponsesLanguageModel = class {
5530
5773
  result: value.item.result
5531
5774
  }
5532
5775
  });
5776
+ } else if (value.item.type === "tool_search_call") {
5777
+ const toolCall = ongoingToolCalls[value.output_index];
5778
+ const isHosted = value.item.execution === "server";
5779
+ if (toolCall != null) {
5780
+ const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
5781
+ if (isHosted) {
5782
+ hostedToolSearchCallIds.push(toolCallId);
5783
+ } else {
5784
+ controller.enqueue({
5785
+ type: "tool-input-start",
5786
+ id: toolCallId,
5787
+ toolName: toolCall.toolName
5788
+ });
5789
+ }
5790
+ controller.enqueue({
5791
+ type: "tool-input-end",
5792
+ id: toolCallId
5793
+ });
5794
+ controller.enqueue({
5795
+ type: "tool-call",
5796
+ toolCallId,
5797
+ toolName: toolCall.toolName,
5798
+ input: JSON.stringify({
5799
+ arguments: value.item.arguments,
5800
+ call_id: isHosted ? null : toolCallId
5801
+ }),
5802
+ ...isHosted ? { providerExecuted: true } : {},
5803
+ providerMetadata: {
5804
+ [providerOptionsName]: {
5805
+ itemId: value.item.id
5806
+ }
5807
+ }
5808
+ });
5809
+ }
5810
+ ongoingToolCalls[value.output_index] = void 0;
5811
+ } else if (value.item.type === "tool_search_output") {
5812
+ const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
5813
+ controller.enqueue({
5814
+ type: "tool-result",
5815
+ toolCallId,
5816
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
5817
+ result: {
5818
+ tools: value.item.tools
5819
+ },
5820
+ providerMetadata: {
5821
+ [providerOptionsName]: {
5822
+ itemId: value.item.id
5823
+ }
5824
+ }
5825
+ });
5533
5826
  } else if (value.item.type === "mcp_call") {
5534
5827
  ongoingToolCalls[value.output_index] = void 0;
5535
- const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5536
- const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
5828
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
5829
+ const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
5537
5830
  approvalRequestId
5538
- )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
5831
+ )) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
5539
5832
  const toolName = `mcp.${value.item.name}`;
5540
5833
  controller.enqueue({
5541
5834
  type: "tool-call",
@@ -5605,8 +5898,8 @@ var OpenAIResponsesLanguageModel = class {
5605
5898
  ongoingToolCalls[value.output_index] = void 0;
5606
5899
  } else if (value.item.type === "mcp_approval_request") {
5607
5900
  ongoingToolCalls[value.output_index] = void 0;
5608
- const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId2();
5609
- const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
5901
+ const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
5902
+ const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
5610
5903
  approvalRequestIdToDummyToolCallIdFromStream.set(
5611
5904
  approvalRequestId,
5612
5905
  dummyToolCallId
@@ -5695,7 +5988,7 @@ var OpenAIResponsesLanguageModel = class {
5695
5988
  providerMetadata: {
5696
5989
  [providerOptionsName]: {
5697
5990
  itemId: value.item.id,
5698
- reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
5991
+ reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
5699
5992
  }
5700
5993
  }
5701
5994
  });
@@ -5808,7 +6101,7 @@ var OpenAIResponsesLanguageModel = class {
5808
6101
  id: value.item_id,
5809
6102
  delta: value.delta
5810
6103
  });
5811
- if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
6104
+ if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
5812
6105
  logprobs.push(value.logprobs);
5813
6106
  }
5814
6107
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -5837,7 +6130,7 @@ var OpenAIResponsesLanguageModel = class {
5837
6130
  providerMetadata: {
5838
6131
  [providerOptionsName]: {
5839
6132
  itemId: value.item_id,
5840
- reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
6133
+ reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
5841
6134
  }
5842
6135
  }
5843
6136
  });
@@ -5871,10 +6164,10 @@ var OpenAIResponsesLanguageModel = class {
5871
6164
  } else if (isResponseFinishedChunk(value)) {
5872
6165
  finishReason = {
5873
6166
  unified: mapOpenAIResponseFinishReason({
5874
- finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
6167
+ finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
5875
6168
  hasFunctionCall
5876
6169
  }),
5877
- raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
6170
+ raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
5878
6171
  };
5879
6172
  usage = value.response.usage;
5880
6173
  if (typeof value.response.service_tier === "string") {
@@ -5886,7 +6179,7 @@ var OpenAIResponsesLanguageModel = class {
5886
6179
  controller.enqueue({
5887
6180
  type: "source",
5888
6181
  sourceType: "url",
5889
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2(),
6182
+ id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
5890
6183
  url: value.annotation.url,
5891
6184
  title: value.annotation.title
5892
6185
  });
@@ -5894,7 +6187,7 @@ var OpenAIResponsesLanguageModel = class {
5894
6187
  controller.enqueue({
5895
6188
  type: "source",
5896
6189
  sourceType: "document",
5897
- id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId2(),
6190
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
5898
6191
  mediaType: "text/plain",
5899
6192
  title: value.annotation.filename,
5900
6193
  filename: value.annotation.filename,
@@ -5910,7 +6203,7 @@ var OpenAIResponsesLanguageModel = class {
5910
6203
  controller.enqueue({
5911
6204
  type: "source",
5912
6205
  sourceType: "document",
5913
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
6206
+ id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
5914
6207
  mediaType: "text/plain",
5915
6208
  title: value.annotation.filename,
5916
6209
  filename: value.annotation.filename,
@@ -5926,7 +6219,7 @@ var OpenAIResponsesLanguageModel = class {
5926
6219
  controller.enqueue({
5927
6220
  type: "source",
5928
6221
  sourceType: "document",
5929
- id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
6222
+ id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
5930
6223
  mediaType: "application/octet-stream",
5931
6224
  title: value.annotation.file_id,
5932
6225
  filename: value.annotation.file_id,
@@ -6044,13 +6337,13 @@ import {
6044
6337
  } from "@ai-sdk/provider-utils";
6045
6338
 
6046
6339
  // src/speech/openai-speech-options.ts
6047
- import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
6048
- import { z as z22 } from "zod/v4";
6049
- var openaiSpeechModelOptionsSchema = lazySchema20(
6050
- () => zodSchema20(
6051
- z22.object({
6052
- instructions: z22.string().nullish(),
6053
- speed: z22.number().min(0.25).max(4).default(1).nullish()
6340
+ import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6341
+ import { z as z23 } from "zod/v4";
6342
+ var openaiSpeechModelOptionsSchema = lazySchema21(
6343
+ () => zodSchema21(
6344
+ z23.object({
6345
+ instructions: z23.string().nullish(),
6346
+ speed: z23.number().min(0.25).max(4).default(1).nullish()
6054
6347
  })
6055
6348
  )
6056
6349
  );
@@ -6167,33 +6460,33 @@ import {
6167
6460
  } from "@ai-sdk/provider-utils";
6168
6461
 
6169
6462
  // src/transcription/openai-transcription-api.ts
6170
- import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6171
- import { z as z23 } from "zod/v4";
6172
- var openaiTranscriptionResponseSchema = lazySchema21(
6173
- () => zodSchema21(
6174
- z23.object({
6175
- text: z23.string(),
6176
- language: z23.string().nullish(),
6177
- duration: z23.number().nullish(),
6178
- words: z23.array(
6179
- z23.object({
6180
- word: z23.string(),
6181
- start: z23.number(),
6182
- end: z23.number()
6463
+ import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6464
+ import { z as z24 } from "zod/v4";
6465
+ var openaiTranscriptionResponseSchema = lazySchema22(
6466
+ () => zodSchema22(
6467
+ z24.object({
6468
+ text: z24.string(),
6469
+ language: z24.string().nullish(),
6470
+ duration: z24.number().nullish(),
6471
+ words: z24.array(
6472
+ z24.object({
6473
+ word: z24.string(),
6474
+ start: z24.number(),
6475
+ end: z24.number()
6183
6476
  })
6184
6477
  ).nullish(),
6185
- segments: z23.array(
6186
- z23.object({
6187
- id: z23.number(),
6188
- seek: z23.number(),
6189
- start: z23.number(),
6190
- end: z23.number(),
6191
- text: z23.string(),
6192
- tokens: z23.array(z23.number()),
6193
- temperature: z23.number(),
6194
- avg_logprob: z23.number(),
6195
- compression_ratio: z23.number(),
6196
- no_speech_prob: z23.number()
6478
+ segments: z24.array(
6479
+ z24.object({
6480
+ id: z24.number(),
6481
+ seek: z24.number(),
6482
+ start: z24.number(),
6483
+ end: z24.number(),
6484
+ text: z24.string(),
6485
+ tokens: z24.array(z24.number()),
6486
+ temperature: z24.number(),
6487
+ avg_logprob: z24.number(),
6488
+ compression_ratio: z24.number(),
6489
+ no_speech_prob: z24.number()
6197
6490
  })
6198
6491
  ).nullish()
6199
6492
  })
@@ -6201,33 +6494,33 @@ var openaiTranscriptionResponseSchema = lazySchema21(
6201
6494
  );
6202
6495
 
6203
6496
  // src/transcription/openai-transcription-options.ts
6204
- import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6205
- import { z as z24 } from "zod/v4";
6206
- var openAITranscriptionModelOptions = lazySchema22(
6207
- () => zodSchema22(
6208
- z24.object({
6497
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
6498
+ import { z as z25 } from "zod/v4";
6499
+ var openAITranscriptionModelOptions = lazySchema23(
6500
+ () => zodSchema23(
6501
+ z25.object({
6209
6502
  /**
6210
6503
  * Additional information to include in the transcription response.
6211
6504
  */
6212
- include: z24.array(z24.string()).optional(),
6505
+ include: z25.array(z25.string()).optional(),
6213
6506
  /**
6214
6507
  * The language of the input audio in ISO-639-1 format.
6215
6508
  */
6216
- language: z24.string().optional(),
6509
+ language: z25.string().optional(),
6217
6510
  /**
6218
6511
  * An optional text to guide the model's style or continue a previous audio segment.
6219
6512
  */
6220
- prompt: z24.string().optional(),
6513
+ prompt: z25.string().optional(),
6221
6514
  /**
6222
6515
  * The sampling temperature, between 0 and 1.
6223
6516
  * @default 0
6224
6517
  */
6225
- temperature: z24.number().min(0).max(1).default(0).optional(),
6518
+ temperature: z25.number().min(0).max(1).default(0).optional(),
6226
6519
  /**
6227
6520
  * The timestamp granularities to populate for this transcription.
6228
6521
  * @default ['segment']
6229
6522
  */
6230
- timestampGranularities: z24.array(z24.enum(["word", "segment"])).default(["segment"]).optional()
6523
+ timestampGranularities: z25.array(z25.enum(["word", "segment"])).default(["segment"]).optional()
6231
6524
  })
6232
6525
  )
6233
6526
  );
@@ -6400,7 +6693,7 @@ var OpenAITranscriptionModel = class {
6400
6693
  };
6401
6694
 
6402
6695
  // src/version.ts
6403
- var VERSION = true ? "3.0.44" : "0.0.0-test";
6696
+ var VERSION = true ? "3.0.46" : "0.0.0-test";
6404
6697
 
6405
6698
  // src/openai-provider.ts
6406
6699
  function createOpenAI(options = {}) {