@ai-sdk/openai 4.0.18 → 4.0.20

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.
@@ -34,10 +34,15 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
34
34
 
35
35
  // src/openai-language-model-capabilities.ts
36
36
  function getOpenAILanguageModelCapabilities(modelId) {
37
- const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
38
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
39
- const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
40
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4") || modelId.startsWith("gpt-5.5") || modelId.startsWith("gpt-5.6");
37
+ var _a, _b, _c, _d, _e;
38
+ const oSeriesVersion = getOSeriesVersion(modelId);
39
+ const gptVersion = getGptVersion(modelId);
40
+ const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a.startsWith("chat")) != null ? _b : false);
41
+ const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
42
+ const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
43
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
44
+ const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
45
+ const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
41
46
  const systemMessageMode = isReasoningModel ? "developer" : "system";
42
47
  return {
43
48
  supportsFlexProcessing,
@@ -47,6 +52,21 @@ function getOpenAILanguageModelCapabilities(modelId) {
47
52
  supportsNonReasoningParameters
48
53
  };
49
54
  }
55
+ function getOSeriesVersion(modelId) {
56
+ const match = /^o(\d+)(?:-|$)/.exec(modelId);
57
+ return match == null ? void 0 : Number(match[1]);
58
+ }
59
+ function getGptVersion(modelId) {
60
+ const match = /^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(modelId);
61
+ if (match == null) {
62
+ return void 0;
63
+ }
64
+ return {
65
+ major: Number(match[1]),
66
+ minor: match[2] == null ? void 0 : Number(match[2]),
67
+ variant: match[3]
68
+ };
69
+ }
50
70
 
51
71
  // src/openai-stream-error.ts
52
72
  import { APICallError } from "@ai-sdk/provider";
@@ -2016,18 +2036,16 @@ var modelMaxImagesPerCall = {
2016
2036
  "gpt-image-2": 10,
2017
2037
  "chatgpt-image-latest": 10
2018
2038
  };
2019
- var defaultResponseFormatPrefixes = [
2020
- "chatgpt-image-",
2021
- "gpt-image-1-mini",
2022
- "gpt-image-1.5",
2023
- "gpt-image-1",
2024
- "gpt-image-2"
2025
- ];
2039
+ var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
2026
2040
  function hasDefaultResponseFormat(modelId) {
2027
2041
  return defaultResponseFormatPrefixes.some(
2028
2042
  (prefix) => modelId.startsWith(prefix)
2029
2043
  );
2030
2044
  }
