@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.
package/dist/index.js CHANGED
@@ -3108,6 +3108,37 @@ var mcpToolFactory = createProviderExecutedToolFactory6({
3108
3108
  });
3109
3109
  var mcp = (args) => mcpToolFactory(args);
3110
3110
 
3111
+ // src/tool/programmatic-tool-calling.ts
3112
+ import {
3113
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
3114
+ lazySchema as lazySchema23,
3115
+ zodSchema as zodSchema23
3116
+ } from "@ai-sdk/provider-utils";
3117
+ import { z as z24 } from "zod/v4";
3118
+ var programmaticToolCallingInputSchema = lazySchema23(
3119
+ () => zodSchema23(
3120
+ z24.object({
3121
+ code: z24.string(),
3122
+ fingerprint: z24.string()
3123
+ })
3124
+ )
3125
+ );
3126
+ var programmaticToolCallingOutputSchema = lazySchema23(
3127
+ () => zodSchema23(
3128
+ z24.object({
3129
+ result: z24.string(),
3130
+ status: z24.enum(["completed", "incomplete"])
3131
+ })
3132
+ )
3133
+ );
3134
+ var programmaticToolCallingFactory = createProviderExecutedToolFactory7({
3135
+ id: "openai.programmatic_tool_calling",
3136
+ inputSchema: programmaticToolCallingInputSchema,
3137
+ outputSchema: programmaticToolCallingOutputSchema,
3138
+ supportsDeferredResults: true
3139
+ });
3140
+ var programmaticToolCalling = () => programmaticToolCallingFactory({});
3141
+
3111
3142
  // src/openai-tools.ts
