@ai-sdk/openai 4.0.19 → 4.0.21

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.
@@ -3069,7 +3069,7 @@ import {
3069
3069
  resolveProviderReference as resolveProviderReference2,
3070
3070
  validateTypes
3071
3071
  } from "@ai-sdk/provider-utils";
3072
- import { z as z18 } from "zod/v4";
3072
+ import { z as z19 } from "zod/v4";
3073
3073
 
3074
3074
  // src/tool/apply-patch.ts
3075
3075
  import {
@@ -3381,10 +3381,44 @@ var toolSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
3381
3381
  outputSchema: toolSearchOutputSchema
3382
3382
  });
3383
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
+
3384
3415
  // src/responses/convert-to-openai-responses-input.ts
3385
3416
  function serializeToolCallArguments2(input) {
3386
3417
  return JSON.stringify(input === void 0 ? {} : input);
3387
3418
  }
3419
+ function mapToolCaller(caller) {
3420
+ return caller == null ? void 0 : caller.type === "program" ? { type: "program", caller_id: caller.callerId } : caller;
3421
+ }
3388
3422
  function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
3389
3423
  var _a;
3390
3424
  return (_a = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a.promptCacheBreakpoint;
@@ -3409,7 +3443,7 @@ async function convertToOpenAIResponsesInput({
3409
3443
  hasComputerTool = false,
3410
3444
  customProviderToolNames
3411
3445
  }) {
3412
- 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;
3413
3447
  let input = [];
3414
3448
  const warnings = [];
3415
3449
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3595,6 +3629,7 @@ async function convertToOpenAIResponsesInput({
3595
3629
  case "tool-call": {
3596
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;
3597
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;
3598
3633
  if (hasConversation && id != null) {
3599
3634
  break;
3600
3635
  }
@@ -3618,12 +3653,30 @@ async function convertToOpenAIResponsesInput({
3618
3653
  type: "tool_search_call",
3619
3654
  id: id != null ? id : part.toolCallId,
3620
3655
  execution,
3621
- call_id: (_l = parsedInput.call_id) != null ? _l : null,
3656
+ call_id: (_n = parsedInput.call_id) != null ? _n : null,
3622
3657
  status: "completed",
3623
3658
  arguments: parsedInput.arguments
3624
3659
  });
3625
3660
  break;
3626
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
+ }
3627
3680
  if (part.providerExecuted) {
3628
3681
  if (store && id != null) {
3629
3682
  input.push({ type: "item_reference", id });
@@ -3633,7 +3686,7 @@ async function convertToOpenAIResponsesInput({
3633
3686
  if (hasPreviousResponseId && store && id != null) {
3634
3687
  break;
3635
3688
  }
3636
- 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);
3637
3690
  if (store && id != null && isProviderDefinedToolCall) {
3638
3691
  input.push({ type: "item_reference", id });
3639
3692
  break;
@@ -3752,7 +3805,10 @@ async function convertToOpenAIResponsesInput({
3752
3805
  call_id: part.toolCallId,
3753
3806
  name: resolvedToolName,
3754
3807
  arguments: serializeToolCallArguments2(part.input),
3755
- ...namespace != null && { namespace }
3808
+ ...namespace != null && { namespace },
3809
+ ...caller != null && {
3810
+ caller: mapToolCaller(caller)
3811
+ }
3756
3812
  });
3757
3813
  break;
3758
3814
  }
@@ -3768,7 +3824,7 @@ async function convertToOpenAIResponsesInput({
3768
3824
  part.toolName
3769
3825
  );
3770
3826
  if (resolvedResultToolName === "tool_search") {
3771
- 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;
3772
3828
  if (store) {
3773
3829
  input.push({ type: "item_reference", id: itemId });
3774
3830
  } else if (part.output.type === "json") {
@@ -3787,6 +3843,25 @@ async function convertToOpenAIResponsesInput({
3787
3843
  }
3788
3844
  break;
3789
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
+ }
3790
3865
  if (hasShellTool && resolvedResultToolName === "shell") {
3791
3866
  if (part.output.type === "json") {
3792
3867
  const parsedOutput = await validateTypes({
@@ -3809,7 +3884,7 @@ async function convertToOpenAIResponsesInput({
3809
3884
  break;
3810
3885
  }
3811
3886
  if (store) {
3812
- 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;
3813
3888
  input.push({ type: "item_reference", id: itemId });
3814
3889
  } else {
3815
3890
  warnings.push({
@@ -3894,7 +3969,7 @@ async function convertToOpenAIResponsesInput({
3894
3969
  }
3895
3970
  case "custom": {
3896
3971
  if (part.kind === "openai.compaction") {
3897
- const providerOptions2 = (_w = part.providerOptions) == null ? void 0 : _w[providerOptionsName];
3972
+ const providerOptions2 = (_E = part.providerOptions) == null ? void 0 : _E[providerOptionsName];
3898
3973
  const id = providerOptions2 == null ? void 0 : providerOptions2.itemId;
3899
3974
  if (hasConversation && id != null) {
3900
3975
  break;
@@ -3941,7 +4016,7 @@ async function convertToOpenAIResponsesInput({
3941
4016
  }
3942
4017
  const output = part.output;
3943
4018
  if (output.type === "execution-denied") {
3944
- 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;
3945
4020
  if (approvalId) {
3946
4021
  continue;
3947
4022
  }
@@ -4021,7 +4096,7 @@ async function convertToOpenAIResponsesInput({
4021
4096
  file_id: parsedOutput.output.fileId,
4022
4097
  detail: parsedOutput.output.detail
4023
4098
  },
4024
- 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) => ({
4025
4100
  id: safetyCheck.id,
4026
4101
  code: safetyCheck.code,
4027
4102
  message: safetyCheck.message
@@ -4037,7 +4112,7 @@ async function convertToOpenAIResponsesInput({
4037
4112
  outputValue = output.value;
4038
4113
  break;
4039
4114
  case "execution-denied":
4040
- outputValue = (_A = output.reason) != null ? _A : "Tool call execution denied.";
4115
+ outputValue = (_I = output.reason) != null ? _I : "Tool call execution denied.";
4041
4116
  break;
4042
4117
  case "json":
4043
4118
  case "error-json":
@@ -4136,7 +4211,7 @@ async function convertToOpenAIResponsesInput({
4136
4211
  contentValue = output.value;
4137
4212
  break;
4138
4213
  case "execution-denied":
4139
- contentValue = (_B = output.reason) != null ? _B : "Tool call execution denied.";
4214
+ contentValue = (_J = output.reason) != null ? _J : "Tool call execution denied.";
4140
4215
  break;
4141
4216
  case "json":
4142
4217
  case "error-json":
@@ -4221,10 +4296,14 @@ async function convertToOpenAIResponsesInput({
4221
4296
  }).filter(isNonNullable);
4222
4297
  break;
4223
4298
  }
4299
+ const caller = mapToolCaller(
4300
+ (_L = (_K = part.providerOptions) == null ? void 0 : _K[providerOptionsName]) == null ? void 0 : _L.caller
4301
+ );
4224
4302
  input.push({
4225
4303
  type: "function_call_output",
4226
4304
  call_id: part.toolCallId,
4227
- output: contentValue
4305
+ output: contentValue,
4306
+ ...caller != null && { caller }
4228
4307
  });
4229
4308
  }
4230
4309
  break;
@@ -4248,9 +4327,9 @@ async function convertToOpenAIResponsesInput({
4248
4327
  }
4249
4328
  return { input, warnings };
4250
4329
  }
4251
- var openaiResponsesReasoningProviderOptionsSchema = z18.object({
4252
- itemId: z18.string().nullish(),
4253
- reasoningEncryptedContent: z18.string().nullish()
4330
+ var openaiResponsesReasoningProviderOptionsSchema = z19.object({
4331
+ itemId: z19.string().nullish(),
4332
+ reasoningEncryptedContent: z19.string().nullish()
4254
4333
  });
4255
4334
 
4256
4335
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4273,643 +4352,670 @@ function mapOpenAIResponseFinishReason({
4273
4352
 
4274
4353
  // src/responses/openai-responses-api.ts
4275
4354
  import {
4276
- lazySchema as lazySchema17,
4277
- zodSchema as zodSchema17
4355
+ lazySchema as lazySchema18,
4356
+ zodSchema as zodSchema18
4278
4357
  } from "@ai-sdk/provider-utils";
4279
- import { z as z19 } from "zod/v4";
4280
- var jsonValueSchema = z19.lazy(
4281
- () => z19.union([
4282
- z19.string(),
4283
- z19.number(),
4284
- z19.boolean(),
4285
- z19.null(),
4286
- z19.array(jsonValueSchema),
4287
- 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())
4288
4367
  ])
4289
4368
  );
4290
- var openaiResponsesComputerSafetyCheckSchema = z19.object({
4291
- id: z19.string(),
4292
- code: z19.string().nullish(),
4293
- message: z19.string().nullish()
4369
+ var openaiResponsesComputerSafetyCheckSchema = z20.object({
4370
+ id: z20.string(),
4371
+ code: z20.string().nullish(),
4372
+ message: z20.string().nullish()
4294
4373
  });
4295
- var openaiResponsesComputerActionSchema = z19.discriminatedUnion("type", [
4296
- z19.object({
4297
- type: z19.literal("click"),
4298
- button: z19.enum(["left", "right", "wheel", "back", "forward"]),
4299
- x: z19.number(),
4300
- y: z19.number(),
4301
- 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()
4302
4381
  }),
4303
- z19.object({
4304
- type: z19.literal("double_click"),
4305
- x: z19.number(),
4306
- y: z19.number(),
4307
- 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()
4308
4387
  }),
4309
- z19.object({
4310
- type: z19.literal("drag"),
4311
- path: z19.array(z19.object({ x: z19.number(), y: z19.number() })),
4312
- 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()
4313
4392
  }),
4314
- z19.object({
4315
- type: z19.literal("keypress"),
4316
- keys: z19.array(z19.string())
4393
+ z20.object({
4394
+ type: z20.literal("keypress"),
4395
+ keys: z20.array(z20.string())
4317
4396
  }),
4318
- z19.object({
4319
- type: z19.literal("move"),
4320
- x: z19.number(),
4321
- y: z19.number(),
4322
- 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()
4323
4402
  }),
4324
- z19.object({
4325
- type: z19.literal("screenshot")
4403
+ z20.object({
4404
+ type: z20.literal("screenshot")
4326
4405
  }),
4327
- z19.object({
4328
- type: z19.literal("scroll"),
4329
- x: z19.number(),
4330
- y: z19.number(),
4331
- scroll_x: z19.number(),
4332
- scroll_y: z19.number(),
4333
- 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()
4334
4413
  }),
4335
- z19.object({
4336
- type: z19.literal("type"),
4337
- text: z19.string()
4414
+ z20.object({
4415
+ type: z20.literal("type"),
4416
+ text: z20.string()
4338
4417
  }),
4339
- z19.object({
4340
- type: z19.literal("wait")
4418
+ z20.object({
4419
+ type: z20.literal("wait")
4341
4420
  })
4342
4421
  ]);
4343
- var openaiResponsesComputerCallSchema = z19.object({
4344
- type: z19.literal("computer_call"),
4345
- id: z19.string(),
4346
- call_id: z19.string().nullish(),
4347
- 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"]),
4348
4427
  action: openaiResponsesComputerActionSchema.nullish(),
4349
- actions: z19.array(openaiResponsesComputerActionSchema).nullish(),
4350
- pending_safety_checks: z19.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4428
+ actions: z20.array(openaiResponsesComputerActionSchema).nullish(),
4429
+ pending_safety_checks: z20.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4351
4430
  });
4352
- var openaiResponsesNestedErrorChunkSchema = z19.object({
4353
- type: z19.literal("error"),
4354
- sequence_number: z19.number(),
4355
- error: z19.object({
4356
- type: z19.string(),
4357
- code: z19.string(),
4358
- message: z19.string(),
4359
- param: z19.string().nullish()
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()
4360
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()
4361
4444
  });
4362
- var openaiResponsesErrorChunkSchema = z19.object({
4363
- type: z19.literal("error"),
4364
- sequence_number: z19.number(),
4365
- code: z19.string().nullish(),
4366
- message: z19.string(),
4367
- param: z19.string().nullish()
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"])
4368
4451
  });
4369
- var openaiResponsesChunkSchema = lazySchema17(
4370
- () => zodSchema17(
4371
- z19.union([
4372
- z19.object({
4373
- type: z19.literal("response.output_text.delta"),
4374
- item_id: z19.string(),
4375
- delta: z19.string(),
4376
- logprobs: z19.array(
4377
- z19.object({
4378
- token: z19.string(),
4379
- logprob: z19.number(),
4380
- top_logprobs: z19.array(
4381
- z19.object({
4382
- token: z19.string(),
4383
- logprob: z19.number()
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()
4460
+ })
4461
+ });
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()
4468
+ });
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()
4384
4484
  })
4385
4485
  )
4386
4486
  })
4387
4487
  ).nullish()
4388
4488
  }),
4389
- z19.object({
4390
- type: z19.enum(["response.completed", "response.incomplete"]),
4391
- response: z19.object({
4392
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4393
- usage: z19.object({
4394
- input_tokens: z19.number(),
4395
- input_tokens_details: z19.object({
4396
- cached_tokens: z19.number().nullish(),
4397
- cache_write_tokens: z19.number().nullish(),
4398
- orchestration_input_tokens: z19.number().nullish(),
4399
- 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()
4400
4500
  }).nullish(),
4401
- output_tokens: z19.number(),
4402
- output_tokens_details: z19.object({
4403
- reasoning_tokens: z19.number().nullish(),
4404
- 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()
4405
4505
  }).nullish()
4406
4506
  }),
4407
- reasoning: z19.object({
4408
- context: z19.string().nullish()
4507
+ reasoning: z20.object({
4508
+ context: z20.string().nullish()
4409
4509
  }).nullish(),
4410
- service_tier: z19.string().nullish()
4510
+ service_tier: z20.string().nullish()
4411
4511
  })
4412
4512
  }),
4413
- z19.object({
4414
- type: z19.literal("response.failed"),
4415
- sequence_number: z19.number(),
4416
- response: z19.object({
4417
- error: z19.object({
4418
- code: z19.string().nullish(),
4419
- 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()
4420
4520
  }).nullish(),
4421
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4422
- usage: z19.object({
4423
- input_tokens: z19.number(),
4424
- input_tokens_details: z19.object({
4425
- cached_tokens: z19.number().nullish(),
4426
- cache_write_tokens: z19.number().nullish(),
4427
- orchestration_input_tokens: z19.number().nullish(),
4428
- 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()
4429
4529
  }).nullish(),
4430
- output_tokens: z19.number(),
4431
- output_tokens_details: z19.object({
4432
- reasoning_tokens: z19.number().nullish(),
4433
- 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()
4434
4534
  }).nullish()
4435
4535
  }).nullish(),
4436
- reasoning: z19.object({
4437
- context: z19.string().nullish()
4536
+ reasoning: z20.object({
4537
+ context: z20.string().nullish()
4438
4538
  }).nullish(),
4439
- service_tier: z19.string().nullish()
4539
+ service_tier: z20.string().nullish()
4440
4540
  })
4441
4541
  }),
4442
- z19.object({
4443
- type: z19.literal("response.created"),
4444
- response: z19.object({
4445
- id: z19.string(),
4446
- created_at: z19.number(),
4447
- model: z19.string(),
4448
- 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()
4449
4549
  })
4450
4550
  }),
4451
- z19.object({
4452
- type: z19.literal("response.output_item.added"),
4453
- output_index: z19.number(),
4454
- item: z19.discriminatedUnion("type", [
4455
- z19.object({
4456
- type: z19.literal("message"),
4457
- id: z19.string(),
4458
- 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()
4459
4559
  }),
4460
- z19.object({
4461
- type: z19.literal("reasoning"),
4462
- id: z19.string(),
4463
- encrypted_content: z19.string().nullish()
4560
+ z20.object({
4561
+ type: z20.literal("reasoning"),
4562
+ id: z20.string(),
4563
+ encrypted_content: z20.string().nullish()
4464
4564
  }),
4465
- z19.object({
4466
- type: z19.literal("function_call"),
4467
- id: z19.string(),
4468
- call_id: z19.string(),
4469
- name: z19.string(),
4470
- arguments: z19.string(),
4471
- 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()
4472
4573
  }),
4473
- z19.object({
4474
- type: z19.literal("web_search_call"),
4475
- id: z19.string(),
4476
- 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()
4477
4580
  }),
4478
4581
  openaiResponsesComputerCallSchema,
4479
- z19.object({
4480
- type: z19.literal("file_search_call"),
4481
- id: z19.string()
4582
+ z20.object({
4583
+ type: z20.literal("file_search_call"),
4584
+ id: z20.string()
4482
4585
  }),
4483
- z19.object({
4484
- type: z19.literal("image_generation_call"),
4485
- id: z19.string()
4586
+ z20.object({
4587
+ type: z20.literal("image_generation_call"),
4588
+ id: z20.string()
4486
4589
  }),
4487
- z19.object({
4488
- type: z19.literal("code_interpreter_call"),
4489
- id: z19.string(),
4490
- container_id: z19.string(),
4491
- code: z19.string().nullable(),
4492
- outputs: z19.array(
4493
- z19.discriminatedUnion("type", [
4494
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4495
- 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() })
4496
4599
  ])
4497
4600
  ).nullable(),
4498
- status: z19.string()
4601
+ status: z20.string()
4499
4602
  }),
4500
- z19.object({
4501
- type: z19.literal("mcp_call"),
4502
- id: z19.string(),
4503
- status: z19.string(),
4504
- 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()
4505
4608
  }),
4506
- z19.object({
4507
- type: z19.literal("mcp_list_tools"),
4508
- id: z19.string()
4609
+ z20.object({
4610
+ type: z20.literal("mcp_list_tools"),
4611
+ id: z20.string()
4509
4612
  }),
4510
- z19.object({
4511
- type: z19.literal("mcp_approval_request"),
4512
- id: z19.string()
4613
+ z20.object({
4614
+ type: z20.literal("mcp_approval_request"),
4615
+ id: z20.string()
4513
4616
  }),
4514
- z19.object({
4515
- type: z19.literal("apply_patch_call"),
4516
- id: z19.string(),
4517
- call_id: z19.string(),
4518
- status: z19.enum(["in_progress", "completed"]),
4519
- operation: z19.discriminatedUnion("type", [
4520
- z19.object({
4521
- type: z19.literal("create_file"),
4522
- path: z19.string(),
4523
- 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()
4524
4627
  }),
4525
- z19.object({
4526
- type: z19.literal("delete_file"),
4527
- path: z19.string()
4628
+ z20.object({
4629
+ type: z20.literal("delete_file"),
4630
+ path: z20.string()
4528
4631
  }),
4529
- z19.object({
4530
- type: z19.literal("update_file"),
4531
- path: z19.string(),
4532
- diff: z19.string()
4632
+ z20.object({
4633
+ type: z20.literal("update_file"),
4634
+ path: z20.string(),
4635
+ diff: z20.string()
4533
4636
  })
4534
4637
  ])
4535
4638
  }),
4536
- z19.object({
4537
- type: z19.literal("custom_tool_call"),
4538
- id: z19.string(),
4539
- call_id: z19.string(),
4540
- name: z19.string(),
4541
- 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()
4542
4645
  }),
4543
- z19.object({
4544
- type: z19.literal("shell_call"),
4545
- id: z19.string(),
4546
- call_id: z19.string(),
4547
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4548
- action: z19.object({
4549
- 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())
4550
4653
  })
4551
4654
  }),
4552
- z19.object({
4553
- type: z19.literal("compaction"),
4554
- id: z19.string(),
4555
- encrypted_content: z19.string().nullish()
4655
+ z20.object({
4656
+ type: z20.literal("compaction"),
4657
+ id: z20.string(),
4658
+ encrypted_content: z20.string().nullish()
4556
4659
  }),
4557
- z19.object({
4558
- type: z19.literal("shell_call_output"),
4559
- id: z19.string(),
4560
- call_id: z19.string(),
4561
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4562
- output: z19.array(
4563
- z19.object({
4564
- stdout: z19.string(),
4565
- stderr: z19.string(),
4566
- outcome: z19.discriminatedUnion("type", [
4567
- z19.object({ type: z19.literal("timeout") }),
4568
- z19.object({
4569
- type: z19.literal("exit"),
4570
- 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()
4571
4674
  })
4572
4675
  ])
4573
4676
  })
4574
4677
  )
4575
4678
  }),
4576
- z19.object({
4577
- type: z19.literal("tool_search_call"),
4578
- id: z19.string(),
4579
- execution: z19.enum(["server", "client"]),
4580
- call_id: z19.string().nullable(),
4581
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4582
- 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()
4583
4686
  }),
4584
- z19.object({
4585
- type: z19.literal("tool_search_output"),
4586
- id: z19.string(),
4587
- execution: z19.enum(["server", "client"]),
4588
- call_id: z19.string().nullable(),
4589
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4590
- 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()))
4591
4694
  })
4592
4695
  ])
4593
4696
  }),
4594
- z19.object({
4595
- type: z19.literal("response.output_item.done"),
4596
- output_index: z19.number(),
4597
- item: z19.discriminatedUnion("type", [
4598
- z19.object({
4599
- type: z19.literal("message"),
4600
- id: z19.string(),
4601
- 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()
4602
4705
  }),
4603
- z19.object({
4604
- type: z19.literal("reasoning"),
4605
- id: z19.string(),
4606
- encrypted_content: z19.string().nullish()
4706
+ z20.object({
4707
+ type: z20.literal("reasoning"),
4708
+ id: z20.string(),
4709
+ encrypted_content: z20.string().nullish()
4607
4710
  }),
4608
- z19.object({
4609
- type: z19.literal("function_call"),
4610
- id: z19.string(),
4611
- call_id: z19.string(),
4612
- name: z19.string(),
4613
- arguments: z19.string(),
4614
- status: z19.literal("completed"),
4615
- 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()
4616
4720
  }),
4617
- z19.object({
4618
- type: z19.literal("custom_tool_call"),
4619
- id: z19.string(),
4620
- call_id: z19.string(),
4621
- name: z19.string(),
4622
- input: z19.string(),
4623
- 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")
4624
4730
  }),
4625
- z19.object({
4626
- type: z19.literal("code_interpreter_call"),
4627
- id: z19.string(),
4628
- code: z19.string().nullable(),
4629
- container_id: z19.string(),
4630
- outputs: z19.array(
4631
- z19.discriminatedUnion("type", [
4632
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4633
- 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() })
4634
4740
  ])
4635
4741
  ).nullable()
4636
4742
  }),
4637
- z19.object({
4638
- type: z19.literal("image_generation_call"),
4639
- id: z19.string(),
4640
- result: z19.string()
4743
+ z20.object({
4744
+ type: z20.literal("image_generation_call"),
4745
+ id: z20.string(),
4746
+ result: z20.string()
4641
4747
  }),
4642
- z19.object({
4643
- type: z19.literal("web_search_call"),
4644
- id: z19.string(),
4645
- status: z19.string(),
4646
- action: z19.discriminatedUnion("type", [
4647
- z19.object({
4648
- type: z19.literal("search"),
4649
- query: z19.string().nullish(),
4650
- queries: z19.array(z19.string()).nullish(),
4651
- sources: z19.array(
4652
- z19.discriminatedUnion("type", [
4653
- z19.object({ type: z19.literal("url"), url: z19.string() }),
4654
- 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() })
4655
4761
  ])
4656
4762
  ).nullish()
4657
4763
  }),
4658
- z19.object({
4659
- type: z19.literal("open_page"),
4660
- url: z19.string().nullish()
4764
+ z20.object({
4765
+ type: z20.literal("open_page"),
4766
+ url: z20.string().nullish()
4661
4767
  }),
4662
- z19.object({
4663
- type: z19.literal("find_in_page"),
4664
- url: z19.string().nullish(),
4665
- pattern: z19.string().nullish()
4768
+ z20.object({
4769
+ type: z20.literal("find_in_page"),
4770
+ url: z20.string().nullish(),
4771
+ pattern: z20.string().nullish()
4666
4772
  })
4667
4773
  ]).nullish()
4668
4774
  }),
4669
- z19.object({
4670
- type: z19.literal("file_search_call"),
4671
- id: z19.string(),
4672
- queries: z19.array(z19.string()),
4673
- results: z19.array(
4674
- z19.object({
4675
- attributes: z19.record(
4676
- z19.string(),
4677
- 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()])
4678
4784
  ),
4679
- file_id: z19.string(),
4680
- filename: z19.string(),
4681
- score: z19.number(),
4682
- text: z19.string()
4785
+ file_id: z20.string(),
4786
+ filename: z20.string(),
4787
+ score: z20.number(),
4788
+ text: z20.string()
4683
4789
  })
4684
4790
  ).nullish()
4685
4791
  }),
4686
- z19.object({
4687
- type: z19.literal("local_shell_call"),
4688
- id: z19.string(),
4689
- call_id: z19.string(),
4690
- action: z19.object({
4691
- type: z19.literal("exec"),
4692
- command: z19.array(z19.string()),
4693
- timeout_ms: z19.number().optional(),
4694
- user: z19.string().optional(),
4695
- working_directory: z19.string().optional(),
4696
- 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()
4697
4803
  })
4698
4804
  }),
4699
4805
  openaiResponsesComputerCallSchema,
4700
- z19.object({
4701
- type: z19.literal("mcp_call"),
4702
- id: z19.string(),
4703
- status: z19.string(),
4704
- arguments: z19.string(),
4705
- name: z19.string(),
4706
- server_label: z19.string(),
4707
- output: z19.string().nullish(),
4708
- error: z19.union([
4709
- z19.string(),
4710
- z19.object({
4711
- type: z19.string().optional(),
4712
- code: z19.union([z19.number(), z19.string()]).optional(),
4713
- 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()
4714
4820
  }).loose()
4715
4821
  ]).nullish(),
4716
- approval_request_id: z19.string().nullish()
4822
+ approval_request_id: z20.string().nullish()
4717
4823
  }),
4718
- z19.object({
4719
- type: z19.literal("mcp_list_tools"),
4720
- id: z19.string(),
4721
- server_label: z19.string(),
4722
- tools: z19.array(
4723
- z19.object({
4724
- name: z19.string(),
4725
- description: z19.string().optional(),
4726
- input_schema: z19.any(),
4727
- 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()
4728
4834
  })
4729
4835
  ),
4730
- error: z19.union([
4731
- z19.string(),
4732
- z19.object({
4733
- type: z19.string().optional(),
4734
- code: z19.union([z19.number(), z19.string()]).optional(),
4735
- 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()
4736
4842
  }).loose()
4737
4843
  ]).optional()
4738
4844
  }),
4739
- z19.object({
4740
- type: z19.literal("mcp_approval_request"),
4741
- id: z19.string(),
4742
- server_label: z19.string(),
4743
- name: z19.string(),
4744
- arguments: z19.string(),
4745
- 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()
4746
4852
  }),
4747
- z19.object({
4748
- type: z19.literal("apply_patch_call"),
4749
- id: z19.string(),
4750
- call_id: z19.string(),
4751
- status: z19.enum(["in_progress", "completed"]),
4752
- operation: z19.discriminatedUnion("type", [
4753
- z19.object({
4754
- type: z19.literal("create_file"),
4755
- path: z19.string(),
4756
- 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()
4757
4863
  }),
4758
- z19.object({
4759
- type: z19.literal("delete_file"),
4760
- path: z19.string()
4864
+ z20.object({
4865
+ type: z20.literal("delete_file"),
4866
+ path: z20.string()
4761
4867
  }),
4762
- z19.object({
4763
- type: z19.literal("update_file"),
4764
- path: z19.string(),
4765
- diff: z19.string()
4868
+ z20.object({
4869
+ type: z20.literal("update_file"),
4870
+ path: z20.string(),
4871
+ diff: z20.string()
4766
4872
  })
4767
4873
  ])
4768
4874
  }),
4769
- z19.object({
4770
- type: z19.literal("shell_call"),
4771
- id: z19.string(),
4772
- call_id: z19.string(),
4773
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4774
- action: z19.object({
4775
- 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())
4776
4882
  })
4777
4883
  }),
4778
- z19.object({
4779
- type: z19.literal("compaction"),
4780
- id: z19.string(),
4781
- encrypted_content: z19.string()
4884
+ z20.object({
4885
+ type: z20.literal("compaction"),
4886
+ id: z20.string(),
4887
+ encrypted_content: z20.string()
4782
4888
  }),
4783
- z19.object({
4784
- type: z19.literal("shell_call_output"),
4785
- id: z19.string(),
4786
- call_id: z19.string(),
4787
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4788
- output: z19.array(
4789
- z19.object({
4790
- stdout: z19.string(),
4791
- stderr: z19.string(),
4792
- outcome: z19.discriminatedUnion("type", [
4793
- z19.object({ type: z19.literal("timeout") }),
4794
- z19.object({
4795
- type: z19.literal("exit"),
4796
- 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()
4797
4903
  })
4798
4904
  ])
4799
4905
  })
4800
4906
  )
4801
4907
  }),
4802
- z19.object({
4803
- type: z19.literal("tool_search_call"),
4804
- id: z19.string(),
4805
- execution: z19.enum(["server", "client"]),
4806
- call_id: z19.string().nullable(),
4807
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4808
- 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()
4809
4915
  }),
4810
- z19.object({
4811
- type: z19.literal("tool_search_output"),
4812
- id: z19.string(),
4813
- execution: z19.enum(["server", "client"]),
4814
- call_id: z19.string().nullable(),
4815
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4816
- 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()))
4817
4923
  })
4818
4924
  ])
4819
4925
  }),
4820
- z19.object({
4821
- type: z19.literal("response.function_call_arguments.delta"),
4822
- item_id: z19.string(),
4823
- output_index: z19.number(),
4824
- 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()
4825
4931
  }),
4826
- z19.object({
4827
- type: z19.literal("response.custom_tool_call_input.delta"),
4828
- item_id: z19.string(),
4829
- output_index: z19.number(),
4830
- 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()
4831
4937
  }),
4832
- z19.object({
4833
- type: z19.literal("response.image_generation_call.partial_image"),
4834
- item_id: z19.string(),
4835
- output_index: z19.number(),
4836
- 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()
4837
4943
  }),
4838
- z19.object({
4839
- type: z19.literal("response.code_interpreter_call_code.delta"),
4840
- item_id: z19.string(),
4841
- output_index: z19.number(),
4842
- 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()
4843
4949
  }),
4844
- z19.object({
4845
- type: z19.literal("response.code_interpreter_call_code.done"),
4846
- item_id: z19.string(),
4847
- output_index: z19.number(),
4848
- 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()
4849
4955
  }),
4850
- z19.object({
4851
- type: z19.literal("response.output_text.annotation.added"),
4852
- annotation: z19.discriminatedUnion("type", [
4853
- z19.object({
4854
- type: z19.literal("url_citation"),
4855
- start_index: z19.number(),
4856
- end_index: z19.number(),
4857
- url: z19.string(),
4858
- 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()
4859
4965
  }),
4860
- z19.object({
4861
- type: z19.literal("file_citation"),
4862
- file_id: z19.string(),
4863
- filename: z19.string(),
4864
- 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()
4865
4971
  }),
4866
- z19.object({
4867
- type: z19.literal("container_file_citation"),
4868
- container_id: z19.string(),
4869
- file_id: z19.string(),
4870
- filename: z19.string(),
4871
- start_index: z19.number(),
4872
- 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()
4873
4979
  }),
4874
- z19.object({
4875
- type: z19.literal("file_path"),
4876
- file_id: z19.string(),
4877
- index: z19.number()
4980
+ z20.object({
4981
+ type: z20.literal("file_path"),
4982
+ file_id: z20.string(),
4983
+ index: z20.number()
4878
4984
  })
4879
4985
  ])
4880
4986
  }),
4881
- z19.object({
4882
- type: z19.literal("response.reasoning_summary_part.added"),
4883
- item_id: z19.string(),
4884
- 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()
4885
4991
  }),
4886
- z19.object({
4887
- type: z19.literal("response.reasoning_summary_text.delta"),
4888
- item_id: z19.string(),
4889
- summary_index: z19.number(),
4890
- 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()
4891
4997
  }),
4892
- z19.object({
4893
- type: z19.literal("response.reasoning_summary_part.done"),
4894
- item_id: z19.string(),
4895
- 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()
4896
5002
  }),
4897
- z19.object({
4898
- type: z19.literal("response.apply_patch_call_operation_diff.delta"),
4899
- item_id: z19.string(),
4900
- output_index: z19.number(),
4901
- delta: z19.string(),
4902
- 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()
4903
5009
  }),
4904
- z19.object({
4905
- type: z19.literal("response.apply_patch_call_operation_diff.done"),
4906
- item_id: z19.string(),
4907
- output_index: z19.number(),
4908
- 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()
4909
5015
  }),
4910
5016
  openaiResponsesNestedErrorChunkSchema,
4911
5017
  openaiResponsesErrorChunkSchema,
4912
- z19.object({ type: z19.string() }).loose().transform((value) => ({
5018
+ z20.object({ type: z20.string() }).loose().transform((value) => ({
4913
5019
  type: "unknown_chunk",
4914
5020
  message: value.type
4915
5021
  }))
@@ -4917,315 +5023,318 @@ var openaiResponsesChunkSchema = lazySchema17(
4917
5023
  ])
4918
5024
  )
4919
5025
  );
4920
- var openaiResponsesResponseSchema = lazySchema17(
4921
- () => zodSchema17(
4922
- z19.object({
4923
- id: z19.string().optional(),
4924
- created_at: z19.number().optional(),
4925
- error: z19.object({
4926
- message: z19.string(),
4927
- type: z19.string(),
4928
- param: z19.string().nullish(),
4929
- 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()
4930
5036
  }).nullish(),
4931
- model: z19.string().optional(),
4932
- output: z19.array(
4933
- z19.discriminatedUnion("type", [
4934
- z19.object({
4935
- type: z19.literal("message"),
4936
- role: z19.literal("assistant"),
4937
- id: z19.string(),
4938
- phase: z19.enum(["commentary", "final_answer"]).nullish(),
4939
- content: z19.array(
4940
- z19.object({
4941
- type: z19.literal("output_text"),
4942
- text: z19.string(),
4943
- logprobs: z19.array(
4944
- z19.object({
4945
- token: z19.string(),
4946
- logprob: z19.number(),
4947
- top_logprobs: z19.array(
4948
- z19.object({
4949
- token: z19.string(),
4950
- 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()
4951
5057
  })
4952
5058
  )
4953
5059
  })
4954
5060
  ).nullish(),
4955
- annotations: z19.array(
4956
- z19.discriminatedUnion("type", [
4957
- z19.object({
4958
- type: z19.literal("url_citation"),
4959
- start_index: z19.number(),
4960
- end_index: z19.number(),
4961
- url: z19.string(),
4962
- 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()
4963
5069
  }),
4964
- z19.object({
4965
- type: z19.literal("file_citation"),
4966
- file_id: z19.string(),
4967
- filename: z19.string(),
4968
- 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()
4969
5075
  }),
4970
- z19.object({
4971
- type: z19.literal("container_file_citation"),
4972
- container_id: z19.string(),
4973
- file_id: z19.string(),
4974
- filename: z19.string(),
4975
- start_index: z19.number(),
4976
- 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()
4977
5083
  }),
4978
- z19.object({
4979
- type: z19.literal("file_path"),
4980
- file_id: z19.string(),
4981
- index: z19.number()
5084
+ z20.object({
5085
+ type: z20.literal("file_path"),
5086
+ file_id: z20.string(),
5087
+ index: z20.number()
4982
5088
  })
4983
5089
  ])
4984
5090
  )
4985
5091
  })
4986
5092
  )
4987
5093
  }),
4988
- z19.object({
4989
- type: z19.literal("web_search_call"),
4990
- id: z19.string(),
4991
- status: z19.string(),
4992
- action: z19.discriminatedUnion("type", [
4993
- z19.object({
4994
- type: z19.literal("search"),
4995
- query: z19.string().nullish(),
4996
- queries: z19.array(z19.string()).nullish(),
4997
- sources: z19.array(
4998
- z19.discriminatedUnion("type", [
4999
- z19.object({ type: z19.literal("url"), url: z19.string() }),
5000
- z19.object({
5001
- type: z19.literal("api"),
5002
- 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()
5003
5109
  })
5004
5110
  ])
5005
5111
  ).nullish()
5006
5112
  }),
5007
- z19.object({
5008
- type: z19.literal("open_page"),
5009
- url: z19.string().nullish()
5113
+ z20.object({
5114
+ type: z20.literal("open_page"),
5115
+ url: z20.string().nullish()
5010
5116
  }),
5011
- z19.object({
5012
- type: z19.literal("find_in_page"),
5013
- url: z19.string().nullish(),
5014
- pattern: z19.string().nullish()
5117
+ z20.object({
5118
+ type: z20.literal("find_in_page"),
5119
+ url: z20.string().nullish(),
5120
+ pattern: z20.string().nullish()
5015
5121
  })
5016
5122
  ]).nullish()
5017
5123
  }),
5018
- z19.object({
5019
- type: z19.literal("file_search_call"),
5020
- id: z19.string(),
5021
- queries: z19.array(z19.string()),
5022
- results: z19.array(
5023
- z19.object({
5024
- attributes: z19.record(
5025
- z19.string(),
5026
- 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()])
5027
5133
  ),
5028
- file_id: z19.string(),
5029
- filename: z19.string(),
5030
- score: z19.number(),
5031
- text: z19.string()
5134
+ file_id: z20.string(),
5135
+ filename: z20.string(),
5136
+ score: z20.number(),
5137
+ text: z20.string()
5032
5138
  })
5033
5139
  ).nullish()
5034
5140
  }),
5035
- z19.object({
5036
- type: z19.literal("code_interpreter_call"),
5037
- id: z19.string(),
5038
- code: z19.string().nullable(),
5039
- container_id: z19.string(),
5040
- outputs: z19.array(
5041
- z19.discriminatedUnion("type", [
5042
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
5043
- 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() })
5044
5150
  ])
5045
5151
  ).nullable()
5046
5152
  }),
5047
- z19.object({
5048
- type: z19.literal("image_generation_call"),
5049
- id: z19.string(),
5050
- result: z19.string()
5153
+ z20.object({
5154
+ type: z20.literal("image_generation_call"),
5155
+ id: z20.string(),
5156
+ result: z20.string()
5051
5157
  }),
5052
- z19.object({
5053
- type: z19.literal("local_shell_call"),
5054
- id: z19.string(),
5055
- call_id: z19.string(),
5056
- action: z19.object({
5057
- type: z19.literal("exec"),
5058
- command: z19.array(z19.string()),
5059
- timeout_ms: z19.number().optional(),
5060
- user: z19.string().optional(),
5061
- working_directory: z19.string().optional(),
5062
- 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()
5063
5169
  })
5064
5170
  }),
5065
- z19.object({
5066
- type: z19.literal("function_call"),
5067
- call_id: z19.string(),
5068
- name: z19.string(),
5069
- arguments: z19.string(),
5070
- id: z19.string(),
5071
- 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()
5072
5179
  }),
5073
- z19.object({
5074
- type: z19.literal("custom_tool_call"),
5075
- call_id: z19.string(),
5076
- name: z19.string(),
5077
- input: z19.string(),
5078
- 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()
5079
5188
  }),
5080
5189
  openaiResponsesComputerCallSchema,
5081
- z19.object({
5082
- type: z19.literal("reasoning"),
5083
- id: z19.string(),
5084
- encrypted_content: z19.string().nullish(),
5085
- summary: z19.array(
5086
- z19.object({
5087
- type: z19.literal("summary_text"),
5088
- 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()
5089
5198
  })
5090
5199
  )
5091
5200
  }),
5092
- z19.object({
5093
- type: z19.literal("mcp_call"),
5094
- id: z19.string(),
5095
- status: z19.string(),
5096
- arguments: z19.string(),
5097
- name: z19.string(),
5098
- server_label: z19.string(),
5099
- output: z19.string().nullish(),
5100
- error: z19.union([
5101
- z19.string(),
5102
- z19.object({
5103
- type: z19.string().optional(),
5104
- code: z19.union([z19.number(), z19.string()]).optional(),
5105
- 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()
5106
5215
  }).loose()
5107
5216
  ]).nullish(),
5108
- approval_request_id: z19.string().nullish()
5217
+ approval_request_id: z20.string().nullish()
5109
5218
  }),
5110
- z19.object({
5111
- type: z19.literal("mcp_list_tools"),
5112
- id: z19.string(),
5113
- server_label: z19.string(),
5114
- tools: z19.array(
5115
- z19.object({
5116
- name: z19.string(),
5117
- description: z19.string().optional(),
5118
- input_schema: z19.any(),
5119
- 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()
5120
5229
  })
5121
5230
  ),
5122
- error: z19.union([
5123
- z19.string(),
5124
- z19.object({
5125
- type: z19.string().optional(),
5126
- code: z19.union([z19.number(), z19.string()]).optional(),
5127
- 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()
5128
5237
  }).loose()
5129
5238
  ]).optional()
5130
5239
  }),
5131
- z19.object({
5132
- type: z19.literal("mcp_approval_request"),
5133
- id: z19.string(),
5134
- server_label: z19.string(),
5135
- name: z19.string(),
5136
- arguments: z19.string(),
5137
- 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()
5138
5247
  }),
5139
- z19.object({
5140
- type: z19.literal("apply_patch_call"),
5141
- id: z19.string(),
5142
- call_id: z19.string(),
5143
- status: z19.enum(["in_progress", "completed"]),
5144
- operation: z19.discriminatedUnion("type", [
5145
- z19.object({
5146
- type: z19.literal("create_file"),
5147
- path: z19.string(),
5148
- 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()
5149
5258
  }),
5150
- z19.object({
5151
- type: z19.literal("delete_file"),
5152
- path: z19.string()
5259
+ z20.object({
5260
+ type: z20.literal("delete_file"),
5261
+ path: z20.string()
5153
5262
  }),
5154
- z19.object({
5155
- type: z19.literal("update_file"),
5156
- path: z19.string(),
5157
- diff: z19.string()
5263
+ z20.object({
5264
+ type: z20.literal("update_file"),
5265
+ path: z20.string(),
5266
+ diff: z20.string()
5158
5267
  })
5159
5268
  ])
5160
5269
  }),
5161
- z19.object({
5162
- type: z19.literal("shell_call"),
5163
- id: z19.string(),
5164
- call_id: z19.string(),
5165
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5166
- action: z19.object({
5167
- 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())
5168
5277
  })
5169
5278
  }),
5170
- z19.object({
5171
- type: z19.literal("compaction"),
5172
- id: z19.string(),
5173
- encrypted_content: z19.string()
5279
+ z20.object({
5280
+ type: z20.literal("compaction"),
5281
+ id: z20.string(),
5282
+ encrypted_content: z20.string()
5174
5283
  }),
5175
- z19.object({
5176
- type: z19.literal("shell_call_output"),
5177
- id: z19.string(),
5178
- call_id: z19.string(),
5179
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5180
- output: z19.array(
5181
- z19.object({
5182
- stdout: z19.string(),
5183
- stderr: z19.string(),
5184
- outcome: z19.discriminatedUnion("type", [
5185
- z19.object({ type: z19.literal("timeout") }),
5186
- z19.object({
5187
- type: z19.literal("exit"),
5188
- 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()
5189
5298
  })
5190
5299
  ])
5191
5300
  })
5192
5301
  )
5193
5302
  }),
5194
- z19.object({
5195
- type: z19.literal("tool_search_call"),
5196
- id: z19.string(),
5197
- execution: z19.enum(["server", "client"]),
5198
- call_id: z19.string().nullable(),
5199
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5200
- 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()
5201
5310
  }),
5202
- z19.object({
5203
- type: z19.literal("tool_search_output"),
5204
- id: z19.string(),
5205
- execution: z19.enum(["server", "client"]),
5206
- call_id: z19.string().nullable(),
5207
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5208
- 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()))
5209
5318
  })
5210
5319
  ])
5211
5320
  ).optional(),
5212
- service_tier: z19.string().nullish(),
5213
- reasoning: z19.object({
5214
- context: z19.string().nullish()
5321
+ service_tier: z20.string().nullish(),
5322
+ reasoning: z20.object({
5323
+ context: z20.string().nullish()
5215
5324
  }).nullish(),
5216
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
5217
- usage: z19.object({
5218
- input_tokens: z19.number(),
5219
- input_tokens_details: z19.object({
5220
- cached_tokens: z19.number().nullish(),
5221
- cache_write_tokens: z19.number().nullish(),
5222
- orchestration_input_tokens: z19.number().nullish(),
5223
- 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()
5224
5333
  }).nullish(),
5225
- output_tokens: z19.number(),
5226
- output_tokens_details: z19.object({
5227
- reasoning_tokens: z19.number().nullish(),
5228
- 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()
5229
5338
  }).nullish()
5230
5339
  }).optional()
5231
5340
  })
@@ -5234,10 +5343,10 @@ var openaiResponsesResponseSchema = lazySchema17(
5234
5343
 
5235
5344
  // src/responses/openai-responses-language-model-options.ts
5236
5345
  import {
5237
- lazySchema as lazySchema18,
5238
- zodSchema as zodSchema18
5346
+ lazySchema as lazySchema19,
5347
+ zodSchema as zodSchema19
5239
5348
  } from "@ai-sdk/provider-utils";
5240
- import { z as z20 } from "zod/v4";
5349
+ import { z as z21 } from "zod/v4";
5241
5350
  var TOP_LOGPROBS_MAX = 20;
5242
5351
  var openaiResponsesReasoningModelIds = [
5243
5352
  "o1",
@@ -5308,9 +5417,9 @@ var openaiResponsesModelIds = [
5308
5417
  "gpt-5-chat-latest",
5309
5418
  ...openaiResponsesReasoningModelIds
5310
5419
  ];
5311
- var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5312
- () => zodSchema18(
5313
- z20.object({
5420
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
5421
+ () => zodSchema19(
5422
+ z21.object({
5314
5423
  /**
5315
5424
  * The ID of the OpenAI Conversation to continue.
5316
5425
  * You must create a conversation first via the OpenAI API.
@@ -5318,13 +5427,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5318
5427
  * Defaults to `undefined`.
5319
5428
  * @see https://platform.openai.com/docs/api-reference/conversations/create
5320
5429
  */
5321
- conversation: z20.string().nullish(),
5430
+ conversation: z21.string().nullish(),
5322
5431
  /**
5323
5432
  * The set of extra fields to include in the response (advanced, usually not needed).
5324
5433
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5325
5434
  */
5326
- include: z20.array(
5327
- z20.enum([
5435
+ include: z21.array(
5436
+ z21.enum([
5328
5437
  "reasoning.encrypted_content",
5329
5438
  // handled internally by default, only needed for unknown reasoning models
5330
5439
  "file_search_call.results",
@@ -5337,7 +5446,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5337
5446
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5338
5447
  * Defaults to `undefined`.
5339
5448
  */
5340
- instructions: z20.string().nullish(),
5449
+ instructions: z21.string().nullish(),
5341
5450
  /**
5342
5451
  * Return the log probabilities of the tokens. Including logprobs will increase
5343
5452
  * the response size and can slow down response times. However, it can
@@ -5352,38 +5461,38 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5352
5461
  * @see https://platform.openai.com/docs/api-reference/responses/create
5353
5462
  * @see https://cookbook.openai.com/examples/using_logprobs
5354
5463
  */
5355
- 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(),
5356
5465
  /**
5357
5466
  * The maximum number of total calls to built-in tools that can be processed in a response.
5358
5467
  * This maximum number applies across all built-in tool calls, not per individual tool.
5359
5468
  * Any further attempts to call a tool by the model will be ignored.
5360
5469
  */
5361
- maxToolCalls: z20.number().nullish(),
5470
+ maxToolCalls: z21.number().nullish(),
5362
5471
  /**
5363
5472
  * Additional metadata to store with the generation.
5364
5473
  */
5365
- metadata: z20.any().nullish(),
5474
+ metadata: z21.any().nullish(),
5366
5475
  /**
5367
5476
  * Whether to use parallel tool calls. Defaults to `true`.
5368
5477
  */
5369
- parallelToolCalls: z20.boolean().nullish(),
5478
+ parallelToolCalls: z21.boolean().nullish(),
5370
5479
  /**
5371
5480
  * The ID of the previous response. You can use it to continue a conversation.
5372
5481
  * Defaults to `undefined`.
5373
5482
  */
5374
- previousResponseId: z20.string().nullish(),
5483
+ previousResponseId: z21.string().nullish(),
5375
5484
  /**
5376
5485
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5377
5486
  */
5378
- promptCacheKey: z20.string().nullish(),
5487
+ promptCacheKey: z21.string().nullish(),
5379
5488
  /**
5380
5489
  * Prompt cache behavior for GPT-5.6 and later models.
5381
5490
  * `mode` controls whether OpenAI also places an implicit breakpoint.
5382
5491
  * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5383
5492
  */
5384
- promptCacheOptions: z20.object({
5385
- mode: z20.enum(["implicit", "explicit"]).optional(),
5386
- ttl: z20.literal("30m").optional()
5493
+ promptCacheOptions: z21.object({
5494
+ mode: z21.enum(["implicit", "explicit"]).optional(),
5495
+ ttl: z21.literal("30m").optional()
5387
5496
  }).optional(),
5388
5497
  /**
5389
5498
  * The retention policy for the prompt cache.
@@ -5395,35 +5504,35 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5395
5504
  *
5396
5505
  * @default 'in_memory'
5397
5506
  */
5398
- promptCacheRetention: z20.enum(["in_memory", "24h"]).nullish(),
5507
+ promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
5399
5508
  /**
5400
5509
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5401
5510
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5402
5511
  * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5403
5512
  * Supported values vary by model.
5404
5513
  */
5405
- reasoningEffort: z20.string().nullish(),
5514
+ reasoningEffort: z21.string().nullish(),
5406
5515
  /**
5407
5516
  * Controls how much model work GPT-5.6 performs before returning a final answer.
5408
5517
  * `standard` is the default. `pro` increases quality, latency, and token usage.
5409
5518
  */
5410
- reasoningMode: z20.enum(["standard", "pro"]).optional(),
5519
+ reasoningMode: z21.enum(["standard", "pro"]).optional(),
5411
5520
  /**
5412
5521
  * Controls which available reasoning items GPT-5.6 can use.
5413
5522
  * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5414
5523
  * turns, and `all_turns` makes compatible earlier reasoning available.
5415
5524
  */
5416
- reasoningContext: z20.enum(["auto", "current_turn", "all_turns"]).optional(),
5525
+ reasoningContext: z21.enum(["auto", "current_turn", "all_turns"]).optional(),
5417
5526
  /**
5418
5527
  * Controls reasoning summary output from the model.
5419
5528
  * Set to "auto" to automatically receive the richest level available,
5420
5529
  * or "detailed" for comprehensive summaries.
5421
5530
  */
5422
- reasoningSummary: z20.string().nullish(),
5531
+ reasoningSummary: z21.string().nullish(),
5423
5532
  /**
5424
5533
  * The identifier for safety monitoring and tracking.
5425
5534
  */
5426
- safetyIdentifier: z20.string().nullish(),
5535
+ safetyIdentifier: z21.string().nullish(),
5427
5536
  /**
5428
5537
  * Service tier for the request.
5429
5538
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -5431,11 +5540,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5431
5540
  *
5432
5541
  * Defaults to 'auto'.
5433
5542
  */
5434
- serviceTier: z20.enum(["auto", "flex", "priority", "default"]).nullish(),
5543
+ serviceTier: z21.enum(["auto", "flex", "priority", "default"]).nullish(),
5435
5544
  /**
5436
5545
  * Whether to store the generation. Defaults to `true`.
5437
5546
  */
5438
- store: z20.boolean().nullish(),
5547
+ store: z21.boolean().nullish(),
5439
5548
  /**
5440
5549
  * Whether to pass through non-image file types as generic input files.
5441
5550
  *
@@ -5443,30 +5552,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5443
5552
  * Enable this when the target OpenAI Responses model supports additional
5444
5553
  * file media types, such as text/csv.
5445
5554
  */
5446
- passThroughUnsupportedFiles: z20.boolean().optional(),
5555
+ passThroughUnsupportedFiles: z21.boolean().optional(),
5447
5556
  /**
5448
5557
  * Whether to use strict JSON schema validation.
5449
5558
  * Defaults to `true`.
5450
5559
  */
5451
- strictJsonSchema: z20.boolean().nullish(),
5560
+ strictJsonSchema: z21.boolean().nullish(),
5452
5561
  /**
5453
5562
  * Controls the verbosity of the model's responses. Lower values ('low') will result
5454
5563
  * in more concise responses, while higher values ('high') will result in more verbose responses.
5455
5564
  * Valid values: 'low', 'medium', 'high'.
5456
5565
  */
5457
- textVerbosity: z20.enum(["low", "medium", "high"]).nullish(),
5566
+ textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
5458
5567
  /**
5459
5568
  * Controls output truncation. 'auto' (default) performs truncation automatically;
5460
5569
  * 'disabled' turns truncation off.
5461
5570
  */
5462
- truncation: z20.enum(["auto", "disabled"]).nullish(),
5571
+ truncation: z21.enum(["auto", "disabled"]).nullish(),
5463
5572
  /**
5464
5573
  * A unique identifier representing your end-user, which can help OpenAI to
5465
5574
  * monitor and detect abuse.
5466
5575
  * Defaults to `undefined`.
5467
5576
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5468
5577
  */
5469
- user: z20.string().nullish(),
5578
+ user: z21.string().nullish(),
5470
5579
  /**
5471
5580
  * Override the system message mode for this model.
5472
5581
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -5475,7 +5584,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5475
5584
  *
5476
5585
  * If not specified, the mode is automatically determined based on the model.
5477
5586
  */
5478
- systemMessageMode: z20.enum(["system", "developer", "remove"]).optional(),
5587
+ systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
5479
5588
  /**
5480
5589
  * Force treating this model as a reasoning model.
5481
5590
  *
@@ -5485,14 +5594,14 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5485
5594
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
5486
5595
  * and defaults `systemMessageMode` to `developer` unless overridden.
5487
5596
  */
5488
- forceReasoning: z20.boolean().optional(),
5597
+ forceReasoning: z21.boolean().optional(),
5489
5598
  /**
5490
5599
  * Enable server-side context management (compaction).
5491
5600
  */
5492
- contextManagement: z20.array(
5493
- z20.object({
5494
- type: z20.literal("compaction"),
5495
- compactThreshold: z20.number()
5601
+ contextManagement: z21.array(
5602
+ z21.object({
5603
+ type: z21.literal("compaction"),
5604
+ compactThreshold: z21.number()
5496
5605
  })
5497
5606
  ).nullish(),
5498
5607
  /**
@@ -5505,9 +5614,9 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
5505
5614
  *
5506
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)
5507
5616
  */
5508
- allowedTools: z20.object({
5509
- toolNames: z20.array(z20.string()).min(1),
5510
- 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()
5511
5620
  }).optional()
5512
5621
  })
5513
5622
  )
@@ -5524,44 +5633,44 @@ import {
5524
5633
 
5525
5634
  // src/tool/code-interpreter.ts
5526
5635
  import {
5527
- createProviderExecutedToolFactory,
5528
- lazySchema as lazySchema19,
5529
- zodSchema as zodSchema19
5636
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
5637
+ lazySchema as lazySchema20,
5638
+ zodSchema as zodSchema20
5530
5639
  } from "@ai-sdk/provider-utils";
5531
- import { z as z21 } from "zod/v4";
5532
- var codeInterpreterInputSchema = lazySchema19(
5533
- () => zodSchema19(
5534
- z21.object({
5535
- code: z21.string().nullish(),
5536
- 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()
5537
5646
  })
5538
5647
  )
5539
5648
  );
5540
- var codeInterpreterOutputSchema = lazySchema19(
5541
- () => zodSchema19(
5542
- z21.object({
5543
- outputs: z21.array(
5544
- z21.discriminatedUnion("type", [
5545
- z21.object({ type: z21.literal("logs"), logs: z21.string() }),
5546
- 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() })
5547
5656
  ])
5548
5657
  ).nullish()
5549
5658
  })
5550
5659
  )
5551
5660
  );
5552
- var codeInterpreterArgsSchema = lazySchema19(
5553
- () => zodSchema19(
5554
- z21.object({
5555
- container: z21.union([
5556
- z21.string(),
5557
- z21.object({
5558
- 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()
5559
5668
  })
5560
5669
  ]).optional()
5561
5670
  })
5562
5671
  )
5563
5672
  );
5564
- var codeInterpreterToolFactory = createProviderExecutedToolFactory({
5673
+ var codeInterpreterToolFactory = createProviderExecutedToolFactory2({
5565
5674
  id: "openai.code_interpreter",
5566
5675
  inputSchema: codeInterpreterInputSchema,
5567
5676
  outputSchema: codeInterpreterOutputSchema
@@ -5572,88 +5681,88 @@ var codeInterpreter = (args = {}) => {
5572
5681
 
5573
5682
  // src/tool/file-search.ts
5574
5683
  import {
5575
- createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
5576
- lazySchema as lazySchema20,
5577
- zodSchema as zodSchema20
5684
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
5685
+ lazySchema as lazySchema21,
5686
+ zodSchema as zodSchema21
5578
5687
  } from "@ai-sdk/provider-utils";
5579
- import { z as z22 } from "zod/v4";
5580
- var comparisonFilterSchema = z22.object({
5581
- key: z22.string(),
5582
- type: z22.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5583
- 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())])
5584
5693
  });
5585
- var compoundFilterSchema = z22.object({
5586
- type: z22.enum(["and", "or"]),
5587
- filters: z22.array(
5588
- 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)])
5589
5698
  )
5590
5699
  });
5591
- var fileSearchArgsSchema = lazySchema20(
5592
- () => zodSchema20(
5593
- z22.object({
5594
- vectorStoreIds: z22.array(z22.string()),
5595
- maxNumResults: z22.number().optional(),
5596
- ranking: z22.object({
5597
- ranker: z22.string().optional(),
5598
- 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()
5599
5708
  }).optional(),
5600
- filters: z22.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5709
+ filters: z23.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5601
5710
  })
5602
5711
  )
5603
5712
  );
5604
- var fileSearchOutputSchema = lazySchema20(
5605
- () => zodSchema20(
5606
- z22.object({
5607
- queries: z22.array(z22.string()),
5608
- results: z22.array(
5609
- z22.object({
5610
- attributes: z22.record(z22.string(), z22.unknown()),
5611
- fileId: z22.string(),
5612
- filename: z22.string(),
5613
- score: z22.number(),
5614
- 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()
5615
5724
  })
5616
5725
  ).nullable()
5617
5726
  })
5618
5727
  )
5619
5728
  );
5620
- var fileSearch = createProviderExecutedToolFactory2({
5729
+ var fileSearch = createProviderExecutedToolFactory3({
5621
5730
  id: "openai.file_search",
5622
- inputSchema: z22.object({}),
5731
+ inputSchema: z23.object({}),
5623
5732
  outputSchema: fileSearchOutputSchema
5624
5733
  });
5625
5734
 
5626
5735
  // src/tool/image-generation.ts
5627
5736
  import {
5628
- createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
5629
- lazySchema as lazySchema21,
5630
- zodSchema as zodSchema21
5737
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
5738
+ lazySchema as lazySchema22,
5739
+ zodSchema as zodSchema22
5631
5740
  } from "@ai-sdk/provider-utils";
5632
- import { z as z23 } from "zod/v4";
5633
- var imageGenerationArgsSchema = lazySchema21(
5634
- () => zodSchema21(
5635
- z23.object({
5636
- background: z23.enum(["auto", "opaque", "transparent"]).optional(),
5637
- inputFidelity: z23.enum(["low", "high"]).optional(),
5638
- inputImageMask: z23.object({
5639
- fileId: z23.string().optional(),
5640
- 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()
5641
5750
  }).optional(),
5642
- model: z23.string().optional(),
5643
- moderation: z23.enum(["auto"]).optional(),
5644
- outputCompression: z23.number().int().min(0).max(100).optional(),
5645
- outputFormat: z23.enum(["png", "jpeg", "webp"]).optional(),
5646
- partialImages: z23.number().int().min(0).max(3).optional(),
5647
- quality: z23.enum(["auto", "low", "medium", "high"]).optional(),
5648
- 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()
5649
5758
  }).strict()
5650
5759
  )
5651
5760
  );
5652
- var imageGenerationInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
5653
- var imageGenerationOutputSchema = lazySchema21(
5654
- () => zodSchema21(z23.object({ result: z23.string() }))
5761
+ var imageGenerationInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
5762
+ var imageGenerationOutputSchema = lazySchema22(
5763
+ () => zodSchema22(z24.object({ result: z24.string() }))
5655
5764
  );
5656
- var imageGenerationToolFactory = createProviderExecutedToolFactory3({
5765
+ var imageGenerationToolFactory = createProviderExecutedToolFactory4({
5657
5766
  id: "openai.image_generation",
5658
5767
  inputSchema: imageGenerationInputSchema,
5659
5768
  outputSchema: imageGenerationOutputSchema
@@ -5665,28 +5774,28 @@ var imageGeneration = (args = {}) => {
5665
5774
  // src/tool/custom.ts
5666
5775
  import {
5667
5776
  createProviderDefinedToolFactory,
5668
- lazySchema as lazySchema22,
5669
- zodSchema as zodSchema22
5777
+ lazySchema as lazySchema23,
5778
+ zodSchema as zodSchema23
5670
5779
  } from "@ai-sdk/provider-utils";
5671
- import { z as z24 } from "zod/v4";
5672
- var customArgsSchema = lazySchema22(
5673
- () => zodSchema22(
5674
- z24.object({
5675
- description: z24.string().optional(),
5676
- format: z24.union([
5677
- z24.object({
5678
- type: z24.literal("grammar"),
5679
- syntax: z24.enum(["regex", "lark"]),
5680
- 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()
5681
5790
  }),
5682
- z24.object({
5683
- type: z24.literal("text")
5791
+ z25.object({
5792
+ type: z25.literal("text")
5684
5793
  })
5685
5794
  ]).optional()
5686
5795
  })
5687
5796
  )
5688
5797
  );
5689
- var customInputSchema = lazySchema22(() => zodSchema22(z24.string()));
5798
+ var customInputSchema = lazySchema23(() => zodSchema23(z25.string()));
5690
5799
  var customToolFactory = createProviderDefinedToolFactory({
5691
5800
  id: "openai.custom",
5692
5801
  inputSchema: customInputSchema
@@ -5694,139 +5803,82 @@ var customToolFactory = createProviderDefinedToolFactory({
5694
5803
 
5695
5804
  // src/tool/mcp.ts
5696
5805
  import {
5697
- createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
5698
- lazySchema as lazySchema23,
5699
- zodSchema as zodSchema23
5806
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
5807
+ lazySchema as lazySchema24,
5808
+ zodSchema as zodSchema24
5700
5809
  } from "@ai-sdk/provider-utils";
5701
- import { z as z25 } from "zod/v4";
5702
- var jsonValueSchema2 = z25.lazy(
5703
- () => z25.union([
5704
- z25.string(),
5705
- z25.number(),
5706
- z25.boolean(),
5707
- z25.null(),
5708
- z25.array(jsonValueSchema2),
5709
- 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)
5710
5819
  ])
5711
5820
  );
5712
- var mcpArgsSchema = lazySchema23(
5713
- () => zodSchema23(
5714
- z25.object({
5715
- serverLabel: z25.string(),
5716
- allowedTools: z25.union([
5717
- z25.array(z25.string()),
5718
- z25.object({
5719
- readOnly: z25.boolean().optional(),
5720
- 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()
5721
5830
  })
5722
5831
  ]).optional(),
5723
- authorization: z25.string().optional(),
5724
- connectorId: z25.string().optional(),
5725
- headers: z25.record(z25.string(), z25.string()).optional(),
5726
- requireApproval: z25.union([
5727
- z25.enum(["always", "never"]),
5728
- z25.object({
5729
- never: z25.object({
5730
- 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()
5731
5840
  }).optional()
5732
5841
  })
5733
5842
  ]).optional(),
5734
- serverDescription: z25.string().optional(),
5735
- serverUrl: z25.string().optional()
5843
+ serverDescription: z26.string().optional(),
5844
+ serverUrl: z26.string().optional()
5736
5845
  }).refine(
5737
5846
  (v) => v.serverUrl != null || v.connectorId != null,
5738
5847
  "One of serverUrl or connectorId must be provided."
5739
5848
  )
5740
5849
  )
5741
5850
  );
5742
- var mcpInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5743
- var mcpOutputSchema = lazySchema23(
5744
- () => zodSchema23(
5745
- z25.object({
5746
- type: z25.literal("call"),
5747
- serverLabel: z25.string(),
5748
- name: z25.string(),
5749
- arguments: z25.string(),
5750
- output: z25.string().nullish(),
5751
- 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()
5752
5861
  })
5753
5862
  )
5754
5863
  );
5755
- var mcpToolFactory = createProviderExecutedToolFactory4({
5864
+ var mcpToolFactory = createProviderExecutedToolFactory5({
5756
5865
  id: "openai.mcp",
5757
5866
  inputSchema: mcpInputSchema,
5758
5867
  outputSchema: mcpOutputSchema
5759
5868
  });
5760
5869
 
5761
5870
  // src/tool/web-search.ts
5762
- import {
5763
- createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
5764
- lazySchema as lazySchema24,
5765
- zodSchema as zodSchema24
5766
- } from "@ai-sdk/provider-utils";
5767
- import { z as z26 } from "zod/v4";
5768
- var webSearchArgsSchema = lazySchema24(
5769
- () => zodSchema24(
5770
- z26.object({
5771
- externalWebAccess: z26.boolean().optional(),
5772
- filters: z26.object({ allowedDomains: z26.array(z26.string()).optional() }).optional(),
5773
- searchContextSize: z26.enum(["low", "medium", "high"]).optional(),
5774
- userLocation: z26.object({
5775
- type: z26.literal("approximate"),
5776
- country: z26.string().optional(),
5777
- city: z26.string().optional(),
5778
- region: z26.string().optional(),
5779
- timezone: z26.string().optional()
5780
- }).optional()
5781
- })
5782
- )
5783
- );
5784
- var webSearchInputSchema = lazySchema24(() => zodSchema24(z26.object({})));
5785
- var webSearchOutputSchema = lazySchema24(
5786
- () => zodSchema24(
5787
- z26.object({
5788
- action: z26.discriminatedUnion("type", [
5789
- z26.object({
5790
- type: z26.literal("search"),
5791
- query: z26.string().optional(),
5792
- queries: z26.array(z26.string()).optional()
5793
- }),
5794
- z26.object({
5795
- type: z26.literal("openPage"),
5796
- url: z26.string().nullish()
5797
- }),
5798
- z26.object({
5799
- type: z26.literal("findInPage"),
5800
- url: z26.string().nullish(),
5801
- pattern: z26.string().nullish()
5802
- })
5803
- ]).optional(),
5804
- sources: z26.array(
5805
- z26.discriminatedUnion("type", [
5806
- z26.object({ type: z26.literal("url"), url: z26.string() }),
5807
- z26.object({ type: z26.literal("api"), name: z26.string() })
5808
- ])
5809
- ).optional()
5810
- })
5811
- )
5812
- );
5813
- var webSearchToolFactory = createProviderExecutedToolFactory5({
5814
- id: "openai.web_search",
5815
- inputSchema: webSearchInputSchema,
5816
- outputSchema: webSearchOutputSchema
5817
- });
5818
- var webSearch = (args = {}) => webSearchToolFactory(args);
5819
-
5820
- // src/tool/web-search-preview.ts
5821
5871
  import {
5822
5872
  createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
5823
5873
  lazySchema as lazySchema25,
5824
5874
  zodSchema as zodSchema25
5825
5875
  } from "@ai-sdk/provider-utils";
5826
5876
  import { z as z27 } from "zod/v4";
5827
- var webSearchPreviewArgsSchema = lazySchema25(
5877
+ var webSearchArgsSchema = lazySchema25(
5828
5878
  () => zodSchema25(
5829
5879
  z27.object({
5880
+ externalWebAccess: z27.boolean().optional(),
5881
+ filters: z27.object({ allowedDomains: z27.array(z27.string()).optional() }).optional(),
5830
5882
  searchContextSize: z27.enum(["low", "medium", "high"]).optional(),
5831
5883
  userLocation: z27.object({
5832
5884
  type: z27.literal("approximate"),
@@ -5838,16 +5890,15 @@ var webSearchPreviewArgsSchema = lazySchema25(
5838
5890
  })
5839
5891
  )
5840
5892
  );
5841
- var webSearchPreviewInputSchema = lazySchema25(
5842
- () => zodSchema25(z27.object({}))
5843
- );
5844
- var webSearchPreviewOutputSchema = lazySchema25(
5893
+ var webSearchInputSchema = lazySchema25(() => zodSchema25(z27.object({})));
5894
+ var webSearchOutputSchema = lazySchema25(
5845
5895
  () => zodSchema25(
5846
5896
  z27.object({
5847
5897
  action: z27.discriminatedUnion("type", [
5848
5898
  z27.object({
5849
5899
  type: z27.literal("search"),
5850
- query: z27.string().optional()
5900
+ query: z27.string().optional(),
5901
+ queries: z27.array(z27.string()).optional()
5851
5902
  }),
5852
5903
  z27.object({
5853
5904
  type: z27.literal("openPage"),
@@ -5858,11 +5909,69 @@ var webSearchPreviewOutputSchema = lazySchema25(
5858
5909
  url: z27.string().nullish(),
5859
5910
  pattern: z27.string().nullish()
5860
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
+ })
5861
5970
  ]).optional()
5862
5971
  })
5863
5972
  )
5864
5973
  );
5865
- var webSearchPreview = createProviderExecutedToolFactory6({
5974
+ var webSearchPreview = createProviderExecutedToolFactory7({
5866
5975
  id: "openai.web_search_preview",
5867
5976
  inputSchema: webSearchPreviewInputSchema,
5868
5977
  outputSchema: webSearchPreviewOutputSchema
@@ -6066,6 +6175,12 @@ async function prepareResponsesTools({
6066
6175
  resolvedCustomProviderToolNames.add(tool.name);
6067
6176
  break;
6068
6177
  }
6178
+ case "openai.programmatic_tool_calling": {
6179
+ openaiTools.push({
6180
+ type: "programmatic_tool_calling"
6181
+ });
6182
+ break;
6183
+ }
6069
6184
  case "openai.tool_search": {
6070
6185
  const args = await validateTypes2({
6071
6186
  value: tool.args,
@@ -6120,7 +6235,7 @@ async function prepareResponsesTools({
6120
6235
  const resolvedToolName = (_c = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _c : toolChoice.toolName;
6121
6236
  return {
6122
6237
  tools: openaiTools,
6123
- 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 },
6124
6239
  toolWarnings
6125
6240
  };
6126
6241
  }
@@ -6143,7 +6258,9 @@ function prepareFunctionTool({
6143
6258
  description: tool.description,
6144
6259
  parameters: tool.inputSchema,
6145
6260
  ...tool.strict != null ? { strict: tool.strict } : {},
6146
- ...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 } : {}
6147
6264
  };
6148
6265
  }
6149
6266
  function mapShellEnvironment(environment) {
@@ -6375,7 +6492,8 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6375
6492
  "openai.web_search_preview": "web_search_preview",
6376
6493
  "openai.mcp": "mcp",
6377
6494
  "openai.apply_patch": "apply_patch",
6378
- "openai.tool_search": "tool_search"
6495
+ "openai.tool_search": "tool_search",
6496
+ "openai.programmatic_tool_calling": "programmatic_tool_calling"
6379
6497
  }
6380
6498
  });
6381
6499
  const customProviderToolNames = /* @__PURE__ */ new Set();
@@ -6862,7 +6980,52 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6862
6980
  providerMetadata: {
6863
6981
  [providerOptionsName]: {
6864
6982
  itemId: part.id,
6865
- ...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
6866
7029
  }
6867
7030
  }
6868
7031
  });
@@ -7414,10 +7577,51 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7414
7577
  itemId: value.item.id,
7415
7578
  ...value.item.namespace != null && {
7416
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
7417
7586
  }
7418
7587
  }
7419
7588
  }
7420
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
+ });
7421
7625
  } else if (value.item.type === "custom_tool_call") {
7422
7626
  ongoingToolCalls[value.output_index] = void 0;
7423
7627
  hasFunctionCall = true;
@@ -8204,6 +8408,9 @@ export {
8204
8408
  openaiLanguageModelChatOptions,
8205
8409
  openaiLanguageModelCompletionOptions,
8206
8410
  openaiSpeechModelOptionsSchema,
8411
+ programmaticToolCalling,
8412
+ programmaticToolCallingInputSchema,
8413
+ programmaticToolCallingOutputSchema,
8207
8414
  webSearch,
8208
8415
  webSearchArgsSchema,
8209
8416
  webSearchOutputSchema,