2045
+ function getMaxImagesPerCall(modelId) {
2046
+ var _a;
2047
+ return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
2048
+ }
2031
2049
  var baseImageModelOptionsObject = z9.object({
2032
2050
  /**
2033
2051
  * Quality of the generated image(s).
@@ -2105,8 +2123,7 @@ var OpenAIImageModel = class _OpenAIImageModel {
2105
2123
  return new _OpenAIImageModel(options.modelId, options.config);
2106
2124
  }
2107
2125
  get maxImagesPerCall() {
2108
- var _a;
2109
- return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
2126
+ return getMaxImagesPerCall(this.modelId);
2110
2127
  }
2111
2128
  get provider() {
2112
2129
  return this.config.provider;
@@ -3052,7 +3069,7 @@ import {
3052
3069
  resolveProviderReference as resolveProviderReference2,
3053
3070
  validateTypes
3054
3071
  } from "@ai-sdk/provider-utils";
3055
- import { z as z18 } from "zod/v4";
3072
+ import { z as z19 } from "zod/v4";
3056
3073
 
3057
3074
  // src/tool/apply-patch.ts
3058
3075
  import {
@@ -3364,10 +3381,44 @@ var toolSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
3364
3381
  outputSchema: toolSearchOutputSchema
3365
3382
  });
3366
3383
 
3384
+ // src/tool/programmatic-tool-calling.ts
3385
+ import {
3386
+ createProviderExecutedToolFactory,
3387
+ lazySchema as lazySchema17,
3388
+ zodSchema as zodSchema17
3389
+ } from "@ai-sdk/provider-utils";
3390
+ import { z as z18 } from "zod/v4";
3391
+ var programmaticToolCallingInputSchema = lazySchema17(
3392
+ () => zodSchema17(
3393
+ z18.object({
3394
+ code: z18.string(),
3395
+ fingerprint: z18.string()
3396
+ })
3397
+ )
3398
+ );
3399
+ var programmaticToolCallingOutputSchema = lazySchema17(
3400
+ () => zodSchema17(
3401
+ z18.object({
3402
+ result: z18.string(),
3403
+ status: z18.enum(["completed", "incomplete"])
3404
+ })
3405
+ )
3406
+ );
3407
+ var programmaticToolCallingFactory = createProviderExecutedToolFactory({
3408
+ id: "openai.programmatic_tool_calling",
3409
+ inputSchema: programmaticToolCallingInputSchema,
3410
+ outputSchema: programmaticToolCallingOutputSchema,
3411
+ supportsDeferredResults: true
3412
+ });
3413
+ var programmaticToolCalling = () => programmaticToolCallingFactory({});
3414
+
3367
3415
  // src/responses/convert-to-openai-responses-input.ts
3368
3416
  function serializeToolCallArguments2(input) {
3369
3417
  return JSON.stringify(input === void 0 ? {} : input);
3370
3418
  }
3419
+ function mapToolCaller(caller) {
3420
+ return caller == null ? void 0 : caller.type === "program" ? { type: "program", caller_id: caller.callerId } : caller;
3421
+ }
3371
3422
  function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
3372
3423
  var _a;
3373
3424
  return (_a = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a.promptCacheBreakpoint;
@@ -3392,7 +3443,7 @@ async function convertToOpenAIResponsesInput({
3392
3443
  hasComputerTool = false,
3393
3444
  customProviderToolNames
3394
3445
  }) {
3395
- 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;
3446
+ 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, _K, _L;
3396
3447
  let input = [];
3397
3448
  const warnings = [];
3398
3449
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3578,6 +3629,7 @@ async function convertToOpenAIResponsesInput({
3578
3629
  case "tool-call": {
3579
3630
  const id = (_f = (_c = (_b = part.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
3580
3631
  const namespace = (_k = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.namespace) != null ? _k : (_j = (_i = part.providerMetadata) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.namespace;
3632
+ const caller = (_m = (_l = part.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.caller;
3581
3633
  if (hasConversation && id != null) {
3582
3634
  break;
3583
3635
  }
@@ -3601,12 +3653,30 @@ async function convertToOpenAIResponsesInput({
3601
3653
  type: "tool_search_call",
3602
3654
  id: id != null ? id : part.toolCallId,
3603
3655
  execution,
3604
- call_id: (_l = parsedInput.call_id) != null ? _l : null,
3656
+ call_id: (_n = parsedInput.call_id) != null ? _n : null,
3605
3657
  status: "completed",
3606
3658
  arguments: parsedInput.arguments
3607
3659
  });
3608
3660
  break;
3609
3661
  }
3662
+ if (resolvedToolName === "programmatic_tool_calling") {
3663
+ if (store && id != null) {
3664
+ input.push({ type: "item_reference", id });
3665
+ break;
3666
+ }
3667
+ const parsedInput = await validateTypes({
3668
+ value: part.input,
3669
+ schema: programmaticToolCallingInputSchema
3670
+ });
3671
+ input.push({
3672
+ type: "program",
3673
+ id: id != null ? id : part.toolCallId,
3674
+ call_id: part.toolCallId,
3675
+ code: parsedInput.code,
3676
+ fingerprint: parsedInput.fingerprint
3677
+ });
3678
+ break;
3679
+ }
3610
3680
  if (part.providerExecuted) {
3611
3681
  if (store && id != null) {
3612
3682
  input.push({ type: "item_reference", id });
@@ -3616,7 +3686,7 @@ async function convertToOpenAIResponsesInput({
3616
3686
  if (hasPreviousResponseId && store && id != null) {
3617
3687
  break;
3618
3688
  }
3619
- const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || hasComputerTool && resolvedToolName === "computer" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
3689
+ const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || hasComputerTool && resolvedToolName === "computer" || ((_o = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _o : false);
3620
3690
  if (store && id != null && isProviderDefinedToolCall) {
3621
3691
  input.push({ type: "item_reference", id });
3622
3692
  break;
@@ -3735,7 +3805,10 @@ async function convertToOpenAIResponsesInput({
3735
3805
  call_id: part.toolCallId,
3736
3806
  name: resolvedToolName,
3737
3807
  arguments: serializeToolCallArguments2(part.input),
3738
- ...namespace != null && { namespace }
3808
+ ...namespace != null && { namespace },
3809
+ ...caller != null && {
3810
+ caller: mapToolCaller(caller)
3811
+ }
3739
3812
  });
3740
3813
  break;
3741
3814
  }
@@ -3751,7 +3824,7 @@ async function convertToOpenAIResponsesInput({
3751
3824
  part.toolName
3752
3825
  );
3753
3826
  if (resolvedResultToolName === "tool_search") {
3754
- const itemId = (_s = (_r = (_o = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.itemId) != null ? _r : (_q = (_p = part.providerMetadata) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _s : part.toolCallId;
3827
+ const itemId = (_u = (_t = (_q = (_p = part.providerOptions) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _t : (_s = (_r = part.providerMetadata) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.itemId) != null ? _u : part.toolCallId;
3755
3828
  if (store) {
3756
3829
  input.push({ type: "item_reference", id: itemId });
3757
3830
  } else if (part.output.type === "json") {
@@ -3770,6 +3843,25 @@ async function convertToOpenAIResponsesInput({
3770
3843
  }
3771
3844
  break;
3772
3845
  }
3846
+ if (resolvedResultToolName === "programmatic_tool_calling") {
3847
+ const itemId = (_A = (_z = (_w = (_v = part.providerOptions) == null ? void 0 : _v[providerOptionsName]) == null ? void 0 : _w.itemId) != null ? _z : (_y = (_x = part.providerMetadata) == null ? void 0 : _x[providerOptionsName]) == null ? void 0 : _y.itemId) != null ? _A : part.toolCallId;
3848
+ if (store) {
3849
+ input.push({ type: "item_reference", id: itemId });
3850
+ } else if (part.output.type === "json") {
3851
+ const parsedOutput = await validateTypes({
3852
+ value: part.output.value,
3853
+ schema: programmaticToolCallingOutputSchema
3854
+ });
3855
+ input.push({
3856
+ type: "program_output",
3857
+ id: itemId,
3858
+ call_id: part.toolCallId,
3859
+ result: parsedOutput.result,
3860
+ status: parsedOutput.status
3861
+ });
3862
+ }
3863
+ break;
3864
+ }
3773
3865
  if (hasShellTool && resolvedResultToolName === "shell") {
3774
3866
  if (part.output.type === "json") {
3775
3867
  const parsedOutput = await validateTypes({
@@ -3792,7 +3884,7 @@ async function convertToOpenAIResponsesInput({
3792
3884
  break;
3793
3885
  }
3794
3886
  if (store) {
3795
- const itemId = (_v = (_u = (_t = part.providerOptions) == null ? void 0 : _t[providerOptionsName]) == null ? void 0 : _u.itemId) != null ? _v : part.toolCallId;
3887
+ const itemId = (_D = (_C = (_B = part.providerOptions) == null ? void 0 : _B[providerOptionsName]) == null ? void 0 : _C.itemId) != null ? _D : part.toolCallId;
3796
3888
  input.push({ type: "item_reference", id: itemId });
3797
3889
  } else {
3798
3890
  warnings.push({
@@ -3877,7 +3969,7 @@ async function convertToOpenAIResponsesInput({
3877
3969
  }
3878
3970
  case "custom": {
3879
3971
  if (part.kind === "openai.compaction") {
3880
- const providerOptions2 = (_w = part.providerOptions) == null ? void 0 : _w[providerOptionsName];
3972
+ const providerOptions2 = (_E = part.providerOptions) == null ? void 0 : _E[providerOptionsName];
3881
3973
  const id = providerOptions2 == null ? void 0 : providerOptions2.itemId;
3882
3974
  if (hasConversation && id != null) {
3883
3975
  break;
@@ -3924,7 +4016,7 @@ async function convertToOpenAIResponsesInput({
3924
4016
  }
3925
4017
  const output = part.output;
3926
4018
  if (output.type === "execution-denied") {
3927
- const approvalId = (_y = (_x = output.providerOptions) == null ? void 0 : _x.openai) == null ? void 0 : _y.approvalId;
4019
+ const approvalId = (_G = (_F = output.providerOptions) == null ? void 0 : _F.openai) == null ? void 0 : _G.approvalId;
3928
4020
  if (approvalId) {
3929
4021
  continue;
3930
4022
  }
@@ -4004,7 +4096,7 @@ async function convertToOpenAIResponsesInput({
4004
4096
  file_id: parsedOutput.output.fileId,
4005
4097
  detail: parsedOutput.output.detail
4006
4098
  },
4007
- acknowledged_safety_checks: (_z = parsedOutput.acknowledgedSafetyChecks) == null ? void 0 : _z.map((safetyCheck) => ({
4099
+ acknowledged_safety_checks: (_H = parsedOutput.acknowledgedSafetyChecks) == null ? void 0 : _H.map((safetyCheck) => ({
4008
4100
  id: safetyCheck.id,
4009
4101
  code: safetyCheck.code,
4010
4102
  message: safetyCheck.message
@@ -4020,7 +4112,7 @@ async function convertToOpenAIResponsesInput({
4020
4112
  outputValue = output.value;
4021
4113
  break;
4022
4114
  case "execution-denied":
4023
- outputValue = (_A = output.reason) != null ? _A : "Tool call execution denied.";
4115
+ outputValue = (_I = output.reason) != null ? _I : "Tool call execution denied.";
4024
4116
  break;
4025
4117
  case "json":
4026
4118
  case "error-json":
@@ -4119,7 +4211,7 @@ async function convertToOpenAIResponsesInput({
4119
4211
  contentValue = output.value;
4120
4212
  break;
4121
4213
  case "execution-denied":
4122
- contentValue = (_B = output.reason) != null ? _B : "Tool call execution denied.";
4214
+ contentValue = (_J = output.reason) != null ? _J : "Tool call execution denied.";
4123
4215
  break;
4124
4216
  case "json":
4125
4217
  case "error-json":
@@ -4204,10 +4296,14 @@ async function convertToOpenAIResponsesInput({
4204
4296
  }).filter(isNonNullable);
4205
4297
  break;
4206
4298
  }
4299
+ const caller = mapToolCaller(
4300
+ (_L = (_K = part.providerOptions) == null ? void 0 : _K[providerOptionsName]) == null ? void 0 : _L.caller
4301
+ );
4207
4302
  input.push({
4208
4303
  type: "function_call_output",
4209
4304
  call_id: part.toolCallId,
4210
- output: contentValue
4305
+ output: contentValue,
4306
+ ...caller != null && { caller }
4211
4307
  });
4212
4308
  }
4213
4309
  break;
@@ -4231,9 +4327,9 @@ async function convertToOpenAIResponsesInput({
4231
4327
  }
4232
4328
  return { input, warnings };
4233
4329
  }
4234
- var openaiResponsesReasoningProviderOptionsSchema = z18.object({
4235
- itemId: z18.string().nullish(),
4236
- reasoningEncryptedContent: z18.string().nullish()
4330
+ var openaiResponsesReasoningProviderOptionsSchema = z19.object({
4331
+ itemId: z19.string().nullish(),
4332
+ reasoningEncryptedContent: z19.string().nullish()
4237
4333
  });
4238
4334
 
4239
4335
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4256,643 +4352,670 @@ function mapOpenAIResponseFinishReason({
4256
4352
 
4257
4353
  // src/responses/openai-responses-api.ts
4258
4354
  import {
4259
- lazySchema as lazySchema17,
4260
- zodSchema as zodSchema17
4355
+ lazySchema as lazySchema18,
4356
+ zodSchema as zodSchema18
4261
4357
  } from "@ai-sdk/provider-utils";
4262
- import { z as z19 } from "zod/v4";
4263
- var jsonValueSchema = z19.lazy(
4264
- () => z19.union([
4265
- z19.string(),
4266
- z19.number(),
4267
- z19.boolean(),
4268
- z19.null(),
4269
- z19.array(jsonValueSchema),
4270
- z19.record(z19.string(), jsonValueSchema.optional())
4358
+ import { z as z20 } from "zod/v4";
4359
+ var jsonValueSchema = z20.lazy(
4360
+ () => z20.union([
4361
+ z20.string(),
4362
+ z20.number(),
4363
+ z20.boolean(),
4364
+ z20.null(),
4365
+ z20.array(jsonValueSchema),
4366
+ z20.record(z20.string(), jsonValueSchema.optional())
4271
4367
  ])
4272
4368
  );
4273
- var openaiResponsesComputerSafetyCheckSchema = z19.object({
4274
- id: z19.string(),
4275
- code: z19.string().nullish(),
4276
- message: z19.string().nullish()
4369
+ var openaiResponsesComputerSafetyCheckSchema = z20.object({
4370
+ id: z20.string(),
4371
+ code: z20.string().nullish(),
4372
+ message: z20.string().nullish()
4277
4373
  });
4278
- var openaiResponsesComputerActionSchema = z19.discriminatedUnion("type", [
4279
- z19.object({
4280
- type: z19.literal("click"),
4281
- button: z19.enum(["left", "right", "wheel", "back", "forward"]),
4282
- x: z19.number(),
4283
- y: z19.number(),
4284
- keys: z19.array(z19.string()).nullish()
4374
+ var openaiResponsesComputerActionSchema = z20.discriminatedUnion("type", [
4375
+ z20.object({
4376
+ type: z20.literal("click"),
4377
+ button: z20.enum(["left", "right", "wheel", "back", "forward"]),
4378
+ x: z20.number(),
4379
+ y: z20.number(),
4380
+ keys: z20.array(z20.string()).nullish()
4285
4381
  }),
4286
- z19.object({
4287
- type: z19.literal("double_click"),
4288
- x: z19.number(),
4289
- y: z19.number(),
4290
- keys: z19.array(z19.string()).nullish()
4382
+ z20.object({
4383
+ type: z20.literal("double_click"),
4384
+ x: z20.number(),
4385
+ y: z20.number(),
4386
+ keys: z20.array(z20.string()).nullish()
4291
4387
  }),
4292
- z19.object({
4293
- type: z19.literal("drag"),
4294
- path: z19.array(z19.object({ x: z19.number(), y: z19.number() })),
4295
- keys: z19.array(z19.string()).nullish()
4388
+ z20.object({
4389
+ type: z20.literal("drag"),
4390
+ path: z20.array(z20.object({ x: z20.number(), y: z20.number() })),
4391
+ keys: z20.array(z20.string()).nullish()
4296
4392
  }),
4297
- z19.object({
4298
- type: z19.literal("keypress"),
4299
- keys: z19.array(z19.string())
4393
+ z20.object({
4394
+ type: z20.literal("keypress"),
4395
+ keys: z20.array(z20.string())
4300
4396
  }),
4301
- z19.object({
4302
- type: z19.literal("move"),
4303
- x: z19.number(),
4304
- y: z19.number(),
4305
- keys: z19.array(z19.string()).nullish()
4397
+ z20.object({
4398
+ type: z20.literal("move"),
4399
+ x: z20.number(),
4400
+ y: z20.number(),
4401
+ keys: z20.array(z20.string()).nullish()
4306
4402
  }),
4307
- z19.object({
4308
- type: z19.literal("screenshot")
4403
+ z20.object({
4404
+ type: z20.literal("screenshot")
4309
4405
  }),
4310
- z19.object({
4311
- type: z19.literal("scroll"),
4312
- x: z19.number(),
4313
- y: z19.number(),
4314
- scroll_x: z19.number(),
4315
- scroll_y: z19.number(),
4316
- keys: z19.array(z19.string()).nullish()
4406
+ z20.object({
4407
+ type: z20.literal("scroll"),
4408
+ x: z20.number(),
4409
+ y: z20.number(),
4410
+ scroll_x: z20.number(),
4411
+ scroll_y: z20.number(),
4412
+ keys: z20.array(z20.string()).nullish()
4317
4413
  }),
4318
- z19.object({
4319
- type: z19.literal("type"),
4320
- text: z19.string()
4414
+ z20.object({
4415
+ type: z20.literal("type"),
4416
+ text: z20.string()
4321
4417
  }),
4322
- z19.object({
4323
- type: z19.literal("wait")
4418
+ z20.object({
4419
+ type: z20.literal("wait")
4324
4420
  })
4325
4421
  ]);
4326
- var openaiResponsesComputerCallSchema = z19.object({
4327
- type: z19.literal("computer_call"),
4328
- id: z19.string(),
4329
- call_id: z19.string().nullish(),
4330
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4422
+ var openaiResponsesComputerCallSchema = z20.object({
4423
+ type: z20.literal("computer_call"),
4424
+ id: z20.string(),
4425
+ call_id: z20.string().nullish(),
4426
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4331
4427
  action: openaiResponsesComputerActionSchema.nullish(),
4332
- actions: z19.array(openaiResponsesComputerActionSchema).nullish(),
4333
- pending_safety_checks: z19.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4428
+ actions: z20.array(openaiResponsesComputerActionSchema).nullish(),
4429
+ pending_safety_checks: z20.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4430
+ });
4431
+ var openaiResponsesToolCallerSchema = z20.discriminatedUnion("type", [
4432
+ z20.object({ type: z20.literal("direct") }),
4433
+ z20.object({
4434
+ type: z20.literal("program"),
4435
+ caller_id: z20.string()
4436
+ })
4437
+ ]);
4438
+ var openaiResponsesProgramSchema = z20.object({
4439
+ type: z20.literal("program"),
4440
+ id: z20.string(),
4441
+ call_id: z20.string(),
4442
+ code: z20.string(),
4443
+ fingerprint: z20.string()
4444
+ });
4445
+ var openaiResponsesProgramOutputSchema = z20.object({
4446
+ type: z20.literal("program_output"),
4447
+ id: z20.string(),
4448
+ call_id: z20.string(),
4449
+ result: z20.string(),
4450
+ status: z20.enum(["completed", "incomplete"])
4334
4451
  });
4335
- var openaiResponsesNestedErrorChunkSchema = z19.object({
4336
- type: z19.literal("error"),
4337
- sequence_number: z19.number(),
4338
- error: z19.object({
4339
- type: z19.string(),
4340
- code: z19.string(),
4341
- message: z19.string(),
4342
- param: z19.string().nullish()
4452
+ var openaiResponsesNestedErrorChunkSchema = z20.object({
4453
+ type: z20.literal("error"),
4454
+ sequence_number: z20.number(),
4455
+ error: z20.object({
4456
+ type: z20.string(),
4457
+ code: z20.string(),
4458
+ message: z20.string(),
4459
+ param: z20.string().nullish()
4343
4460
  })
4344
4461
  });
4345
- var openaiResponsesErrorChunkSchema = z19.object({
4346
- type: z19.literal("error"),
4347
- sequence_number: z19.number(),
4348
- code: z19.string().nullish(),
4349
- message: z19.string(),
4350
- param: z19.string().nullish()
4462
+ var openaiResponsesErrorChunkSchema = z20.object({
4463
+ type: z20.literal("error"),
4464
+ sequence_number: z20.number(),
4465
+ code: z20.string().nullish(),
4466
+ message: z20.string(),
4467
+ param: z20.string().nullish()
4351
4468
  });
4352
- var openaiResponsesChunkSchema = lazySchema17(
4353
- () => zodSchema17(
4354
- z19.union([
4355
- z19.object({
4356
- type: z19.literal("response.output_text.delta"),
4357
- item_id: z19.string(),
4358
- delta: z19.string(),
4359
- logprobs: z19.array(
4360
- z19.object({
4361
- token: z19.string(),
4362
- logprob: z19.number(),
4363
- top_logprobs: z19.array(
4364
- z19.object({
4365
- token: z19.string(),
4366
- logprob: z19.number()
4469
+ var openaiResponsesChunkSchema = lazySchema18(
4470
+ () => zodSchema18(
4471
+ z20.union([
4472
+ z20.object({
4473
+ type: z20.literal("response.output_text.delta"),
4474
+ item_id: z20.string(),
4475
+ delta: z20.string(),
4476
+ logprobs: z20.array(
4477
+ z20.object({
4478
+ token: z20.string(),
4479
+ logprob: z20.number(),
4480
+ top_logprobs: z20.array(
4481
+ z20.object({
4482
+ token: z20.string(),
4483
+ logprob: z20.number()
4367
4484
  })
4368
4485
  )
4369
4486
  })
4370
4487
  ).nullish()
4371
4488
  }),
4372
- z19.object({
4373
- type: z19.enum(["response.completed", "response.incomplete"]),
4374
- response: z19.object({
4375
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4376
- usage: z19.object({
4377
- input_tokens: z19.number(),
4378
- input_tokens_details: z19.object({
4379
- cached_tokens: z19.number().nullish(),
4380
- cache_write_tokens: z19.number().nullish(),
4381
- orchestration_input_tokens: z19.number().nullish(),
4382
- orchestration_input_cached_tokens: z19.number().nullish()
4489
+ z20.object({
4490
+ type: z20.enum(["response.completed", "response.incomplete"]),
4491
+ response: z20.object({
4492
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4493
+ usage: z20.object({
4494
+ input_tokens: z20.number(),
4495
+ input_tokens_details: z20.object({
4496
+ cached_tokens: z20.number().nullish(),
4497
+ cache_write_tokens: z20.number().nullish(),
4498
+ orchestration_input_tokens: z20.number().nullish(),
4499
+ orchestration_input_cached_tokens: z20.number().nullish()
4383
4500
  }).nullish(),
4384
- output_tokens: z19.number(),
4385
- output_tokens_details: z19.object({
4386
- reasoning_tokens: z19.number().nullish(),
4387
- orchestration_output_tokens: z19.number().nullish()
4501
+ output_tokens: z20.number(),
4502
+ output_tokens_details: z20.object({
4503
+ reasoning_tokens: z20.number().nullish(),
4504
+ orchestration_output_tokens: z20.number().nullish()
4388
4505
  }).nullish()
4389
4506
  }),
4390
- reasoning: z19.object({
4391
- context: z19.string().nullish()
4507
+ reasoning: z20.object({
4508
+ context: z20.string().nullish()
4392
4509
  }).nullish(),
4393
- service_tier: z19.string().nullish()
4510
+ service_tier: z20.string().nullish()
4394
4511
  })
4395
4512
  }),
4396
- z19.object({
4397
- type: z19.literal("response.failed"),
4398
- sequence_number: z19.number(),
4399
- response: z19.object({
4400
- error: z19.object({
4401
- code: z19.string().nullish(),
4402
- message: z19.string()
4513
+ z20.object({
4514
+ type: z20.literal("response.failed"),
4515
+ sequence_number: z20.number(),
4516
+ response: z20.object({
4517
+ error: z20.object({
4518
+ code: z20.string().nullish(),
4519
+ message: z20.string()
4403
4520
  }).nullish(),
4404
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4405
- usage: z19.object({
4406
- input_tokens: z19.number(),
4407
- input_tokens_details: z19.object({
4408
- cached_tokens: z19.number().nullish(),
4409
- cache_write_tokens: z19.number().nullish(),
4410
- orchestration_input_tokens: z19.number().nullish(),
4411
- orchestration_input_cached_tokens: z19.number().nullish()
4521
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4522
+ usage: z20.object({
4523
+ input_tokens: z20.number(),
4524
+ input_tokens_details: z20.object({
4525
+ cached_tokens: z20.number().nullish(),
4526
+ cache_write_tokens: z20.number().nullish(),
4527
+ orchestration_input_tokens: z20.number().nullish(),
4528
+ orchestration_input_cached_tokens: z20.number().nullish()
4412
4529
  }).nullish(),
4413
- output_tokens: z19.number(),
4414
- output_tokens_details: z19.object({
4415
- reasoning_tokens: z19.number().nullish(),
4416
- orchestration_output_tokens: z19.number().nullish()
4530
+ output_tokens: z20.number(),
4531
+ output_tokens_details: z20.object({
4532
+ reasoning_tokens: z20.number().nullish(),
4533
+ orchestration_output_tokens: z20.number().nullish()
4417
4534
  }).nullish()
4418
4535
  }).nullish(),
4419
- reasoning: z19.object({
4420
- context: z19.string().nullish()
4536
+ reasoning: z20.object({
4537
+ context: z20.string().nullish()
4421
4538
  }).nullish(),
4422
- service_tier: z19.string().nullish()
4539
+ service_tier: z20.string().nullish()
4423
4540
  })
4424
4541
  }),
4425
- z19.object({
4426
- type: z19.literal("response.created"),
4427
- response: z19.object({
4428
- id: z19.string(),
4429
- created_at: z19.number(),
4430
- model: z19.string(),
4431
- service_tier: z19.string().nullish()
4542
+ z20.object({
4543
+ type: z20.literal("response.created"),
4544
+ response: z20.object({
4545
+ id: z20.string(),
4546
+ created_at: z20.number(),
4547
+ model: z20.string(),
4548
+ service_tier: z20.string().nullish()
4432
4549
  })
4433
4550
  }),
4434
- z19.object({
4435
- type: z19.literal("response.output_item.added"),
4436
- output_index: z19.number(),
4437
- item: z19.discriminatedUnion("type", [
4438
- z19.object({
4439
- type: z19.literal("message"),
4440
- id: z19.string(),
4441
- phase: z19.enum(["commentary", "final_answer"]).nullish()
4551
+ z20.object({
4552
+ type: z20.literal("response.output_item.added"),
4553
+ output_index: z20.number(),
4554
+ item: z20.discriminatedUnion("type", [
4555
+ z20.object({
4556
+ type: z20.literal("message"),
4557
+ id: z20.string(),
4558
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
4442
4559
  }),
4443
- z19.object({
4444
- type: z19.literal("reasoning"),
4445
- id: z19.string(),
4446
- encrypted_content: z19.string().nullish()
4560
+ z20.object({
4561
+ type: z20.literal("reasoning"),
4562
+ id: z20.string(),
4563
+ encrypted_content: z20.string().nullish()
4447
4564
  }),
4448
- z19.object({
4449
- type: z19.literal("function_call"),
4450
- id: z19.string(),
4451
- call_id: z19.string(),
4452
- name: z19.string(),
4453
- arguments: z19.string(),
4454
- namespace: z19.string().nullish()
4565
+ z20.object({
4566
+ type: z20.literal("function_call"),
4567
+ id: z20.string(),
4568
+ call_id: z20.string(),
4569
+ name: z20.string(),
4570
+ arguments: z20.string(),
4571
+ namespace: z20.string().nullish(),
4572
+ caller: openaiResponsesToolCallerSchema.nullish()
4455
4573
  }),
4456
- z19.object({
4457
- type: z19.literal("web_search_call"),
4458
- id: z19.string(),
4459
- status: z19.string()
4574
+ openaiResponsesProgramSchema,
4575
+ openaiResponsesProgramOutputSchema,
4576
+ z20.object({
4577
+ type: z20.literal("web_search_call"),
4578
+ id: z20.string(),
4579
+ status: z20.string()
4460
4580
  }),
4461
4581
  openaiResponsesComputerCallSchema,
4462
- z19.object({
4463
- type: z19.literal("file_search_call"),
4464
- id: z19.string()
4582
+ z20.object({
4583
+ type: z20.literal("file_search_call"),
4584
+ id: z20.string()
4465
4585
  }),
4466
- z19.object({
4467
- type: z19.literal("image_generation_call"),
4468
- id: z19.string()
4586
+ z20.object({
4587
+ type: z20.literal("image_generation_call"),
4588
+ id: z20.string()
4469
4589
  }),
4470
- z19.object({
4471
- type: z19.literal("code_interpreter_call"),
4472
- id: z19.string(),
4473
- container_id: z19.string(),
4474
- code: z19.string().nullable(),
4475
- outputs: z19.array(
4476
- z19.discriminatedUnion("type", [
4477
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4478
- z19.object({ type: z19.literal("image"), url: z19.string() })
4590
+ z20.object({
4591
+ type: z20.literal("code_interpreter_call"),
4592
+ id: z20.string(),
4593
+ container_id: z20.string(),
4594
+ code: z20.string().nullable(),
4595
+ outputs: z20.array(
4596
+ z20.discriminatedUnion("type", [
4597
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
4598
+ z20.object({ type: z20.literal("image"), url: z20.string() })
4479
4599
  ])
4480
4600
  ).nullable(),
4481
- status: z19.string()
4601
+ status: z20.string()
4482
4602
  }),
4483
- z19.object({
4484
- type: z19.literal("mcp_call"),
4485
- id: z19.string(),
4486
- status: z19.string(),
4487
- approval_request_id: z19.string().nullish()
4603
+ z20.object({
4604
+ type: z20.literal("mcp_call"),
4605
+ id: z20.string(),
4606
+ status: z20.string(),
4607
+ approval_request_id: z20.string().nullish()
4488
4608
  }),
4489
- z19.object({
4490
- type: z19.literal("mcp_list_tools"),
4491
- id: z19.string()
4609
+ z20.object({
4610
+ type: z20.literal("mcp_list_tools"),
4611
+ id: z20.string()
4492
4612
  }),
4493
- z19.object({
4494
- type: z19.literal("mcp_approval_request"),
4495
- id: z19.string()
4613
+ z20.object({
4614
+ type: z20.literal("mcp_approval_request"),
4615
+ id: z20.string()
4496
4616
  }),
4497
- z19.object({
4498
- type: z19.literal("apply_patch_call"),
4499
- id: z19.string(),
4500
- call_id: z19.string(),
4501
- status: z19.enum(["in_progress", "completed"]),
4502
- operation: z19.discriminatedUnion("type", [
4503
- z19.object({
4504
- type: z19.literal("create_file"),
4505
- path: z19.string(),
4506
- diff: z19.string()
4617
+ z20.object({
4618
+ type: z20.literal("apply_patch_call"),
4619
+ id: z20.string(),
4620
+ call_id: z20.string(),
4621
+ status: z20.enum(["in_progress", "completed"]),
4622
+ operation: z20.discriminatedUnion("type", [
4623
+ z20.object({
4624
+ type: z20.literal("create_file"),
4625
+ path: z20.string(),
4626
+ diff: z20.string()
4507
4627
  }),
4508
- z19.object({
4509
- type: z19.literal("delete_file"),
4510
- path: z19.string()
4628
+ z20.object({
4629
+ type: z20.literal("delete_file"),
4630
+ path: z20.string()
4511
4631
  }),
4512
- z19.object({
4513
- type: z19.literal("update_file"),
4514
- path: z19.string(),
4515
- diff: z19.string()
4632
+ z20.object({
4633
+ type: z20.literal("update_file"),
4634
+ path: z20.string(),
4635
+ diff: z20.string()
4516
4636
  })
4517
4637
  ])
4518
4638
  }),
4519
- z19.object({
4520
- type: z19.literal("custom_tool_call"),
4521
- id: z19.string(),
4522
- call_id: z19.string(),
4523
- name: z19.string(),
4524
- input: z19.string()
4639
+ z20.object({
4640
+ type: z20.literal("custom_tool_call"),
4641
+ id: z20.string(),
4642
+ call_id: z20.string(),
4643
+ name: z20.string(),
4644
+ input: z20.string()
4525
4645
  }),
4526
- z19.object({
4527
- type: z19.literal("shell_call"),
4528
- id: z19.string(),
4529
- call_id: z19.string(),
4530
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4531
- action: z19.object({
4532
- commands: z19.array(z19.string())
4646
+ z20.object({
4647
+ type: z20.literal("shell_call"),
4648
+ id: z20.string(),
4649
+ call_id: z20.string(),
4650
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4651
+ action: z20.object({
4652
+ commands: z20.array(z20.string())
4533
4653
  })
4534
4654
  }),
4535
- z19.object({
4536
- type: z19.literal("compaction"),
4537
- id: z19.string(),
4538
- encrypted_content: z19.string().nullish()
4655
+ z20.object({
4656
+ type: z20.literal("compaction"),
4657
+ id: z20.string(),
4658
+ encrypted_content: z20.string().nullish()
4539
4659
  }),
4540
- z19.object({
4541
- type: z19.literal("shell_call_output"),
4542
- id: z19.string(),
4543
- call_id: z19.string(),
4544
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4545
- output: z19.array(
4546
- z19.object({
4547
- stdout: z19.string(),
4548
- stderr: z19.string(),
4549
- outcome: z19.discriminatedUnion("type", [
4550
- z19.object({ type: z19.literal("timeout") }),
4551
- z19.object({
4552
- type: z19.literal("exit"),
4553
- exit_code: z19.number()
4660
+ z20.object({
4661
+ type: z20.literal("shell_call_output"),
4662
+ id: z20.string(),
4663
+ call_id: z20.string(),
4664
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4665
+ output: z20.array(
4666
+ z20.object({
4667
+ stdout: z20.string(),
4668
+ stderr: z20.string(),
4669
+ outcome: z20.discriminatedUnion("type", [
4670
+ z20.object({ type: z20.literal("timeout") }),
4671
+ z20.object({
4672
+ type: z20.literal("exit"),
4673
+ exit_code: z20.number()
4554
4674
  })
4555
4675
  ])
4556
4676
  })
4557
4677
  )
4558
4678
  }),
4559
- z19.object({
4560
- type: z19.literal("tool_search_call"),
4561
- id: z19.string(),
4562
- execution: z19.enum(["server", "client"]),
4563
- call_id: z19.string().nullable(),
4564
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4565
- arguments: z19.unknown()
4679
+ z20.object({
4680
+ type: z20.literal("tool_search_call"),
4681
+ id: z20.string(),
4682
+ execution: z20.enum(["server", "client"]),
4683
+ call_id: z20.string().nullable(),
4684
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4685
+ arguments: z20.unknown()
4566
4686
  }),
4567
- z19.object({
4568
- type: z19.literal("tool_search_output"),
4569
- id: z19.string(),
4570
- execution: z19.enum(["server", "client"]),
4571
- call_id: z19.string().nullable(),
4572
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4573
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
4687
+ z20.object({
4688
+ type: z20.literal("tool_search_output"),
4689
+ id: z20.string(),
4690
+ execution: z20.enum(["server", "client"]),
4691
+ call_id: z20.string().nullable(),
4692
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4693
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4574
4694
  })
4575
4695
  ])
4576
4696
  }),
4577
- z19.object({
4578
- type: z19.literal("response.output_item.done"),
4579
- output_index: z19.number(),
4580
- item: z19.discriminatedUnion("type", [
4581
- z19.object({
4582
- type: z19.literal("message"),
4583
- id: z19.string(),
4584
- phase: z19.enum(["commentary", "final_answer"]).nullish()
4697
+ z20.object({
4698
+ type: z20.literal("response.output_item.done"),
4699
+ output_index: z20.number(),
4700
+ item: z20.discriminatedUnion("type", [
4701
+ z20.object({
4702
+ type: z20.literal("message"),
4703
+ id: z20.string(),
4704
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
4585
4705
  }),
4586
- z19.object({
4587
- type: z19.literal("reasoning"),
4588
- id: z19.string(),
4589
- encrypted_content: z19.string().nullish()
4706
+ z20.object({
4707
+ type: z20.literal("reasoning"),
4708
+ id: z20.string(),
4709
+ encrypted_content: z20.string().nullish()
4590
4710
  }),
4591
- z19.object({
4592
- type: z19.literal("function_call"),
4593
- id: z19.string(),
4594
- call_id: z19.string(),
4595
- name: z19.string(),
4596
- arguments: z19.string(),
4597
- status: z19.literal("completed"),
4598
- namespace: z19.string().nullish()
4711
+ z20.object({
4712
+ type: z20.literal("function_call"),
4713
+ id: z20.string(),
4714
+ call_id: z20.string(),
4715
+ name: z20.string(),
4716
+ arguments: z20.string(),
4717
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4718
+ namespace: z20.string().nullish(),
4719
+ caller: openaiResponsesToolCallerSchema.nullish()
4599
4720
  }),
4600
- z19.object({
4601
- type: z19.literal("custom_tool_call"),
4602
- id: z19.string(),
4603
- call_id: z19.string(),
4604
- name: z19.string(),
4605
- input: z19.string(),
4606
- status: z19.literal("completed")
4721
+ openaiResponsesProgramSchema,
4722
+ openaiResponsesProgramOutputSchema,
4723
+ z20.object({
4724
+ type: z20.literal("custom_tool_call"),
4725
+ id: z20.string(),
4726
+ call_id: z20.string(),
4727
+ name: z20.string(),
4728
+ input: z20.string(),
4729
+ status: z20.literal("completed")
4607
4730
  }),
4608
- z19.object({
4609
- type: z19.literal("code_interpreter_call"),
4610
- id: z19.string(),
4611
- code: z19.string().nullable(),
4612
- container_id: z19.string(),
4613
- outputs: z19.array(
4614
- z19.discriminatedUnion("type", [
4615
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4616
- z19.object({ type: z19.literal("image"), url: z19.string() })
4731
+ z20.object({
4732
+ type: z20.literal("code_interpreter_call"),
4733
+ id: z20.string(),
4734
+ code: z20.string().nullable(),
4735
+ container_id: z20.string(),
4736
+ outputs: z20.array(
4737
+ z20.discriminatedUnion("type", [
4738
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
4739
+ z20.object({ type: z20.literal("image"), url: z20.string() })
4617
4740
  ])
4618
4741
  ).nullable()
4619
4742
  }),
4620
- z19.object({
4621
- type: z19.literal("image_generation_call"),
4622
- id: z19.string(),
4623
- result: z19.string()
4743
+ z20.object({
4744
+ type: z20.literal("image_generation_call"),
4745
+ id: z20.string(),
4746
+ result: z20.string()
4624
4747
  }),
4625
- z19.object({
4626
- type: z19.literal("web_search_call"),
4627
- id: z19.string(),
4628
- status: z19.string(),
4629
- action: z19.discriminatedUnion("type", [
4630
- z19.object({
4631
- type: z19.literal("search"),
4632
- query: z19.string().nullish(),
4633
- queries: z19.array(z19.string()).nullish(),
4634
- sources: z19.array(
4635
- z19.discriminatedUnion("type", [
4636
- z19.object({ type: z19.literal("url"), url: z19.string() }),
4637
- z19.object({ type: z19.literal("api"), name: z19.string() })
4748
+ z20.object({
4749
+ type: z20.literal("web_search_call"),
4750
+ id: z20.string(),
4751
+ status: z20.string(),
4752
+ action: z20.discriminatedUnion("type", [
4753
+ z20.object({
4754
+ type: z20.literal("search"),
4755
+ query: z20.string().nullish(),
4756
+ queries: z20.array(z20.string()).nullish(),
4757
+ sources: z20.array(
4758
+ z20.discriminatedUnion("type", [
4759
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
4760
+ z20.object({ type: z20.literal("api"), name: z20.string() })
4638
4761
  ])
4639
4762
  ).nullish()
4640
4763
  }),
4641
- z19.object({
4642
- type: z19.literal("open_page"),
4643
- url: z19.string().nullish()
4764
+ z20.object({
4765
+ type: z20.literal("open_page"),
4766
+ url: z20.string().nullish()
4644
4767
  }),
4645
- z19.object({
4646
- type: z19.literal("find_in_page"),
4647
- url: z19.string().nullish(),
4648
- pattern: z19.string().nullish()
4768
+ z20.object({
4769
+ type: z20.literal("find_in_page"),
4770
+ url: z20.string().nullish(),
4771
+ pattern: z20.string().nullish()
4649
4772
  })
4650
4773
  ]).nullish()
4651
4774
  }),
4652
- z19.object({
4653
- type: z19.literal("file_search_call"),
4654
- id: z19.string(),
4655
- queries: z19.array(z19.string()),
4656
- results: z19.array(
4657
- z19.object({
4658
- attributes: z19.record(
4659
- z19.string(),
4660
- z19.union([z19.string(), z19.number(), z19.boolean()])
4775
+ z20.object({
4776
+ type: z20.literal("file_search_call"),
4777
+ id: z20.string(),
4778
+ queries: z20.array(z20.string()),
4779
+ results: z20.array(
4780
+ z20.object({
4781
+ attributes: z20.record(
4782
+ z20.string(),
4783
+ z20.union([z20.string(), z20.number(), z20.boolean()])
4661
4784
  ),
4662
- file_id: z19.string(),
4663
- filename: z19.string(),
4664
- score: z19.number(),
4665
- text: z19.string()
4785
+ file_id: z20.string(),
4786
+ filename: z20.string(),
4787
+ score: z20.number(),
4788
+ text: z20.string()
4666
4789
  })
4667
4790
  ).nullish()
4668
4791
  }),
4669
- z19.object({
4670
- type: z19.literal("local_shell_call"),
4671
- id: z19.string(),
4672
- call_id: z19.string(),
4673
- action: z19.object({
4674
- type: z19.literal("exec"),
4675
- command: z19.array(z19.string()),
4676
- timeout_ms: z19.number().optional(),
4677
- user: z19.string().optional(),
4678
- working_directory: z19.string().optional(),
4679
- env: z19.record(z19.string(), z19.string()).optional()
4792
+ z20.object({
4793
+ type: z20.literal("local_shell_call"),
4794
+ id: z20.string(),
4795
+ call_id: z20.string(),
4796
+ action: z20.object({
4797
+ type: z20.literal("exec"),
4798
+ command: z20.array(z20.string()),
4799
+ timeout_ms: z20.number().optional(),
4800
+ user: z20.string().optional(),
4801
+ working_directory: z20.string().optional(),
4802
+ env: z20.record(z20.string(), z20.string()).optional()
4680
4803
  })
4681
4804
  }),
4682
4805
  openaiResponsesComputerCallSchema,
4683
- z19.object({
4684
- type: z19.literal("mcp_call"),
4685
- id: z19.string(),
4686
- status: z19.string(),
4687
- arguments: z19.string(),
4688
- name: z19.string(),
4689
- server_label: z19.string(),
4690
- output: z19.string().nullish(),
4691
- error: z19.union([
4692
- z19.string(),
4693
- z19.object({
4694
- type: z19.string().optional(),
4695
- code: z19.union([z19.number(), z19.string()]).optional(),
4696
- message: z19.string().optional()
4806
+ z20.object({
4807
+ type: z20.literal("mcp_call"),
4808
+ id: z20.string(),
4809
+ status: z20.string(),
4810
+ arguments: z20.string(),
4811
+ name: z20.string(),
4812
+ server_label: z20.string(),
4813
+ output: z20.string().nullish(),
4814
+ error: z20.union([
4815
+ z20.string(),
4816
+ z20.object({
4817
+ type: z20.string().optional(),
4818
+ code: z20.union([z20.number(), z20.string()]).optional(),
4819
+ message: z20.string().optional()
4697
4820
  }).loose()
4698
4821
  ]).nullish(),
4699
- approval_request_id: z19.string().nullish()
4822
+ approval_request_id: z20.string().nullish()
4700
4823
  }),
4701
- z19.object({
4702
- type: z19.literal("mcp_list_tools"),
4703
- id: z19.string(),
4704
- server_label: z19.string(),
4705
- tools: z19.array(
4706
- z19.object({
4707
- name: z19.string(),
4708
- description: z19.string().optional(),
4709
- input_schema: z19.any(),
4710
- annotations: z19.record(z19.string(), z19.unknown()).optional()
4824
+ z20.object({
4825
+ type: z20.literal("mcp_list_tools"),
4826
+ id: z20.string(),
4827
+ server_label: z20.string(),
4828
+ tools: z20.array(
4829
+ z20.object({
4830
+ name: z20.string(),
4831
+ description: z20.string().optional(),
4832
+ input_schema: z20.any(),
4833
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
4711
4834
  })
4712
4835
  ),
4713
- error: z19.union([
4714
- z19.string(),
4715
- z19.object({
4716
- type: z19.string().optional(),
4717
- code: z19.union([z19.number(), z19.string()]).optional(),
4718
- message: z19.string().optional()
4836
+ error: z20.union([
4837
+ z20.string(),
4838
+ z20.object({
4839
+ type: z20.string().optional(),
4840
+ code: z20.union([z20.number(), z20.string()]).optional(),
4841
+ message: z20.string().optional()
4719
4842
  }).loose()
4720
4843
  ]).optional()
4721
4844
  }),
4722
- z19.object({
4723
- type: z19.literal("mcp_approval_request"),
4724
- id: z19.string(),
4725
- server_label: z19.string(),
4726
- name: z19.string(),
4727
- arguments: z19.string(),
4728
- approval_request_id: z19.string().optional()
4845
+ z20.object({
4846
+ type: z20.literal("mcp_approval_request"),
4847
+ id: z20.string(),
4848
+ server_label: z20.string(),
4849
+ name: z20.string(),
4850
+ arguments: z20.string(),
4851
+ approval_request_id: z20.string().optional()
4729
4852
  }),
4730
- z19.object({
4731
- type: z19.literal("apply_patch_call"),
4732
- id: z19.string(),
4733
- call_id: z19.string(),
4734
- status: z19.enum(["in_progress", "completed"]),
4735
- operation: z19.discriminatedUnion("type", [
4736
- z19.object({
4737
- type: z19.literal("create_file"),
4738
- path: z19.string(),
4739
- diff: z19.string()
4853
+ z20.object({
4854
+ type: z20.literal("apply_patch_call"),
4855
+ id: z20.string(),
4856
+ call_id: z20.string(),
4857
+ status: z20.enum(["in_progress", "completed"]),
4858
+ operation: z20.discriminatedUnion("type", [
4859
+ z20.object({
4860
+ type: z20.literal("create_file"),
4861
+ path: z20.string(),
4862
+ diff: z20.string()
4740
4863
  }),
4741
- z19.object({
4742
- type: z19.literal("delete_file"),
4743
- path: z19.string()
4864
+ z20.object({
4865
+ type: z20.literal("delete_file"),
4866
+ path: z20.string()
4744
4867
  }),
4745
- z19.object({
4746
- type: z19.literal("update_file"),
4747
- path: z19.string(),
4748
- diff: z19.string()
4868
+ z20.object({
4869
+ type: z20.literal("update_file"),
4870
+ path: z20.string(),
4871
+ diff: z20.string()
4749
4872
  })
4750
4873
  ])
4751
4874
  }),
4752
- z19.object({
4753
- type: z19.literal("shell_call"),
4754
- id: z19.string(),
4755
- call_id: z19.string(),
4756
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4757
- action: z19.object({
4758
- commands: z19.array(z19.string())
4875
+ z20.object({
4876
+ type: z20.literal("shell_call"),
4877
+ id: z20.string(),
4878
+ call_id: z20.string(),
4879
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4880
+ action: z20.object({
4881
+ commands: z20.array(z20.string())
4759
4882
  })
4760
4883
  }),
4761
- z19.object({
4762
- type: z19.literal("compaction"),
4763
- id: z19.string(),
4764
- encrypted_content: z19.string()
4884
+ z20.object({
4885
+ type: z20.literal("compaction"),
4886
+ id: z20.string(),
4887
+ encrypted_content: z20.string()
4765
4888
  }),
4766
- z19.object({
4767
- type: z19.literal("shell_call_output"),
4768
- id: z19.string(),
4769
- call_id: z19.string(),
4770
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4771
- output: z19.array(
4772
- z19.object({
4773
- stdout: z19.string(),
4774
- stderr: z19.string(),
4775
- outcome: z19.discriminatedUnion("type", [
4776
- z19.object({ type: z19.literal("timeout") }),
4777
- z19.object({
4778
- type: z19.literal("exit"),
4779
- exit_code: z19.number()
4889
+ z20.object({
4890
+ type: z20.literal("shell_call_output"),
4891
+ id: z20.string(),
4892
+ call_id: z20.string(),
4893
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4894
+ output: z20.array(
4895
+ z20.object({
4896
+ stdout: z20.string(),
4897
+ stderr: z20.string(),
4898
+ outcome: z20.discriminatedUnion("type", [
4899
+ z20.object({ type: z20.literal("timeout") }),
4900
+ z20.object({
4901
+ type: z20.literal("exit"),
4902
+ exit_code: z20.number()
4780
4903
  })
4781
4904
  ])
4782
4905
  })
4783
4906
  )
4784
4907
  }),
4785
- z19.object({
4786
- type: z19.literal("tool_search_call"),
4787
- id: z19.string(),
4788
- execution: z19.enum(["server", "client"]),
4789
- call_id: z19.string().nullable(),
4790
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4791
- arguments: z19.unknown()
4908
+ z20.object({
4909
+ type: z20.literal("tool_search_call"),
4910
+ id: z20.string(),
4911
+ execution: z20.enum(["server", "client"]),
4912
+ call_id: z20.string().nullable(),
4913
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4914
+ arguments: z20.unknown()
4792
4915
  }),
4793
- z19.object({
4794
- type: z19.literal("tool_search_output"),
4795
- id: z19.string(),
4796
- execution: z19.enum(["server", "client"]),
4797
- call_id: z19.string().nullable(),
4798
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4799
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
4916
+ z20.object({
4917
+ type: z20.literal("tool_search_output"),
4918
+ id: z20.string(),
4919
+ execution: z20.enum(["server", "client"]),
4920
+ call_id: z20.string().nullable(),
4921
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4922
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4800
4923
  })
4801
4924
  ])
4802
4925
  }),
4803
- z19.object({
4804
- type: z19.literal("response.function_call_arguments.delta"),
4805
- item_id: z19.string(),
4806
- output_index: z19.number(),
4807
- delta: z19.string()
4926
+ z20.object({
4927
+ type: z20.literal("response.function_call_arguments.delta"),
4928
+ item_id: z20.string(),
4929
+ output_index: z20.number(),
4930
+ delta: z20.string()
4808
4931
  }),
4809
- z19.object({
4810
- type: z19.literal("response.custom_tool_call_input.delta"),
4811
- item_id: z19.string(),
4812
- output_index: z19.number(),
4813
- delta: z19.string()
4932
+ z20.object({
4933
+ type: z20.literal("response.custom_tool_call_input.delta"),
4934
+ item_id: z20.string(),
4935
+ output_index: z20.number(),
4936
+ delta: z20.string()
4814
4937
  }),
4815
- z19.object({
4816
- type: z19.literal("response.image_generation_call.partial_image"),
4817
- item_id: z19.string(),
4818
- output_index: z19.number(),
4819
- partial_image_b64: z19.string()
4938
+ z20.object({
4939
+ type: z20.literal("response.image_generation_call.partial_image"),
4940
+ item_id: z20.string(),
4941
+ output_index: z20.number(),
4942
+ partial_image_b64: z20.string()
4820
4943
  }),
4821
- z19.object({
4822
- type: z19.literal("response.code_interpreter_call_code.delta"),
4823
- item_id: z19.string(),
4824
- output_index: z19.number(),
4825
- delta: z19.string()
4944
+ z20.object({
4945
+ type: z20.literal("response.code_interpreter_call_code.delta"),
4946
+ item_id: z20.string(),
4947
+ output_index: z20.number(),
4948
+ delta: z20.string()
4826
4949
  }),
4827
- z19.object({
4828
- type: z19.literal("response.code_interpreter_call_code.done"),
4829
- item_id: z19.string(),
4830
- output_index: z19.number(),
4831
- code: z19.string()
4950
+ z20.object({
4951
+ type: z20.literal("response.code_interpreter_call_code.done"),
4952
+ item_id: z20.string(),
4953
+ output_index: z20.number(),
4954
+ code: z20.string()
4832
4955
  }),
4833
- z19.object({
4834
- type: z19.literal("response.output_text.annotation.added"),
4835
- annotation: z19.discriminatedUnion("type", [
4836
- z19.object({
4837
- type: z19.literal("url_citation"),
4838
- start_index: z19.number(),
4839
- end_index: z19.number(),
4840
- url: z19.string(),
4841
- title: z19.string()
4956
+ z20.object({
4957
+ type: z20.literal("response.output_text.annotation.added"),
4958
+ annotation: z20.discriminatedUnion("type", [
4959
+ z20.object({
4960
+ type: z20.literal("url_citation"),
4961
+ start_index: z20.number(),
4962
+ end_index: z20.number(),
4963
+ url: z20.string(),
4964
+ title: z20.string()
4842
4965
  }),
4843
- z19.object({
4844
- type: z19.literal("file_citation"),
4845
- file_id: z19.string(),
4846
- filename: z19.string(),
4847
- index: z19.number()
4966
+ z20.object({
4967
+ type: z20.literal("file_citation"),
4968
+ file_id: z20.string(),
4969
+ filename: z20.string(),
4970
+ index: z20.number()
4848
4971
  }),
4849
- z19.object({
4850
- type: z19.literal("container_file_citation"),
4851
- container_id: z19.string(),
4852
- file_id: z19.string(),
4853
- filename: z19.string(),
4854
- start_index: z19.number(),
4855
- end_index: z19.number()
4972
+ z20.object({
4973
+ type: z20.literal("container_file_citation"),
4974
+ container_id: z20.string(),
4975
+ file_id: z20.string(),
4976
+ filename: z20.string(),
4977
+ start_index: z20.number(),
4978
+ end_index: z20.number()
4856
4979
  }),
4857
- z19.object({
4858
- type: z19.literal("file_path"),
4859
- file_id: z19.string(),
4860
- index: z19.number()
4980
+ z20.object({
4981
+ type: z20.literal("file_path"),
4982
+ file_id: z20.string(),
4983
+ index: z20.number()
4861
4984
  })
4862
4985
  ])
4863
4986
  }),
4864
- z19.object({
4865
- type: z19.literal("response.reasoning_summary_part.added"),
4866
- item_id: z19.string(),
4867
- summary_index: z19.number()
4987
+ z20.object({
4988
+ type: z20.literal("response.reasoning_summary_part.added"),
4989
+ item_id: z20.string(),
4990
+ summary_index: z20.number()
4868
4991
  }),
4869
- z19.object({
4870
- type: z19.literal("response.reasoning_summary_text.delta"),
4871
- item_id: z19.string(),
4872
- summary_index: z19.number(),
4873
- delta: z19.string()
4992
+ z20.object({
4993
+ type: z20.literal("response.reasoning_summary_text.delta"),
4994
+ item_id: z20.string(),
4995
+ summary_index: z20.number(),
4996
+ delta: z20.string()
4874
4997
  }),
4875
- z19.object({
4876
- type: z19.literal("response.reasoning_summary_part.done"),
4877
- item_id: z19.string(),
4878
- summary_index: z19.number()
4998
+ z20.object({
4999
+ type: z20.literal("response.reasoning_summary_part.done"),
5000
+ item_id: z20.string(),
5001
+ summary_index: z20.number()
4879
5002
  }),
4880
- z19.object({
4881
- type: z19.literal("response.apply_patch_call_operation_diff.delta"),
4882
- item_id: z19.string(),
4883
- output_index: z19.number(),
4884
- delta: z19.string(),
4885
- obfuscation: z19.string().nullish()
5003
+ z20.object({
5004
+ type: z20.literal("response.apply_patch_call_operation_diff.delta"),
5005
+ item_id: z20.string(),
5006
+ output_index: z20.number(),
5007
+ delta: z20.string(),
5008
+ obfuscation: z20.string().nullish()
4886
5009
  }),
4887
- z19.object({
4888
- type: z19.literal("response.apply_patch_call_operation_diff.done"),
4889
- item_id: z19.string(),
4890
- output_index: z19.number(),
4891
- diff: z19.string()
5010
+ z20.object({
5011
+ type: z20.literal("response.apply_patch_call_operation_diff.done"),
5012
+ item_id: z20.string(),
5013
+ output_index: z20.number(),
5014
+ diff: z20.string()
4892
5015
  }),
4893
5016
  openaiResponsesNestedErrorChunkSchema,
4894
5017
  openaiResponsesErrorChunkSchema,
4895
- z19.object({ type: z19.string() }).loose().transform((value) => ({
5018
+ z20.object({ type: z20.string() }).loose().transform((value) => ({
4896
5019
  type: "unknown_chunk",
4897
5020
  message: value.type
4898
5021
  }))
@@ -4900,315 +5023,318 @@ var openaiResponsesChunkSchema = lazySchema17(
4900
5023
  ])
4901
5024
  )
4902
5025
  );
4903
- var openaiResponsesResponseSchema = lazySchema17(
4904
- () => zodSchema17(
4905
- z19.object({
4906
- id: z19.string().optional(),
4907
- created_at: z19.number().optional(),
4908
- error: z19.object({
4909
- message: z19.string(),
4910
- type: z19.string(),
4911
- param: z19.string().nullish(),
4912
- code: z19.string()
5026
+ var openaiResponsesResponseSchema = lazySchema18(
5027
+ () => zodSchema18(
5028
+ z20.object({
5029
+ id: z20.string().optional(),
5030
+ created_at: z20.number().optional(),
5031
+ error: z20.object({
5032
+ message: z20.string(),
5033
+ type: z20.string(),
5034
+ param: z20.string().nullish(),
5035
+ code: z20.string()
4913
5036
  }).nullish(),
4914
- model: z19.string().optional(),
4915
- output: z19.array(
4916
- z19.discriminatedUnion("type", [
4917
- z19.object({
4918
- type: z19.literal("message"),
4919
- role: z19.literal("assistant"),
4920
- id: z19.string(),
4921
- phase: z19.enum(["commentary", "final_answer"]).nullish(),
4922
- content: z19.array(
4923
- z19.object({
4924
- type: z19.literal("output_text"),
4925
- text: z19.string(),
4926
- logprobs: z19.array(
4927
- z19.object({
4928
- token: z19.string(),
4929
- logprob: z19.number(),
4930
- top_logprobs: z19.array(
4931
- z19.object({
4932
- token: z19.string(),
4933
- logprob: z19.number()
5037
+ model: z20.string().optional(),
5038
+ output: z20.array(
5039
+ z20.discriminatedUnion("type", [
5040
+ z20.object({
5041
+ type: z20.literal("message"),
5042
+ role: z20.literal("assistant"),
5043
+ id: z20.string(),
5044
+ phase: z20.enum(["commentary", "final_answer"]).nullish(),
5045
+ content: z20.array(
5046
+ z20.object({
5047
+ type: z20.literal("output_text"),
5048
+ text: z20.string(),
5049
+ logprobs: z20.array(
5050
+ z20.object({
5051
+ token: z20.string(),
5052
+ logprob: z20.number(),
5053
+ top_logprobs: z20.array(
5054
+ z20.object({
5055
+ token: z20.string(),
5056
+ logprob: z20.number()
4934
5057
  })
4935
5058
  )
4936
5059
  })
4937
5060
  ).nullish(),
4938
- annotations: z19.array(
4939
- z19.discriminatedUnion("type", [
4940
- z19.object({
4941
- type: z19.literal("url_citation"),
4942
- start_index: z19.number(),
4943
- end_index: z19.number(),
4944
- url: z19.string(),
4945
- title: z19.string()
5061
+ annotations: z20.array(
5062
+ z20.discriminatedUnion("type", [
5063
+ z20.object({
5064
+ type: z20.literal("url_citation"),
5065
+ start_index: z20.number(),
5066
+ end_index: z20.number(),
5067
+ url: z20.string(),
5068
+ title: z20.string()
4946
5069
  }),
4947
- z19.object({
4948
- type: z19.literal("file_citation"),
4949
- file_id: z19.string(),
4950
- filename: z19.string(),
4951
- index: z19.number()
5070
+ z20.object({
5071
+ type: z20.literal("file_citation"),
5072
+ file_id: z20.string(),
5073
+ filename: z20.string(),
5074
+ index: z20.number()
4952
5075
  }),
4953
- z19.object({
4954
- type: z19.literal("container_file_citation"),
4955
- container_id: z19.string(),
4956
- file_id: z19.string(),
4957
- filename: z19.string(),
4958
- start_index: z19.number(),
4959
- end_index: z19.number()
5076
+ z20.object({
5077
+ type: z20.literal("container_file_citation"),
5078
+ container_id: z20.string(),
5079
+ file_id: z20.string(),
5080
+ filename: z20.string(),
5081
+ start_index: z20.number(),
5082
+ end_index: z20.number()
4960
5083
  }),
4961
- z19.object({
4962
- type: z19.literal("file_path"),
4963
- file_id: z19.string(),
4964
- index: z19.number()
5084
+ z20.object({
5085
+ type: z20.literal("file_path"),
5086
+ file_id: z20.string(),
5087
+ index: z20.number()
4965
5088
  })
4966
5089
  ])
4967
5090
  )
4968
5091
  })
4969
5092
  )
4970
5093
  }),
4971
- z19.object({
4972
- type: z19.literal("web_search_call"),
4973
- id: z19.string(),
4974
- status: z19.string(),
4975
- action: z19.discriminatedUnion("type", [
4976
- z19.object({
4977
- type: z19.literal("search"),
4978
- query: z19.string().nullish(),
4979
- queries: z19.array(z19.string()).nullish(),
4980
- sources: z19.array(
4981
- z19.discriminatedUnion("type", [
4982
- z19.object({ type: z19.literal("url"), url: z19.string() }),
4983
- z19.object({
4984
- type: z19.literal("api"),
4985
- name: z19.string()
5094
+ z20.object({
5095
+ type: z20.literal("web_search_call"),
5096
+ id: z20.string(),
5097
+ status: z20.string(),
5098
+ action: z20.discriminatedUnion("type", [
5099
+ z20.object({
5100
+ type: z20.literal("search"),
5101
+ query: z20.string().nullish(),
5102
+ queries: z20.array(z20.string()).nullish(),
5103
+ sources: z20.array(
5104
+ z20.discriminatedUnion("type", [
5105
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
5106
+ z20.object({
5107
+ type: z20.literal("api"),
5108
+ name: z20.string()
4986
5109
  })
4987
5110
  ])
4988
5111
  ).nullish()
4989
5112
  }),
4990
- z19.object({
4991
- type: z19.literal("open_page"),
4992
- url: z19.string().nullish()
5113
+ z20.object({
5114
+ type: z20.literal("open_page"),
5115
+ url: z20.string().nullish()
4993
5116
  }),
4994
- z19.object({
4995
- type: z19.literal("find_in_page"),
4996
- url: z19.string().nullish(),
4997
- pattern: z19.string().nullish()
5117
+ z20.object({
5118
+ type: z20.literal("find_in_page"),
5119
+ url: z20.string().nullish(),
5120
+ pattern: z20.string().nullish()
4998
5121
  })
4999
5122
  ]).nullish()
5000
5123
  }),
5001
- z19.object({
5002
- type: z19.literal("file_search_call"),
5003
- id: z19.string(),
5004
- queries: z19.array(z19.string()),
5005
- results: z19.array(
5006
- z19.object({
5007
- attributes: z19.record(
5008
- z19.string(),
5009
- z19.union([z19.string(), z19.number(), z19.boolean()])
5124
+ z20.object({
5125
+ type: z20.literal("file_search_call"),
5126
+ id: z20.string(),
5127
+ queries: z20.array(z20.string()),
5128
+ results: z20.array(
5129
+ z20.object({
5130
+ attributes: z20.record(
5131
+ z20.string(),
5132
+ z20.union([z20.string(), z20.number(), z20.boolean()])
5010
5133
  ),
5011
- file_id: z19.string(),
5012
- filename: z19.string(),
5013
- score: z19.number(),
5014
- text: z19.string()
5134
+ file_id: z20.string(),
5135
+ filename: z20.string(),
5136
+ score: z20.number(),
5137
+ text: z20.string()
5015
5138
  })
5016
5139
  ).nullish()
5017
5140
  }),
5018
- z19.object({
5019
- type: z19.literal("code_interpreter_call"),
5020
- id: z19.string(),
5021
- code: z19.string().nullable(),
5022
- container_id: z19.string(),
5023
- outputs: z19.array(
5024
- z19.discriminatedUnion("type", [
5025
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
5026
- z19.object({ type: z19.literal("image"), url: z19.string() })
5141
+ z20.object({
5142
+ type: z20.literal("code_interpreter_call"),
5143
+ id: z20.string(),
5144
+ code: z20.string().nullable(),
5145
+ container_id: z20.string(),
5146
+ outputs: z20.array(
5147
+ z20.discriminatedUnion("type", [
5148
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
5149
+ z20.object({ type: z20.literal("image"), url: z20.string() })
5027
5150
  ])
5028
5151
  ).nullable()
5029
5152
  }),
5030
- z19.object({
5031
- type: z19.literal("image_generation_call"),
5032
- id: z19.string(),
5033
- result: z19.string()
5153
+ z20.object({
5154
+ type: z20.literal("image_generation_call"),
5155
+ id: z20.string(),
5156
+ result: z20.string()
5034
5157
  }),
5035
- z19.object({
5036
- type: z19.literal("local_shell_call"),
5037
- id: z19.string(),
5038
- call_id: z19.string(),
5039
- action: z19.object({
5040
- type: z19.literal("exec"),
5041
- command: z19.array(z19.string()),
5042
- timeout_ms: z19.number().optional(),
5043
- user: z19.string().optional(),
5044
- working_directory: z19.string().optional(),
5045
- env: z19.record(z19.string(), z19.string()).optional()
5158
+ z20.object({
5159
+ type: z20.literal("local_shell_call"),
5160
+ id: z20.string(),
5161
+ call_id: z20.string(),
5162
+ action: z20.object({
5163
+ type: z20.literal("exec"),
5164
+ command: z20.array(z20.string()),
5165
+ timeout_ms: z20.number().optional(),
5166
+ user: z20.string().optional(),
5167
+ working_directory: z20.string().optional(),
5168
+ env: z20.record(z20.string(), z20.string()).optional()
5046
5169
  })
5047
5170
  }),
5048
- z19.object({
5049
- type: z19.literal("function_call"),
5050
- call_id: z19.string(),
5051
- name: z19.string(),
5052
- arguments: z19.string(),
5053
- id: z19.string(),
5054
- namespace: z19.string().nullish()
5171
+ z20.object({
5172
+ type: z20.literal("function_call"),
5173
+ call_id: z20.string(),
5174
+ name: z20.string(),
5175
+ arguments: z20.string(),
5176
+ id: z20.string(),
5177
+ namespace: z20.string().nullish(),
5178
+ caller: openaiResponsesToolCallerSchema.nullish()
5055
5179
  }),
5056
- z19.object({
5057
- type: z19.literal("custom_tool_call"),
5058
- call_id: z19.string(),
5059
- name: z19.string(),
5060
- input: z19.string(),
5061
- id: z19.string()
5180
+ openaiResponsesProgramSchema,
5181
+ openaiResponsesProgramOutputSchema,
5182
+ z20.object({
5183
+ type: z20.literal("custom_tool_call"),
5184
+ call_id: z20.string(),
5185
+ name: z20.string(),
5186
+ input: z20.string(),
5187
+ id: z20.string()
5062
5188
  }),
5063
5189
  openaiResponsesComputerCallSchema,
5064
- z19.object({
5065
- type: z19.literal("reasoning"),
5066
- id: z19.string(),
5067
- encrypted_content: z19.string().nullish(),
5068
- summary: z19.array(
5069
- z19.object({
5070
- type: z19.literal("summary_text"),
5071
- text: z19.string()
5190
+ z20.object({
5191
+ type: z20.literal("reasoning"),
5192
+ id: z20.string(),
5193
+ encrypted_content: z20.string().nullish(),
5194
+ summary: z20.array(
5195
+ z20.object({
5196
+ type: z20.literal("summary_text"),
5197
+ text: z20.string()
5072
5198
  })
5073
5199
  )
5074
5200
  }),
5075
- z19.object({
5076
- type: z19.literal("mcp_call"),
5077
- id: z19.string(),
5078
- status: z19.string(),
5079
- arguments: z19.string(),
5080
- name: z19.string(),
5081
- server_label: z19.string(),
5082
- output: z19.string().nullish(),
5083
- error: z19.union([
5084
- z19.string(),
5085
- z19.object({
5086
- type: z19.string().optional(),
5087
- code: z19.union([z19.number(), z19.string()]).optional(),
5088
- message: z19.string().optional()
5201
+ z20.object({
5202
+ type: z20.literal("mcp_call"),
5203
+ id: z20.string(),
5204
+ status: z20.string(),
5205
+ arguments: z20.string(),
5206
+ name: z20.string(),
5207
+ server_label: z20.string(),
5208
+ output: z20.string().nullish(),
5209
+ error: z20.union([
5210
+ z20.string(),
5211
+ z20.object({
5212
+ type: z20.string().optional(),
5213
+ code: z20.union([z20.number(), z20.string()]).optional(),
5214
+ message: z20.string().optional()
5089
5215
  }).loose()
5090
5216
  ]).nullish(),
5091
- approval_request_id: z19.string().nullish()
5217
+ approval_request_id: z20.string().nullish()
5092
5218
  }),
5093
- z19.object({
5094
- type: z19.literal("mcp_list_tools"),
5095
- id: z19.string(),
5096
- server_label: z19.string(),
5097
- tools: z19.array(
5098
- z19.object({
5099
- name: z19.string(),
5100
- description: z19.string().optional(),
5101
- input_schema: z19.any(),
5102
- annotations: z19.record(z19.string(), z19.unknown()).optional()
5219
+ z20.object({
5220
+ type: z20.literal("mcp_list_tools"),
5221
+ id: z20.string(),
5222
+ server_label: z20.string(),
5223
+ tools: z20.array(
5224
+ z20.object({
5225
+ name: z20.string(),
5226
+ description: z20.string().optional(),
5227
+ input_schema: z20.any(),
5228
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
5103
5229
  })
5104
5230
  ),
5105
- error: z19.union([
5106
- z19.string(),
5107
- z19.object({
5108
- type: z19.string().optional(),
5109
- code: z19.union([z19.number(), z19.string()]).optional(),
5110
- message: z19.string().optional()
5231
+ error: z20.union([
5232
+ z20.string(),
5233
+ z20.object({
5234
+ type: z20.string().optional(),
5235
+ code: z20.union([z20.number(), z20.string()]).optional(),
5236
+ message: z20.string().optional()
5111
5237
  }).loose()
5112
5238
  ]).optional()
5113
5239
  }),
5114
- z19.object({
5115
- type: z19.literal("mcp_approval_request"),
5116
- id: z19.string(),
5117
- server_label: z19.string(),
5118
- name: z19.string(),
5119
- arguments: z19.string(),
5120
- approval_request_id: z19.string().optional()
5240
+ z20.object({
5241
+ type: z20.literal("mcp_approval_request"),
5242
+ id: z20.string(),
5243
+ server_label: z20.string(),
5244
+ name: z20.string(),
5245
+ arguments: z20.string(),
5246
+ approval_request_id: z20.string().optional()
5121
5247
  }),
5122
- z19.object({
5123
- type: z19.literal("apply_patch_call"),
5124
- id: z19.string(),
5125
- call_id: z19.string(),
5126
- status: z19.enum(["in_progress", "completed"]),
5127
- operation: z19.discriminatedUnion("type", [
5128
- z19.object({
5129
- type: z19.literal("create_file"),
5130
- path: z19.string(),
5131
- diff: z19.string()
5248
+ z20.object({
5249
+ type: z20.literal("apply_patch_call"),
5250
+ id: z20.string(),
5251
+ call_id: z20.string(),
5252
+ status: z20.enum(["in_progress", "completed"]),
5253
+ operation: z20.discriminatedUnion("type", [
5254
+ z20.object({
5255
+ type: z20.literal("create_file"),
5256
+ path: z20.string(),
5257
+ diff: z20.string()
5132
5258
  }),
5133
- z19.object({
5134
- type: z19.literal("delete_file"),
5135
- path: z19.string()
5259
+ z20.object({
5260
+ type: z20.literal("delete_file"),
5261
+ path: z20.string()
5136
5262
  }),
5137
- z19.object({
5138
- type: z19.literal("update_file"),
5139
- path: z19.string(),
5140
- diff: z19.string()
5263
+ z20.object({
5264
+ type: z20.literal("update_file"),
5265
+ path: z20.string(),
5266
+ diff: z20.string()
5141
5267
  })
5142
5268
  ])
5143
5269
  }),
5144
- z19.object({
5145
- type: z19.literal("shell_call"),
5146
- id: z19.string(),
5147
- call_id: z19.string(),
5148
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5149
- action: z19.object({
5150
- commands: z19.array(z19.string())
5270
+ z20.object({
5271
+ type: z20.literal("shell_call"),
5272
+ id: z20.string(),
5273
+ call_id: z20.string(),
5274
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5275
+ action: z20.object({
5276
+ commands: z20.array(z20.string())
5151
5277
  })
5152
5278
  }),
5153
- z19.object({
5154
- type: z19.literal("compaction"),
5155
- id: z19.string(),
5156
- encrypted_content: z19.string()
5279
+ z20.object({
5280
+ type: z20.literal("compaction"),
5281
+ id: z20.string(),
5282
+ encrypted_content: z20.string()
5157
5283
  }),
5158
- z19.object({
5159
- type: z19.literal("shell_call_output"),
5160
- id: z19.string(),
5161
- call_id: z19.string(),
5162
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5163
- output: z19.array(
5164
- z19.object({
5165
- stdout: z19.string(),
5166
- stderr: z19.string(),
5167
- outcome: z19.discriminatedUnion("type", [
5168
- z19.object({ type: z19.literal("timeout") }),
5169
- z19.object({
5170
- type: z19.literal("exit"),
5171
- exit_code: z19.number()
5284
+ z20.object({
5285
+ type: z20.literal("shell_call_output"),
5286
+ id: z20.string(),
5287
+ call_id: z20.string(),
5288
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5289
+ output: z20.array(
5290
+ z20.object({
5291
+ stdout: z20.string(),
5292
+ stderr: z20.string(),
5293
+ outcome: z20.discriminatedUnion("type", [
5294
+ z20.object({ type: z20.literal("timeout") }),
5295
+ z20.object({
5296
+ type: z20.literal("exit"),
5297
+ exit_code: z20.number()
5172
5298
  })
5173
5299
  ])
5174
5300
  })
5175
5301
  )
5176
5302
  }),
5177
- z19.object({
5178
- type: z19.literal("tool_search_call"),
5179
- id: z19.string(),
5180
- execution: z19.enum(["server", "client"]),
5181
- call_id: z19.string().nullable(),
5182
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5183
- arguments: z19.unknown()
5303
+ z20.object({
5304
+ type: z20.literal("tool_search_call"),
5305
+ id: z20.string(),
5306
+ execution: z20.enum(["server", "client"]),
5307
+ call_id: z20.string().nullable(),
5308
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5309
+ arguments: z20.unknown()
5184
5310
  }),
5185
- z19.object({
5186
- type: z19.literal("tool_search_output"),
5187
- id: z19.string(),
5188
- execution: z19.enum(["server", "client"]),
5189
- call_id: z19.string().nullable(),
5190
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5191
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
5311
+ z20.object({
5312
+ type: z20.literal("tool_search_output"),
5313
+ id: z20.string(),
5314
+ execution: z20.enum(["server", "client"]),
5315
+ call_id: z20.string().nullable(),
5316
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5317
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5192
5318
  })
5193
5319
  ])
5194
5320
  ).optional(),
5195
- service_tier: z19.string().nullish(),
5196
- reasoning: z19.object({
5197
- context: z19.string().nullish()
5321
+ service_tier: z20.string().nullish(),
5322
+ reasoning: z20.object({
5323
+ context: z20.string().nullish()
5198
5324
  }).nullish(),
5199
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
5200
- usage: z19.object({
5201
- input_tokens: z19.number(),
5202
- input_tokens_details: z19.object({
5203
- cached_tokens: z19.number().nullish(),
5204
- cache_write_tokens: z19.number().nullish(),
5205
- orchestration_input_tokens: z19.number().nullish(),
5206
- orchestration_input_cached_tokens: z19.number().nullish()
5325
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
5326
+ usage: z20.object({
5327
+ input_tokens: z20.number(),
5328
+ input_tokens_details: z20.object({
5329
+ cached_tokens: z20.number().nullish(),
5330
+ cache_write_tokens: z20.number().nullish(),
5331
+ orchestration_input_tokens: z20.number().nullish(),
5332
+ orchestration_input_cached_tokens: z20.number().nullish()
5207
5333
  }).nullish(),
5208
- output_tokens: z19.number(),
5209
- output_tokens_details: z19.object({
5210
- reasoning_tokens: z19.number().nullish(),
5211
- orchestration_output_tokens: z19.number().nullish()
5334
+ output_tokens: z20.number(),
5335
+ output_tokens_details: z20.object({
5336
+ reasoning_tokens: z20.number().nullish(),
5337
+ orchestration_output_tokens: z20.number().nullish()
5212
5338
  }).nullish()
5213
5339
  }).optional()
5214
5340
  })
@@ -5217,10 +5343,10 @@ var openaiResponsesResponseSchema = lazySchema17(
5217
5343
 
5218
5344
  // src/responses/openai-responses-language-model-options.ts
5219
5345
  import {
5220
- lazySchema as lazySchema18,
5221
- zodSchema as zodSchema18
5346
+ lazySchema as lazySchema19,
5347
+ zodSchema as zodSchema19
5222
5348
  } from "@ai-sdk/provider-utils";
5223
- import { z as z20 } from "zod/v4";
5349
+ import { z as z21 } from "zod/v4";
5224
5350
  var TOP_LOGPROBS_MAX = 20;
5225
5351
  var openaiResponsesReasoningModelIds = [
5226
5352
  "o1",
@@ -5291,9 +5417,9 @@ var openaiResponsesModelIds = [
5291
5417
  "gpt-5-chat-latest",
5292
5418
  ...openaiResponsesReasoningModelIds
5293
5419
  ];
5294
- var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5295
- () => zodSchema18(
5296
- z20.object({
5420
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
5421
+ () => zodSchema19(
5422
+ z21.object({
5297
5423
  /**
5298
5424
  * The ID of the OpenAI Conversation to continue.
5299
5425
  * You must create a conversation first via the OpenAI API.
@@ -5301,13 +5427,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5301
5427
  * Defaults to `undefined`.
5302
5428
  * @see https://platform.openai.com/docs/api-reference/conversations/create
5303
5429
  */
5304
- conversation: z20.string().nullish(),
5430
+ conversation: z21.string().nullish(),
5305
5431
  /**
5306
5432
  * The set of extra fields to include in the response (advanced, usually not needed).
5307
5433
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5308
5434
  */
5309
- include: z20.array(
5310
- z20.enum([
5435
+ include: z21.array(
5436
+ z21.enum([
5311
5437
  "reasoning.encrypted_content",
5312
5438
  // handled internally by default, only needed for unknown reasoning models
5313
5439
  "file_search_call.results",
@@ -5320,7 +5446,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5320
5446
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5321
5447
  * Defaults to `undefined`.
5322
5448
  */
5323
- instructions: z20.string().nullish(),
5449
+ instructions: z21.string().nullish(),
5324
5450
  /**
5325
5451
  * Return the log probabilities of the tokens. Including logprobs will increase
5326
5452
  * the response size and can slow down response times. However, it can
@@ -5335,38 +5461,38 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5335
5461
  * @see https://platform.openai.com/docs/api-reference/responses/create
5336
5462
  * @see https://cookbook.openai.com/examples/using_logprobs
5337
5463
  */
5338
- logprobs: z20.union([z20.boolean(), z20.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5464
+ logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5339
5465
  /**
5340
5466
  * The maximum number of total calls to built-in tools that can be processed in a response.
5341
5467
  * This maximum number applies across all built-in tool calls, not per individual tool.
5342
5468
  * Any further attempts to call a tool by the model will be ignored.
5343
5469
  */
5344
- maxToolCalls: z20.number().nullish(),
5470
+ maxToolCalls: z21.number().nullish(),
5345
5471
  /**
5346
5472
  * Additional metadata to store with the generation.
5347
5473
  */
5348
- metadata: z20.any().nullish(),
5474
+ metadata: z21.any().nullish(),
5349
5475
  /**
5350
5476
  * Whether to use parallel tool calls. Defaults to `true`.
5351
5477
  */
5352
- parallelToolCalls: z20.boolean().nullish(),
5478
+ parallelToolCalls: z21.boolean().nullish(),
5353
5479
  /**
5354
5480
  * The ID of the previous response. You can use it to continue a conversation.
5355
5481
  * Defaults to `undefined`.
5356
5482
  */
5357
- previousResponseId: z20.string().nullish(),
5483
+ previousResponseId: z21.string().nullish(),
5358
5484
  /**
5359
5485
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5360
5486
  */
5361
- promptCacheKey: z20.string().nullish(),
5487
+ promptCacheKey: z21.string().nullish(),
5362
5488
  /**
5363
5489
  * Prompt cache behavior for GPT-5.6 and later models.
5364
5490
  * `mode` controls whether OpenAI also places an implicit breakpoint.
5365
5491
  * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5366
5492
  */
5367
- promptCacheOptions: z20.object({
5368
- mode: z20.enum(["implicit", "explicit"]).optional(),
5369
- ttl: z20.literal("30m").optional()
5493
+ promptCacheOptions: z21.object({
5494
+ mode: z21.enum(["implicit", "explicit"]).optional(),
5495
+ ttl: z21.literal("30m").optional()
5370
5496
  }).optional(),
5371
5497
  /**
5372
5498
  * The retention policy for the prompt cache.
@@ -5378,35 +5504,35 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5378
5504
  *
5379
5505
  * @default 'in_memory'
5380
5506
  */
5381
- promptCacheRetention: z20.enum(["in_memory", "24h"]).nullish(),
5507
+ promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
5382
5508
  /**
5383
5509
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5384
5510
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5385
5511
  * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5386
5512
  * Supported values vary by model.
5387
5513
  */
5388
- reasoningEffort: z20.string().nullish(),
5514
+ reasoningEffort: z21.string().nullish(),
5389
5515
  /**
5390
5516
  * Controls how much model work GPT-5.6 performs before returning a final answer.
5391
5517
  * `standard` is the default. `pro` increases quality, latency, and token usage.
5392
5518
  */
5393
- reasoningMode: z20.enum(["standard", "pro"]).optional(),
5519
+ reasoningMode: z21.enum(["standard", "pro"]).optional(),
5394
5520
  /**
5395
5521
  * Controls which available reasoning items GPT-5.6 can use.
5396
5522
  * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5397
5523
  * turns, and `all_turns` makes compatible earlier reasoning available.
5398
5524
  */
5399
- reasoningContext: z20.enum(["auto", "current_turn", "all_turns"]).optional(),
5525
+ reasoningContext: z21.enum(["auto", "current_turn", "all_turns"]).optional(),
5400
5526
  /**
5401
5527
  * Controls reasoning summary output from the model.
5402
5528
  * Set to "auto" to automatically receive the richest level available,
5403
5529
  * or "detailed" for comprehensive summaries.
5404
5530
  */
5405
- reasoningSummary: z20.string().nullish(),
5531
+ reasoningSummary: z21.string().nullish(),
5406
5532
  /**
5407
5533
  * The identifier for safety monitoring and tracking.
5408
5534
  */
5409
- safetyIdentifier: z20.string().nullish(),
5535
+ safetyIdentifier: z21.string().nullish(),
5410
5536
  /**
5411
5537
  * Service tier for the request.
5412
5538
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -5414,11 +5540,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5414
5540
  *
5415
5541
  * Defaults to 'auto'.
5416
5542
  */
5417
- serviceTier: z20.enum(["auto", "flex", "priority", "default"]).nullish(),
5543
+ serviceTier: z21.enum(["auto", "flex", "priority", "default"]).nullish(),
5418
5544
  /**
5419
5545
  * Whether to store the generation. Defaults to `true`.
5420
5546
  */
5421
- store: z20.boolean().nullish(),
5547
+ store: z21.boolean().nullish(),
5422
5548
  /**
5423
5549
  * Whether to pass through non-image file types as generic input files.
5424
5550
  *
@@ -5426,30 +5552,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5426
5552
  * Enable this when the target OpenAI Responses model supports additional
5427
5553
  * file media types, such as text/csv.
5428
5554
  */
5429
- passThroughUnsupportedFiles: z20.boolean().optional(),
5555
+ passThroughUnsupportedFiles: z21.boolean().optional(),
5430
5556
  /**
5431
5557
  * Whether to use strict JSON schema validation.
5432
5558
  * Defaults to `true`.
5433
5559
  */
5434
- strictJsonSchema: z20.boolean().nullish(),
5560
+ strictJsonSchema: z21.boolean().nullish(),
5435
5561
  /**
5436
5562
  * Controls the verbosity of the model's responses. Lower values ('low') will result
5437
5563
  * in more concise responses, while higher values ('high') will result in more verbose responses.
5438
5564
  * Valid values: 'low', 'medium', 'high'.
5439
5565
  */
5440
- textVerbosity: z20.enum(["low", "medium", "high"]).nullish(),
5566
+ textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
5441
5567
  /**
5442
5568
  * Controls output truncation. 'auto' (default) performs truncation automatically;
5443
5569
  * 'disabled' turns truncation off.
5444
5570
  */
5445
- truncation: z20.enum(["auto", "disabled"]).nullish(),
5571
+ truncation: z21.enum(["auto", "disabled"]).nullish(),
5446
5572
  /**
5447
5573
  * A unique identifier representing your end-user, which can help OpenAI to
5448
5574
  * monitor and detect abuse.
5449
5575
  * Defaults to `undefined`.
5450
5576
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5451
5577
  */
5452
- user: z20.string().nullish(),
5578
+ user: z21.string().nullish(),
5453
5579
  /**
5454
5580
  * Override the system message mode for this model.
5455
5581
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -5458,7 +5584,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5458
5584
  *
5459
5585
  * If not specified, the mode is automatically determined based on the model.
5460
5586
  */
5461
- systemMessageMode: z20.enum(["system", "developer", "remove"]).optional(),
5587
+ systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
5462
5588
  /**
5463
5589
  * Force treating this model as a reasoning model.
5464
5590
  *
@@ -5468,14 +5594,14 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5468
5594
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
5469
5595
  * and defaults `systemMessageMode` to `developer` unless overridden.
5470
5596
  */
5471
- forceReasoning: z20.boolean().optional(),
5597
+ forceReasoning: z21.boolean().optional(),
5472
5598
  /**
5473
5599
  * Enable server-side context management (compaction).
5474
5600
  */
5475
- contextManagement: z20.array(
5476
- z20.object({
5477
- type: z20.literal("compaction"),
5478
- compactThreshold: z20.number()
5601
+ contextManagement: z21.array(
5602
+ z21.object({
5603
+ type: z21.literal("compaction"),
5604
+ compactThreshold: z21.number()
5479
5605
  })
5480
5606
  ).nullish(),
5481
5607
  /**
@@ -5488,9 +5614,9 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5488
5614
  *
5489
5615
  * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5490
5616
  */
5491
- allowedTools: z20.object({
5492
- toolNames: z20.array(z20.string()).min(1),
5493
- mode: z20.enum(["auto", "required"]).optional()
5617
+ allowedTools: z21.object({
5618
+ toolNames: z21.array(z21.string()).min(1),
5619
+ mode: z21.enum(["auto", "required"]).optional()
5494
5620
  }).optional()
5495
5621
  })
5496
5622
  )
@@ -5507,44 +5633,44 @@ import {
5507
5633
 
5508
5634
  // src/tool/code-interpreter.ts
5509
5635
  import {
5510
- createProviderExecutedToolFactory,
5511
- lazySchema as lazySchema19,
5512
- zodSchema as zodSchema19
5636
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
5637
+ lazySchema as lazySchema20,
5638
+ zodSchema as zodSchema20
5513
5639
  } from "@ai-sdk/provider-utils";
5514
- import { z as z21 } from "zod/v4";
5515
- var codeInterpreterInputSchema = lazySchema19(
5516
- () => zodSchema19(
5517
- z21.object({
5518
- code: z21.string().nullish(),
5519
- containerId: z21.string()
5640
+ import { z as z22 } from "zod/v4";
5641
+ var codeInterpreterInputSchema = lazySchema20(
5642
+ () => zodSchema20(
5643
+ z22.object({
5644
+ code: z22.string().nullish(),
5645
+ containerId: z22.string()
5520
5646
  })
5521
5647
  )
5522
5648
  );
5523
- var codeInterpreterOutputSchema = lazySchema19(
5524
- () => zodSchema19(
5525
- z21.object({
5526
- outputs: z21.array(
5527
- z21.discriminatedUnion("type", [
5528
- z21.object({ type: z21.literal("logs"), logs: z21.string() }),
5529
- z21.object({ type: z21.literal("image"), url: z21.string() })
5649
+ var codeInterpreterOutputSchema = lazySchema20(
5650
+ () => zodSchema20(
5651
+ z22.object({
5652
+ outputs: z22.array(
5653
+ z22.discriminatedUnion("type", [
5654
+ z22.object({ type: z22.literal("logs"), logs: z22.string() }),
5655
+ z22.object({ type: z22.literal("image"), url: z22.string() })
5530
5656
  ])
5531
5657
  ).nullish()
5532
5658
  })
5533
5659
  )
5534
5660
  );
5535
- var codeInterpreterArgsSchema = lazySchema19(
5536
- () => zodSchema19(
5537
- z21.object({
5538
- container: z21.union([
5539
- z21.string(),
5540
- z21.object({
5541
- fileIds: z21.array(z21.string()).optional()
5661
+ var codeInterpreterArgsSchema = lazySchema20(
5662
+ () => zodSchema20(
5663
+ z22.object({
5664
+ container: z22.union([
5665
+ z22.string(),
5666
+ z22.object({
5667
+ fileIds: z22.array(z22.string()).optional()
5542
5668
  })
5543
5669
  ]).optional()
5544
5670
  })
5545
5671
  )
5546
5672
  );
5547
- var codeInterpreterToolFactory = createProviderExecutedToolFactory({
5673
+ var codeInterpreterToolFactory = createProviderExecutedToolFactory2({
5548
5674
  id: "openai.code_interpreter",
5549
5675
  inputSchema: codeInterpreterInputSchema,
5550
5676
  outputSchema: codeInterpreterOutputSchema
@@ -5555,88 +5681,88 @@ var codeInterpreter = (args = {}) => {
5555
5681
 
5556
5682
  // src/tool/file-search.ts
5557
5683
  import {
5558
- createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
5559
- lazySchema as lazySchema20,
5560
- zodSchema as zodSchema20
5684
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
5685
+ lazySchema as lazySchema21,
5686
+ zodSchema as zodSchema21
5561
5687
  } from "@ai-sdk/provider-utils";
5562
- import { z as z22 } from "zod/v4";
5563
- var comparisonFilterSchema = z22.object({
5564
- key: z22.string(),
5565
- type: z22.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5566
- value: z22.union([z22.string(), z22.number(), z22.boolean(), z22.array(z22.string())])
5688
+ import { z as z23 } from "zod/v4";
5689
+ var comparisonFilterSchema = z23.object({
5690
+ key: z23.string(),
5691
+ type: z23.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5692
+ value: z23.union([z23.string(), z23.number(), z23.boolean(), z23.array(z23.string())])
5567
5693
  });
5568
- var compoundFilterSchema = z22.object({
5569
- type: z22.enum(["and", "or"]),
5570
- filters: z22.array(
5571
- z22.union([comparisonFilterSchema, z22.lazy(() => compoundFilterSchema)])
5694
+ var compoundFilterSchema = z23.object({
5695
+ type: z23.enum(["and", "or"]),
5696
+ filters: z23.array(
5697
+ z23.union([comparisonFilterSchema, z23.lazy(() => compoundFilterSchema)])
5572
5698
  )
5573
5699
  });
5574
- var fileSearchArgsSchema = lazySchema20(
5575
- () => zodSchema20(
5576
- z22.object({
5577
- vectorStoreIds: z22.array(z22.string()),
5578
- maxNumResults: z22.number().optional(),
5579
- ranking: z22.object({
5580
- ranker: z22.string().optional(),
5581
- scoreThreshold: z22.number().optional()
5700
+ var fileSearchArgsSchema = lazySchema21(
5701
+ () => zodSchema21(
5702
+ z23.object({
5703
+ vectorStoreIds: z23.array(z23.string()),
5704
+ maxNumResults: z23.number().optional(),
5705
+ ranking: z23.object({
5706
+ ranker: z23.string().optional(),
5707
+ scoreThreshold: z23.number().optional()
5582
5708
  }).optional(),
5583
- filters: z22.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5709
+ filters: z23.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5584
5710
  })
5585
5711
  )
5586
5712
  );
5587
- var fileSearchOutputSchema = lazySchema20(
5588
- () => zodSchema20(
5589
- z22.object({
5590
- queries: z22.array(z22.string()),
5591
- results: z22.array(
5592
- z22.object({
5593
- attributes: z22.record(z22.string(), z22.unknown()),
5594
- fileId: z22.string(),
5595
- filename: z22.string(),
5596
- score: z22.number(),
5597
- text: z22.string()
5713
+ var fileSearchOutputSchema = lazySchema21(
5714
+ () => zodSchema21(
5715
+ z23.object({
5716
+ queries: z23.array(z23.string()),
5717
+ results: z23.array(
5718
+ z23.object({
5719
+ attributes: z23.record(z23.string(), z23.unknown()),
5720
+ fileId: z23.string(),
5721
+ filename: z23.string(),
5722
+ score: z23.number(),
5723
+ text: z23.string()
5598
5724
  })
5599
5725
  ).nullable()
5600
5726
  })
5601
5727
  )
5602
5728
  );
5603
- var fileSearch = createProviderExecutedToolFactory2({
5729
+ var fileSearch = createProviderExecutedToolFactory3({
5604
5730
  id: "openai.file_search",
5605
- inputSchema: z22.object({}),
5731
+ inputSchema: z23.object({}),
5606
5732
  outputSchema: fileSearchOutputSchema
5607
5733
  });
5608
5734
 
5609
5735
  // src/tool/image-generation.ts
5610
5736
  import {
5611
- createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
5612
- lazySchema as lazySchema21,
5613
- zodSchema as zodSchema21
5737
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
5738
+ lazySchema as lazySchema22,
5739
+ zodSchema as zodSchema22
5614
5740
  } from "@ai-sdk/provider-utils";
5615
- import { z as z23 } from "zod/v4";
5616
- var imageGenerationArgsSchema = lazySchema21(
5617
- () => zodSchema21(
5618
- z23.object({
5619
- background: z23.enum(["auto", "opaque", "transparent"]).optional(),
5620
- inputFidelity: z23.enum(["low", "high"]).optional(),
5621
- inputImageMask: z23.object({
5622
- fileId: z23.string().optional(),
5623
- imageUrl: z23.string().optional()
5741
+ import { z as z24 } from "zod/v4";
5742
+ var imageGenerationArgsSchema = lazySchema22(
5743
+ () => zodSchema22(
5744
+ z24.object({
5745
+ background: z24.enum(["auto", "opaque", "transparent"]).optional(),
5746
+ inputFidelity: z24.enum(["low", "high"]).optional(),
5747
+ inputImageMask: z24.object({
5748
+ fileId: z24.string().optional(),
5749
+ imageUrl: z24.string().optional()
5624
5750
  }).optional(),
5625
- model: z23.string().optional(),
5626
- moderation: z23.enum(["auto"]).optional(),
5627
- outputCompression: z23.number().int().min(0).max(100).optional(),
5628
- outputFormat: z23.enum(["png", "jpeg", "webp"]).optional(),
5629
- partialImages: z23.number().int().min(0).max(3).optional(),
5630
- quality: z23.enum(["auto", "low", "medium", "high"]).optional(),
5631
- size: z23.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
5751
+ model: z24.string().optional(),
5752
+ moderation: z24.enum(["auto"]).optional(),
5753
+ outputCompression: z24.number().int().min(0).max(100).optional(),
5754
+ outputFormat: z24.enum(["png", "jpeg", "webp"]).optional(),
5755
+ partialImages: z24.number().int().min(0).max(3).optional(),
5756
+ quality: z24.enum(["auto", "low", "medium", "high"]).optional(),
5757
+ size: z24.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
5632
5758
  }).strict()
5633
5759
  )
5634
5760
  );
5635
- var imageGenerationInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
5636
- var imageGenerationOutputSchema = lazySchema21(
5637
- () => zodSchema21(z23.object({ result: z23.string() }))
5761
+ var imageGenerationInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
5762
+ var imageGenerationOutputSchema = lazySchema22(
5763
+ () => zodSchema22(z24.object({ result: z24.string() }))
5638
5764
  );
5639
- var imageGenerationToolFactory = createProviderExecutedToolFactory3({
5765
+ var imageGenerationToolFactory = createProviderExecutedToolFactory4({
5640
5766
  id: "openai.image_generation",
5641
5767
  inputSchema: imageGenerationInputSchema,
5642
5768
  outputSchema: imageGenerationOutputSchema
@@ -5648,28 +5774,28 @@ var imageGeneration = (args = {}) => {
5648
5774
  // src/tool/custom.ts
5649
5775
  import {
5650
5776
  createProviderDefinedToolFactory,
5651
- lazySchema as lazySchema22,
5652
- zodSchema as zodSchema22
5777
+ lazySchema as lazySchema23,
5778
+ zodSchema as zodSchema23
5653
5779
  } from "@ai-sdk/provider-utils";
5654
- import { z as z24 } from "zod/v4";
5655
- var customArgsSchema = lazySchema22(
5656
- () => zodSchema22(
5657
- z24.object({
5658
- description: z24.string().optional(),
5659
- format: z24.union([
5660
- z24.object({
5661
- type: z24.literal("grammar"),
5662
- syntax: z24.enum(["regex", "lark"]),
5663
- definition: z24.string()
5780
+ import { z as z25 } from "zod/v4";
5781
+ var customArgsSchema = lazySchema23(
5782
+ () => zodSchema23(
5783
+ z25.object({
5784
+ description: z25.string().optional(),
5785
+ format: z25.union([
5786
+ z25.object({
5787
+ type: z25.literal("grammar"),
5788
+ syntax: z25.enum(["regex", "lark"]),
5789
+ definition: z25.string()
5664
5790
  }),
5665
- z24.object({
5666
- type: z24.literal("text")
5791
+ z25.object({
5792
+ type: z25.literal("text")
5667
5793
  })
5668
5794
  ]).optional()
5669
5795
  })
5670
5796
  )
5671
5797
  );
5672
- var customInputSchema = lazySchema22(() => zodSchema22(z24.string()));
5798
+ var customInputSchema = lazySchema23(() => zodSchema23(z25.string()));
5673
5799
  var customToolFactory = createProviderDefinedToolFactory({
5674
5800
  id: "openai.custom",
5675
5801
  inputSchema: customInputSchema
@@ -5677,139 +5803,82 @@ var customToolFactory = createProviderDefinedToolFactory({
5677
5803
 
5678
5804
  // src/tool/mcp.ts
5679
5805
  import {
5680
- createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
5681
- lazySchema as lazySchema23,
5682
- zodSchema as zodSchema23
5806
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
5807
+ lazySchema as lazySchema24,
5808
+ zodSchema as zodSchema24
5683
5809
  } from "@ai-sdk/provider-utils";
5684
- import { z as z25 } from "zod/v4";
5685
- var jsonValueSchema2 = z25.lazy(
5686
- () => z25.union([
5687
- z25.string(),
5688
- z25.number(),
5689
- z25.boolean(),
5690
- z25.null(),
5691
- z25.array(jsonValueSchema2),
5692
- z25.record(z25.string(), jsonValueSchema2)
5810
+ import { z as z26 } from "zod/v4";
5811
+ var jsonValueSchema2 = z26.lazy(
5812
+ () => z26.union([
5813
+ z26.string(),
5814
+ z26.number(),
5815
+ z26.boolean(),
5816
+ z26.null(),
5817
+ z26.array(jsonValueSchema2),
5818
+ z26.record(z26.string(), jsonValueSchema2)
5693
5819
  ])
5694
5820
  );
5695
- var mcpArgsSchema = lazySchema23(
5696
- () => zodSchema23(
5697
- z25.object({
5698
- serverLabel: z25.string(),
5699
- allowedTools: z25.union([
5700
- z25.array(z25.string()),
5701
- z25.object({
5702
- readOnly: z25.boolean().optional(),
5703
- toolNames: z25.array(z25.string()).optional()
5821
+ var mcpArgsSchema = lazySchema24(
5822
+ () => zodSchema24(
5823
+ z26.object({
5824
+ serverLabel: z26.string(),
5825
+ allowedTools: z26.union([
5826
+ z26.array(z26.string()),
5827
+ z26.object({
5828
+ readOnly: z26.boolean().optional(),
5829
+ toolNames: z26.array(z26.string()).optional()
5704
5830
  })
5705
5831
  ]).optional(),
5706
- authorization: z25.string().optional(),
5707
- connectorId: z25.string().optional(),
5708
- headers: z25.record(z25.string(), z25.string()).optional(),
5709
- requireApproval: z25.union([
5710
- z25.enum(["always", "never"]),
5711
- z25.object({
5712
- never: z25.object({
5713
- toolNames: z25.array(z25.string()).optional()
5832
+ authorization: z26.string().optional(),
5833
+ connectorId: z26.string().optional(),
5834
+ headers: z26.record(z26.string(), z26.string()).optional(),
5835
+ requireApproval: z26.union([
5836
+ z26.enum(["always", "never"]),
5837
+ z26.object({
5838
+ never: z26.object({
5839
+ toolNames: z26.array(z26.string()).optional()
5714
5840
  }).optional()
5715
5841
  })
5716
5842
  ]).optional(),
5717
- serverDescription: z25.string().optional(),
5718
- serverUrl: z25.string().optional()
5843
+ serverDescription: z26.string().optional(),
5844
+ serverUrl: z26.string().optional()
5719
5845
  }).refine(
5720
5846
  (v) => v.serverUrl != null || v.connectorId != null,
5721
5847
  "One of serverUrl or connectorId must be provided."
5722
5848
  )
5723
5849
  )
5724
5850
  );
5725
- var mcpInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5726
- var mcpOutputSchema = lazySchema23(
5727
- () => zodSchema23(
5728
- z25.object({
5729
- type: z25.literal("call"),
5730
- serverLabel: z25.string(),
5731
- name: z25.string(),
5732
- arguments: z25.string(),
5733
- output: z25.string().nullish(),
5734
- error: z25.union([z25.string(), jsonValueSchema2]).optional()
5851
+ var mcpInputSchema = lazySchema24(() => zodSchema24(z26.object({})));
5852
+ var mcpOutputSchema = lazySchema24(
5853
+ () => zodSchema24(
5854
+ z26.object({
5855
+ type: z26.literal("call"),
5856
+ serverLabel: z26.string(),
5857
+ name: z26.string(),
5858
+ arguments: z26.string(),
5859
+ output: z26.string().nullish(),
5860
+ error: z26.union([z26.string(), jsonValueSchema2]).optional()
5735
5861
  })
5736
5862
  )
5737
5863
  );
5738
- var mcpToolFactory = createProviderExecutedToolFactory4({
5864
+ var mcpToolFactory = createProviderExecutedToolFactory5({
5739
5865
  id: "openai.mcp",
5740
5866
  inputSchema: mcpInputSchema,
5741
5867
  outputSchema: mcpOutputSchema
5742
5868
  });
5743
5869
 
5744
5870
  // src/tool/web-search.ts
5745
- import {
5746
- createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
5747
- lazySchema as lazySchema24,
5748
- zodSchema as zodSchema24
5749
- } from "@ai-sdk/provider-utils";
5750
- import { z as z26 } from "zod/v4";
5751
- var webSearchArgsSchema = lazySchema24(
5752
- () => zodSchema24(
5753
- z26.object({
5754
- externalWebAccess: z26.boolean().optional(),
5755
- filters: z26.object({ allowedDomains: z26.array(z26.string()).optional() }).optional(),
5756
- searchContextSize: z26.enum(["low", "medium", "high"]).optional(),
5757
- userLocation: z26.object({
5758
- type: z26.literal("approximate"),
5759
- country: z26.string().optional(),
5760
- city: z26.string().optional(),
5761
- region: z26.string().optional(),
5762
- timezone: z26.string().optional()
5763
- }).optional()
5764
- })
5765
- )
5766
- );
5767
- var webSearchInputSchema = lazySchema24(() => zodSchema24(z26.object({})));
5768
- var webSearchOutputSchema = lazySchema24(
5769
- () => zodSchema24(
5770
- z26.object({
5771
- action: z26.discriminatedUnion("type", [
5772
- z26.object({
5773
- type: z26.literal("search"),
5774
- query: z26.string().optional(),
5775
- queries: z26.array(z26.string()).optional()
5776
- }),
5777
- z26.object({
5778
- type: z26.literal("openPage"),
5779
- url: z26.string().nullish()
5780
- }),
5781
- z26.object({
5782
- type: z26.literal("findInPage"),
5783
- url: z26.string().nullish(),
5784
- pattern: z26.string().nullish()
5785
- })
5786
- ]).optional(),
5787
- sources: z26.array(
5788
- z26.discriminatedUnion("type", [
5789
- z26.object({ type: z26.literal("url"), url: z26.string() }),
5790
- z26.object({ type: z26.literal("api"), name: z26.string() })
5791
- ])
5792
- ).optional()
5793
- })
5794
- )
5795
- );
5796
- var webSearchToolFactory = createProviderExecutedToolFactory5({
5797
- id: "openai.web_search",
5798
- inputSchema: webSearchInputSchema,
5799
- outputSchema: webSearchOutputSchema
5800
- });
5801
- var webSearch = (args = {}) => webSearchToolFactory(args);
5802
-
5803
- // src/tool/web-search-preview.ts
5804
5871
  import {
5805
5872
  createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
5806
5873
  lazySchema as lazySchema25,
5807
5874
  zodSchema as zodSchema25
5808
5875
  } from "@ai-sdk/provider-utils";
5809
5876
  import { z as z27 } from "zod/v4";
5810
- var webSearchPreviewArgsSchema = lazySchema25(
5877
+ var webSearchArgsSchema = lazySchema25(
5811
5878
  () => zodSchema25(
5812
5879
  z27.object({
5880
+ externalWebAccess: z27.boolean().optional(),
5881
+ filters: z27.object({ allowedDomains: z27.array(z27.string()).optional() }).optional(),
5813
5882
  searchContextSize: z27.enum(["low", "medium", "high"]).optional(),
5814
5883
  userLocation: z27.object({
5815
5884
  type: z27.literal("approximate"),
@@ -5821,16 +5890,15 @@ var webSearchPreviewArgsSchema = lazySchema25(
5821
5890
  })
5822
5891
  )
5823
5892
  );
5824
- var webSearchPreviewInputSchema = lazySchema25(
5825
- () => zodSchema25(z27.object({}))
5826
- );
5827
- var webSearchPreviewOutputSchema = lazySchema25(
5893
+ var webSearchInputSchema = lazySchema25(() => zodSchema25(z27.object({})));
5894
+ var webSearchOutputSchema = lazySchema25(
5828
5895
  () => zodSchema25(
5829
5896
  z27.object({
5830
5897
  action: z27.discriminatedUnion("type", [
5831
5898
  z27.object({
5832
5899
  type: z27.literal("search"),
5833
- query: z27.string().optional()
5900
+ query: z27.string().optional(),
5901
+ queries: z27.array(z27.string()).optional()
5834
5902
  }),
5835
5903
  z27.object({
5836
5904
  type: z27.literal("openPage"),
@@ -5841,11 +5909,69 @@ var webSearchPreviewOutputSchema = lazySchema25(
5841
5909
  url: z27.string().nullish(),
5842
5910
  pattern: z27.string().nullish()
5843
5911
  })
5912
+ ]).optional(),
5913
+ sources: z27.array(
5914
+ z27.discriminatedUnion("type", [
5915
+ z27.object({ type: z27.literal("url"), url: z27.string() }),
5916
+ z27.object({ type: z27.literal("api"), name: z27.string() })
5917
+ ])
5918
+ ).optional()
5919
+ })
5920
+ )
5921
+ );
5922
+ var webSearchToolFactory = createProviderExecutedToolFactory6({
5923
+ id: "openai.web_search",
5924
+ inputSchema: webSearchInputSchema,
5925
+ outputSchema: webSearchOutputSchema
5926
+ });
5927
+ var webSearch = (args = {}) => webSearchToolFactory(args);
5928
+
5929
+ // src/tool/web-search-preview.ts
5930
+ import {
5931
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
5932
+ lazySchema as lazySchema26,
5933
+ zodSchema as zodSchema26
5934
+ } from "@ai-sdk/provider-utils";
5935
+ import { z as z28 } from "zod/v4";
5936
+ var webSearchPreviewArgsSchema = lazySchema26(
5937
+ () => zodSchema26(
5938
+ z28.object({
5939
+ searchContextSize: z28.enum(["low", "medium", "high"]).optional(),
5940
+ userLocation: z28.object({
5941
+ type: z28.literal("approximate"),
5942
+ country: z28.string().optional(),
5943
+ city: z28.string().optional(),
5944
+ region: z28.string().optional(),
5945
+ timezone: z28.string().optional()
5946
+ }).optional()
5947
+ })
5948
+ )
5949
+ );
5950
+ var webSearchPreviewInputSchema = lazySchema26(
5951
+ () => zodSchema26(z28.object({}))
5952
+ );
5953
+ var webSearchPreviewOutputSchema = lazySchema26(
5954
+ () => zodSchema26(
5955
+ z28.object({
5956
+ action: z28.discriminatedUnion("type", [
5957
+ z28.object({
5958
+ type: z28.literal("search"),
5959
+ query: z28.string().optional()
5960
+ }),
5961
+ z28.object({
5962
+ type: z28.literal("openPage"),
5963
+ url: z28.string().nullish()
5964
+ }),
5965
+ z28.object({
5966
+ type: z28.literal("findInPage"),
5967
+ url: z28.string().nullish(),
5968
+ pattern: z28.string().nullish()
5969
+ })
5844
5970
  ]).optional()
5845
5971
  })
5846
5972
  )
5847
5973
  );
5848
- var webSearchPreview = createProviderExecutedToolFactory6({
5974
+ var webSearchPreview = createProviderExecutedToolFactory7({
5849
5975
  id: "openai.web_search_preview",
5850
5976
  inputSchema: webSearchPreviewInputSchema,
5851
5977
  outputSchema: webSearchPreviewOutputSchema
@@ -6049,6 +6175,12 @@ async function prepareResponsesTools({
6049
6175
  resolvedCustomProviderToolNames.add(tool.name);
6050
6176
  break;
6051
6177
  }
6178
+ case "openai.programmatic_tool_calling": {
6179
+ openaiTools.push({
6180
+ type: "programmatic_tool_calling"
6181
+ });
6182
+ break;
6183
+ }
6052
6184
  case "openai.tool_search": {
6053
6185
  const args = await validateTypes2({
6054
6186
  value: tool.args,
@@ -6103,7 +6235,7 @@ async function prepareResponsesTools({
6103
6235
  const resolvedToolName = (_c = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _c : toolChoice.toolName;
6104
6236
  return {
6105
6237
  tools: openaiTools,
6106
- toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" || resolvedToolName === "computer" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
6238
+ toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" || resolvedToolName === "computer" || resolvedToolName === "programmatic_tool_calling" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
6107
6239
  toolWarnings
6108
6240
  };
6109
6241
  }
@@ -6126,7 +6258,9 @@ function prepareFunctionTool({
6126
6258
  description: tool.description,
6127
6259
  parameters: tool.inputSchema,
6128
6260
  ...tool.strict != null ? { strict: tool.strict } : {},
6129
- ...deferLoading != null ? { defer_loading: deferLoading } : {}
6261
+ ...deferLoading != null ? { defer_loading: deferLoading } : {},
6262
+ ...(options == null ? void 0 : options.allowedCallers) != null ? { allowed_callers: options.allowedCallers } : {},
6263
+ ...(options == null ? void 0 : options.outputSchema) != null ? { output_schema: options.outputSchema } : {}
6130
6264
  };
6131
6265
  }
6132
6266
  function mapShellEnvironment(environment) {
@@ -6358,7 +6492,8 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6358
6492
  "openai.web_search_preview": "web_search_preview",
6359
6493
  "openai.mcp": "mcp",
6360
6494
  "openai.apply_patch": "apply_patch",
6361
- "openai.tool_search": "tool_search"
6495
+ "openai.tool_search": "tool_search",
6496
+ "openai.programmatic_tool_calling": "programmatic_tool_calling"
6362
6497
  }
6363
6498
  });
6364
6499
  const customProviderToolNames = /* @__PURE__ */ new Set();
@@ -6845,7 +6980,52 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6845
6980
  providerMetadata: {
6846
6981
  [providerOptionsName]: {
6847
6982
  itemId: part.id,
6848
- ...part.namespace != null && { namespace: part.namespace }
6983
+ ...part.namespace != null && { namespace: part.namespace },
6984
+ ...part.caller != null && {
6985
+ caller: part.caller.type === "program" ? {
6986
+ type: "program",
6987
+ callerId: part.caller.caller_id
6988
+ } : part.caller
6989
+ }
6990
+ }
6991
+ }
6992
+ });
6993
+ break;
6994
+ }
6995
+ case "program": {
6996
+ content.push({
6997
+ type: "tool-call",
6998
+ toolCallId: part.call_id,
6999
+ toolName: toolNameMapping.toCustomToolName(
7000
+ "programmatic_tool_calling"
7001
+ ),
7002
+ input: JSON.stringify({
7003
+ code: part.code,
7004
+ fingerprint: part.fingerprint
7005
+ }),
7006
+ providerExecuted: true,
7007
+ providerMetadata: {
7008
+ [providerOptionsName]: {
7009
+ itemId: part.id
7010
+ }
7011
+ }
7012
+ });
7013
+ break;
7014
+ }
7015
+ case "program_output": {
7016
+ content.push({
7017
+ type: "tool-result",
7018
+ toolCallId: part.call_id,
7019
+ toolName: toolNameMapping.toCustomToolName(
7020
+ "programmatic_tool_calling"
7021
+ ),
7022
+ result: {
7023
+ result: part.result,
7024
+ status: part.status
7025
+ },
7026
+ providerMetadata: {
7027
+ [providerOptionsName]: {
7028
+ itemId: part.id
6849
7029
  }
6850
7030
  }
6851
7031
  });
@@ -7397,10 +7577,51 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7397
7577
  itemId: value.item.id,
7398
7578
  ...value.item.namespace != null && {
7399
7579
  namespace: value.item.namespace
7580
+ },
7581
+ ...value.item.caller != null && {
7582
+ caller: value.item.caller.type === "program" ? {
7583
+ type: "program",
7584
+ callerId: value.item.caller.caller_id
7585
+ } : value.item.caller
7400
7586
  }
7401
7587
  }
7402
7588
  }
7403
7589
  });
7590
+ } else if (value.item.type === "program") {
7591
+ controller.enqueue({
7592
+ type: "tool-call",
7593
+ toolCallId: value.item.call_id,
7594
+ toolName: toolNameMapping.toCustomToolName(
7595
+ "programmatic_tool_calling"
7596
+ ),
7597
+ input: JSON.stringify({
7598
+ code: value.item.code,
7599
+ fingerprint: value.item.fingerprint
7600
+ }),
7601
+ providerExecuted: true,
7602
+ providerMetadata: {
7603
+ [providerOptionsName]: {
7604
+ itemId: value.item.id
7605
+ }
7606
+ }
7607
+ });
7608
+ } else if (value.item.type === "program_output") {
7609
+ controller.enqueue({
7610
+ type: "tool-result",
7611
+ toolCallId: value.item.call_id,
7612
+ toolName: toolNameMapping.toCustomToolName(
7613
+ "programmatic_tool_calling"
7614
+ ),
7615
+ result: {
7616
+ result: value.item.result,
7617
+ status: value.item.status
7618
+ },
7619
+ providerMetadata: {
7620
+ [providerOptionsName]: {
7621
+ itemId: value.item.id
7622
+ }
7623
+ }
7624
+ });
7404
7625
  } else if (value.item.type === "custom_tool_call") {
7405
7626
  ongoingToolCalls[value.output_index] = void 0;
7406
7627
  hasFunctionCall = true;
@@ -8173,6 +8394,7 @@ export {
8173
8394
  fileSearch,
8174
8395
  fileSearchArgsSchema,
8175
8396
  fileSearchOutputSchema,
8397
+ getMaxImagesPerCall,
8176
8398
  hasDefaultResponseFormat,
8177
8399
  imageGeneration,
8178
8400
  imageGenerationArgsSchema,
@@ -8186,6 +8408,9 @@ export {
8186
8408
  openaiLanguageModelChatOptions,
8187
8409
  openaiLanguageModelCompletionOptions,
8188
8410
  openaiSpeechModelOptionsSchema,
8411
+ programmaticToolCalling,
8412
+ programmaticToolCallingInputSchema,
8413
+ programmaticToolCallingOutputSchema,
8189
8414
  webSearch,
8190
8415
  webSearchArgsSchema,
8191
8416
  webSearchOutputSchema,