3112
3143
  var openaiTools = {
3113
3144
  /**
@@ -3222,6 +3253,11 @@ var openaiTools = {
3222
3253
  * @param serverUrl - URL for the MCP server.
3223
3254
  */
3224
3255
  mcp,
3256
+ /**
3257
+ * Programmatic Tool Calling lets OpenAI Responses models write and execute
3258
+ * JavaScript that orchestrates eligible tools.
3259
+ */
3260
+ programmaticToolCalling,
3225
3261
  /**
3226
3262
  * Tool search allows the model to dynamically search for and load deferred
3227
3263
  * tools into the model's context as needed. This helps reduce overall token
@@ -3695,10 +3731,13 @@ import {
3695
3731
  resolveProviderReference as resolveProviderReference2,
3696
3732
  validateTypes
3697
3733
  } from "@ai-sdk/provider-utils";
3698
- import { z as z24 } from "zod/v4";
3734
+ import { z as z25 } from "zod/v4";
3699
3735
  function serializeToolCallArguments2(input) {
3700
3736
  return JSON.stringify(input === void 0 ? {} : input);
3701
3737
  }
3738
+ function mapToolCaller(caller) {
3739
+ return caller == null ? void 0 : caller.type === "program" ? { type: "program", caller_id: caller.callerId } : caller;
3740
+ }
3702
3741
  function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
3703
3742
  var _a;
3704
3743
  return (_a = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a.promptCacheBreakpoint;
@@ -3723,7 +3762,7 @@ async function convertToOpenAIResponsesInput({
3723
3762
  hasComputerTool = false,
3724
3763
  customProviderToolNames
3725
3764
  }) {
3726
- 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;
3765
+ 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;
3727
3766
  let input = [];
3728
3767
  const warnings = [];
3729
3768
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3909,6 +3948,7 @@ async function convertToOpenAIResponsesInput({
3909
3948
  case "tool-call": {
3910
3949
  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;
3911
3950
  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;
3951
+ const caller = (_m = (_l = part.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.caller;
3912
3952
  if (hasConversation && id != null) {
3913
3953
  break;
3914
3954
  }
@@ -3932,12 +3972,30 @@ async function convertToOpenAIResponsesInput({
3932
3972
  type: "tool_search_call",
3933
3973
  id: id != null ? id : part.toolCallId,
3934
3974
  execution,
3935
- call_id: (_l = parsedInput.call_id) != null ? _l : null,
3975
+ call_id: (_n = parsedInput.call_id) != null ? _n : null,
3936
3976
  status: "completed",
3937
3977
  arguments: parsedInput.arguments
3938
3978
  });
3939
3979
  break;
3940
3980
  }
3981
+ if (resolvedToolName === "programmatic_tool_calling") {
3982
+ if (store && id != null) {
3983
+ input.push({ type: "item_reference", id });
3984
+ break;
3985
+ }
3986
+ const parsedInput = await validateTypes({
3987
+ value: part.input,
3988
+ schema: programmaticToolCallingInputSchema
3989
+ });
3990
+ input.push({
3991
+ type: "program",
3992
+ id: id != null ? id : part.toolCallId,
3993
+ call_id: part.toolCallId,
3994
+ code: parsedInput.code,
3995
+ fingerprint: parsedInput.fingerprint
3996
+ });
3997
+ break;
3998
+ }
3941
3999
  if (part.providerExecuted) {
3942
4000
  if (store && id != null) {
3943
4001
  input.push({ type: "item_reference", id });
@@ -3947,7 +4005,7 @@ async function convertToOpenAIResponsesInput({
3947
4005
  if (hasPreviousResponseId && store && id != null) {
3948
4006
  break;
3949
4007
  }
3950
- 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);
4008
+ 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);
3951
4009
  if (store && id != null && isProviderDefinedToolCall) {
3952
4010
  input.push({ type: "item_reference", id });
3953
4011
  break;
@@ -4066,7 +4124,10 @@ async function convertToOpenAIResponsesInput({
4066
4124
  call_id: part.toolCallId,
4067
4125
  name: resolvedToolName,
4068
4126
  arguments: serializeToolCallArguments2(part.input),
4069
- ...namespace != null && { namespace }
4127
+ ...namespace != null && { namespace },
4128
+ ...caller != null && {
4129
+ caller: mapToolCaller(caller)
4130
+ }
4070
4131
  });
4071
4132
  break;
4072
4133
  }
@@ -4082,7 +4143,7 @@ async function convertToOpenAIResponsesInput({
4082
4143
  part.toolName
4083
4144
  );
4084
4145
  if (resolvedResultToolName === "tool_search") {
4085
- 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;
4146
+ 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;
4086
4147
  if (store) {
4087
4148
  input.push({ type: "item_reference", id: itemId });
4088
4149
  } else if (part.output.type === "json") {
@@ -4101,6 +4162,25 @@ async function convertToOpenAIResponsesInput({
4101
4162
  }
4102
4163
  break;
4103
4164
  }
4165
+ if (resolvedResultToolName === "programmatic_tool_calling") {
4166
+ 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;
4167
+ if (store) {
4168
+ input.push({ type: "item_reference", id: itemId });
4169
+ } else if (part.output.type === "json") {
4170
+ const parsedOutput = await validateTypes({
4171
+ value: part.output.value,
4172
+ schema: programmaticToolCallingOutputSchema
4173
+ });
4174
+ input.push({
4175
+ type: "program_output",
4176
+ id: itemId,
4177
+ call_id: part.toolCallId,
4178
+ result: parsedOutput.result,
4179
+ status: parsedOutput.status
4180
+ });
4181
+ }
4182
+ break;
4183
+ }
4104
4184
  if (hasShellTool && resolvedResultToolName === "shell") {
4105
4185
  if (part.output.type === "json") {
4106
4186
  const parsedOutput = await validateTypes({
@@ -4123,7 +4203,7 @@ async function convertToOpenAIResponsesInput({
4123
4203
  break;
4124
4204
  }
4125
4205
  if (store) {
4126
- const itemId = (_v = (_u = (_t = part.providerOptions) == null ? void 0 : _t[providerOptionsName]) == null ? void 0 : _u.itemId) != null ? _v : part.toolCallId;
4206
+ const itemId = (_D = (_C = (_B = part.providerOptions) == null ? void 0 : _B[providerOptionsName]) == null ? void 0 : _C.itemId) != null ? _D : part.toolCallId;
4127
4207
  input.push({ type: "item_reference", id: itemId });
4128
4208
  } else {
4129
4209
  warnings.push({
@@ -4208,7 +4288,7 @@ async function convertToOpenAIResponsesInput({
4208
4288
  }
4209
4289
  case "custom": {
4210
4290
  if (part.kind === "openai.compaction") {
4211
- const providerOptions2 = (_w = part.providerOptions) == null ? void 0 : _w[providerOptionsName];
4291
+ const providerOptions2 = (_E = part.providerOptions) == null ? void 0 : _E[providerOptionsName];
4212
4292
  const id = providerOptions2 == null ? void 0 : providerOptions2.itemId;
4213
4293
  if (hasConversation && id != null) {
4214
4294
  break;
@@ -4255,7 +4335,7 @@ async function convertToOpenAIResponsesInput({
4255
4335
  }
4256
4336
  const output = part.output;
4257
4337
  if (output.type === "execution-denied") {
4258
- const approvalId = (_y = (_x = output.providerOptions) == null ? void 0 : _x.openai) == null ? void 0 : _y.approvalId;
4338
+ const approvalId = (_G = (_F = output.providerOptions) == null ? void 0 : _F.openai) == null ? void 0 : _G.approvalId;
4259
4339
  if (approvalId) {
4260
4340
  continue;
4261
4341
  }
@@ -4335,7 +4415,7 @@ async function convertToOpenAIResponsesInput({
4335
4415
  file_id: parsedOutput.output.fileId,
4336
4416
  detail: parsedOutput.output.detail
4337
4417
  },
4338
- acknowledged_safety_checks: (_z = parsedOutput.acknowledgedSafetyChecks) == null ? void 0 : _z.map((safetyCheck) => ({
4418
+ acknowledged_safety_checks: (_H = parsedOutput.acknowledgedSafetyChecks) == null ? void 0 : _H.map((safetyCheck) => ({
4339
4419
  id: safetyCheck.id,
4340
4420
  code: safetyCheck.code,
4341
4421
  message: safetyCheck.message
@@ -4351,7 +4431,7 @@ async function convertToOpenAIResponsesInput({
4351
4431
  outputValue = output.value;
4352
4432
  break;
4353
4433
  case "execution-denied":
4354
- outputValue = (_A = output.reason) != null ? _A : "Tool call execution denied.";
4434
+ outputValue = (_I = output.reason) != null ? _I : "Tool call execution denied.";
4355
4435
  break;
4356
4436
  case "json":
4357
4437
  case "error-json":
@@ -4450,7 +4530,7 @@ async function convertToOpenAIResponsesInput({
4450
4530
  contentValue = output.value;
4451
4531
  break;
4452
4532
  case "execution-denied":
4453
- contentValue = (_B = output.reason) != null ? _B : "Tool call execution denied.";
4533
+ contentValue = (_J = output.reason) != null ? _J : "Tool call execution denied.";
4454
4534
  break;
4455
4535
  case "json":
4456
4536
  case "error-json":
@@ -4535,10 +4615,14 @@ async function convertToOpenAIResponsesInput({
4535
4615
  }).filter(isNonNullable);
4536
4616
  break;
4537
4617
  }
4618
+ const caller = mapToolCaller(
4619
+ (_L = (_K = part.providerOptions) == null ? void 0 : _K[providerOptionsName]) == null ? void 0 : _L.caller
4620
+ );
4538
4621
  input.push({
4539
4622
  type: "function_call_output",
4540
4623
  call_id: part.toolCallId,
4541
- output: contentValue
4624
+ output: contentValue,
4625
+ ...caller != null && { caller }
4542
4626
  });
4543
4627
  }
4544
4628
  break;
@@ -4562,9 +4646,9 @@ async function convertToOpenAIResponsesInput({
4562
4646
  }
4563
4647
  return { input, warnings };
4564
4648
  }
4565
- var openaiResponsesReasoningProviderOptionsSchema = z24.object({
4566
- itemId: z24.string().nullish(),
4567
- reasoningEncryptedContent: z24.string().nullish()
4649
+ var openaiResponsesReasoningProviderOptionsSchema = z25.object({
4650
+ itemId: z25.string().nullish(),
4651
+ reasoningEncryptedContent: z25.string().nullish()
4568
4652
  });
4569
4653
 
4570
4654
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4587,643 +4671,670 @@ function mapOpenAIResponseFinishReason({
4587
4671
 
4588
4672
  // src/responses/openai-responses-api.ts
4589
4673
  import {
4590
- lazySchema as lazySchema23,
4591
- zodSchema as zodSchema23
4674
+ lazySchema as lazySchema24,
4675
+ zodSchema as zodSchema24
4592
4676
  } from "@ai-sdk/provider-utils";
4593
- import { z as z25 } from "zod/v4";
4594
- var jsonValueSchema2 = z25.lazy(
4595
- () => z25.union([
4596
- z25.string(),
4597
- z25.number(),
4598
- z25.boolean(),
4599
- z25.null(),
4600
- z25.array(jsonValueSchema2),
4601
- z25.record(z25.string(), jsonValueSchema2.optional())
4677
+ import { z as z26 } from "zod/v4";
4678
+ var jsonValueSchema2 = z26.lazy(
4679
+ () => z26.union([
4680
+ z26.string(),
4681
+ z26.number(),
4682
+ z26.boolean(),
4683
+ z26.null(),
4684
+ z26.array(jsonValueSchema2),
4685
+ z26.record(z26.string(), jsonValueSchema2.optional())
4602
4686
  ])
4603
4687
  );
4604
- var openaiResponsesComputerSafetyCheckSchema = z25.object({
4605
- id: z25.string(),
4606
- code: z25.string().nullish(),
4607
- message: z25.string().nullish()
4688
+ var openaiResponsesComputerSafetyCheckSchema = z26.object({
4689
+ id: z26.string(),
4690
+ code: z26.string().nullish(),
4691
+ message: z26.string().nullish()
4608
4692
  });
4609
- var openaiResponsesComputerActionSchema = z25.discriminatedUnion("type", [
4610
- z25.object({
4611
- type: z25.literal("click"),
4612
- button: z25.enum(["left", "right", "wheel", "back", "forward"]),
4613
- x: z25.number(),
4614
- y: z25.number(),
4615
- keys: z25.array(z25.string()).nullish()
4693
+ var openaiResponsesComputerActionSchema = z26.discriminatedUnion("type", [
4694
+ z26.object({
4695
+ type: z26.literal("click"),
4696
+ button: z26.enum(["left", "right", "wheel", "back", "forward"]),
4697
+ x: z26.number(),
4698
+ y: z26.number(),
4699
+ keys: z26.array(z26.string()).nullish()
4616
4700
  }),
4617
- z25.object({
4618
- type: z25.literal("double_click"),
4619
- x: z25.number(),
4620
- y: z25.number(),
4621
- keys: z25.array(z25.string()).nullish()
4701
+ z26.object({
4702
+ type: z26.literal("double_click"),
4703
+ x: z26.number(),
4704
+ y: z26.number(),
4705
+ keys: z26.array(z26.string()).nullish()
4622
4706
  }),
4623
- z25.object({
4624
- type: z25.literal("drag"),
4625
- path: z25.array(z25.object({ x: z25.number(), y: z25.number() })),
4626
- keys: z25.array(z25.string()).nullish()
4707
+ z26.object({
4708
+ type: z26.literal("drag"),
4709
+ path: z26.array(z26.object({ x: z26.number(), y: z26.number() })),
4710
+ keys: z26.array(z26.string()).nullish()
4627
4711
  }),
4628
- z25.object({
4629
- type: z25.literal("keypress"),
4630
- keys: z25.array(z25.string())
4712
+ z26.object({
4713
+ type: z26.literal("keypress"),
4714
+ keys: z26.array(z26.string())
4631
4715
  }),
4632
- z25.object({
4633
- type: z25.literal("move"),
4634
- x: z25.number(),
4635
- y: z25.number(),
4636
- keys: z25.array(z25.string()).nullish()
4716
+ z26.object({
4717
+ type: z26.literal("move"),
4718
+ x: z26.number(),
4719
+ y: z26.number(),
4720
+ keys: z26.array(z26.string()).nullish()
4637
4721
  }),
4638
- z25.object({
4639
- type: z25.literal("screenshot")
4722
+ z26.object({
4723
+ type: z26.literal("screenshot")
4640
4724
  }),
4641
- z25.object({
4642
- type: z25.literal("scroll"),
4643
- x: z25.number(),
4644
- y: z25.number(),
4645
- scroll_x: z25.number(),
4646
- scroll_y: z25.number(),
4647
- keys: z25.array(z25.string()).nullish()
4725
+ z26.object({
4726
+ type: z26.literal("scroll"),
4727
+ x: z26.number(),
4728
+ y: z26.number(),
4729
+ scroll_x: z26.number(),
4730
+ scroll_y: z26.number(),
4731
+ keys: z26.array(z26.string()).nullish()
4648
4732
  }),
4649
- z25.object({
4650
- type: z25.literal("type"),
4651
- text: z25.string()
4733
+ z26.object({
4734
+ type: z26.literal("type"),
4735
+ text: z26.string()
4652
4736
  }),
4653
- z25.object({
4654
- type: z25.literal("wait")
4737
+ z26.object({
4738
+ type: z26.literal("wait")
4655
4739
  })
4656
4740
  ]);
4657
- var openaiResponsesComputerCallSchema = z25.object({
4658
- type: z25.literal("computer_call"),
4659
- id: z25.string(),
4660
- call_id: z25.string().nullish(),
4661
- status: z25.enum(["in_progress", "completed", "incomplete"]),
4741
+ var openaiResponsesComputerCallSchema = z26.object({
4742
+ type: z26.literal("computer_call"),
4743
+ id: z26.string(),
4744
+ call_id: z26.string().nullish(),
4745
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
4662
4746
  action: openaiResponsesComputerActionSchema.nullish(),
4663
- actions: z25.array(openaiResponsesComputerActionSchema).nullish(),
4664
- pending_safety_checks: z25.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4747
+ actions: z26.array(openaiResponsesComputerActionSchema).nullish(),
4748
+ pending_safety_checks: z26.array(openaiResponsesComputerSafetyCheckSchema).nullish()
4665
4749
  });
4666
- var openaiResponsesNestedErrorChunkSchema = z25.object({
4667
- type: z25.literal("error"),
4668
- sequence_number: z25.number(),
4669
- error: z25.object({
4670
- type: z25.string(),
4671
- code: z25.string(),
4672
- message: z25.string(),
4673
- param: z25.string().nullish()
4750
+ var openaiResponsesToolCallerSchema = z26.discriminatedUnion("type", [
4751
+ z26.object({ type: z26.literal("direct") }),
4752
+ z26.object({
4753
+ type: z26.literal("program"),
4754
+ caller_id: z26.string()
4674
4755
  })
4756
+ ]);
4757
+ var openaiResponsesProgramSchema = z26.object({
4758
+ type: z26.literal("program"),
4759
+ id: z26.string(),
4760
+ call_id: z26.string(),
4761
+ code: z26.string(),
4762
+ fingerprint: z26.string()
4675
4763
  });
4676
- var openaiResponsesErrorChunkSchema = z25.object({
4677
- type: z25.literal("error"),
4678
- sequence_number: z25.number(),
4679
- code: z25.string().nullish(),
4680
- message: z25.string(),
4681
- param: z25.string().nullish()
4764
+ var openaiResponsesProgramOutputSchema = z26.object({
4765
+ type: z26.literal("program_output"),
4766
+ id: z26.string(),
4767
+ call_id: z26.string(),
4768
+ result: z26.string(),
4769
+ status: z26.enum(["completed", "incomplete"])
4682
4770
  });
4683
- var openaiResponsesChunkSchema = lazySchema23(
4684
- () => zodSchema23(
4685
- z25.union([
4686
- z25.object({
4687
- type: z25.literal("response.output_text.delta"),
4688
- item_id: z25.string(),
4689
- delta: z25.string(),
4690
- logprobs: z25.array(
4691
- z25.object({
4692
- token: z25.string(),
4693
- logprob: z25.number(),
4694
- top_logprobs: z25.array(
4695
- z25.object({
4696
- token: z25.string(),
4697
- logprob: z25.number()
4771
+ var openaiResponsesNestedErrorChunkSchema = z26.object({
4772
+ type: z26.literal("error"),
4773
+ sequence_number: z26.number(),
4774
+ error: z26.object({
4775
+ type: z26.string(),
4776
+ code: z26.string(),
4777
+ message: z26.string(),
4778
+ param: z26.string().nullish()
4779
+ })
4780
+ });
4781
+ var openaiResponsesErrorChunkSchema = z26.object({
4782
+ type: z26.literal("error"),
4783
+ sequence_number: z26.number(),
4784
+ code: z26.string().nullish(),
4785
+ message: z26.string(),
4786
+ param: z26.string().nullish()
4787
+ });
4788
+ var openaiResponsesChunkSchema = lazySchema24(
4789
+ () => zodSchema24(
4790
+ z26.union([
4791
+ z26.object({
4792
+ type: z26.literal("response.output_text.delta"),
4793
+ item_id: z26.string(),
4794
+ delta: z26.string(),
4795
+ logprobs: z26.array(
4796
+ z26.object({
4797
+ token: z26.string(),
4798
+ logprob: z26.number(),
4799
+ top_logprobs: z26.array(
4800
+ z26.object({
4801
+ token: z26.string(),
4802
+ logprob: z26.number()
4698
4803
  })
4699
4804
  )
4700
4805
  })
4701
4806
  ).nullish()
4702
4807
  }),
4703
- z25.object({
4704
- type: z25.enum(["response.completed", "response.incomplete"]),
4705
- response: z25.object({
4706
- incomplete_details: z25.object({ reason: z25.string() }).nullish(),
4707
- usage: z25.object({
4708
- input_tokens: z25.number(),
4709
- input_tokens_details: z25.object({
4710
- cached_tokens: z25.number().nullish(),
4711
- cache_write_tokens: z25.number().nullish(),
4712
- orchestration_input_tokens: z25.number().nullish(),
4713
- orchestration_input_cached_tokens: z25.number().nullish()
4808
+ z26.object({
4809
+ type: z26.enum(["response.completed", "response.incomplete"]),
4810
+ response: z26.object({
4811
+ incomplete_details: z26.object({ reason: z26.string() }).nullish(),
4812
+ usage: z26.object({
4813
+ input_tokens: z26.number(),
4814
+ input_tokens_details: z26.object({
4815
+ cached_tokens: z26.number().nullish(),
4816
+ cache_write_tokens: z26.number().nullish(),
4817
+ orchestration_input_tokens: z26.number().nullish(),
4818
+ orchestration_input_cached_tokens: z26.number().nullish()
4714
4819
  }).nullish(),
4715
- output_tokens: z25.number(),
4716
- output_tokens_details: z25.object({
4717
- reasoning_tokens: z25.number().nullish(),
4718
- orchestration_output_tokens: z25.number().nullish()
4820
+ output_tokens: z26.number(),
4821
+ output_tokens_details: z26.object({
4822
+ reasoning_tokens: z26.number().nullish(),
4823
+ orchestration_output_tokens: z26.number().nullish()
4719
4824
  }).nullish()
4720
4825
  }),
4721
- reasoning: z25.object({
4722
- context: z25.string().nullish()
4826
+ reasoning: z26.object({
4827
+ context: z26.string().nullish()
4723
4828
  }).nullish(),
4724
- service_tier: z25.string().nullish()
4829
+ service_tier: z26.string().nullish()
4725
4830
  })
4726
4831
  }),
4727
- z25.object({
4728
- type: z25.literal("response.failed"),
4729
- sequence_number: z25.number(),
4730
- response: z25.object({
4731
- error: z25.object({
4732
- code: z25.string().nullish(),
4733
- message: z25.string()
4832
+ z26.object({
4833
+ type: z26.literal("response.failed"),
4834
+ sequence_number: z26.number(),
4835
+ response: z26.object({
4836
+ error: z26.object({
4837
+ code: z26.string().nullish(),
4838
+ message: z26.string()
4734
4839
  }).nullish(),
4735
- incomplete_details: z25.object({ reason: z25.string() }).nullish(),
4736
- usage: z25.object({
4737
- input_tokens: z25.number(),
4738
- input_tokens_details: z25.object({
4739
- cached_tokens: z25.number().nullish(),
4740
- cache_write_tokens: z25.number().nullish(),
4741
- orchestration_input_tokens: z25.number().nullish(),
4742
- orchestration_input_cached_tokens: z25.number().nullish()
4840
+ incomplete_details: z26.object({ reason: z26.string() }).nullish(),
4841
+ usage: z26.object({
4842
+ input_tokens: z26.number(),
4843
+ input_tokens_details: z26.object({
4844
+ cached_tokens: z26.number().nullish(),
4845
+ cache_write_tokens: z26.number().nullish(),
4846
+ orchestration_input_tokens: z26.number().nullish(),
4847
+ orchestration_input_cached_tokens: z26.number().nullish()
4743
4848
  }).nullish(),
4744
- output_tokens: z25.number(),
4745
- output_tokens_details: z25.object({
4746
- reasoning_tokens: z25.number().nullish(),
4747
- orchestration_output_tokens: z25.number().nullish()
4849
+ output_tokens: z26.number(),
4850
+ output_tokens_details: z26.object({
4851
+ reasoning_tokens: z26.number().nullish(),
4852
+ orchestration_output_tokens: z26.number().nullish()
4748
4853
  }).nullish()
4749
4854
  }).nullish(),
4750
- reasoning: z25.object({
4751
- context: z25.string().nullish()
4855
+ reasoning: z26.object({
4856
+ context: z26.string().nullish()
4752
4857
  }).nullish(),
4753
- service_tier: z25.string().nullish()
4858
+ service_tier: z26.string().nullish()
4754
4859
  })
4755
4860
  }),
4756
- z25.object({
4757
- type: z25.literal("response.created"),
4758
- response: z25.object({
4759
- id: z25.string(),
4760
- created_at: z25.number(),
4761
- model: z25.string(),
4762
- service_tier: z25.string().nullish()
4861
+ z26.object({
4862
+ type: z26.literal("response.created"),
4863
+ response: z26.object({
4864
+ id: z26.string(),
4865
+ created_at: z26.number(),
4866
+ model: z26.string(),
4867
+ service_tier: z26.string().nullish()
4763
4868
  })
4764
4869
  }),
4765
- z25.object({
4766
- type: z25.literal("response.output_item.added"),
4767
- output_index: z25.number(),
4768
- item: z25.discriminatedUnion("type", [
4769
- z25.object({
4770
- type: z25.literal("message"),
4771
- id: z25.string(),
4772
- phase: z25.enum(["commentary", "final_answer"]).nullish()
4870
+ z26.object({
4871
+ type: z26.literal("response.output_item.added"),
4872
+ output_index: z26.number(),
4873
+ item: z26.discriminatedUnion("type", [
4874
+ z26.object({
4875
+ type: z26.literal("message"),
4876
+ id: z26.string(),
4877
+ phase: z26.enum(["commentary", "final_answer"]).nullish()
4773
4878
  }),
4774
- z25.object({
4775
- type: z25.literal("reasoning"),
4776
- id: z25.string(),
4777
- encrypted_content: z25.string().nullish()
4879
+ z26.object({
4880
+ type: z26.literal("reasoning"),
4881
+ id: z26.string(),
4882
+ encrypted_content: z26.string().nullish()
4778
4883
  }),
4779
- z25.object({
4780
- type: z25.literal("function_call"),
4781
- id: z25.string(),
4782
- call_id: z25.string(),
4783
- name: z25.string(),
4784
- arguments: z25.string(),
4785
- namespace: z25.string().nullish()
4884
+ z26.object({
4885
+ type: z26.literal("function_call"),
4886
+ id: z26.string(),
4887
+ call_id: z26.string(),
4888
+ name: z26.string(),
4889
+ arguments: z26.string(),
4890
+ namespace: z26.string().nullish(),
4891
+ caller: openaiResponsesToolCallerSchema.nullish()
4786
4892
  }),
4787
- z25.object({
4788
- type: z25.literal("web_search_call"),
4789
- id: z25.string(),
4790
- status: z25.string()
4893
+ openaiResponsesProgramSchema,
4894
+ openaiResponsesProgramOutputSchema,
4895
+ z26.object({
4896
+ type: z26.literal("web_search_call"),
4897
+ id: z26.string(),
4898
+ status: z26.string()
4791
4899
  }),
4792
4900
  openaiResponsesComputerCallSchema,
4793
- z25.object({
4794
- type: z25.literal("file_search_call"),
4795
- id: z25.string()
4901
+ z26.object({
4902
+ type: z26.literal("file_search_call"),
4903
+ id: z26.string()
4796
4904
  }),
4797
- z25.object({
4798
- type: z25.literal("image_generation_call"),
4799
- id: z25.string()
4905
+ z26.object({
4906
+ type: z26.literal("image_generation_call"),
4907
+ id: z26.string()
4800
4908
  }),
4801
- z25.object({
4802
- type: z25.literal("code_interpreter_call"),
4803
- id: z25.string(),
4804
- container_id: z25.string(),
4805
- code: z25.string().nullable(),
4806
- outputs: z25.array(
4807
- z25.discriminatedUnion("type", [
4808
- z25.object({ type: z25.literal("logs"), logs: z25.string() }),
4809
- z25.object({ type: z25.literal("image"), url: z25.string() })
4909
+ z26.object({
4910
+ type: z26.literal("code_interpreter_call"),
4911
+ id: z26.string(),
4912
+ container_id: z26.string(),
4913
+ code: z26.string().nullable(),
4914
+ outputs: z26.array(
4915
+ z26.discriminatedUnion("type", [
4916
+ z26.object({ type: z26.literal("logs"), logs: z26.string() }),
4917
+ z26.object({ type: z26.literal("image"), url: z26.string() })
4810
4918
  ])
4811
4919
  ).nullable(),
4812
- status: z25.string()
4920
+ status: z26.string()
4813
4921
  }),
4814
- z25.object({
4815
- type: z25.literal("mcp_call"),
4816
- id: z25.string(),
4817
- status: z25.string(),
4818
- approval_request_id: z25.string().nullish()
4922
+ z26.object({
4923
+ type: z26.literal("mcp_call"),
4924
+ id: z26.string(),
4925
+ status: z26.string(),
4926
+ approval_request_id: z26.string().nullish()
4819
4927
  }),
4820
- z25.object({
4821
- type: z25.literal("mcp_list_tools"),
4822
- id: z25.string()
4928
+ z26.object({
4929
+ type: z26.literal("mcp_list_tools"),
4930
+ id: z26.string()
4823
4931
  }),
4824
- z25.object({
4825
- type: z25.literal("mcp_approval_request"),
4826
- id: z25.string()
4932
+ z26.object({
4933
+ type: z26.literal("mcp_approval_request"),
4934
+ id: z26.string()
4827
4935
  }),
4828
- z25.object({
4829
- type: z25.literal("apply_patch_call"),
4830
- id: z25.string(),
4831
- call_id: z25.string(),
4832
- status: z25.enum(["in_progress", "completed"]),
4833
- operation: z25.discriminatedUnion("type", [
4834
- z25.object({
4835
- type: z25.literal("create_file"),
4836
- path: z25.string(),
4837
- diff: z25.string()
4936
+ z26.object({
4937
+ type: z26.literal("apply_patch_call"),
4938
+ id: z26.string(),
4939
+ call_id: z26.string(),
4940
+ status: z26.enum(["in_progress", "completed"]),
4941
+ operation: z26.discriminatedUnion("type", [
4942
+ z26.object({
4943
+ type: z26.literal("create_file"),
4944
+ path: z26.string(),
4945
+ diff: z26.string()
4838
4946
  }),
4839
- z25.object({
4840
- type: z25.literal("delete_file"),
4841
- path: z25.string()
4947
+ z26.object({
4948
+ type: z26.literal("delete_file"),
4949
+ path: z26.string()
4842
4950
  }),
4843
- z25.object({
4844
- type: z25.literal("update_file"),
4845
- path: z25.string(),
4846
- diff: z25.string()
4951
+ z26.object({
4952
+ type: z26.literal("update_file"),
4953
+ path: z26.string(),
4954
+ diff: z26.string()
4847
4955
  })
4848
4956
  ])
4849
4957
  }),
4850
- z25.object({
4851
- type: z25.literal("custom_tool_call"),
4852
- id: z25.string(),
4853
- call_id: z25.string(),
4854
- name: z25.string(),
4855
- input: z25.string()
4958
+ z26.object({
4959
+ type: z26.literal("custom_tool_call"),
4960
+ id: z26.string(),
4961
+ call_id: z26.string(),
4962
+ name: z26.string(),
4963
+ input: z26.string()
4856
4964
  }),
4857
- z25.object({
4858
- type: z25.literal("shell_call"),
4859
- id: z25.string(),
4860
- call_id: z25.string(),
4861
- status: z25.enum(["in_progress", "completed", "incomplete"]),
4862
- action: z25.object({
4863
- commands: z25.array(z25.string())
4965
+ z26.object({
4966
+ type: z26.literal("shell_call"),
4967
+ id: z26.string(),
4968
+ call_id: z26.string(),
4969
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
4970
+ action: z26.object({
4971
+ commands: z26.array(z26.string())
4864
4972
  })
4865
4973
  }),
4866
- z25.object({
4867
- type: z25.literal("compaction"),
4868
- id: z25.string(),
4869
- encrypted_content: z25.string().nullish()
4974
+ z26.object({
4975
+ type: z26.literal("compaction"),
4976
+ id: z26.string(),
4977
+ encrypted_content: z26.string().nullish()
4870
4978
  }),
4871
- z25.object({
4872
- type: z25.literal("shell_call_output"),
4873
- id: z25.string(),
4874
- call_id: z25.string(),
4875
- status: z25.enum(["in_progress", "completed", "incomplete"]),
4876
- output: z25.array(
4877
- z25.object({
4878
- stdout: z25.string(),
4879
- stderr: z25.string(),
4880
- outcome: z25.discriminatedUnion("type", [
4881
- z25.object({ type: z25.literal("timeout") }),
4882
- z25.object({
4883
- type: z25.literal("exit"),
4884
- exit_code: z25.number()
4979
+ z26.object({
4980
+ type: z26.literal("shell_call_output"),
4981
+ id: z26.string(),
4982
+ call_id: z26.string(),
4983
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
4984
+ output: z26.array(
4985
+ z26.object({
4986
+ stdout: z26.string(),
4987
+ stderr: z26.string(),
4988
+ outcome: z26.discriminatedUnion("type", [
4989
+ z26.object({ type: z26.literal("timeout") }),
4990
+ z26.object({
4991
+ type: z26.literal("exit"),
4992
+ exit_code: z26.number()
4885
4993
  })
4886
4994
  ])
4887
4995
  })
4888
4996
  )
4889
4997
  }),
4890
- z25.object({
4891
- type: z25.literal("tool_search_call"),
4892
- id: z25.string(),
4893
- execution: z25.enum(["server", "client"]),
4894
- call_id: z25.string().nullable(),
4895
- status: z25.enum(["in_progress", "completed", "incomplete"]),
4896
- arguments: z25.unknown()
4998
+ z26.object({
4999
+ type: z26.literal("tool_search_call"),
5000
+ id: z26.string(),
5001
+ execution: z26.enum(["server", "client"]),
5002
+ call_id: z26.string().nullable(),
5003
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5004
+ arguments: z26.unknown()
4897
5005
  }),
4898
- z25.object({
4899
- type: z25.literal("tool_search_output"),
4900
- id: z25.string(),
4901
- execution: z25.enum(["server", "client"]),
4902
- call_id: z25.string().nullable(),
4903
- status: z25.enum(["in_progress", "completed", "incomplete"]),
4904
- tools: z25.array(z25.record(z25.string(), jsonValueSchema2.optional()))
5006
+ z26.object({
5007
+ type: z26.literal("tool_search_output"),
5008
+ id: z26.string(),
5009
+ execution: z26.enum(["server", "client"]),
5010
+ call_id: z26.string().nullable(),
5011
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5012
+ tools: z26.array(z26.record(z26.string(), jsonValueSchema2.optional()))
4905
5013
  })
4906
5014
  ])
4907
5015
  }),
4908
- z25.object({
4909
- type: z25.literal("response.output_item.done"),
4910
- output_index: z25.number(),
4911
- item: z25.discriminatedUnion("type", [
4912
- z25.object({
4913
- type: z25.literal("message"),
4914
- id: z25.string(),
4915
- phase: z25.enum(["commentary", "final_answer"]).nullish()
5016
+ z26.object({
5017
+ type: z26.literal("response.output_item.done"),
5018
+ output_index: z26.number(),
5019
+ item: z26.discriminatedUnion("type", [
5020
+ z26.object({
5021
+ type: z26.literal("message"),
5022
+ id: z26.string(),
5023
+ phase: z26.enum(["commentary", "final_answer"]).nullish()
4916
5024
  }),
4917
- z25.object({
4918
- type: z25.literal("reasoning"),
4919
- id: z25.string(),
4920
- encrypted_content: z25.string().nullish()
5025
+ z26.object({
5026
+ type: z26.literal("reasoning"),
5027
+ id: z26.string(),
5028
+ encrypted_content: z26.string().nullish()
4921
5029
  }),
4922
- z25.object({
4923
- type: z25.literal("function_call"),
4924
- id: z25.string(),
4925
- call_id: z25.string(),
4926
- name: z25.string(),
4927
- arguments: z25.string(),
4928
- status: z25.literal("completed"),
4929
- namespace: z25.string().nullish()
5030
+ z26.object({
5031
+ type: z26.literal("function_call"),
5032
+ id: z26.string(),
5033
+ call_id: z26.string(),
5034
+ name: z26.string(),
5035
+ arguments: z26.string(),
5036
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5037
+ namespace: z26.string().nullish(),
5038
+ caller: openaiResponsesToolCallerSchema.nullish()
4930
5039
  }),
4931
- z25.object({
4932
- type: z25.literal("custom_tool_call"),
4933
- id: z25.string(),
4934
- call_id: z25.string(),
4935
- name: z25.string(),
4936
- input: z25.string(),
4937
- status: z25.literal("completed")
5040
+ openaiResponsesProgramSchema,
5041
+ openaiResponsesProgramOutputSchema,
5042
+ z26.object({
5043
+ type: z26.literal("custom_tool_call"),
5044
+ id: z26.string(),
5045
+ call_id: z26.string(),
5046
+ name: z26.string(),
5047
+ input: z26.string(),
5048
+ status: z26.literal("completed")
4938
5049
  }),
4939
- z25.object({
4940
- type: z25.literal("code_interpreter_call"),
4941
- id: z25.string(),
4942
- code: z25.string().nullable(),
4943
- container_id: z25.string(),
4944
- outputs: z25.array(
4945
- z25.discriminatedUnion("type", [
4946
- z25.object({ type: z25.literal("logs"), logs: z25.string() }),
4947
- z25.object({ type: z25.literal("image"), url: z25.string() })
5050
+ z26.object({
5051
+ type: z26.literal("code_interpreter_call"),
5052
+ id: z26.string(),
5053
+ code: z26.string().nullable(),
5054
+ container_id: z26.string(),
5055
+ outputs: z26.array(
5056
+ z26.discriminatedUnion("type", [
5057
+ z26.object({ type: z26.literal("logs"), logs: z26.string() }),
5058
+ z26.object({ type: z26.literal("image"), url: z26.string() })
4948
5059
  ])
4949
5060
  ).nullable()
4950
5061
  }),
4951
- z25.object({
4952
- type: z25.literal("image_generation_call"),
4953
- id: z25.string(),
4954
- result: z25.string()
5062
+ z26.object({
5063
+ type: z26.literal("image_generation_call"),
5064
+ id: z26.string(),
5065
+ result: z26.string()
4955
5066
  }),
4956
- z25.object({
4957
- type: z25.literal("web_search_call"),
4958
- id: z25.string(),
4959
- status: z25.string(),
4960
- action: z25.discriminatedUnion("type", [
4961
- z25.object({
4962
- type: z25.literal("search"),
4963
- query: z25.string().nullish(),
4964
- queries: z25.array(z25.string()).nullish(),
4965
- sources: z25.array(
4966
- z25.discriminatedUnion("type", [
4967
- z25.object({ type: z25.literal("url"), url: z25.string() }),
4968
- z25.object({ type: z25.literal("api"), name: z25.string() })
5067
+ z26.object({
5068
+ type: z26.literal("web_search_call"),
5069
+ id: z26.string(),
5070
+ status: z26.string(),
5071
+ action: z26.discriminatedUnion("type", [
5072
+ z26.object({
5073
+ type: z26.literal("search"),
5074
+ query: z26.string().nullish(),
5075
+ queries: z26.array(z26.string()).nullish(),
5076
+ sources: z26.array(
5077
+ z26.discriminatedUnion("type", [
5078
+ z26.object({ type: z26.literal("url"), url: z26.string() }),
5079
+ z26.object({ type: z26.literal("api"), name: z26.string() })
4969
5080
  ])
4970
5081
  ).nullish()
4971
5082
  }),
4972
- z25.object({
4973
- type: z25.literal("open_page"),
4974
- url: z25.string().nullish()
5083
+ z26.object({
5084
+ type: z26.literal("open_page"),
5085
+ url: z26.string().nullish()
4975
5086
  }),
4976
- z25.object({
4977
- type: z25.literal("find_in_page"),
4978
- url: z25.string().nullish(),
4979
- pattern: z25.string().nullish()
5087
+ z26.object({
5088
+ type: z26.literal("find_in_page"),
5089
+ url: z26.string().nullish(),
5090
+ pattern: z26.string().nullish()
4980
5091
  })
4981
5092
  ]).nullish()
4982
5093
  }),
4983
- z25.object({
4984
- type: z25.literal("file_search_call"),
4985
- id: z25.string(),
4986
- queries: z25.array(z25.string()),
4987
- results: z25.array(
4988
- z25.object({
4989
- attributes: z25.record(
4990
- z25.string(),
4991
- z25.union([z25.string(), z25.number(), z25.boolean()])
5094
+ z26.object({
5095
+ type: z26.literal("file_search_call"),
5096
+ id: z26.string(),
5097
+ queries: z26.array(z26.string()),
5098
+ results: z26.array(
5099
+ z26.object({
5100
+ attributes: z26.record(
5101
+ z26.string(),
5102
+ z26.union([z26.string(), z26.number(), z26.boolean()])
4992
5103
  ),
4993
- file_id: z25.string(),
4994
- filename: z25.string(),
4995
- score: z25.number(),
4996
- text: z25.string()
5104
+ file_id: z26.string(),
5105
+ filename: z26.string(),
5106
+ score: z26.number(),
5107
+ text: z26.string()
4997
5108
  })
4998
5109
  ).nullish()
4999
5110
  }),
5000
- z25.object({
5001
- type: z25.literal("local_shell_call"),
5002
- id: z25.string(),
5003
- call_id: z25.string(),
5004
- action: z25.object({
5005
- type: z25.literal("exec"),
5006
- command: z25.array(z25.string()),
5007
- timeout_ms: z25.number().optional(),
5008
- user: z25.string().optional(),
5009
- working_directory: z25.string().optional(),
5010
- env: z25.record(z25.string(), z25.string()).optional()
5111
+ z26.object({
5112
+ type: z26.literal("local_shell_call"),
5113
+ id: z26.string(),
5114
+ call_id: z26.string(),
5115
+ action: z26.object({
5116
+ type: z26.literal("exec"),
5117
+ command: z26.array(z26.string()),
5118
+ timeout_ms: z26.number().optional(),
5119
+ user: z26.string().optional(),
5120
+ working_directory: z26.string().optional(),
5121
+ env: z26.record(z26.string(), z26.string()).optional()
5011
5122
  })
5012
5123
  }),
5013
5124
  openaiResponsesComputerCallSchema,
5014
- z25.object({
5015
- type: z25.literal("mcp_call"),
5016
- id: z25.string(),
5017
- status: z25.string(),
5018
- arguments: z25.string(),
5019
- name: z25.string(),
5020
- server_label: z25.string(),
5021
- output: z25.string().nullish(),
5022
- error: z25.union([
5023
- z25.string(),
5024
- z25.object({
5025
- type: z25.string().optional(),
5026
- code: z25.union([z25.number(), z25.string()]).optional(),
5027
- message: z25.string().optional()
5125
+ z26.object({
5126
+ type: z26.literal("mcp_call"),
5127
+ id: z26.string(),
5128
+ status: z26.string(),
5129
+ arguments: z26.string(),
5130
+ name: z26.string(),
5131
+ server_label: z26.string(),
5132
+ output: z26.string().nullish(),
5133
+ error: z26.union([
5134
+ z26.string(),
5135
+ z26.object({
5136
+ type: z26.string().optional(),
5137
+ code: z26.union([z26.number(), z26.string()]).optional(),
5138
+ message: z26.string().optional()
5028
5139
  }).loose()
5029
5140
  ]).nullish(),
5030
- approval_request_id: z25.string().nullish()
5141
+ approval_request_id: z26.string().nullish()
5031
5142
  }),
5032
- z25.object({
5033
- type: z25.literal("mcp_list_tools"),
5034
- id: z25.string(),
5035
- server_label: z25.string(),
5036
- tools: z25.array(
5037
- z25.object({
5038
- name: z25.string(),
5039
- description: z25.string().optional(),
5040
- input_schema: z25.any(),
5041
- annotations: z25.record(z25.string(), z25.unknown()).optional()
5143
+ z26.object({
5144
+ type: z26.literal("mcp_list_tools"),
5145
+ id: z26.string(),
5146
+ server_label: z26.string(),
5147
+ tools: z26.array(
5148
+ z26.object({
5149
+ name: z26.string(),
5150
+ description: z26.string().optional(),
5151
+ input_schema: z26.any(),
5152
+ annotations: z26.record(z26.string(), z26.unknown()).optional()
5042
5153
  })
5043
5154
  ),
5044
- error: z25.union([
5045
- z25.string(),
5046
- z25.object({
5047
- type: z25.string().optional(),
5048
- code: z25.union([z25.number(), z25.string()]).optional(),
5049
- message: z25.string().optional()
5155
+ error: z26.union([
5156
+ z26.string(),
5157
+ z26.object({
5158
+ type: z26.string().optional(),
5159
+ code: z26.union([z26.number(), z26.string()]).optional(),
5160
+ message: z26.string().optional()
5050
5161
  }).loose()
5051
5162
  ]).optional()
5052
5163
  }),
5053
- z25.object({
5054
- type: z25.literal("mcp_approval_request"),
5055
- id: z25.string(),
5056
- server_label: z25.string(),
5057
- name: z25.string(),
5058
- arguments: z25.string(),
5059
- approval_request_id: z25.string().optional()
5164
+ z26.object({
5165
+ type: z26.literal("mcp_approval_request"),
5166
+ id: z26.string(),
5167
+ server_label: z26.string(),
5168
+ name: z26.string(),
5169
+ arguments: z26.string(),
5170
+ approval_request_id: z26.string().optional()
5060
5171
  }),
5061
- z25.object({
5062
- type: z25.literal("apply_patch_call"),
5063
- id: z25.string(),
5064
- call_id: z25.string(),
5065
- status: z25.enum(["in_progress", "completed"]),
5066
- operation: z25.discriminatedUnion("type", [
5067
- z25.object({
5068
- type: z25.literal("create_file"),
5069
- path: z25.string(),
5070
- diff: z25.string()
5172
+ z26.object({
5173
+ type: z26.literal("apply_patch_call"),
5174
+ id: z26.string(),
5175
+ call_id: z26.string(),
5176
+ status: z26.enum(["in_progress", "completed"]),
5177
+ operation: z26.discriminatedUnion("type", [
5178
+ z26.object({
5179
+ type: z26.literal("create_file"),
5180
+ path: z26.string(),
5181
+ diff: z26.string()
5071
5182
  }),
5072
- z25.object({
5073
- type: z25.literal("delete_file"),
5074
- path: z25.string()
5183
+ z26.object({
5184
+ type: z26.literal("delete_file"),
5185
+ path: z26.string()
5075
5186
  }),
5076
- z25.object({
5077
- type: z25.literal("update_file"),
5078
- path: z25.string(),
5079
- diff: z25.string()
5187
+ z26.object({
5188
+ type: z26.literal("update_file"),
5189
+ path: z26.string(),
5190
+ diff: z26.string()
5080
5191
  })
5081
5192
  ])
5082
5193
  }),
5083
- z25.object({
5084
- type: z25.literal("shell_call"),
5085
- id: z25.string(),
5086
- call_id: z25.string(),
5087
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5088
- action: z25.object({
5089
- commands: z25.array(z25.string())
5194
+ z26.object({
5195
+ type: z26.literal("shell_call"),
5196
+ id: z26.string(),
5197
+ call_id: z26.string(),
5198
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5199
+ action: z26.object({
5200
+ commands: z26.array(z26.string())
5090
5201
  })
5091
5202
  }),
5092
- z25.object({
5093
- type: z25.literal("compaction"),
5094
- id: z25.string(),
5095
- encrypted_content: z25.string()
5203
+ z26.object({
5204
+ type: z26.literal("compaction"),
5205
+ id: z26.string(),
5206
+ encrypted_content: z26.string()
5096
5207
  }),
5097
- z25.object({
5098
- type: z25.literal("shell_call_output"),
5099
- id: z25.string(),
5100
- call_id: z25.string(),
5101
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5102
- output: z25.array(
5103
- z25.object({
5104
- stdout: z25.string(),
5105
- stderr: z25.string(),
5106
- outcome: z25.discriminatedUnion("type", [
5107
- z25.object({ type: z25.literal("timeout") }),
5108
- z25.object({
5109
- type: z25.literal("exit"),
5110
- exit_code: z25.number()
5208
+ z26.object({
5209
+ type: z26.literal("shell_call_output"),
5210
+ id: z26.string(),
5211
+ call_id: z26.string(),
5212
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5213
+ output: z26.array(
5214
+ z26.object({
5215
+ stdout: z26.string(),
5216
+ stderr: z26.string(),
5217
+ outcome: z26.discriminatedUnion("type", [
5218
+ z26.object({ type: z26.literal("timeout") }),
5219
+ z26.object({
5220
+ type: z26.literal("exit"),
5221
+ exit_code: z26.number()
5111
5222
  })
5112
5223
  ])
5113
5224
  })
5114
5225
  )
5115
5226
  }),
5116
- z25.object({
5117
- type: z25.literal("tool_search_call"),
5118
- id: z25.string(),
5119
- execution: z25.enum(["server", "client"]),
5120
- call_id: z25.string().nullable(),
5121
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5122
- arguments: z25.unknown()
5227
+ z26.object({
5228
+ type: z26.literal("tool_search_call"),
5229
+ id: z26.string(),
5230
+ execution: z26.enum(["server", "client"]),
5231
+ call_id: z26.string().nullable(),
5232
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5233
+ arguments: z26.unknown()
5123
5234
  }),
5124
- z25.object({
5125
- type: z25.literal("tool_search_output"),
5126
- id: z25.string(),
5127
- execution: z25.enum(["server", "client"]),
5128
- call_id: z25.string().nullable(),
5129
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5130
- tools: z25.array(z25.record(z25.string(), jsonValueSchema2.optional()))
5235
+ z26.object({
5236
+ type: z26.literal("tool_search_output"),
5237
+ id: z26.string(),
5238
+ execution: z26.enum(["server", "client"]),
5239
+ call_id: z26.string().nullable(),
5240
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5241
+ tools: z26.array(z26.record(z26.string(), jsonValueSchema2.optional()))
5131
5242
  })
5132
5243
  ])
5133
5244
  }),
5134
- z25.object({
5135
- type: z25.literal("response.function_call_arguments.delta"),
5136
- item_id: z25.string(),
5137
- output_index: z25.number(),
5138
- delta: z25.string()
5245
+ z26.object({
5246
+ type: z26.literal("response.function_call_arguments.delta"),
5247
+ item_id: z26.string(),
5248
+ output_index: z26.number(),
5249
+ delta: z26.string()
5139
5250
  }),
5140
- z25.object({
5141
- type: z25.literal("response.custom_tool_call_input.delta"),
5142
- item_id: z25.string(),
5143
- output_index: z25.number(),
5144
- delta: z25.string()
5251
+ z26.object({
5252
+ type: z26.literal("response.custom_tool_call_input.delta"),
5253
+ item_id: z26.string(),
5254
+ output_index: z26.number(),
5255
+ delta: z26.string()
5145
5256
  }),
5146
- z25.object({
5147
- type: z25.literal("response.image_generation_call.partial_image"),
5148
- item_id: z25.string(),
5149
- output_index: z25.number(),
5150
- partial_image_b64: z25.string()
5257
+ z26.object({
5258
+ type: z26.literal("response.image_generation_call.partial_image"),
5259
+ item_id: z26.string(),
5260
+ output_index: z26.number(),
5261
+ partial_image_b64: z26.string()
5151
5262
  }),
5152
- z25.object({
5153
- type: z25.literal("response.code_interpreter_call_code.delta"),
5154
- item_id: z25.string(),
5155
- output_index: z25.number(),
5156
- delta: z25.string()
5263
+ z26.object({
5264
+ type: z26.literal("response.code_interpreter_call_code.delta"),
5265
+ item_id: z26.string(),
5266
+ output_index: z26.number(),
5267
+ delta: z26.string()
5157
5268
  }),
5158
- z25.object({
5159
- type: z25.literal("response.code_interpreter_call_code.done"),
5160
- item_id: z25.string(),
5161
- output_index: z25.number(),
5162
- code: z25.string()
5269
+ z26.object({
5270
+ type: z26.literal("response.code_interpreter_call_code.done"),
5271
+ item_id: z26.string(),
5272
+ output_index: z26.number(),
5273
+ code: z26.string()
5163
5274
  }),
5164
- z25.object({
5165
- type: z25.literal("response.output_text.annotation.added"),
5166
- annotation: z25.discriminatedUnion("type", [
5167
- z25.object({
5168
- type: z25.literal("url_citation"),
5169
- start_index: z25.number(),
5170
- end_index: z25.number(),
5171
- url: z25.string(),
5172
- title: z25.string()
5275
+ z26.object({
5276
+ type: z26.literal("response.output_text.annotation.added"),
5277
+ annotation: z26.discriminatedUnion("type", [
5278
+ z26.object({
5279
+ type: z26.literal("url_citation"),
5280
+ start_index: z26.number(),
5281
+ end_index: z26.number(),
5282
+ url: z26.string(),
5283
+ title: z26.string()
5173
5284
  }),
5174
- z25.object({
5175
- type: z25.literal("file_citation"),
5176
- file_id: z25.string(),
5177
- filename: z25.string(),
5178
- index: z25.number()
5285
+ z26.object({
5286
+ type: z26.literal("file_citation"),
5287
+ file_id: z26.string(),
5288
+ filename: z26.string(),
5289
+ index: z26.number()
5179
5290
  }),
5180
- z25.object({
5181
- type: z25.literal("container_file_citation"),
5182
- container_id: z25.string(),
5183
- file_id: z25.string(),
5184
- filename: z25.string(),
5185
- start_index: z25.number(),
5186
- end_index: z25.number()
5291
+ z26.object({
5292
+ type: z26.literal("container_file_citation"),
5293
+ container_id: z26.string(),
5294
+ file_id: z26.string(),
5295
+ filename: z26.string(),
5296
+ start_index: z26.number(),
5297
+ end_index: z26.number()
5187
5298
  }),
5188
- z25.object({
5189
- type: z25.literal("file_path"),
5190
- file_id: z25.string(),
5191
- index: z25.number()
5299
+ z26.object({
5300
+ type: z26.literal("file_path"),
5301
+ file_id: z26.string(),
5302
+ index: z26.number()
5192
5303
  })
5193
5304
  ])
5194
5305
  }),
5195
- z25.object({
5196
- type: z25.literal("response.reasoning_summary_part.added"),
5197
- item_id: z25.string(),
5198
- summary_index: z25.number()
5306
+ z26.object({
5307
+ type: z26.literal("response.reasoning_summary_part.added"),
5308
+ item_id: z26.string(),
5309
+ summary_index: z26.number()
5199
5310
  }),
5200
- z25.object({
5201
- type: z25.literal("response.reasoning_summary_text.delta"),
5202
- item_id: z25.string(),
5203
- summary_index: z25.number(),
5204
- delta: z25.string()
5311
+ z26.object({
5312
+ type: z26.literal("response.reasoning_summary_text.delta"),
5313
+ item_id: z26.string(),
5314
+ summary_index: z26.number(),
5315
+ delta: z26.string()
5205
5316
  }),
5206
- z25.object({
5207
- type: z25.literal("response.reasoning_summary_part.done"),
5208
- item_id: z25.string(),
5209
- summary_index: z25.number()
5317
+ z26.object({
5318
+ type: z26.literal("response.reasoning_summary_part.done"),
5319
+ item_id: z26.string(),
5320
+ summary_index: z26.number()
5210
5321
  }),
5211
- z25.object({
5212
- type: z25.literal("response.apply_patch_call_operation_diff.delta"),
5213
- item_id: z25.string(),
5214
- output_index: z25.number(),
5215
- delta: z25.string(),
5216
- obfuscation: z25.string().nullish()
5322
+ z26.object({
5323
+ type: z26.literal("response.apply_patch_call_operation_diff.delta"),
5324
+ item_id: z26.string(),
5325
+ output_index: z26.number(),
5326
+ delta: z26.string(),
5327
+ obfuscation: z26.string().nullish()
5217
5328
  }),
5218
- z25.object({
5219
- type: z25.literal("response.apply_patch_call_operation_diff.done"),
5220
- item_id: z25.string(),
5221
- output_index: z25.number(),
5222
- diff: z25.string()
5329
+ z26.object({
5330
+ type: z26.literal("response.apply_patch_call_operation_diff.done"),
5331
+ item_id: z26.string(),
5332
+ output_index: z26.number(),
5333
+ diff: z26.string()
5223
5334
  }),
5224
5335
  openaiResponsesNestedErrorChunkSchema,
5225
5336
  openaiResponsesErrorChunkSchema,
5226
- z25.object({ type: z25.string() }).loose().transform((value) => ({
5337
+ z26.object({ type: z26.string() }).loose().transform((value) => ({
5227
5338
  type: "unknown_chunk",
5228
5339
  message: value.type
5229
5340
  }))
@@ -5231,315 +5342,318 @@ var openaiResponsesChunkSchema = lazySchema23(
5231
5342
  ])
5232
5343
  )
5233
5344
  );
5234
- var openaiResponsesResponseSchema = lazySchema23(
5235
- () => zodSchema23(
5236
- z25.object({
5237
- id: z25.string().optional(),
5238
- created_at: z25.number().optional(),
5239
- error: z25.object({
5240
- message: z25.string(),
5241
- type: z25.string(),
5242
- param: z25.string().nullish(),
5243
- code: z25.string()
5345
+ var openaiResponsesResponseSchema = lazySchema24(
5346
+ () => zodSchema24(
5347
+ z26.object({
5348
+ id: z26.string().optional(),
5349
+ created_at: z26.number().optional(),
5350
+ error: z26.object({
5351
+ message: z26.string(),
5352
+ type: z26.string(),
5353
+ param: z26.string().nullish(),
5354
+ code: z26.string()
5244
5355
  }).nullish(),
5245
- model: z25.string().optional(),
5246
- output: z25.array(
5247
- z25.discriminatedUnion("type", [
5248
- z25.object({
5249
- type: z25.literal("message"),
5250
- role: z25.literal("assistant"),
5251
- id: z25.string(),
5252
- phase: z25.enum(["commentary", "final_answer"]).nullish(),
5253
- content: z25.array(
5254
- z25.object({
5255
- type: z25.literal("output_text"),
5256
- text: z25.string(),
5257
- logprobs: z25.array(
5258
- z25.object({
5259
- token: z25.string(),
5260
- logprob: z25.number(),
5261
- top_logprobs: z25.array(
5262
- z25.object({
5263
- token: z25.string(),
5264
- logprob: z25.number()
5356
+ model: z26.string().optional(),
5357
+ output: z26.array(
5358
+ z26.discriminatedUnion("type", [
5359
+ z26.object({
5360
+ type: z26.literal("message"),
5361
+ role: z26.literal("assistant"),
5362
+ id: z26.string(),
5363
+ phase: z26.enum(["commentary", "final_answer"]).nullish(),
5364
+ content: z26.array(
5365
+ z26.object({
5366
+ type: z26.literal("output_text"),
5367
+ text: z26.string(),
5368
+ logprobs: z26.array(
5369
+ z26.object({
5370
+ token: z26.string(),
5371
+ logprob: z26.number(),
5372
+ top_logprobs: z26.array(
5373
+ z26.object({
5374
+ token: z26.string(),
5375
+ logprob: z26.number()
5265
5376
  })
5266
5377
  )
5267
5378
  })
5268
5379
  ).nullish(),
5269
- annotations: z25.array(
5270
- z25.discriminatedUnion("type", [
5271
- z25.object({
5272
- type: z25.literal("url_citation"),
5273
- start_index: z25.number(),
5274
- end_index: z25.number(),
5275
- url: z25.string(),
5276
- title: z25.string()
5380
+ annotations: z26.array(
5381
+ z26.discriminatedUnion("type", [
5382
+ z26.object({
5383
+ type: z26.literal("url_citation"),
5384
+ start_index: z26.number(),
5385
+ end_index: z26.number(),
5386
+ url: z26.string(),
5387
+ title: z26.string()
5277
5388
  }),
5278
- z25.object({
5279
- type: z25.literal("file_citation"),
5280
- file_id: z25.string(),
5281
- filename: z25.string(),
5282
- index: z25.number()
5389
+ z26.object({
5390
+ type: z26.literal("file_citation"),
5391
+ file_id: z26.string(),
5392
+ filename: z26.string(),
5393
+ index: z26.number()
5283
5394
  }),
5284
- z25.object({
5285
- type: z25.literal("container_file_citation"),
5286
- container_id: z25.string(),
5287
- file_id: z25.string(),
5288
- filename: z25.string(),
5289
- start_index: z25.number(),
5290
- end_index: z25.number()
5395
+ z26.object({
5396
+ type: z26.literal("container_file_citation"),
5397
+ container_id: z26.string(),
5398
+ file_id: z26.string(),
5399
+ filename: z26.string(),
5400
+ start_index: z26.number(),
5401
+ end_index: z26.number()
5291
5402
  }),
5292
- z25.object({
5293
- type: z25.literal("file_path"),
5294
- file_id: z25.string(),
5295
- index: z25.number()
5403
+ z26.object({
5404
+ type: z26.literal("file_path"),
5405
+ file_id: z26.string(),
5406
+ index: z26.number()
5296
5407
  })
5297
5408
  ])
5298
5409
  )
5299
5410
  })
5300
5411
  )
5301
5412
  }),
5302
- z25.object({
5303
- type: z25.literal("web_search_call"),
5304
- id: z25.string(),
5305
- status: z25.string(),
5306
- action: z25.discriminatedUnion("type", [
5307
- z25.object({
5308
- type: z25.literal("search"),
5309
- query: z25.string().nullish(),
5310
- queries: z25.array(z25.string()).nullish(),
5311
- sources: z25.array(
5312
- z25.discriminatedUnion("type", [
5313
- z25.object({ type: z25.literal("url"), url: z25.string() }),
5314
- z25.object({
5315
- type: z25.literal("api"),
5316
- name: z25.string()
5413
+ z26.object({
5414
+ type: z26.literal("web_search_call"),
5415
+ id: z26.string(),
5416
+ status: z26.string(),
5417
+ action: z26.discriminatedUnion("type", [
5418
+ z26.object({
5419
+ type: z26.literal("search"),
5420
+ query: z26.string().nullish(),
5421
+ queries: z26.array(z26.string()).nullish(),
5422
+ sources: z26.array(
5423
+ z26.discriminatedUnion("type", [
5424
+ z26.object({ type: z26.literal("url"), url: z26.string() }),
5425
+ z26.object({
5426
+ type: z26.literal("api"),
5427
+ name: z26.string()
5317
5428
  })
5318
5429
  ])
5319
5430
  ).nullish()
5320
5431
  }),
5321
- z25.object({
5322
- type: z25.literal("open_page"),
5323
- url: z25.string().nullish()
5432
+ z26.object({
5433
+ type: z26.literal("open_page"),
5434
+ url: z26.string().nullish()
5324
5435
  }),
5325
- z25.object({
5326
- type: z25.literal("find_in_page"),
5327
- url: z25.string().nullish(),
5328
- pattern: z25.string().nullish()
5436
+ z26.object({
5437
+ type: z26.literal("find_in_page"),
5438
+ url: z26.string().nullish(),
5439
+ pattern: z26.string().nullish()
5329
5440
  })
5330
5441
  ]).nullish()
5331
5442
  }),
5332
- z25.object({
5333
- type: z25.literal("file_search_call"),
5334
- id: z25.string(),
5335
- queries: z25.array(z25.string()),
5336
- results: z25.array(
5337
- z25.object({
5338
- attributes: z25.record(
5339
- z25.string(),
5340
- z25.union([z25.string(), z25.number(), z25.boolean()])
5443
+ z26.object({
5444
+ type: z26.literal("file_search_call"),
5445
+ id: z26.string(),
5446
+ queries: z26.array(z26.string()),
5447
+ results: z26.array(
5448
+ z26.object({
5449
+ attributes: z26.record(
5450
+ z26.string(),
5451
+ z26.union([z26.string(), z26.number(), z26.boolean()])
5341
5452
  ),
5342
- file_id: z25.string(),
5343
- filename: z25.string(),
5344
- score: z25.number(),
5345
- text: z25.string()
5453
+ file_id: z26.string(),
5454
+ filename: z26.string(),
5455
+ score: z26.number(),
5456
+ text: z26.string()
5346
5457
  })
5347
5458
  ).nullish()
5348
5459
  }),
5349
- z25.object({
5350
- type: z25.literal("code_interpreter_call"),
5351
- id: z25.string(),
5352
- code: z25.string().nullable(),
5353
- container_id: z25.string(),
5354
- outputs: z25.array(
5355
- z25.discriminatedUnion("type", [
5356
- z25.object({ type: z25.literal("logs"), logs: z25.string() }),
5357
- z25.object({ type: z25.literal("image"), url: z25.string() })
5460
+ z26.object({
5461
+ type: z26.literal("code_interpreter_call"),
5462
+ id: z26.string(),
5463
+ code: z26.string().nullable(),
5464
+ container_id: z26.string(),
5465
+ outputs: z26.array(
5466
+ z26.discriminatedUnion("type", [
5467
+ z26.object({ type: z26.literal("logs"), logs: z26.string() }),
5468
+ z26.object({ type: z26.literal("image"), url: z26.string() })
5358
5469
  ])
5359
5470
  ).nullable()
5360
5471
  }),
5361
- z25.object({
5362
- type: z25.literal("image_generation_call"),
5363
- id: z25.string(),
5364
- result: z25.string()
5472
+ z26.object({
5473
+ type: z26.literal("image_generation_call"),
5474
+ id: z26.string(),
5475
+ result: z26.string()
5365
5476
  }),
5366
- z25.object({
5367
- type: z25.literal("local_shell_call"),
5368
- id: z25.string(),
5369
- call_id: z25.string(),
5370
- action: z25.object({
5371
- type: z25.literal("exec"),
5372
- command: z25.array(z25.string()),
5373
- timeout_ms: z25.number().optional(),
5374
- user: z25.string().optional(),
5375
- working_directory: z25.string().optional(),
5376
- env: z25.record(z25.string(), z25.string()).optional()
5477
+ z26.object({
5478
+ type: z26.literal("local_shell_call"),
5479
+ id: z26.string(),
5480
+ call_id: z26.string(),
5481
+ action: z26.object({
5482
+ type: z26.literal("exec"),
5483
+ command: z26.array(z26.string()),
5484
+ timeout_ms: z26.number().optional(),
5485
+ user: z26.string().optional(),
5486
+ working_directory: z26.string().optional(),
5487
+ env: z26.record(z26.string(), z26.string()).optional()
5377
5488
  })
5378
5489
  }),
5379
- z25.object({
5380
- type: z25.literal("function_call"),
5381
- call_id: z25.string(),
5382
- name: z25.string(),
5383
- arguments: z25.string(),
5384
- id: z25.string(),
5385
- namespace: z25.string().nullish()
5490
+ z26.object({
5491
+ type: z26.literal("function_call"),
5492
+ call_id: z26.string(),
5493
+ name: z26.string(),
5494
+ arguments: z26.string(),
5495
+ id: z26.string(),
5496
+ namespace: z26.string().nullish(),
5497
+ caller: openaiResponsesToolCallerSchema.nullish()
5386
5498
  }),
5387
- z25.object({
5388
- type: z25.literal("custom_tool_call"),
5389
- call_id: z25.string(),
5390
- name: z25.string(),
5391
- input: z25.string(),
5392
- id: z25.string()
5499
+ openaiResponsesProgramSchema,
5500
+ openaiResponsesProgramOutputSchema,
5501
+ z26.object({
5502
+ type: z26.literal("custom_tool_call"),
5503
+ call_id: z26.string(),
5504
+ name: z26.string(),
5505
+ input: z26.string(),
5506
+ id: z26.string()
5393
5507
  }),
5394
5508
  openaiResponsesComputerCallSchema,
5395
- z25.object({
5396
- type: z25.literal("reasoning"),
5397
- id: z25.string(),
5398
- encrypted_content: z25.string().nullish(),
5399
- summary: z25.array(
5400
- z25.object({
5401
- type: z25.literal("summary_text"),
5402
- text: z25.string()
5509
+ z26.object({
5510
+ type: z26.literal("reasoning"),
5511
+ id: z26.string(),
5512
+ encrypted_content: z26.string().nullish(),
5513
+ summary: z26.array(
5514
+ z26.object({
5515
+ type: z26.literal("summary_text"),
5516
+ text: z26.string()
5403
5517
  })
5404
5518
  )
5405
5519
  }),
5406
- z25.object({
5407
- type: z25.literal("mcp_call"),
5408
- id: z25.string(),
5409
- status: z25.string(),
5410
- arguments: z25.string(),
5411
- name: z25.string(),
5412
- server_label: z25.string(),
5413
- output: z25.string().nullish(),
5414
- error: z25.union([
5415
- z25.string(),
5416
- z25.object({
5417
- type: z25.string().optional(),
5418
- code: z25.union([z25.number(), z25.string()]).optional(),
5419
- message: z25.string().optional()
5520
+ z26.object({
5521
+ type: z26.literal("mcp_call"),
5522
+ id: z26.string(),
5523
+ status: z26.string(),
5524
+ arguments: z26.string(),
5525
+ name: z26.string(),
5526
+ server_label: z26.string(),
5527
+ output: z26.string().nullish(),
5528
+ error: z26.union([
5529
+ z26.string(),
5530
+ z26.object({
5531
+ type: z26.string().optional(),
5532
+ code: z26.union([z26.number(), z26.string()]).optional(),
5533
+ message: z26.string().optional()
5420
5534
  }).loose()
5421
5535
  ]).nullish(),
5422
- approval_request_id: z25.string().nullish()
5536
+ approval_request_id: z26.string().nullish()
5423
5537
  }),
5424
- z25.object({
5425
- type: z25.literal("mcp_list_tools"),
5426
- id: z25.string(),
5427
- server_label: z25.string(),
5428
- tools: z25.array(
5429
- z25.object({
5430
- name: z25.string(),
5431
- description: z25.string().optional(),
5432
- input_schema: z25.any(),
5433
- annotations: z25.record(z25.string(), z25.unknown()).optional()
5538
+ z26.object({
5539
+ type: z26.literal("mcp_list_tools"),
5540
+ id: z26.string(),
5541
+ server_label: z26.string(),
5542
+ tools: z26.array(
5543
+ z26.object({
5544
+ name: z26.string(),
5545
+ description: z26.string().optional(),
5546
+ input_schema: z26.any(),
5547
+ annotations: z26.record(z26.string(), z26.unknown()).optional()
5434
5548
  })
5435
5549
  ),
5436
- error: z25.union([
5437
- z25.string(),
5438
- z25.object({
5439
- type: z25.string().optional(),
5440
- code: z25.union([z25.number(), z25.string()]).optional(),
5441
- message: z25.string().optional()
5550
+ error: z26.union([
5551
+ z26.string(),
5552
+ z26.object({
5553
+ type: z26.string().optional(),
5554
+ code: z26.union([z26.number(), z26.string()]).optional(),
5555
+ message: z26.string().optional()
5442
5556
  }).loose()
5443
5557
  ]).optional()
5444
5558
  }),
5445
- z25.object({
5446
- type: z25.literal("mcp_approval_request"),
5447
- id: z25.string(),
5448
- server_label: z25.string(),
5449
- name: z25.string(),
5450
- arguments: z25.string(),
5451
- approval_request_id: z25.string().optional()
5559
+ z26.object({
5560
+ type: z26.literal("mcp_approval_request"),
5561
+ id: z26.string(),
5562
+ server_label: z26.string(),
5563
+ name: z26.string(),
5564
+ arguments: z26.string(),
5565
+ approval_request_id: z26.string().optional()
5452
5566
  }),
5453
- z25.object({
5454
- type: z25.literal("apply_patch_call"),
5455
- id: z25.string(),
5456
- call_id: z25.string(),
5457
- status: z25.enum(["in_progress", "completed"]),
5458
- operation: z25.discriminatedUnion("type", [
5459
- z25.object({
5460
- type: z25.literal("create_file"),
5461
- path: z25.string(),
5462
- diff: z25.string()
5567
+ z26.object({
5568
+ type: z26.literal("apply_patch_call"),
5569
+ id: z26.string(),
5570
+ call_id: z26.string(),
5571
+ status: z26.enum(["in_progress", "completed"]),
5572
+ operation: z26.discriminatedUnion("type", [
5573
+ z26.object({
5574
+ type: z26.literal("create_file"),
5575
+ path: z26.string(),
5576
+ diff: z26.string()
5463
5577
  }),
5464
- z25.object({
5465
- type: z25.literal("delete_file"),
5466
- path: z25.string()
5578
+ z26.object({
5579
+ type: z26.literal("delete_file"),
5580
+ path: z26.string()
5467
5581
  }),
5468
- z25.object({
5469
- type: z25.literal("update_file"),
5470
- path: z25.string(),
5471
- diff: z25.string()
5582
+ z26.object({
5583
+ type: z26.literal("update_file"),
5584
+ path: z26.string(),
5585
+ diff: z26.string()
5472
5586
  })
5473
5587
  ])
5474
5588
  }),
5475
- z25.object({
5476
- type: z25.literal("shell_call"),
5477
- id: z25.string(),
5478
- call_id: z25.string(),
5479
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5480
- action: z25.object({
5481
- commands: z25.array(z25.string())
5589
+ z26.object({
5590
+ type: z26.literal("shell_call"),
5591
+ id: z26.string(),
5592
+ call_id: z26.string(),
5593
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5594
+ action: z26.object({
5595
+ commands: z26.array(z26.string())
5482
5596
  })
5483
5597
  }),
5484
- z25.object({
5485
- type: z25.literal("compaction"),
5486
- id: z25.string(),
5487
- encrypted_content: z25.string()
5598
+ z26.object({
5599
+ type: z26.literal("compaction"),
5600
+ id: z26.string(),
5601
+ encrypted_content: z26.string()
5488
5602
  }),
5489
- z25.object({
5490
- type: z25.literal("shell_call_output"),
5491
- id: z25.string(),
5492
- call_id: z25.string(),
5493
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5494
- output: z25.array(
5495
- z25.object({
5496
- stdout: z25.string(),
5497
- stderr: z25.string(),
5498
- outcome: z25.discriminatedUnion("type", [
5499
- z25.object({ type: z25.literal("timeout") }),
5500
- z25.object({
5501
- type: z25.literal("exit"),
5502
- exit_code: z25.number()
5603
+ z26.object({
5604
+ type: z26.literal("shell_call_output"),
5605
+ id: z26.string(),
5606
+ call_id: z26.string(),
5607
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5608
+ output: z26.array(
5609
+ z26.object({
5610
+ stdout: z26.string(),
5611
+ stderr: z26.string(),
5612
+ outcome: z26.discriminatedUnion("type", [
5613
+ z26.object({ type: z26.literal("timeout") }),
5614
+ z26.object({
5615
+ type: z26.literal("exit"),
5616
+ exit_code: z26.number()
5503
5617
  })
5504
5618
  ])
5505
5619
  })
5506
5620
  )
5507
5621
  }),
5508
- z25.object({
5509
- type: z25.literal("tool_search_call"),
5510
- id: z25.string(),
5511
- execution: z25.enum(["server", "client"]),
5512
- call_id: z25.string().nullable(),
5513
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5514
- arguments: z25.unknown()
5622
+ z26.object({
5623
+ type: z26.literal("tool_search_call"),
5624
+ id: z26.string(),
5625
+ execution: z26.enum(["server", "client"]),
5626
+ call_id: z26.string().nullable(),
5627
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5628
+ arguments: z26.unknown()
5515
5629
  }),
5516
- z25.object({
5517
- type: z25.literal("tool_search_output"),
5518
- id: z25.string(),
5519
- execution: z25.enum(["server", "client"]),
5520
- call_id: z25.string().nullable(),
5521
- status: z25.enum(["in_progress", "completed", "incomplete"]),
5522
- tools: z25.array(z25.record(z25.string(), jsonValueSchema2.optional()))
5630
+ z26.object({
5631
+ type: z26.literal("tool_search_output"),
5632
+ id: z26.string(),
5633
+ execution: z26.enum(["server", "client"]),
5634
+ call_id: z26.string().nullable(),
5635
+ status: z26.enum(["in_progress", "completed", "incomplete"]),
5636
+ tools: z26.array(z26.record(z26.string(), jsonValueSchema2.optional()))
5523
5637
  })
5524
5638
  ])
5525
5639
  ).optional(),
5526
- service_tier: z25.string().nullish(),
5527
- reasoning: z25.object({
5528
- context: z25.string().nullish()
5640
+ service_tier: z26.string().nullish(),
5641
+ reasoning: z26.object({
5642
+ context: z26.string().nullish()
5529
5643
  }).nullish(),
5530
- incomplete_details: z25.object({ reason: z25.string() }).nullish(),
5531
- usage: z25.object({
5532
- input_tokens: z25.number(),
5533
- input_tokens_details: z25.object({
5534
- cached_tokens: z25.number().nullish(),
5535
- cache_write_tokens: z25.number().nullish(),
5536
- orchestration_input_tokens: z25.number().nullish(),
5537
- orchestration_input_cached_tokens: z25.number().nullish()
5644
+ incomplete_details: z26.object({ reason: z26.string() }).nullish(),
5645
+ usage: z26.object({
5646
+ input_tokens: z26.number(),
5647
+ input_tokens_details: z26.object({
5648
+ cached_tokens: z26.number().nullish(),
5649
+ cache_write_tokens: z26.number().nullish(),
5650
+ orchestration_input_tokens: z26.number().nullish(),
5651
+ orchestration_input_cached_tokens: z26.number().nullish()
5538
5652
  }).nullish(),
5539
- output_tokens: z25.number(),
5540
- output_tokens_details: z25.object({
5541
- reasoning_tokens: z25.number().nullish(),
5542
- orchestration_output_tokens: z25.number().nullish()
5653
+ output_tokens: z26.number(),
5654
+ output_tokens_details: z26.object({
5655
+ reasoning_tokens: z26.number().nullish(),
5656
+ orchestration_output_tokens: z26.number().nullish()
5543
5657
  }).nullish()
5544
5658
  }).optional()
5545
5659
  })
@@ -5548,10 +5662,10 @@ var openaiResponsesResponseSchema = lazySchema23(
5548
5662
 
5549
5663
  // src/responses/openai-responses-language-model-options.ts
5550
5664
  import {
5551
- lazySchema as lazySchema24,
5552
- zodSchema as zodSchema24
5665
+ lazySchema as lazySchema25,
5666
+ zodSchema as zodSchema25
5553
5667
  } from "@ai-sdk/provider-utils";
5554
- import { z as z26 } from "zod/v4";
5668
+ import { z as z27 } from "zod/v4";
5555
5669
  var TOP_LOGPROBS_MAX = 20;
5556
5670
  var openaiResponsesReasoningModelIds = [
5557
5671
  "o1",
@@ -5622,9 +5736,9 @@ var openaiResponsesModelIds = [
5622
5736
  "gpt-5-chat-latest",
5623
5737
  ...openaiResponsesReasoningModelIds
5624
5738
  ];
5625
- var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5626
- () => zodSchema24(
5627
- z26.object({
5739
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema25(
5740
+ () => zodSchema25(
5741
+ z27.object({
5628
5742
  /**
5629
5743
  * The ID of the OpenAI Conversation to continue.
5630
5744
  * You must create a conversation first via the OpenAI API.
@@ -5632,13 +5746,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5632
5746
  * Defaults to `undefined`.
5633
5747
  * @see https://platform.openai.com/docs/api-reference/conversations/create
5634
5748
  */
5635
- conversation: z26.string().nullish(),
5749
+ conversation: z27.string().nullish(),
5636
5750
  /**
5637
5751
  * The set of extra fields to include in the response (advanced, usually not needed).
5638
5752
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
5639
5753
  */
5640
- include: z26.array(
5641
- z26.enum([
5754
+ include: z27.array(
5755
+ z27.enum([
5642
5756
  "reasoning.encrypted_content",
5643
5757
  // handled internally by default, only needed for unknown reasoning models
5644
5758
  "file_search_call.results",
@@ -5651,7 +5765,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5651
5765
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
5652
5766
  * Defaults to `undefined`.
5653
5767
  */
5654
- instructions: z26.string().nullish(),
5768
+ instructions: z27.string().nullish(),
5655
5769
  /**
5656
5770
  * Return the log probabilities of the tokens. Including logprobs will increase
5657
5771
  * the response size and can slow down response times. However, it can
@@ -5666,38 +5780,38 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5666
5780
  * @see https://platform.openai.com/docs/api-reference/responses/create
5667
5781
  * @see https://cookbook.openai.com/examples/using_logprobs
5668
5782
  */
5669
- logprobs: z26.union([z26.boolean(), z26.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5783
+ logprobs: z27.union([z27.boolean(), z27.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
5670
5784
  /**
5671
5785
  * The maximum number of total calls to built-in tools that can be processed in a response.
5672
5786
  * This maximum number applies across all built-in tool calls, not per individual tool.
5673
5787
  * Any further attempts to call a tool by the model will be ignored.
5674
5788
  */
5675
- maxToolCalls: z26.number().nullish(),
5789
+ maxToolCalls: z27.number().nullish(),
5676
5790
  /**
5677
5791
  * Additional metadata to store with the generation.
5678
5792
  */
5679
- metadata: z26.any().nullish(),
5793
+ metadata: z27.any().nullish(),
5680
5794
  /**
5681
5795
  * Whether to use parallel tool calls. Defaults to `true`.
5682
5796
  */
5683
- parallelToolCalls: z26.boolean().nullish(),
5797
+ parallelToolCalls: z27.boolean().nullish(),
5684
5798
  /**
5685
5799
  * The ID of the previous response. You can use it to continue a conversation.
5686
5800
  * Defaults to `undefined`.
5687
5801
  */
5688
- previousResponseId: z26.string().nullish(),
5802
+ previousResponseId: z27.string().nullish(),
5689
5803
  /**
5690
5804
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
5691
5805
  */
5692
- promptCacheKey: z26.string().nullish(),
5806
+ promptCacheKey: z27.string().nullish(),
5693
5807
  /**
5694
5808
  * Prompt cache behavior for GPT-5.6 and later models.
5695
5809
  * `mode` controls whether OpenAI also places an implicit breakpoint.
5696
5810
  * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
5697
5811
  */
5698
- promptCacheOptions: z26.object({
5699
- mode: z26.enum(["implicit", "explicit"]).optional(),
5700
- ttl: z26.literal("30m").optional()
5812
+ promptCacheOptions: z27.object({
5813
+ mode: z27.enum(["implicit", "explicit"]).optional(),
5814
+ ttl: z27.literal("30m").optional()
5701
5815
  }).optional(),
5702
5816
  /**
5703
5817
  * The retention policy for the prompt cache.
@@ -5709,35 +5823,35 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5709
5823
  *
5710
5824
  * @default 'in_memory'
5711
5825
  */
5712
- promptCacheRetention: z26.enum(["in_memory", "24h"]).nullish(),
5826
+ promptCacheRetention: z27.enum(["in_memory", "24h"]).nullish(),
5713
5827
  /**
5714
5828
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5715
5829
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5716
5830
  * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5717
5831
  * Supported values vary by model.
5718
5832
  */
5719
- reasoningEffort: z26.string().nullish(),
5833
+ reasoningEffort: z27.string().nullish(),
5720
5834
  /**
5721
5835
  * Controls how much model work GPT-5.6 performs before returning a final answer.
5722
5836
  * `standard` is the default. `pro` increases quality, latency, and token usage.
5723
5837
  */
5724
- reasoningMode: z26.enum(["standard", "pro"]).optional(),
5838
+ reasoningMode: z27.enum(["standard", "pro"]).optional(),
5725
5839
  /**
5726
5840
  * Controls which available reasoning items GPT-5.6 can use.
5727
5841
  * `auto` uses the model default, `current_turn` excludes reasoning from earlier
5728
5842
  * turns, and `all_turns` makes compatible earlier reasoning available.
5729
5843
  */
5730
- reasoningContext: z26.enum(["auto", "current_turn", "all_turns"]).optional(),
5844
+ reasoningContext: z27.enum(["auto", "current_turn", "all_turns"]).optional(),
5731
5845
  /**
5732
5846
  * Controls reasoning summary output from the model.
5733
5847
  * Set to "auto" to automatically receive the richest level available,
5734
5848
  * or "detailed" for comprehensive summaries.
5735
5849
  */
5736
- reasoningSummary: z26.string().nullish(),
5850
+ reasoningSummary: z27.string().nullish(),
5737
5851
  /**
5738
5852
  * The identifier for safety monitoring and tracking.
5739
5853
  */
5740
- safetyIdentifier: z26.string().nullish(),
5854
+ safetyIdentifier: z27.string().nullish(),
5741
5855
  /**
5742
5856
  * Service tier for the request.
5743
5857
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -5745,11 +5859,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5745
5859
  *
5746
5860
  * Defaults to 'auto'.
5747
5861
  */
5748
- serviceTier: z26.enum(["auto", "flex", "priority", "default"]).nullish(),
5862
+ serviceTier: z27.enum(["auto", "flex", "priority", "default"]).nullish(),
5749
5863
  /**
5750
5864
  * Whether to store the generation. Defaults to `true`.
5751
5865
  */
5752
- store: z26.boolean().nullish(),
5866
+ store: z27.boolean().nullish(),
5753
5867
  /**
5754
5868
  * Whether to pass through non-image file types as generic input files.
5755
5869
  *
@@ -5757,30 +5871,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5757
5871
  * Enable this when the target OpenAI Responses model supports additional
5758
5872
  * file media types, such as text/csv.
5759
5873
  */
5760
- passThroughUnsupportedFiles: z26.boolean().optional(),
5874
+ passThroughUnsupportedFiles: z27.boolean().optional(),
5761
5875
  /**
5762
5876
  * Whether to use strict JSON schema validation.
5763
5877
  * Defaults to `true`.
5764
5878
  */
5765
- strictJsonSchema: z26.boolean().nullish(),
5879
+ strictJsonSchema: z27.boolean().nullish(),
5766
5880
  /**
5767
5881
  * Controls the verbosity of the model's responses. Lower values ('low') will result
5768
5882
  * in more concise responses, while higher values ('high') will result in more verbose responses.
5769
5883
  * Valid values: 'low', 'medium', 'high'.
5770
5884
  */
5771
- textVerbosity: z26.enum(["low", "medium", "high"]).nullish(),
5885
+ textVerbosity: z27.enum(["low", "medium", "high"]).nullish(),
5772
5886
  /**
5773
5887
  * Controls output truncation. 'auto' (default) performs truncation automatically;
5774
5888
  * 'disabled' turns truncation off.
5775
5889
  */
5776
- truncation: z26.enum(["auto", "disabled"]).nullish(),
5890
+ truncation: z27.enum(["auto", "disabled"]).nullish(),
5777
5891
  /**
5778
5892
  * A unique identifier representing your end-user, which can help OpenAI to
5779
5893
  * monitor and detect abuse.
5780
5894
  * Defaults to `undefined`.
5781
5895
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
5782
5896
  */
5783
- user: z26.string().nullish(),
5897
+ user: z27.string().nullish(),
5784
5898
  /**
5785
5899
  * Override the system message mode for this model.
5786
5900
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -5789,7 +5903,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5789
5903
  *
5790
5904
  * If not specified, the mode is automatically determined based on the model.
5791
5905
  */
5792
- systemMessageMode: z26.enum(["system", "developer", "remove"]).optional(),
5906
+ systemMessageMode: z27.enum(["system", "developer", "remove"]).optional(),
5793
5907
  /**
5794
5908
  * Force treating this model as a reasoning model.
5795
5909
  *
@@ -5799,14 +5913,14 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5799
5913
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
5800
5914
  * and defaults `systemMessageMode` to `developer` unless overridden.
5801
5915
  */
5802
- forceReasoning: z26.boolean().optional(),
5916
+ forceReasoning: z27.boolean().optional(),
5803
5917
  /**
5804
5918
  * Enable server-side context management (compaction).
5805
5919
  */
5806
- contextManagement: z26.array(
5807
- z26.object({
5808
- type: z26.literal("compaction"),
5809
- compactThreshold: z26.number()
5920
+ contextManagement: z27.array(
5921
+ z27.object({
5922
+ type: z27.literal("compaction"),
5923
+ compactThreshold: z27.number()
5810
5924
  })
5811
5925
  ).nullish(),
5812
5926
  /**
@@ -5819,9 +5933,9 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema24(
5819
5933
  *
5820
5934
  * @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
5821
5935
  */
5822
- allowedTools: z26.object({
5823
- toolNames: z26.array(z26.string()).min(1),
5824
- mode: z26.enum(["auto", "required"]).optional()
5936
+ allowedTools: z27.object({
5937
+ toolNames: z27.array(z27.string()).min(1),
5938
+ mode: z27.enum(["auto", "required"]).optional()
5825
5939
  }).optional()
5826
5940
  })
5827
5941
  )
@@ -6032,6 +6146,12 @@ async function prepareResponsesTools({
6032
6146
  resolvedCustomProviderToolNames.add(tool.name);
6033
6147
  break;
6034
6148
  }
6149
+ case "openai.programmatic_tool_calling": {
6150
+ openaiTools2.push({
6151
+ type: "programmatic_tool_calling"
6152
+ });
6153
+ break;
6154
+ }
6035
6155
  case "openai.tool_search": {
6036
6156
  const args = await validateTypes2({
6037
6157
  value: tool.args,
@@ -6086,7 +6206,7 @@ async function prepareResponsesTools({
6086
6206
  const resolvedToolName = (_c = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _c : toolChoice.toolName;
6087
6207
  return {
6088
6208
  tools: openaiTools2,
6089
- 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 },
6209
+ 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 },
6090
6210
  toolWarnings
6091
6211
  };
6092
6212
  }
@@ -6109,7 +6229,9 @@ function prepareFunctionTool({
6109
6229
  description: tool.description,
6110
6230
  parameters: tool.inputSchema,
6111
6231
  ...tool.strict != null ? { strict: tool.strict } : {},
6112
- ...deferLoading != null ? { defer_loading: deferLoading } : {}
6232
+ ...deferLoading != null ? { defer_loading: deferLoading } : {},
6233
+ ...(options == null ? void 0 : options.allowedCallers) != null ? { allowed_callers: options.allowedCallers } : {},
6234
+ ...(options == null ? void 0 : options.outputSchema) != null ? { output_schema: options.outputSchema } : {}
6113
6235
  };
6114
6236
  }
6115
6237
  function mapShellEnvironment(environment) {
@@ -6341,7 +6463,8 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6341
6463
  "openai.web_search_preview": "web_search_preview",
6342
6464
  "openai.mcp": "mcp",
6343
6465
  "openai.apply_patch": "apply_patch",
6344
- "openai.tool_search": "tool_search"
6466
+ "openai.tool_search": "tool_search",
6467
+ "openai.programmatic_tool_calling": "programmatic_tool_calling"
6345
6468
  }
6346
6469
  });
6347
6470
  const customProviderToolNames = /* @__PURE__ */ new Set();
@@ -6828,7 +6951,52 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6828
6951
  providerMetadata: {
6829
6952
  [providerOptionsName]: {
6830
6953
  itemId: part.id,
6831
- ...part.namespace != null && { namespace: part.namespace }
6954
+ ...part.namespace != null && { namespace: part.namespace },
6955
+ ...part.caller != null && {
6956
+ caller: part.caller.type === "program" ? {
6957
+ type: "program",
6958
+ callerId: part.caller.caller_id
6959
+ } : part.caller
6960
+ }
6961
+ }
6962
+ }
6963
+ });
6964
+ break;
6965
+ }
6966
+ case "program": {
6967
+ content.push({
6968
+ type: "tool-call",
6969
+ toolCallId: part.call_id,
6970
+ toolName: toolNameMapping.toCustomToolName(
6971
+ "programmatic_tool_calling"
6972
+ ),
6973
+ input: JSON.stringify({
6974
+ code: part.code,
6975
+ fingerprint: part.fingerprint
6976
+ }),
6977
+ providerExecuted: true,
6978
+ providerMetadata: {
6979
+ [providerOptionsName]: {
6980
+ itemId: part.id
6981
+ }
6982
+ }
6983
+ });
6984
+ break;
6985
+ }
6986
+ case "program_output": {
6987
+ content.push({
6988
+ type: "tool-result",
6989
+ toolCallId: part.call_id,
6990
+ toolName: toolNameMapping.toCustomToolName(
6991
+ "programmatic_tool_calling"
6992
+ ),
6993
+ result: {
6994
+ result: part.result,
6995
+ status: part.status
6996
+ },
6997
+ providerMetadata: {
6998
+ [providerOptionsName]: {
6999
+ itemId: part.id
6832
7000
  }
6833
7001
  }
6834
7002
  });
@@ -7380,10 +7548,51 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7380
7548
  itemId: value.item.id,
7381
7549
  ...value.item.namespace != null && {
7382
7550
  namespace: value.item.namespace
7551
+ },
7552
+ ...value.item.caller != null && {
7553
+ caller: value.item.caller.type === "program" ? {
7554
+ type: "program",
7555
+ callerId: value.item.caller.caller_id
7556
+ } : value.item.caller
7383
7557
  }
7384
7558
  }
7385
7559
  }
7386
7560
  });
7561
+ } else if (value.item.type === "program") {
7562
+ controller.enqueue({
7563
+ type: "tool-call",
7564
+ toolCallId: value.item.call_id,
7565
+ toolName: toolNameMapping.toCustomToolName(
7566
+ "programmatic_tool_calling"
7567
+ ),
7568
+ input: JSON.stringify({
7569
+ code: value.item.code,
7570
+ fingerprint: value.item.fingerprint
7571
+ }),
7572
+ providerExecuted: true,
7573
+ providerMetadata: {
7574
+ [providerOptionsName]: {
7575
+ itemId: value.item.id
7576
+ }
7577
+ }
7578
+ });
7579
+ } else if (value.item.type === "program_output") {
7580
+ controller.enqueue({
7581
+ type: "tool-result",
7582
+ toolCallId: value.item.call_id,
7583
+ toolName: toolNameMapping.toCustomToolName(
7584
+ "programmatic_tool_calling"
7585
+ ),
7586
+ result: {
7587
+ result: value.item.result,
7588
+ status: value.item.status
7589
+ },
7590
+ providerMetadata: {
7591
+ [providerOptionsName]: {
7592
+ itemId: value.item.id
7593
+ }
7594
+ }
7595
+ });
7387
7596
  } else if (value.item.type === "custom_tool_call") {
7388
7597
  ongoingToolCalls[value.output_index] = void 0;
7389
7598
  hasFunctionCall = true;
@@ -8149,15 +8358,15 @@ import {
8149
8358
 
8150
8359
  // src/speech/openai-speech-model-options.ts
8151
8360
  import {
8152
- lazySchema as lazySchema25,
8153
- zodSchema as zodSchema25
8361
+ lazySchema as lazySchema26,
8362
+ zodSchema as zodSchema26
8154
8363
  } from "@ai-sdk/provider-utils";
8155
- import { z as z27 } from "zod/v4";
8156
- var openaiSpeechModelOptionsSchema = lazySchema25(
8157
- () => zodSchema25(
8158
- z27.object({
8159
- instructions: z27.string().nullish(),
8160
- speed: z27.number().min(0.25).max(4).default(1).nullish()
8364
+ import { z as z28 } from "zod/v4";
8365
+ var openaiSpeechModelOptionsSchema = lazySchema26(
8366
+ () => zodSchema26(
8367
+ z28.object({
8368
+ instructions: z28.string().nullish(),
8369
+ speed: z28.number().min(0.25).max(4).default(1).nullish()
8161
8370
  })
8162
8371
  )
8163
8372
  );
@@ -8294,33 +8503,33 @@ import {
8294
8503
  } from "@ai-sdk/provider-utils";
8295
8504
 
8296
8505
  // src/transcription/openai-transcription-api.ts
8297
- import { lazySchema as lazySchema26, zodSchema as zodSchema26 } from "@ai-sdk/provider-utils";
8298
- import { z as z28 } from "zod/v4";
8299
- var openaiTranscriptionResponseSchema = lazySchema26(
8300
- () => zodSchema26(
8301
- z28.object({
8302
- text: z28.string(),
8303
- language: z28.string().nullish(),
8304
- duration: z28.number().nullish(),
8305
- words: z28.array(
8306
- z28.object({
8307
- word: z28.string(),
8308
- start: z28.number(),
8309
- end: z28.number()
8506
+ import { lazySchema as lazySchema27, zodSchema as zodSchema27 } from "@ai-sdk/provider-utils";
8507
+ import { z as z29 } from "zod/v4";
8508
+ var openaiTranscriptionResponseSchema = lazySchema27(
8509
+ () => zodSchema27(
8510
+ z29.object({
8511
+ text: z29.string(),
8512
+ language: z29.string().nullish(),
8513
+ duration: z29.number().nullish(),
8514
+ words: z29.array(
8515
+ z29.object({
8516
+ word: z29.string(),
8517
+ start: z29.number(),
8518
+ end: z29.number()
8310
8519
  })
8311
8520
  ).nullish(),
8312
- segments: z28.array(
8313
- z28.object({
8314
- id: z28.number(),
8315
- seek: z28.number(),
8316
- start: z28.number(),
8317
- end: z28.number(),
8318
- text: z28.string(),
8319
- tokens: z28.array(z28.number()),
8320
- temperature: z28.number(),
8321
- avg_logprob: z28.number(),
8322
- compression_ratio: z28.number(),
8323
- no_speech_prob: z28.number()
8521
+ segments: z29.array(
8522
+ z29.object({
8523
+ id: z29.number(),
8524
+ seek: z29.number(),
8525
+ start: z29.number(),
8526
+ end: z29.number(),
8527
+ text: z29.string(),
8528
+ tokens: z29.array(z29.number()),
8529
+ temperature: z29.number(),
8530
+ avg_logprob: z29.number(),
8531
+ compression_ratio: z29.number(),
8532
+ no_speech_prob: z29.number()
8324
8533
  })
8325
8534
  ).nullish()
8326
8535
  })
@@ -8329,47 +8538,47 @@ var openaiTranscriptionResponseSchema = lazySchema26(
8329
8538
 
8330
8539
  // src/transcription/openai-transcription-model-options.ts
8331
8540
  import {
8332
- lazySchema as lazySchema27,
8333
- zodSchema as zodSchema27
8541
+ lazySchema as lazySchema28,
8542
+ zodSchema as zodSchema28
8334
8543
  } from "@ai-sdk/provider-utils";
8335
- import { z as z29 } from "zod/v4";
8336
- var openAITranscriptionModelOptions = lazySchema27(
8337
- () => zodSchema27(
8338
- z29.object({
8544
+ import { z as z30 } from "zod/v4";
8545
+ var openAITranscriptionModelOptions = lazySchema28(
8546
+ () => zodSchema28(
8547
+ z30.object({
8339
8548
  /**
8340
8549
  * Additional information to include in the transcription response.
8341
8550
  */
8342
- include: z29.array(z29.string()).optional(),
8551
+ include: z30.array(z30.string()).optional(),
8343
8552
  /**
8344
8553
  * The language of the input audio in ISO-639-1 format.
8345
8554
  */
8346
- language: z29.string().optional(),
8555
+ language: z30.string().optional(),
8347
8556
  /**
8348
8557
  * An optional text to guide the model's style or continue a previous audio segment.
8349
8558
  */
8350
- prompt: z29.string().optional(),
8559
+ prompt: z30.string().optional(),
8351
8560
  /**
8352
8561
  * The sampling temperature, between 0 and 1.
8353
8562
  * @default 0
8354
8563
  */
8355
- temperature: z29.number().min(0).max(1).default(0).optional(),
8564
+ temperature: z30.number().min(0).max(1).default(0).optional(),
8356
8565
  /**
8357
8566
  * The timestamp granularities to populate for this transcription.
8358
8567
  * @default ['segment']
8359
8568
  */
8360
- timestampGranularities: z29.array(z29.enum(["word", "segment"])).default(["segment"]).optional(),
8569
+ timestampGranularities: z30.array(z30.enum(["word", "segment"])).default(["segment"]).optional(),
8361
8570
  /**
8362
8571
  * Options for streaming transcription models such as `gpt-realtime-whisper`.
8363
8572
  */
8364
- streaming: z29.object({
8573
+ streaming: z30.object({
8365
8574
  /**
8366
8575
  * Latency/accuracy tradeoff for realtime transcription.
8367
8576
  */
8368
- delay: z29.enum(["minimal", "low", "medium", "high", "xhigh"]).optional(),
8577
+ delay: z30.enum(["minimal", "low", "medium", "high", "xhigh"]).optional(),
8369
8578
  /**
8370
8579
  * Additional fields to include in realtime transcription events.
8371
8580
  */
8372
- include: z29.array(z29.string()).optional()
8581
+ include: z30.array(z30.string()).optional()
8373
8582
  }).optional()
8374
8583
  })
8375
8584
  )
@@ -8814,28 +9023,28 @@ import {
8814
9023
  } from "@ai-sdk/provider-utils";
8815
9024
 
8816
9025
  // src/skills/openai-skills-api.ts
8817
- import { lazySchema as lazySchema28, zodSchema as zodSchema28 } from "@ai-sdk/provider-utils";
8818
- import { z as z30 } from "zod/v4";
8819
- var openaiSkillResponseSchema = lazySchema28(
8820
- () => zodSchema28(
8821
- z30.object({
8822
- id: z30.string(),
8823
- name: z30.string().nullish(),
8824
- description: z30.string().nullish(),
8825
- default_version: z30.string().nullish(),
8826
- latest_version: z30.string().nullish(),
8827
- created_at: z30.number(),
8828
- updated_at: z30.number().nullish()
9026
+ import { lazySchema as lazySchema29, zodSchema as zodSchema29 } from "@ai-sdk/provider-utils";
9027
+ import { z as z31 } from "zod/v4";
9028
+ var openaiSkillResponseSchema = lazySchema29(
9029
+ () => zodSchema29(
9030
+ z31.object({
9031
+ id: z31.string(),
9032
+ name: z31.string().nullish(),
9033
+ description: z31.string().nullish(),
9034
+ default_version: z31.string().nullish(),
9035
+ latest_version: z31.string().nullish(),
9036
+ created_at: z31.number(),
9037
+ updated_at: z31.number().nullish()
8829
9038
  })
8830
9039
  )
8831
9040
  );
8832
- var openaiSkillVersionResponseSchema = lazySchema28(
8833
- () => zodSchema28(
8834
- z30.object({
8835
- id: z30.string(),
8836
- version: z30.string().nullish(),
8837
- name: z30.string().nullish(),
8838
- description: z30.string().nullish()
9041
+ var openaiSkillVersionResponseSchema = lazySchema29(
9042
+ () => zodSchema29(
9043
+ z31.object({
9044
+ id: z31.string(),
9045
+ version: z31.string().nullish(),
9046
+ name: z31.string().nullish(),
9047
+ description: z31.string().nullish()
8839
9048
  })
8840
9049
  )
8841
9050
  );
@@ -8890,7 +9099,7 @@ var OpenAISkills = class {
8890
9099
  };
8891
9100
 
8892
9101
  // src/version.ts
8893
- var VERSION = true ? "4.0.19" : "0.0.0-test";
9102
+ var VERSION = true ? "4.0.21" : "0.0.0-test";
8894
9103
 
8895
9104
  // src/openai-provider.ts
8896
9105
  function createOpenAI(options = {}) {