@ai-sdk/openai 3.0.124 → 3.0.126

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.
@@ -2844,9 +2844,10 @@ import {
2844
2844
  isNonNullable,
2845
2845
  parseJSON,
2846
2846
  parseProviderOptions as parseProviderOptions7,
2847
+ safeValidateTypes,
2847
2848
  validateTypes
2848
2849
  } from "@ai-sdk/provider-utils";
2849
- import { z as z18 } from "zod/v4";
2850
+ import { z as z19 } from "zod/v4";
2850
2851
 
2851
2852
  // src/responses/openai-responses-options.ts
2852
2853
  import {
@@ -3365,6 +3366,68 @@ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
3365
3366
  outputSchema: toolSearchOutputSchema
3366
3367
  });
3367
3368
 
3369
+ // src/tool/web-search.ts
3370
+ import {
3371
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3372
+ lazySchema as lazySchema17,
3373
+ zodSchema as zodSchema17
3374
+ } from "@ai-sdk/provider-utils";
3375
+ import { z as z18 } from "zod/v4";
3376
+ var webSearchArgsSchema = lazySchema17(
3377
+ () => zodSchema17(
3378
+ z18.object({
3379
+ externalWebAccess: z18.boolean().optional(),
3380
+ filters: z18.object({
3381
+ allowedDomains: z18.array(z18.string()).optional(),
3382
+ blockedDomains: z18.array(z18.string()).optional()
3383
+ }).optional(),
3384
+ searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
3385
+ userLocation: z18.object({
3386
+ type: z18.literal("approximate"),
3387
+ country: z18.string().optional(),
3388
+ city: z18.string().optional(),
3389
+ region: z18.string().optional(),
3390
+ timezone: z18.string().optional()
3391
+ }).optional()
3392
+ })
3393
+ )
3394
+ );
3395
+ var webSearchInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
3396
+ var webSearchOutputSchema = lazySchema17(
3397
+ () => zodSchema17(
3398
+ z18.object({
3399
+ action: z18.discriminatedUnion("type", [
3400
+ z18.object({
3401
+ type: z18.literal("search"),
3402
+ query: z18.string().optional(),
3403
+ queries: z18.array(z18.string()).optional()
3404
+ }),
3405
+ z18.object({
3406
+ type: z18.literal("openPage"),
3407
+ url: z18.string().nullish()
3408
+ }),
3409
+ z18.object({
3410
+ type: z18.literal("findInPage"),
3411
+ url: z18.string().nullish(),
3412
+ pattern: z18.string().nullish()
3413
+ })
3414
+ ]).optional(),
3415
+ sources: z18.array(
3416
+ z18.discriminatedUnion("type", [
3417
+ z18.object({ type: z18.literal("url"), url: z18.string() }),
3418
+ z18.object({ type: z18.literal("api"), name: z18.string() })
3419
+ ])
3420
+ ).optional()
3421
+ })
3422
+ )
3423
+ );
3424
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema5({
3425
+ id: "openai.web_search",
3426
+ inputSchema: webSearchInputSchema,
3427
+ outputSchema: webSearchOutputSchema
3428
+ });
3429
+ var webSearch = (args = {}) => webSearchToolFactory(args);
3430
+
3368
3431
  // src/responses/expand-parallel-tool-call.ts
3369
3432
  import {
3370
3433
  isJSONObject
@@ -3447,6 +3510,57 @@ async function expandParallelToolCall({
3447
3510
  function serializeToolCallArguments2(input) {
3448
3511
  return JSON.stringify(input === void 0 ? {} : input);
3449
3512
  }
3513
+ async function convertWebSearchToolResultOutput({
3514
+ output,
3515
+ id
3516
+ }) {
3517
+ if (output.type !== "json") {
3518
+ return void 0;
3519
+ }
3520
+ const validation = await safeValidateTypes({
3521
+ value: output.value,
3522
+ schema: webSearchOutputSchema
3523
+ });
3524
+ if (!validation.success || validation.value.action == null) {
3525
+ return void 0;
3526
+ }
3527
+ const { action, sources } = validation.value;
3528
+ switch (action.type) {
3529
+ case "search":
3530
+ return {
3531
+ type: "web_search_call",
3532
+ id,
3533
+ status: "completed",
3534
+ action: {
3535
+ type: "search",
3536
+ ...action.query != null && { query: action.query },
3537
+ ...action.queries != null && { queries: action.queries },
3538
+ ...sources != null && { sources }
3539
+ }
3540
+ };
3541
+ case "openPage":
3542
+ return {
3543
+ type: "web_search_call",
3544
+ id,
3545
+ status: "completed",
3546
+ action: {
3547
+ type: "open_page",
3548
+ url: action.url
3549
+ }
3550
+ };
3551
+ case "findInPage":
3552
+ return {
3553
+ type: "web_search_call",
3554
+ id,
3555
+ status: "completed",
3556
+ action: {
3557
+ type: "find_in_page",
3558
+ url: action.url,
3559
+ pattern: action.pattern
3560
+ }
3561
+ };
3562
+ }
3563
+ }
3450
3564
  async function convertFunctionToolResultOutput({
3451
3565
  output,
3452
3566
  promptCacheBreakpoint,
@@ -3653,7 +3767,7 @@ async function convertToOpenAIResponsesInput({
3653
3767
  toolSearchToolName,
3654
3768
  customProviderToolNames
3655
3769
  }) {
3656
- var _a2, _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;
3770
+ var _a2, _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;
3657
3771
  let input = [];
3658
3772
  const warnings = [];
3659
3773
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3999,8 +4113,23 @@ async function convertToOpenAIResponsesInput({
3999
4113
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
4000
4114
  part.toolName
4001
4115
  );
4116
+ if (resolvedResultToolName === "web_search" || resolvedResultToolName === "web_search_preview") {
4117
+ const itemId = (_u = (_t = (_s = part.providerOptions) == null ? void 0 : _s[providerOptionsName]) == null ? void 0 : _t.itemId) != null ? _u : part.toolCallId;
4118
+ if (store) {
4119
+ input.push({ type: "item_reference", id: itemId });
4120
+ break;
4121
+ }
4122
+ const webSearchCall = await convertWebSearchToolResultOutput({
4123
+ output: part.output,
4124
+ id: itemId
4125
+ });
4126
+ if (webSearchCall != null) {
4127
+ input.push(webSearchCall);
4128
+ break;
4129
+ }
4130
+ }
4002
4131
  if (part.toolName === toolSearchToolName) {
4003
- const itemId = (_x = (_w = (_t = (_s = part.providerOptions) == null ? void 0 : _s[providerOptionsName]) == null ? void 0 : _t.itemId) != null ? _w : (_v = (_u = part.providerMetadata) == null ? void 0 : _u[providerOptionsName]) == null ? void 0 : _v.itemId) != null ? _x : part.toolCallId;
4132
+ 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;
4004
4133
  if (store) {
4005
4134
  input.push({ type: "item_reference", id: itemId });
4006
4135
  } else if (part.output.type === "json") {
@@ -4041,7 +4170,7 @@ async function convertToOpenAIResponsesInput({
4041
4170
  break;
4042
4171
  }
4043
4172
  if (store) {
4044
- const itemId = (_A = (_z = (_y = part.providerOptions) == null ? void 0 : _y[providerOptionsName]) == null ? void 0 : _z.itemId) != null ? _A : part.toolCallId;
4173
+ const itemId = (_D = (_C = (_B = part.providerOptions) == null ? void 0 : _B[providerOptionsName]) == null ? void 0 : _C.itemId) != null ? _D : part.toolCallId;
4045
4174
  input.push({ type: "item_reference", id: itemId });
4046
4175
  } else {
4047
4176
  warnings.push({
@@ -4208,7 +4337,7 @@ ${text}`,
4208
4337
  }
4209
4338
  const output = part.output;
4210
4339
  if (output.type === "execution-denied") {
4211
- const approvalId = (_C = (_B = output.providerOptions) == null ? void 0 : _B.openai) == null ? void 0 : _C.approvalId;
4340
+ const approvalId = (_F = (_E = output.providerOptions) == null ? void 0 : _E.openai) == null ? void 0 : _F.approvalId;
4212
4341
  if (approvalId) {
4213
4342
  continue;
4214
4343
  }
@@ -4295,7 +4424,7 @@ ${text}`,
4295
4424
  break;
4296
4425
  case "execution-denied":
4297
4426
  outputValue = convertScalarOutput(
4298
- (_D = output.reason) != null ? _D : "Tool call execution denied."
4427
+ (_G = output.reason) != null ? _G : "Tool call execution denied."
4299
4428
  );
4300
4429
  break;
4301
4430
  case "json":
@@ -4409,9 +4538,9 @@ ${text}`,
4409
4538
  }
4410
4539
  return { input, warnings };
4411
4540
  }
4412
- var openaiResponsesReasoningProviderOptionsSchema = z18.object({
4413
- itemId: z18.string().nullish(),
4414
- reasoningEncryptedContent: z18.string().nullish()
4541
+ var openaiResponsesReasoningProviderOptionsSchema = z19.object({
4542
+ itemId: z19.string().nullish(),
4543
+ reasoningEncryptedContent: z19.string().nullish()
4415
4544
  });
4416
4545
 
4417
4546
  // src/responses/map-openai-responses-finish-reason.ts
@@ -4434,77 +4563,77 @@ function mapOpenAIResponseFinishReason({
4434
4563
 
4435
4564
  // src/responses/openai-responses-api.ts
4436
4565
  import {
4437
- lazySchema as lazySchema17,
4438
- zodSchema as zodSchema17
4566
+ lazySchema as lazySchema18,
4567
+ zodSchema as zodSchema18
4439
4568
  } from "@ai-sdk/provider-utils";
4440
- import { z as z19 } from "zod/v4";
4441
- var jsonValueSchema = z19.lazy(
4442
- () => z19.union([
4443
- z19.string(),
4444
- z19.number(),
4445
- z19.boolean(),
4446
- z19.null(),
4447
- z19.array(jsonValueSchema),
4448
- z19.record(z19.string(), jsonValueSchema.optional())
4569
+ import { z as z20 } from "zod/v4";
4570
+ var jsonValueSchema = z20.lazy(
4571
+ () => z20.union([
4572
+ z20.string(),
4573
+ z20.number(),
4574
+ z20.boolean(),
4575
+ z20.null(),
4576
+ z20.array(jsonValueSchema),
4577
+ z20.record(z20.string(), jsonValueSchema.optional())
4449
4578
  ])
4450
4579
  );
4451
- var jsonObjectSchema = z19.record(z19.string(), jsonValueSchema.optional());
4452
- var openaiResponsesUsageSchema = z19.intersection(
4580
+ var jsonObjectSchema = z20.record(z20.string(), jsonValueSchema.optional());
4581
+ var openaiResponsesUsageSchema = z20.intersection(
4453
4582
  jsonObjectSchema,
4454
- z19.object({
4455
- input_tokens: z19.number(),
4456
- input_tokens_details: z19.intersection(
4583
+ z20.object({
4584
+ input_tokens: z20.number(),
4585
+ input_tokens_details: z20.intersection(
4457
4586
  jsonObjectSchema,
4458
- z19.object({
4459
- cached_tokens: z19.number().nullish(),
4460
- cache_write_tokens: z19.number().nullish(),
4461
- orchestration_input_tokens: z19.number().nullish(),
4462
- orchestration_input_cached_tokens: z19.number().nullish()
4587
+ z20.object({
4588
+ cached_tokens: z20.number().nullish(),
4589
+ cache_write_tokens: z20.number().nullish(),
4590
+ orchestration_input_tokens: z20.number().nullish(),
4591
+ orchestration_input_cached_tokens: z20.number().nullish()
4463
4592
  })
4464
4593
  ).nullish(),
4465
- output_tokens: z19.number(),
4466
- output_tokens_details: z19.intersection(
4594
+ output_tokens: z20.number(),
4595
+ output_tokens_details: z20.intersection(
4467
4596
  jsonObjectSchema,
4468
- z19.object({
4469
- reasoning_tokens: z19.number().nullish(),
4470
- orchestration_output_tokens: z19.number().nullish()
4597
+ z20.object({
4598
+ reasoning_tokens: z20.number().nullish(),
4599
+ orchestration_output_tokens: z20.number().nullish()
4471
4600
  })
4472
4601
  ).nullish(),
4473
- total_tokens: z19.number().optional()
4602
+ total_tokens: z20.number().optional()
4474
4603
  })
4475
4604
  );
4476
4605
  function isRecord(value) {
4477
4606
  return value != null && typeof value === "object" && !Array.isArray(value);
4478
4607
  }
4479
- var openaiResponsesLocalShellCallSchema = z19.object({
4480
- type: z19.literal("local_shell_call"),
4481
- id: z19.string(),
4482
- call_id: z19.string(),
4483
- action: z19.object({
4484
- type: z19.literal("exec"),
4485
- command: z19.array(z19.string()),
4486
- timeout_ms: z19.number().optional(),
4487
- user: z19.string().optional(),
4488
- working_directory: z19.string().optional(),
4489
- env: z19.record(z19.string(), z19.string()).optional()
4608
+ var openaiResponsesLocalShellCallSchema = z20.object({
4609
+ type: z20.literal("local_shell_call"),
4610
+ id: z20.string(),
4611
+ call_id: z20.string(),
4612
+ action: z20.object({
4613
+ type: z20.literal("exec"),
4614
+ command: z20.array(z20.string()),
4615
+ timeout_ms: z20.number().optional(),
4616
+ user: z20.string().optional(),
4617
+ working_directory: z20.string().optional(),
4618
+ env: z20.record(z20.string(), z20.string()).optional()
4490
4619
  })
4491
4620
  });
4492
- var openaiResponsesNestedErrorChunkSchema = z19.object({
4493
- type: z19.literal("error"),
4494
- sequence_number: z19.number(),
4495
- error: z19.object({
4496
- type: z19.string(),
4497
- code: z19.string(),
4498
- message: z19.string(),
4499
- param: z19.string().nullish()
4621
+ var openaiResponsesNestedErrorChunkSchema = z20.object({
4622
+ type: z20.literal("error"),
4623
+ sequence_number: z20.number(),
4624
+ error: z20.object({
4625
+ type: z20.string(),
4626
+ code: z20.string().nullish(),
4627
+ message: z20.string(),
4628
+ param: z20.string().nullish()
4500
4629
  })
4501
4630
  });
4502
- var openaiResponsesErrorChunkSchema = z19.object({
4503
- type: z19.literal("error"),
4504
- sequence_number: z19.number(),
4505
- code: z19.string().nullish(),
4506
- message: z19.string(),
4507
- param: z19.string().nullish()
4631
+ var openaiResponsesErrorChunkSchema = z20.object({
4632
+ type: z20.literal("error"),
4633
+ sequence_number: z20.number(),
4634
+ code: z20.string().nullish(),
4635
+ message: z20.string(),
4636
+ param: z20.string().nullish()
4508
4637
  });
4509
4638
  var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
4510
4639
  "error",
@@ -4560,523 +4689,523 @@ function isModeledOpenAIResponsesChunk(value) {
4560
4689
  }
4561
4690
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4562
4691
  }
4563
- var openaiResponsesChunkSchema = lazySchema17(
4564
- () => zodSchema17(
4565
- z19.union([
4566
- z19.object({
4567
- type: z19.literal("response.output_text.delta"),
4568
- item_id: z19.string(),
4569
- delta: z19.string(),
4570
- logprobs: z19.array(
4571
- z19.object({
4572
- token: z19.string(),
4573
- logprob: z19.number(),
4574
- top_logprobs: z19.array(
4575
- z19.object({
4576
- token: z19.string(),
4577
- logprob: z19.number()
4692
+ var openaiResponsesChunkSchema = lazySchema18(
4693
+ () => zodSchema18(
4694
+ z20.union([
4695
+ z20.object({
4696
+ type: z20.literal("response.output_text.delta"),
4697
+ item_id: z20.string(),
4698
+ delta: z20.string(),
4699
+ logprobs: z20.array(
4700
+ z20.object({
4701
+ token: z20.string(),
4702
+ logprob: z20.number(),
4703
+ top_logprobs: z20.array(
4704
+ z20.object({
4705
+ token: z20.string(),
4706
+ logprob: z20.number()
4578
4707
  })
4579
4708
  )
4580
4709
  })
4581
4710
  ).nullish()
4582
4711
  }),
4583
- z19.object({
4584
- type: z19.enum(["response.completed", "response.incomplete"]),
4585
- response: z19.object({
4586
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4712
+ z20.object({
4713
+ type: z20.enum(["response.completed", "response.incomplete"]),
4714
+ response: z20.object({
4715
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4587
4716
  usage: openaiResponsesUsageSchema.nullish(),
4588
- reasoning: z19.object({
4589
- context: z19.string().nullish()
4717
+ reasoning: z20.object({
4718
+ context: z20.string().nullish()
4590
4719
  }).nullish(),
4591
- service_tier: z19.string().nullish()
4720
+ service_tier: z20.string().nullish()
4592
4721
  })
4593
4722
  }),
4594
- z19.object({
4595
- type: z19.literal("response.failed"),
4596
- sequence_number: z19.number(),
4597
- response: z19.object({
4598
- error: z19.object({
4599
- code: z19.string().nullish(),
4600
- message: z19.string()
4723
+ z20.object({
4724
+ type: z20.literal("response.failed"),
4725
+ sequence_number: z20.number(),
4726
+ response: z20.object({
4727
+ error: z20.object({
4728
+ code: z20.string().nullish(),
4729
+ message: z20.string()
4601
4730
  }).nullish(),
4602
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
4731
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4603
4732
  usage: openaiResponsesUsageSchema.nullish(),
4604
- reasoning: z19.object({
4605
- context: z19.string().nullish()
4733
+ reasoning: z20.object({
4734
+ context: z20.string().nullish()
4606
4735
  }).nullish(),
4607
- service_tier: z19.string().nullish()
4736
+ service_tier: z20.string().nullish()
4608
4737
  })
4609
4738
  }),
4610
- z19.object({
4611
- type: z19.literal("response.created"),
4612
- response: z19.object({
4613
- id: z19.string(),
4614
- created_at: z19.number(),
4615
- model: z19.string(),
4616
- service_tier: z19.string().nullish()
4739
+ z20.object({
4740
+ type: z20.literal("response.created"),
4741
+ response: z20.object({
4742
+ id: z20.string(),
4743
+ created_at: z20.number(),
4744
+ model: z20.string(),
4745
+ service_tier: z20.string().nullish()
4617
4746
  })
4618
4747
  }),
4619
- z19.object({
4620
- type: z19.literal("response.output_item.added"),
4621
- output_index: z19.number(),
4622
- item: z19.discriminatedUnion("type", [
4623
- z19.object({
4624
- type: z19.literal("message"),
4625
- id: z19.string(),
4626
- phase: z19.enum(["commentary", "final_answer"]).nullish()
4748
+ z20.object({
4749
+ type: z20.literal("response.output_item.added"),
4750
+ output_index: z20.number(),
4751
+ item: z20.discriminatedUnion("type", [
4752
+ z20.object({
4753
+ type: z20.literal("message"),
4754
+ id: z20.string(),
4755
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
4627
4756
  }),
4628
- z19.object({
4629
- type: z19.literal("reasoning"),
4630
- id: z19.string(),
4631
- encrypted_content: z19.string().nullish()
4757
+ z20.object({
4758
+ type: z20.literal("reasoning"),
4759
+ id: z20.string(),
4760
+ encrypted_content: z20.string().nullish()
4632
4761
  }),
4633
- z19.object({
4634
- type: z19.literal("function_call"),
4635
- id: z19.string(),
4636
- call_id: z19.string(),
4637
- name: z19.string(),
4638
- arguments: z19.string(),
4639
- async: z19.boolean().nullish(),
4640
- namespace: z19.string().nullish()
4762
+ z20.object({
4763
+ type: z20.literal("function_call"),
4764
+ id: z20.string(),
4765
+ call_id: z20.string(),
4766
+ name: z20.string(),
4767
+ arguments: z20.string(),
4768
+ async: z20.boolean().nullish(),
4769
+ namespace: z20.string().nullish()
4641
4770
  }),
4642
- z19.object({
4643
- type: z19.literal("web_search_call"),
4644
- id: z19.string(),
4645
- status: z19.string()
4771
+ z20.object({
4772
+ type: z20.literal("web_search_call"),
4773
+ id: z20.string(),
4774
+ status: z20.string()
4646
4775
  }),
4647
- z19.object({
4648
- type: z19.literal("computer_call"),
4649
- id: z19.string(),
4650
- status: z19.string()
4776
+ z20.object({
4777
+ type: z20.literal("computer_call"),
4778
+ id: z20.string(),
4779
+ status: z20.string()
4651
4780
  }),
4652
- z19.object({
4653
- type: z19.literal("file_search_call"),
4654
- id: z19.string()
4781
+ z20.object({
4782
+ type: z20.literal("file_search_call"),
4783
+ id: z20.string()
4655
4784
  }),
4656
4785
  openaiResponsesLocalShellCallSchema,
4657
- z19.object({
4658
- type: z19.literal("image_generation_call"),
4659
- id: z19.string()
4786
+ z20.object({
4787
+ type: z20.literal("image_generation_call"),
4788
+ id: z20.string()
4660
4789
  }),
4661
- z19.object({
4662
- type: z19.literal("code_interpreter_call"),
4663
- id: z19.string(),
4664
- container_id: z19.string(),
4665
- code: z19.string().nullable(),
4666
- outputs: z19.array(
4667
- z19.discriminatedUnion("type", [
4668
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4669
- z19.object({ type: z19.literal("image"), url: z19.string() })
4790
+ z20.object({
4791
+ type: z20.literal("code_interpreter_call"),
4792
+ id: z20.string(),
4793
+ container_id: z20.string(),
4794
+ code: z20.string().nullable(),
4795
+ outputs: z20.array(
4796
+ z20.discriminatedUnion("type", [
4797
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
4798
+ z20.object({ type: z20.literal("image"), url: z20.string() })
4670
4799
  ])
4671
4800
  ).nullable(),
4672
- status: z19.string()
4801
+ status: z20.string()
4673
4802
  }),
4674
- z19.object({
4675
- type: z19.literal("mcp_call"),
4676
- id: z19.string(),
4677
- status: z19.string(),
4678
- approval_request_id: z19.string().nullish()
4803
+ z20.object({
4804
+ type: z20.literal("mcp_call"),
4805
+ id: z20.string(),
4806
+ status: z20.string(),
4807
+ approval_request_id: z20.string().nullish()
4679
4808
  }),
4680
- z19.object({
4681
- type: z19.literal("mcp_list_tools"),
4682
- id: z19.string()
4809
+ z20.object({
4810
+ type: z20.literal("mcp_list_tools"),
4811
+ id: z20.string()
4683
4812
  }),
4684
- z19.object({
4685
- type: z19.literal("mcp_approval_request"),
4686
- id: z19.string()
4813
+ z20.object({
4814
+ type: z20.literal("mcp_approval_request"),
4815
+ id: z20.string()
4687
4816
  }),
4688
- z19.object({
4689
- type: z19.literal("apply_patch_call"),
4690
- id: z19.string(),
4691
- call_id: z19.string(),
4692
- status: z19.enum(["in_progress", "completed"]),
4693
- operation: z19.discriminatedUnion("type", [
4694
- z19.object({
4695
- type: z19.literal("create_file"),
4696
- path: z19.string(),
4697
- diff: z19.string()
4817
+ z20.object({
4818
+ type: z20.literal("apply_patch_call"),
4819
+ id: z20.string(),
4820
+ call_id: z20.string(),
4821
+ status: z20.enum(["in_progress", "completed"]),
4822
+ operation: z20.discriminatedUnion("type", [
4823
+ z20.object({
4824
+ type: z20.literal("create_file"),
4825
+ path: z20.string(),
4826
+ diff: z20.string()
4698
4827
  }),
4699
- z19.object({
4700
- type: z19.literal("delete_file"),
4701
- path: z19.string()
4828
+ z20.object({
4829
+ type: z20.literal("delete_file"),
4830
+ path: z20.string()
4702
4831
  }),
4703
- z19.object({
4704
- type: z19.literal("update_file"),
4705
- path: z19.string(),
4706
- diff: z19.string()
4832
+ z20.object({
4833
+ type: z20.literal("update_file"),
4834
+ path: z20.string(),
4835
+ diff: z20.string()
4707
4836
  })
4708
4837
  ])
4709
4838
  }),
4710
- z19.object({
4711
- type: z19.literal("custom_tool_call"),
4712
- id: z19.string(),
4713
- call_id: z19.string(),
4714
- name: z19.string(),
4715
- input: z19.string(),
4716
- async: z19.boolean().nullish()
4839
+ z20.object({
4840
+ type: z20.literal("custom_tool_call"),
4841
+ id: z20.string(),
4842
+ call_id: z20.string(),
4843
+ name: z20.string(),
4844
+ input: z20.string(),
4845
+ async: z20.boolean().nullish()
4717
4846
  }),
4718
- z19.object({
4719
- type: z19.literal("shell_call"),
4720
- id: z19.string(),
4721
- call_id: z19.string(),
4722
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4723
- action: z19.object({
4724
- commands: z19.array(z19.string())
4847
+ z20.object({
4848
+ type: z20.literal("shell_call"),
4849
+ id: z20.string(),
4850
+ call_id: z20.string(),
4851
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4852
+ action: z20.object({
4853
+ commands: z20.array(z20.string())
4725
4854
  })
4726
4855
  }),
4727
- z19.object({
4728
- type: z19.literal("shell_call_output"),
4729
- id: z19.string(),
4730
- call_id: z19.string(),
4731
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4732
- output: z19.array(
4733
- z19.object({
4734
- stdout: z19.string(),
4735
- stderr: z19.string(),
4736
- outcome: z19.discriminatedUnion("type", [
4737
- z19.object({ type: z19.literal("timeout") }),
4738
- z19.object({
4739
- type: z19.literal("exit"),
4740
- exit_code: z19.number()
4856
+ z20.object({
4857
+ type: z20.literal("shell_call_output"),
4858
+ id: z20.string(),
4859
+ call_id: z20.string(),
4860
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4861
+ output: z20.array(
4862
+ z20.object({
4863
+ stdout: z20.string(),
4864
+ stderr: z20.string(),
4865
+ outcome: z20.discriminatedUnion("type", [
4866
+ z20.object({ type: z20.literal("timeout") }),
4867
+ z20.object({
4868
+ type: z20.literal("exit"),
4869
+ exit_code: z20.number()
4741
4870
  })
4742
4871
  ])
4743
4872
  })
4744
4873
  )
4745
4874
  }),
4746
- z19.object({
4747
- type: z19.literal("tool_search_call"),
4748
- id: z19.string(),
4749
- execution: z19.enum(["server", "client"]),
4750
- call_id: z19.string().nullable(),
4751
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4752
- arguments: z19.unknown()
4875
+ z20.object({
4876
+ type: z20.literal("tool_search_call"),
4877
+ id: z20.string(),
4878
+ execution: z20.enum(["server", "client"]),
4879
+ call_id: z20.string().nullable(),
4880
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4881
+ arguments: z20.unknown()
4753
4882
  }),
4754
- z19.object({
4755
- type: z19.literal("tool_search_output"),
4756
- id: z19.string(),
4757
- execution: z19.enum(["server", "client"]),
4758
- call_id: z19.string().nullable(),
4759
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4760
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
4883
+ z20.object({
4884
+ type: z20.literal("tool_search_output"),
4885
+ id: z20.string(),
4886
+ execution: z20.enum(["server", "client"]),
4887
+ call_id: z20.string().nullable(),
4888
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4889
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4761
4890
  })
4762
4891
  ])
4763
4892
  }),
4764
- z19.object({
4765
- type: z19.literal("response.output_item.done"),
4766
- output_index: z19.number(),
4767
- item: z19.discriminatedUnion("type", [
4768
- z19.object({
4769
- type: z19.literal("message"),
4770
- id: z19.string(),
4771
- phase: z19.enum(["commentary", "final_answer"]).nullish()
4893
+ z20.object({
4894
+ type: z20.literal("response.output_item.done"),
4895
+ output_index: z20.number(),
4896
+ item: z20.discriminatedUnion("type", [
4897
+ z20.object({
4898
+ type: z20.literal("message"),
4899
+ id: z20.string(),
4900
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
4772
4901
  }),
4773
- z19.object({
4774
- type: z19.literal("reasoning"),
4775
- id: z19.string(),
4776
- encrypted_content: z19.string().nullish()
4902
+ z20.object({
4903
+ type: z20.literal("reasoning"),
4904
+ id: z20.string(),
4905
+ encrypted_content: z20.string().nullish()
4777
4906
  }),
4778
- z19.object({
4779
- type: z19.literal("function_call"),
4780
- id: z19.string(),
4781
- call_id: z19.string(),
4782
- name: z19.string(),
4783
- arguments: z19.string(),
4784
- async: z19.boolean().nullish(),
4785
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4786
- namespace: z19.string().nullish()
4907
+ z20.object({
4908
+ type: z20.literal("function_call"),
4909
+ id: z20.string(),
4910
+ call_id: z20.string(),
4911
+ name: z20.string(),
4912
+ arguments: z20.string(),
4913
+ async: z20.boolean().nullish(),
4914
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
4915
+ namespace: z20.string().nullish()
4787
4916
  }),
4788
- z19.object({
4789
- type: z19.literal("custom_tool_call"),
4790
- id: z19.string(),
4791
- call_id: z19.string(),
4792
- name: z19.string(),
4793
- input: z19.string(),
4794
- async: z19.boolean().nullish(),
4795
- status: z19.enum(["in_progress", "completed", "incomplete"])
4917
+ z20.object({
4918
+ type: z20.literal("custom_tool_call"),
4919
+ id: z20.string(),
4920
+ call_id: z20.string(),
4921
+ name: z20.string(),
4922
+ input: z20.string(),
4923
+ async: z20.boolean().nullish(),
4924
+ status: z20.enum(["in_progress", "completed", "incomplete"])
4796
4925
  }),
4797
- z19.object({
4798
- type: z19.literal("code_interpreter_call"),
4799
- id: z19.string(),
4800
- code: z19.string().nullable(),
4801
- container_id: z19.string(),
4802
- outputs: z19.array(
4803
- z19.discriminatedUnion("type", [
4804
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
4805
- z19.object({ type: z19.literal("image"), url: z19.string() })
4926
+ z20.object({
4927
+ type: z20.literal("code_interpreter_call"),
4928
+ id: z20.string(),
4929
+ code: z20.string().nullable(),
4930
+ container_id: z20.string(),
4931
+ outputs: z20.array(
4932
+ z20.discriminatedUnion("type", [
4933
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
4934
+ z20.object({ type: z20.literal("image"), url: z20.string() })
4806
4935
  ])
4807
4936
  ).nullable()
4808
4937
  }),
4809
- z19.object({
4810
- type: z19.literal("image_generation_call"),
4811
- id: z19.string(),
4812
- result: z19.string()
4938
+ z20.object({
4939
+ type: z20.literal("image_generation_call"),
4940
+ id: z20.string(),
4941
+ result: z20.string()
4813
4942
  }),
4814
- z19.object({
4815
- type: z19.literal("web_search_call"),
4816
- id: z19.string(),
4817
- status: z19.string(),
4818
- action: z19.discriminatedUnion("type", [
4819
- z19.object({
4820
- type: z19.literal("search"),
4821
- query: z19.string().nullish(),
4822
- queries: z19.array(z19.string()).nullish(),
4823
- sources: z19.array(
4824
- z19.discriminatedUnion("type", [
4825
- z19.object({ type: z19.literal("url"), url: z19.string() }),
4826
- z19.object({ type: z19.literal("api"), name: z19.string() })
4943
+ z20.object({
4944
+ type: z20.literal("web_search_call"),
4945
+ id: z20.string(),
4946
+ status: z20.string(),
4947
+ action: z20.discriminatedUnion("type", [
4948
+ z20.object({
4949
+ type: z20.literal("search"),
4950
+ query: z20.string().nullish(),
4951
+ queries: z20.array(z20.string()).nullish(),
4952
+ sources: z20.array(
4953
+ z20.discriminatedUnion("type", [
4954
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
4955
+ z20.object({ type: z20.literal("api"), name: z20.string() })
4827
4956
  ])
4828
4957
  ).nullish()
4829
4958
  }),
4830
- z19.object({
4831
- type: z19.literal("open_page"),
4832
- url: z19.string().nullish()
4959
+ z20.object({
4960
+ type: z20.literal("open_page"),
4961
+ url: z20.string().nullish()
4833
4962
  }),
4834
- z19.object({
4835
- type: z19.literal("find_in_page"),
4836
- url: z19.string().nullish(),
4837
- pattern: z19.string().nullish()
4963
+ z20.object({
4964
+ type: z20.literal("find_in_page"),
4965
+ url: z20.string().nullish(),
4966
+ pattern: z20.string().nullish()
4838
4967
  })
4839
4968
  ]).nullish()
4840
4969
  }),
4841
- z19.object({
4842
- type: z19.literal("file_search_call"),
4843
- id: z19.string(),
4844
- queries: z19.array(z19.string()),
4845
- results: z19.array(
4846
- z19.object({
4847
- attributes: z19.record(
4848
- z19.string(),
4849
- z19.union([z19.string(), z19.number(), z19.boolean()])
4970
+ z20.object({
4971
+ type: z20.literal("file_search_call"),
4972
+ id: z20.string(),
4973
+ queries: z20.array(z20.string()),
4974
+ results: z20.array(
4975
+ z20.object({
4976
+ attributes: z20.record(
4977
+ z20.string(),
4978
+ z20.union([z20.string(), z20.number(), z20.boolean()])
4850
4979
  ),
4851
- file_id: z19.string(),
4852
- filename: z19.string(),
4853
- score: z19.number(),
4854
- text: z19.string()
4980
+ file_id: z20.string(),
4981
+ filename: z20.string(),
4982
+ score: z20.number(),
4983
+ text: z20.string()
4855
4984
  })
4856
4985
  ).nullish()
4857
4986
  }),
4858
4987
  openaiResponsesLocalShellCallSchema,
4859
- z19.object({
4860
- type: z19.literal("computer_call"),
4861
- id: z19.string(),
4862
- status: z19.literal("completed")
4988
+ z20.object({
4989
+ type: z20.literal("computer_call"),
4990
+ id: z20.string(),
4991
+ status: z20.literal("completed")
4863
4992
  }),
4864
- z19.object({
4865
- type: z19.literal("mcp_call"),
4866
- id: z19.string(),
4867
- status: z19.string(),
4868
- arguments: z19.string(),
4869
- name: z19.string(),
4870
- server_label: z19.string(),
4871
- output: z19.string().nullish(),
4872
- error: z19.union([
4873
- z19.string(),
4874
- z19.object({
4875
- type: z19.string().optional(),
4876
- code: z19.union([z19.number(), z19.string()]).optional(),
4877
- message: z19.string().optional()
4993
+ z20.object({
4994
+ type: z20.literal("mcp_call"),
4995
+ id: z20.string(),
4996
+ status: z20.string(),
4997
+ arguments: z20.string(),
4998
+ name: z20.string(),
4999
+ server_label: z20.string(),
5000
+ output: z20.string().nullish(),
5001
+ error: z20.union([
5002
+ z20.string(),
5003
+ z20.object({
5004
+ type: z20.string().optional(),
5005
+ code: z20.union([z20.number(), z20.string()]).optional(),
5006
+ message: z20.string().optional()
4878
5007
  }).loose()
4879
5008
  ]).nullish(),
4880
- approval_request_id: z19.string().nullish()
5009
+ approval_request_id: z20.string().nullish()
4881
5010
  }),
4882
- z19.object({
4883
- type: z19.literal("mcp_list_tools"),
4884
- id: z19.string(),
4885
- server_label: z19.string(),
4886
- tools: z19.array(
4887
- z19.object({
4888
- name: z19.string(),
4889
- description: z19.string().optional(),
4890
- input_schema: z19.any(),
4891
- annotations: z19.record(z19.string(), z19.unknown()).optional()
5011
+ z20.object({
5012
+ type: z20.literal("mcp_list_tools"),
5013
+ id: z20.string(),
5014
+ server_label: z20.string(),
5015
+ tools: z20.array(
5016
+ z20.object({
5017
+ name: z20.string(),
5018
+ description: z20.string().optional(),
5019
+ input_schema: z20.any(),
5020
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
4892
5021
  })
4893
5022
  ),
4894
- error: z19.union([
4895
- z19.string(),
4896
- z19.object({
4897
- type: z19.string().optional(),
4898
- code: z19.union([z19.number(), z19.string()]).optional(),
4899
- message: z19.string().optional()
5023
+ error: z20.union([
5024
+ z20.string(),
5025
+ z20.object({
5026
+ type: z20.string().optional(),
5027
+ code: z20.union([z20.number(), z20.string()]).optional(),
5028
+ message: z20.string().optional()
4900
5029
  }).loose()
4901
5030
  ]).optional()
4902
5031
  }),
4903
- z19.object({
4904
- type: z19.literal("mcp_approval_request"),
4905
- id: z19.string(),
4906
- server_label: z19.string(),
4907
- name: z19.string(),
4908
- arguments: z19.string(),
4909
- approval_request_id: z19.string().optional()
5032
+ z20.object({
5033
+ type: z20.literal("mcp_approval_request"),
5034
+ id: z20.string(),
5035
+ server_label: z20.string(),
5036
+ name: z20.string(),
5037
+ arguments: z20.string(),
5038
+ approval_request_id: z20.string().optional()
4910
5039
  }),
4911
- z19.object({
4912
- type: z19.literal("apply_patch_call"),
4913
- id: z19.string(),
4914
- call_id: z19.string(),
4915
- status: z19.enum(["in_progress", "completed"]),
4916
- operation: z19.discriminatedUnion("type", [
4917
- z19.object({
4918
- type: z19.literal("create_file"),
4919
- path: z19.string(),
4920
- diff: z19.string()
5040
+ z20.object({
5041
+ type: z20.literal("apply_patch_call"),
5042
+ id: z20.string(),
5043
+ call_id: z20.string(),
5044
+ status: z20.enum(["in_progress", "completed"]),
5045
+ operation: z20.discriminatedUnion("type", [
5046
+ z20.object({
5047
+ type: z20.literal("create_file"),
5048
+ path: z20.string(),
5049
+ diff: z20.string()
4921
5050
  }),
4922
- z19.object({
4923
- type: z19.literal("delete_file"),
4924
- path: z19.string()
5051
+ z20.object({
5052
+ type: z20.literal("delete_file"),
5053
+ path: z20.string()
4925
5054
  }),
4926
- z19.object({
4927
- type: z19.literal("update_file"),
4928
- path: z19.string(),
4929
- diff: z19.string()
5055
+ z20.object({
5056
+ type: z20.literal("update_file"),
5057
+ path: z20.string(),
5058
+ diff: z20.string()
4930
5059
  })
4931
5060
  ])
4932
5061
  }),
4933
- z19.object({
4934
- type: z19.literal("shell_call"),
4935
- id: z19.string(),
4936
- call_id: z19.string(),
4937
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4938
- action: z19.object({
4939
- commands: z19.array(z19.string())
5062
+ z20.object({
5063
+ type: z20.literal("shell_call"),
5064
+ id: z20.string(),
5065
+ call_id: z20.string(),
5066
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5067
+ action: z20.object({
5068
+ commands: z20.array(z20.string())
4940
5069
  })
4941
5070
  }),
4942
- z19.object({
4943
- type: z19.literal("shell_call_output"),
4944
- id: z19.string(),
4945
- call_id: z19.string(),
4946
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4947
- output: z19.array(
4948
- z19.object({
4949
- stdout: z19.string(),
4950
- stderr: z19.string(),
4951
- outcome: z19.discriminatedUnion("type", [
4952
- z19.object({ type: z19.literal("timeout") }),
4953
- z19.object({
4954
- type: z19.literal("exit"),
4955
- exit_code: z19.number()
5071
+ z20.object({
5072
+ type: z20.literal("shell_call_output"),
5073
+ id: z20.string(),
5074
+ call_id: z20.string(),
5075
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5076
+ output: z20.array(
5077
+ z20.object({
5078
+ stdout: z20.string(),
5079
+ stderr: z20.string(),
5080
+ outcome: z20.discriminatedUnion("type", [
5081
+ z20.object({ type: z20.literal("timeout") }),
5082
+ z20.object({
5083
+ type: z20.literal("exit"),
5084
+ exit_code: z20.number()
4956
5085
  })
4957
5086
  ])
4958
5087
  })
4959
5088
  )
4960
5089
  }),
4961
- z19.object({
4962
- type: z19.literal("tool_search_call"),
4963
- id: z19.string(),
4964
- execution: z19.enum(["server", "client"]),
4965
- call_id: z19.string().nullable(),
4966
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4967
- arguments: z19.unknown()
5090
+ z20.object({
5091
+ type: z20.literal("tool_search_call"),
5092
+ id: z20.string(),
5093
+ execution: z20.enum(["server", "client"]),
5094
+ call_id: z20.string().nullable(),
5095
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5096
+ arguments: z20.unknown()
4968
5097
  }),
4969
- z19.object({
4970
- type: z19.literal("tool_search_output"),
4971
- id: z19.string(),
4972
- execution: z19.enum(["server", "client"]),
4973
- call_id: z19.string().nullable(),
4974
- status: z19.enum(["in_progress", "completed", "incomplete"]),
4975
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
5098
+ z20.object({
5099
+ type: z20.literal("tool_search_output"),
5100
+ id: z20.string(),
5101
+ execution: z20.enum(["server", "client"]),
5102
+ call_id: z20.string().nullable(),
5103
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5104
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4976
5105
  })
4977
5106
  ])
4978
5107
  }),
4979
- z19.object({
4980
- type: z19.literal("response.function_call_arguments.delta"),
4981
- item_id: z19.string(),
4982
- output_index: z19.number(),
4983
- delta: z19.string()
5108
+ z20.object({
5109
+ type: z20.literal("response.function_call_arguments.delta"),
5110
+ item_id: z20.string(),
5111
+ output_index: z20.number(),
5112
+ delta: z20.string()
4984
5113
  }),
4985
- z19.object({
5114
+ z20.object({
4986
5115
  // `name` is documented as required but omitted from live API events:
4987
5116
  // https://github.com/openai/openai-openapi/issues/545
4988
- type: z19.literal("response.function_call_arguments.done"),
4989
- item_id: z19.string(),
4990
- output_index: z19.number(),
4991
- arguments: z19.string()
5117
+ type: z20.literal("response.function_call_arguments.done"),
5118
+ item_id: z20.string(),
5119
+ output_index: z20.number(),
5120
+ arguments: z20.string()
4992
5121
  }),
4993
- z19.object({
4994
- type: z19.literal("response.custom_tool_call_input.delta"),
4995
- item_id: z19.string(),
4996
- output_index: z19.number(),
4997
- delta: z19.string()
5122
+ z20.object({
5123
+ type: z20.literal("response.custom_tool_call_input.delta"),
5124
+ item_id: z20.string(),
5125
+ output_index: z20.number(),
5126
+ delta: z20.string()
4998
5127
  }),
4999
- z19.object({
5000
- type: z19.literal("response.image_generation_call.partial_image"),
5001
- item_id: z19.string(),
5002
- output_index: z19.number(),
5003
- partial_image_b64: z19.string()
5128
+ z20.object({
5129
+ type: z20.literal("response.image_generation_call.partial_image"),
5130
+ item_id: z20.string(),
5131
+ output_index: z20.number(),
5132
+ partial_image_b64: z20.string()
5004
5133
  }),
5005
- z19.object({
5006
- type: z19.literal("response.code_interpreter_call_code.delta"),
5007
- item_id: z19.string(),
5008
- output_index: z19.number(),
5009
- delta: z19.string()
5134
+ z20.object({
5135
+ type: z20.literal("response.code_interpreter_call_code.delta"),
5136
+ item_id: z20.string(),
5137
+ output_index: z20.number(),
5138
+ delta: z20.string()
5010
5139
  }),
5011
- z19.object({
5012
- type: z19.literal("response.code_interpreter_call_code.done"),
5013
- item_id: z19.string(),
5014
- output_index: z19.number(),
5015
- code: z19.string()
5140
+ z20.object({
5141
+ type: z20.literal("response.code_interpreter_call_code.done"),
5142
+ item_id: z20.string(),
5143
+ output_index: z20.number(),
5144
+ code: z20.string()
5016
5145
  }),
5017
- z19.object({
5018
- type: z19.literal("response.output_text.annotation.added"),
5019
- annotation: z19.discriminatedUnion("type", [
5020
- z19.object({
5021
- type: z19.literal("url_citation"),
5022
- start_index: z19.number(),
5023
- end_index: z19.number(),
5024
- url: z19.string(),
5025
- title: z19.string()
5146
+ z20.object({
5147
+ type: z20.literal("response.output_text.annotation.added"),
5148
+ annotation: z20.discriminatedUnion("type", [
5149
+ z20.object({
5150
+ type: z20.literal("url_citation"),
5151
+ start_index: z20.number(),
5152
+ end_index: z20.number(),
5153
+ url: z20.string(),
5154
+ title: z20.string()
5026
5155
  }),
5027
- z19.object({
5028
- type: z19.literal("file_citation"),
5029
- file_id: z19.string(),
5030
- filename: z19.string(),
5031
- index: z19.number()
5156
+ z20.object({
5157
+ type: z20.literal("file_citation"),
5158
+ file_id: z20.string(),
5159
+ filename: z20.string(),
5160
+ index: z20.number()
5032
5161
  }),
5033
- z19.object({
5034
- type: z19.literal("container_file_citation"),
5035
- container_id: z19.string(),
5036
- file_id: z19.string(),
5037
- filename: z19.string(),
5038
- start_index: z19.number(),
5039
- end_index: z19.number()
5162
+ z20.object({
5163
+ type: z20.literal("container_file_citation"),
5164
+ container_id: z20.string(),
5165
+ file_id: z20.string(),
5166
+ filename: z20.string(),
5167
+ start_index: z20.number(),
5168
+ end_index: z20.number()
5040
5169
  }),
5041
- z19.object({
5042
- type: z19.literal("file_path"),
5043
- file_id: z19.string(),
5044
- index: z19.number()
5170
+ z20.object({
5171
+ type: z20.literal("file_path"),
5172
+ file_id: z20.string(),
5173
+ index: z20.number()
5045
5174
  })
5046
5175
  ])
5047
5176
  }),
5048
- z19.object({
5049
- type: z19.literal("response.reasoning_summary_part.added"),
5050
- item_id: z19.string(),
5051
- summary_index: z19.number()
5177
+ z20.object({
5178
+ type: z20.literal("response.reasoning_summary_part.added"),
5179
+ item_id: z20.string(),
5180
+ summary_index: z20.number()
5052
5181
  }),
5053
- z19.object({
5054
- type: z19.literal("response.reasoning_summary_text.delta"),
5055
- item_id: z19.string(),
5056
- summary_index: z19.number(),
5057
- delta: z19.string()
5182
+ z20.object({
5183
+ type: z20.literal("response.reasoning_summary_text.delta"),
5184
+ item_id: z20.string(),
5185
+ summary_index: z20.number(),
5186
+ delta: z20.string()
5058
5187
  }),
5059
- z19.object({
5060
- type: z19.literal("response.reasoning_summary_part.done"),
5061
- item_id: z19.string(),
5062
- summary_index: z19.number()
5188
+ z20.object({
5189
+ type: z20.literal("response.reasoning_summary_part.done"),
5190
+ item_id: z20.string(),
5191
+ summary_index: z20.number()
5063
5192
  }),
5064
- z19.object({
5065
- type: z19.literal("response.apply_patch_call_operation_diff.delta"),
5066
- item_id: z19.string(),
5067
- output_index: z19.number(),
5068
- delta: z19.string(),
5069
- obfuscation: z19.string().nullish()
5193
+ z20.object({
5194
+ type: z20.literal("response.apply_patch_call_operation_diff.delta"),
5195
+ item_id: z20.string(),
5196
+ output_index: z20.number(),
5197
+ delta: z20.string(),
5198
+ obfuscation: z20.string().nullish()
5070
5199
  }),
5071
- z19.object({
5072
- type: z19.literal("response.apply_patch_call_operation_diff.done"),
5073
- item_id: z19.string(),
5074
- output_index: z19.number(),
5075
- diff: z19.string()
5200
+ z20.object({
5201
+ type: z20.literal("response.apply_patch_call_operation_diff.done"),
5202
+ item_id: z20.string(),
5203
+ output_index: z20.number(),
5204
+ diff: z20.string()
5076
5205
  }),
5077
5206
  openaiResponsesNestedErrorChunkSchema,
5078
5207
  openaiResponsesErrorChunkSchema,
5079
- z19.object({ type: z19.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5208
+ z20.object({ type: z20.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5080
5209
  message: "Known response chunk failed schema validation"
5081
5210
  }).transform((value) => ({
5082
5211
  type: "unknown_chunk",
@@ -5086,292 +5215,292 @@ var openaiResponsesChunkSchema = lazySchema17(
5086
5215
  ])
5087
5216
  )
5088
5217
  );
5089
- var openaiResponsesResponseSchema = lazySchema17(
5090
- () => zodSchema17(
5091
- z19.object({
5092
- id: z19.string().optional(),
5093
- created_at: z19.number().optional(),
5094
- error: z19.object({
5095
- message: z19.string(),
5096
- type: z19.string(),
5097
- param: z19.string().nullish(),
5098
- code: z19.string()
5218
+ var openaiResponsesResponseSchema = lazySchema18(
5219
+ () => zodSchema18(
5220
+ z20.object({
5221
+ id: z20.string().optional(),
5222
+ created_at: z20.number().optional(),
5223
+ error: z20.object({
5224
+ message: z20.string(),
5225
+ type: z20.string(),
5226
+ param: z20.string().nullish(),
5227
+ code: z20.string()
5099
5228
  }).nullish(),
5100
- model: z19.string().optional(),
5101
- output: z19.array(
5102
- z19.discriminatedUnion("type", [
5103
- z19.object({
5104
- type: z19.literal("message"),
5105
- role: z19.literal("assistant"),
5106
- id: z19.string(),
5107
- phase: z19.enum(["commentary", "final_answer"]).nullish(),
5108
- content: z19.array(
5109
- z19.object({
5110
- type: z19.literal("output_text"),
5111
- text: z19.string(),
5112
- logprobs: z19.array(
5113
- z19.object({
5114
- token: z19.string(),
5115
- logprob: z19.number(),
5116
- top_logprobs: z19.array(
5117
- z19.object({
5118
- token: z19.string(),
5119
- logprob: z19.number()
5229
+ model: z20.string().optional(),
5230
+ output: z20.array(
5231
+ z20.discriminatedUnion("type", [
5232
+ z20.object({
5233
+ type: z20.literal("message"),
5234
+ role: z20.literal("assistant"),
5235
+ id: z20.string(),
5236
+ phase: z20.enum(["commentary", "final_answer"]).nullish(),
5237
+ content: z20.array(
5238
+ z20.object({
5239
+ type: z20.literal("output_text"),
5240
+ text: z20.string(),
5241
+ logprobs: z20.array(
5242
+ z20.object({
5243
+ token: z20.string(),
5244
+ logprob: z20.number(),
5245
+ top_logprobs: z20.array(
5246
+ z20.object({
5247
+ token: z20.string(),
5248
+ logprob: z20.number()
5120
5249
  })
5121
5250
  )
5122
5251
  })
5123
5252
  ).nullish(),
5124
- annotations: z19.array(
5125
- z19.discriminatedUnion("type", [
5126
- z19.object({
5127
- type: z19.literal("url_citation"),
5128
- start_index: z19.number(),
5129
- end_index: z19.number(),
5130
- url: z19.string(),
5131
- title: z19.string()
5253
+ annotations: z20.array(
5254
+ z20.discriminatedUnion("type", [
5255
+ z20.object({
5256
+ type: z20.literal("url_citation"),
5257
+ start_index: z20.number(),
5258
+ end_index: z20.number(),
5259
+ url: z20.string(),
5260
+ title: z20.string()
5132
5261
  }),
5133
- z19.object({
5134
- type: z19.literal("file_citation"),
5135
- file_id: z19.string(),
5136
- filename: z19.string(),
5137
- index: z19.number()
5262
+ z20.object({
5263
+ type: z20.literal("file_citation"),
5264
+ file_id: z20.string(),
5265
+ filename: z20.string(),
5266
+ index: z20.number()
5138
5267
  }),
5139
- z19.object({
5140
- type: z19.literal("container_file_citation"),
5141
- container_id: z19.string(),
5142
- file_id: z19.string(),
5143
- filename: z19.string(),
5144
- start_index: z19.number(),
5145
- end_index: z19.number()
5268
+ z20.object({
5269
+ type: z20.literal("container_file_citation"),
5270
+ container_id: z20.string(),
5271
+ file_id: z20.string(),
5272
+ filename: z20.string(),
5273
+ start_index: z20.number(),
5274
+ end_index: z20.number()
5146
5275
  }),
5147
- z19.object({
5148
- type: z19.literal("file_path"),
5149
- file_id: z19.string(),
5150
- index: z19.number()
5276
+ z20.object({
5277
+ type: z20.literal("file_path"),
5278
+ file_id: z20.string(),
5279
+ index: z20.number()
5151
5280
  })
5152
5281
  ])
5153
5282
  )
5154
5283
  })
5155
5284
  )
5156
5285
  }),
5157
- z19.object({
5158
- type: z19.literal("web_search_call"),
5159
- id: z19.string(),
5160
- status: z19.string(),
5161
- action: z19.discriminatedUnion("type", [
5162
- z19.object({
5163
- type: z19.literal("search"),
5164
- query: z19.string().nullish(),
5165
- queries: z19.array(z19.string()).nullish(),
5166
- sources: z19.array(
5167
- z19.discriminatedUnion("type", [
5168
- z19.object({ type: z19.literal("url"), url: z19.string() }),
5169
- z19.object({
5170
- type: z19.literal("api"),
5171
- name: z19.string()
5286
+ z20.object({
5287
+ type: z20.literal("web_search_call"),
5288
+ id: z20.string(),
5289
+ status: z20.string(),
5290
+ action: z20.discriminatedUnion("type", [
5291
+ z20.object({
5292
+ type: z20.literal("search"),
5293
+ query: z20.string().nullish(),
5294
+ queries: z20.array(z20.string()).nullish(),
5295
+ sources: z20.array(
5296
+ z20.discriminatedUnion("type", [
5297
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
5298
+ z20.object({
5299
+ type: z20.literal("api"),
5300
+ name: z20.string()
5172
5301
  })
5173
5302
  ])
5174
5303
  ).nullish()
5175
5304
  }),
5176
- z19.object({
5177
- type: z19.literal("open_page"),
5178
- url: z19.string().nullish()
5305
+ z20.object({
5306
+ type: z20.literal("open_page"),
5307
+ url: z20.string().nullish()
5179
5308
  }),
5180
- z19.object({
5181
- type: z19.literal("find_in_page"),
5182
- url: z19.string().nullish(),
5183
- pattern: z19.string().nullish()
5309
+ z20.object({
5310
+ type: z20.literal("find_in_page"),
5311
+ url: z20.string().nullish(),
5312
+ pattern: z20.string().nullish()
5184
5313
  })
5185
5314
  ]).nullish()
5186
5315
  }),
5187
- z19.object({
5188
- type: z19.literal("file_search_call"),
5189
- id: z19.string(),
5190
- queries: z19.array(z19.string()),
5191
- results: z19.array(
5192
- z19.object({
5193
- attributes: z19.record(
5194
- z19.string(),
5195
- z19.union([z19.string(), z19.number(), z19.boolean()])
5316
+ z20.object({
5317
+ type: z20.literal("file_search_call"),
5318
+ id: z20.string(),
5319
+ queries: z20.array(z20.string()),
5320
+ results: z20.array(
5321
+ z20.object({
5322
+ attributes: z20.record(
5323
+ z20.string(),
5324
+ z20.union([z20.string(), z20.number(), z20.boolean()])
5196
5325
  ),
5197
- file_id: z19.string(),
5198
- filename: z19.string(),
5199
- score: z19.number(),
5200
- text: z19.string()
5326
+ file_id: z20.string(),
5327
+ filename: z20.string(),
5328
+ score: z20.number(),
5329
+ text: z20.string()
5201
5330
  })
5202
5331
  ).nullish()
5203
5332
  }),
5204
- z19.object({
5205
- type: z19.literal("code_interpreter_call"),
5206
- id: z19.string(),
5207
- code: z19.string().nullable(),
5208
- container_id: z19.string(),
5209
- outputs: z19.array(
5210
- z19.discriminatedUnion("type", [
5211
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
5212
- z19.object({ type: z19.literal("image"), url: z19.string() })
5333
+ z20.object({
5334
+ type: z20.literal("code_interpreter_call"),
5335
+ id: z20.string(),
5336
+ code: z20.string().nullable(),
5337
+ container_id: z20.string(),
5338
+ outputs: z20.array(
5339
+ z20.discriminatedUnion("type", [
5340
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
5341
+ z20.object({ type: z20.literal("image"), url: z20.string() })
5213
5342
  ])
5214
5343
  ).nullable()
5215
5344
  }),
5216
- z19.object({
5217
- type: z19.literal("image_generation_call"),
5218
- id: z19.string(),
5219
- result: z19.string()
5345
+ z20.object({
5346
+ type: z20.literal("image_generation_call"),
5347
+ id: z20.string(),
5348
+ result: z20.string()
5220
5349
  }),
5221
5350
  openaiResponsesLocalShellCallSchema,
5222
- z19.object({
5223
- type: z19.literal("function_call"),
5224
- call_id: z19.string(),
5225
- name: z19.string(),
5226
- arguments: z19.string(),
5227
- id: z19.string(),
5228
- async: z19.boolean().nullish(),
5229
- namespace: z19.string().nullish()
5351
+ z20.object({
5352
+ type: z20.literal("function_call"),
5353
+ call_id: z20.string(),
5354
+ name: z20.string(),
5355
+ arguments: z20.string(),
5356
+ id: z20.string(),
5357
+ async: z20.boolean().nullish(),
5358
+ namespace: z20.string().nullish()
5230
5359
  }),
5231
- z19.object({
5232
- type: z19.literal("custom_tool_call"),
5233
- call_id: z19.string(),
5234
- name: z19.string(),
5235
- input: z19.string(),
5236
- id: z19.string(),
5237
- async: z19.boolean().nullish()
5360
+ z20.object({
5361
+ type: z20.literal("custom_tool_call"),
5362
+ call_id: z20.string(),
5363
+ name: z20.string(),
5364
+ input: z20.string(),
5365
+ id: z20.string(),
5366
+ async: z20.boolean().nullish()
5238
5367
  }),
5239
- z19.object({
5240
- type: z19.literal("computer_call"),
5241
- id: z19.string(),
5242
- status: z19.string().optional()
5368
+ z20.object({
5369
+ type: z20.literal("computer_call"),
5370
+ id: z20.string(),
5371
+ status: z20.string().optional()
5243
5372
  }),
5244
- z19.object({
5245
- type: z19.literal("reasoning"),
5246
- id: z19.string(),
5247
- encrypted_content: z19.string().nullish(),
5248
- summary: z19.array(
5249
- z19.object({
5250
- type: z19.literal("summary_text"),
5251
- text: z19.string()
5373
+ z20.object({
5374
+ type: z20.literal("reasoning"),
5375
+ id: z20.string(),
5376
+ encrypted_content: z20.string().nullish(),
5377
+ summary: z20.array(
5378
+ z20.object({
5379
+ type: z20.literal("summary_text"),
5380
+ text: z20.string()
5252
5381
  })
5253
5382
  )
5254
5383
  }),
5255
- z19.object({
5256
- type: z19.literal("mcp_call"),
5257
- id: z19.string(),
5258
- status: z19.string(),
5259
- arguments: z19.string(),
5260
- name: z19.string(),
5261
- server_label: z19.string(),
5262
- output: z19.string().nullish(),
5263
- error: z19.union([
5264
- z19.string(),
5265
- z19.object({
5266
- type: z19.string().optional(),
5267
- code: z19.union([z19.number(), z19.string()]).optional(),
5268
- message: z19.string().optional()
5384
+ z20.object({
5385
+ type: z20.literal("mcp_call"),
5386
+ id: z20.string(),
5387
+ status: z20.string(),
5388
+ arguments: z20.string(),
5389
+ name: z20.string(),
5390
+ server_label: z20.string(),
5391
+ output: z20.string().nullish(),
5392
+ error: z20.union([
5393
+ z20.string(),
5394
+ z20.object({
5395
+ type: z20.string().optional(),
5396
+ code: z20.union([z20.number(), z20.string()]).optional(),
5397
+ message: z20.string().optional()
5269
5398
  }).loose()
5270
5399
  ]).nullish(),
5271
- approval_request_id: z19.string().nullish()
5400
+ approval_request_id: z20.string().nullish()
5272
5401
  }),
5273
- z19.object({
5274
- type: z19.literal("mcp_list_tools"),
5275
- id: z19.string(),
5276
- server_label: z19.string(),
5277
- tools: z19.array(
5278
- z19.object({
5279
- name: z19.string(),
5280
- description: z19.string().optional(),
5281
- input_schema: z19.any(),
5282
- annotations: z19.record(z19.string(), z19.unknown()).optional()
5402
+ z20.object({
5403
+ type: z20.literal("mcp_list_tools"),
5404
+ id: z20.string(),
5405
+ server_label: z20.string(),
5406
+ tools: z20.array(
5407
+ z20.object({
5408
+ name: z20.string(),
5409
+ description: z20.string().optional(),
5410
+ input_schema: z20.any(),
5411
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
5283
5412
  })
5284
5413
  ),
5285
- error: z19.union([
5286
- z19.string(),
5287
- z19.object({
5288
- type: z19.string().optional(),
5289
- code: z19.union([z19.number(), z19.string()]).optional(),
5290
- message: z19.string().optional()
5414
+ error: z20.union([
5415
+ z20.string(),
5416
+ z20.object({
5417
+ type: z20.string().optional(),
5418
+ code: z20.union([z20.number(), z20.string()]).optional(),
5419
+ message: z20.string().optional()
5291
5420
  }).loose()
5292
5421
  ]).optional()
5293
5422
  }),
5294
- z19.object({
5295
- type: z19.literal("mcp_approval_request"),
5296
- id: z19.string(),
5297
- server_label: z19.string(),
5298
- name: z19.string(),
5299
- arguments: z19.string(),
5300
- approval_request_id: z19.string().optional()
5423
+ z20.object({
5424
+ type: z20.literal("mcp_approval_request"),
5425
+ id: z20.string(),
5426
+ server_label: z20.string(),
5427
+ name: z20.string(),
5428
+ arguments: z20.string(),
5429
+ approval_request_id: z20.string().optional()
5301
5430
  }),
5302
- z19.object({
5303
- type: z19.literal("apply_patch_call"),
5304
- id: z19.string(),
5305
- call_id: z19.string(),
5306
- status: z19.enum(["in_progress", "completed"]),
5307
- operation: z19.discriminatedUnion("type", [
5308
- z19.object({
5309
- type: z19.literal("create_file"),
5310
- path: z19.string(),
5311
- diff: z19.string()
5431
+ z20.object({
5432
+ type: z20.literal("apply_patch_call"),
5433
+ id: z20.string(),
5434
+ call_id: z20.string(),
5435
+ status: z20.enum(["in_progress", "completed"]),
5436
+ operation: z20.discriminatedUnion("type", [
5437
+ z20.object({
5438
+ type: z20.literal("create_file"),
5439
+ path: z20.string(),
5440
+ diff: z20.string()
5312
5441
  }),
5313
- z19.object({
5314
- type: z19.literal("delete_file"),
5315
- path: z19.string()
5442
+ z20.object({
5443
+ type: z20.literal("delete_file"),
5444
+ path: z20.string()
5316
5445
  }),
5317
- z19.object({
5318
- type: z19.literal("update_file"),
5319
- path: z19.string(),
5320
- diff: z19.string()
5446
+ z20.object({
5447
+ type: z20.literal("update_file"),
5448
+ path: z20.string(),
5449
+ diff: z20.string()
5321
5450
  })
5322
5451
  ])
5323
5452
  }),
5324
- z19.object({
5325
- type: z19.literal("shell_call"),
5326
- id: z19.string(),
5327
- call_id: z19.string(),
5328
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5329
- action: z19.object({
5330
- commands: z19.array(z19.string())
5453
+ z20.object({
5454
+ type: z20.literal("shell_call"),
5455
+ id: z20.string(),
5456
+ call_id: z20.string(),
5457
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5458
+ action: z20.object({
5459
+ commands: z20.array(z20.string())
5331
5460
  })
5332
5461
  }),
5333
- z19.object({
5334
- type: z19.literal("shell_call_output"),
5335
- id: z19.string(),
5336
- call_id: z19.string(),
5337
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5338
- output: z19.array(
5339
- z19.object({
5340
- stdout: z19.string(),
5341
- stderr: z19.string(),
5342
- outcome: z19.discriminatedUnion("type", [
5343
- z19.object({ type: z19.literal("timeout") }),
5344
- z19.object({
5345
- type: z19.literal("exit"),
5346
- exit_code: z19.number()
5462
+ z20.object({
5463
+ type: z20.literal("shell_call_output"),
5464
+ id: z20.string(),
5465
+ call_id: z20.string(),
5466
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5467
+ output: z20.array(
5468
+ z20.object({
5469
+ stdout: z20.string(),
5470
+ stderr: z20.string(),
5471
+ outcome: z20.discriminatedUnion("type", [
5472
+ z20.object({ type: z20.literal("timeout") }),
5473
+ z20.object({
5474
+ type: z20.literal("exit"),
5475
+ exit_code: z20.number()
5347
5476
  })
5348
5477
  ])
5349
5478
  })
5350
5479
  )
5351
5480
  }),
5352
- z19.object({
5353
- type: z19.literal("tool_search_call"),
5354
- id: z19.string(),
5355
- execution: z19.enum(["server", "client"]),
5356
- call_id: z19.string().nullable(),
5357
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5358
- arguments: z19.unknown()
5481
+ z20.object({
5482
+ type: z20.literal("tool_search_call"),
5483
+ id: z20.string(),
5484
+ execution: z20.enum(["server", "client"]),
5485
+ call_id: z20.string().nullable(),
5486
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5487
+ arguments: z20.unknown()
5359
5488
  }),
5360
- z19.object({
5361
- type: z19.literal("tool_search_output"),
5362
- id: z19.string(),
5363
- execution: z19.enum(["server", "client"]),
5364
- call_id: z19.string().nullable(),
5365
- status: z19.enum(["in_progress", "completed", "incomplete"]),
5366
- tools: z19.array(z19.record(z19.string(), jsonValueSchema.optional()))
5489
+ z20.object({
5490
+ type: z20.literal("tool_search_output"),
5491
+ id: z20.string(),
5492
+ execution: z20.enum(["server", "client"]),
5493
+ call_id: z20.string().nullable(),
5494
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
5495
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5367
5496
  })
5368
5497
  ])
5369
5498
  ).optional(),
5370
- service_tier: z19.string().nullish(),
5371
- reasoning: z19.object({
5372
- context: z19.string().nullish()
5499
+ service_tier: z20.string().nullish(),
5500
+ reasoning: z20.object({
5501
+ context: z20.string().nullish()
5373
5502
  }).nullish(),
5374
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
5503
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
5375
5504
  usage: openaiResponsesUsageSchema.nullish()
5376
5505
  })
5377
5506
  )
@@ -5385,44 +5514,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
5385
5514
 
5386
5515
  // src/tool/code-interpreter.ts
5387
5516
  import {
5388
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
5389
- lazySchema as lazySchema18,
5390
- zodSchema as zodSchema18
5517
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
5518
+ lazySchema as lazySchema19,
5519
+ zodSchema as zodSchema19
5391
5520
  } from "@ai-sdk/provider-utils";
5392
- import { z as z20 } from "zod/v4";
5393
- var codeInterpreterInputSchema = lazySchema18(
5394
- () => zodSchema18(
5395
- z20.object({
5396
- code: z20.string().nullish(),
5397
- containerId: z20.string()
5521
+ import { z as z21 } from "zod/v4";
5522
+ var codeInterpreterInputSchema = lazySchema19(
5523
+ () => zodSchema19(
5524
+ z21.object({
5525
+ code: z21.string().nullish(),
5526
+ containerId: z21.string()
5398
5527
  })
5399
5528
  )
5400
5529
  );
5401
- var codeInterpreterOutputSchema = lazySchema18(
5402
- () => zodSchema18(
5403
- z20.object({
5404
- outputs: z20.array(
5405
- z20.discriminatedUnion("type", [
5406
- z20.object({ type: z20.literal("logs"), logs: z20.string() }),
5407
- z20.object({ type: z20.literal("image"), url: z20.string() })
5530
+ var codeInterpreterOutputSchema = lazySchema19(
5531
+ () => zodSchema19(
5532
+ z21.object({
5533
+ outputs: z21.array(
5534
+ z21.discriminatedUnion("type", [
5535
+ z21.object({ type: z21.literal("logs"), logs: z21.string() }),
5536
+ z21.object({ type: z21.literal("image"), url: z21.string() })
5408
5537
  ])
5409
5538
  ).nullish()
5410
5539
  })
5411
5540
  )
5412
5541
  );
5413
- var codeInterpreterArgsSchema = lazySchema18(
5414
- () => zodSchema18(
5415
- z20.object({
5416
- container: z20.union([
5417
- z20.string(),
5418
- z20.object({
5419
- fileIds: z20.array(z20.string()).optional()
5542
+ var codeInterpreterArgsSchema = lazySchema19(
5543
+ () => zodSchema19(
5544
+ z21.object({
5545
+ container: z21.union([
5546
+ z21.string(),
5547
+ z21.object({
5548
+ fileIds: z21.array(z21.string()).optional()
5420
5549
  })
5421
5550
  ]).optional()
5422
5551
  })
5423
5552
  )
5424
5553
  );
5425
- var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema5({
5554
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema6({
5426
5555
  id: "openai.code_interpreter",
5427
5556
  inputSchema: codeInterpreterInputSchema,
5428
5557
  outputSchema: codeInterpreterOutputSchema
@@ -5433,88 +5562,88 @@ var codeInterpreter = (args = {}) => {
5433
5562
 
5434
5563
  // src/tool/file-search.ts
5435
5564
  import {
5436
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
5437
- lazySchema as lazySchema19,
5438
- zodSchema as zodSchema19
5565
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
5566
+ lazySchema as lazySchema20,
5567
+ zodSchema as zodSchema20
5439
5568
  } from "@ai-sdk/provider-utils";
5440
- import { z as z21 } from "zod/v4";
5441
- var comparisonFilterSchema = z21.object({
5442
- key: z21.string(),
5443
- type: z21.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5444
- value: z21.union([z21.string(), z21.number(), z21.boolean(), z21.array(z21.string())])
5569
+ import { z as z22 } from "zod/v4";
5570
+ var comparisonFilterSchema = z22.object({
5571
+ key: z22.string(),
5572
+ type: z22.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5573
+ value: z22.union([z22.string(), z22.number(), z22.boolean(), z22.array(z22.string())])
5445
5574
  });
5446
- var compoundFilterSchema = z21.object({
5447
- type: z21.enum(["and", "or"]),
5448
- filters: z21.array(
5449
- z21.union([comparisonFilterSchema, z21.lazy(() => compoundFilterSchema)])
5575
+ var compoundFilterSchema = z22.object({
5576
+ type: z22.enum(["and", "or"]),
5577
+ filters: z22.array(
5578
+ z22.union([comparisonFilterSchema, z22.lazy(() => compoundFilterSchema)])
5450
5579
  )
5451
5580
  });
5452
- var fileSearchArgsSchema = lazySchema19(
5453
- () => zodSchema19(
5454
- z21.object({
5455
- vectorStoreIds: z21.array(z21.string()),
5456
- maxNumResults: z21.number().optional(),
5457
- ranking: z21.object({
5458
- ranker: z21.string().optional(),
5459
- scoreThreshold: z21.number().optional()
5581
+ var fileSearchArgsSchema = lazySchema20(
5582
+ () => zodSchema20(
5583
+ z22.object({
5584
+ vectorStoreIds: z22.array(z22.string()),
5585
+ maxNumResults: z22.number().optional(),
5586
+ ranking: z22.object({
5587
+ ranker: z22.string().optional(),
5588
+ scoreThreshold: z22.number().optional()
5460
5589
  }).optional(),
5461
- filters: z21.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5590
+ filters: z22.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5462
5591
  })
5463
5592
  )
5464
5593
  );
5465
- var fileSearchOutputSchema = lazySchema19(
5466
- () => zodSchema19(
5467
- z21.object({
5468
- queries: z21.array(z21.string()),
5469
- results: z21.array(
5470
- z21.object({
5471
- attributes: z21.record(z21.string(), z21.unknown()),
5472
- fileId: z21.string(),
5473
- filename: z21.string(),
5474
- score: z21.number(),
5475
- text: z21.string()
5594
+ var fileSearchOutputSchema = lazySchema20(
5595
+ () => zodSchema20(
5596
+ z22.object({
5597
+ queries: z22.array(z22.string()),
5598
+ results: z22.array(
5599
+ z22.object({
5600
+ attributes: z22.record(z22.string(), z22.unknown()),
5601
+ fileId: z22.string(),
5602
+ filename: z22.string(),
5603
+ score: z22.number(),
5604
+ text: z22.string()
5476
5605
  })
5477
5606
  ).nullable()
5478
5607
  })
5479
5608
  )
5480
5609
  );
5481
- var fileSearch = createProviderToolFactoryWithOutputSchema6({
5610
+ var fileSearch = createProviderToolFactoryWithOutputSchema7({
5482
5611
  id: "openai.file_search",
5483
- inputSchema: z21.object({}),
5612
+ inputSchema: z22.object({}),
5484
5613
  outputSchema: fileSearchOutputSchema
5485
5614
  });
5486
5615
 
5487
5616
  // src/tool/image-generation.ts
5488
5617
  import {
5489
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
5490
- lazySchema as lazySchema20,
5491
- zodSchema as zodSchema20
5618
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
5619
+ lazySchema as lazySchema21,
5620
+ zodSchema as zodSchema21
5492
5621
  } from "@ai-sdk/provider-utils";
5493
- import { z as z22 } from "zod/v4";
5494
- var imageGenerationArgsSchema = lazySchema20(
5495
- () => zodSchema20(
5496
- z22.object({
5497
- background: z22.enum(["auto", "opaque", "transparent"]).optional(),
5498
- inputFidelity: z22.enum(["low", "high"]).optional(),
5499
- inputImageMask: z22.object({
5500
- fileId: z22.string().optional(),
5501
- imageUrl: z22.string().optional()
5622
+ import { z as z23 } from "zod/v4";
5623
+ var imageGenerationArgsSchema = lazySchema21(
5624
+ () => zodSchema21(
5625
+ z23.object({
5626
+ background: z23.enum(["auto", "opaque", "transparent"]).optional(),
5627
+ inputFidelity: z23.enum(["low", "high"]).optional(),
5628
+ inputImageMask: z23.object({
5629
+ fileId: z23.string().optional(),
5630
+ imageUrl: z23.string().optional()
5502
5631
  }).optional(),
5503
- model: z22.string().optional(),
5504
- moderation: z22.enum(["auto"]).optional(),
5505
- outputCompression: z22.number().int().min(0).max(100).optional(),
5506
- outputFormat: z22.enum(["png", "jpeg", "webp"]).optional(),
5507
- partialImages: z22.number().int().min(0).max(3).optional(),
5508
- quality: z22.enum(["auto", "low", "medium", "high", "xhigh", "max"]).optional(),
5509
- size: z22.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
5632
+ model: z23.string().optional(),
5633
+ moderation: z23.enum(["auto"]).optional(),
5634
+ outputCompression: z23.number().int().min(0).max(100).optional(),
5635
+ outputFormat: z23.enum(["png", "jpeg", "webp"]).optional(),
5636
+ partialImages: z23.number().int().min(0).max(3).optional(),
5637
+ quality: z23.enum(["auto", "low", "medium", "high", "xhigh", "max"]).optional(),
5638
+ size: z23.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
5510
5639
  }).strict()
5511
5640
  )
5512
5641
  );
5513
- var imageGenerationInputSchema = lazySchema20(() => zodSchema20(z22.object({})));
5514
- var imageGenerationOutputSchema = lazySchema20(
5515
- () => zodSchema20(z22.object({ result: z22.string() }))
5642
+ var imageGenerationInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
5643
+ var imageGenerationOutputSchema = lazySchema21(
5644
+ () => zodSchema21(z23.object({ result: z23.string() }))
5516
5645
  );
5517
- var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema7({
5646
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema8({
5518
5647
  id: "openai.image_generation",
5519
5648
  inputSchema: imageGenerationInputSchema,
5520
5649
  outputSchema: imageGenerationOutputSchema
@@ -5526,30 +5655,30 @@ var imageGeneration = (args = {}) => {
5526
5655
  // src/tool/custom.ts
5527
5656
  import {
5528
5657
  createProviderToolFactory,
5529
- lazySchema as lazySchema21,
5530
- zodSchema as zodSchema21
5658
+ lazySchema as lazySchema22,
5659
+ zodSchema as zodSchema22
5531
5660
  } from "@ai-sdk/provider-utils";
5532
- import { z as z23 } from "zod/v4";
5533
- var customArgsSchema = lazySchema21(
5534
- () => zodSchema21(
5535
- z23.object({
5536
- name: z23.string(),
5537
- description: z23.string().optional(),
5538
- async: z23.boolean().optional(),
5539
- format: z23.union([
5540
- z23.object({
5541
- type: z23.literal("grammar"),
5542
- syntax: z23.enum(["regex", "lark"]),
5543
- definition: z23.string()
5661
+ import { z as z24 } from "zod/v4";
5662
+ var customArgsSchema = lazySchema22(
5663
+ () => zodSchema22(
5664
+ z24.object({
5665
+ name: z24.string(),
5666
+ description: z24.string().optional(),
5667
+ async: z24.boolean().optional(),
5668
+ format: z24.union([
5669
+ z24.object({
5670
+ type: z24.literal("grammar"),
5671
+ syntax: z24.enum(["regex", "lark"]),
5672
+ definition: z24.string()
5544
5673
  }),
5545
- z23.object({
5546
- type: z23.literal("text")
5674
+ z24.object({
5675
+ type: z24.literal("text")
5547
5676
  })
5548
5677
  ]).optional()
5549
5678
  })
5550
5679
  )
5551
5680
  );
5552
- var customInputSchema = lazySchema21(() => zodSchema21(z23.string()));
5681
+ var customInputSchema = lazySchema22(() => zodSchema22(z24.string()));
5553
5682
  var customToolFactory = createProviderToolFactory({
5554
5683
  id: "openai.custom",
5555
5684
  inputSchema: customInputSchema
@@ -5557,132 +5686,70 @@ var customToolFactory = createProviderToolFactory({
5557
5686
 
5558
5687
  // src/tool/mcp.ts
5559
5688
  import {
5560
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
5561
- lazySchema as lazySchema22,
5562
- zodSchema as zodSchema22
5689
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5690
+ lazySchema as lazySchema23,
5691
+ zodSchema as zodSchema23
5563
5692
  } from "@ai-sdk/provider-utils";
5564
- import { z as z24 } from "zod/v4";
5565
- var jsonValueSchema2 = z24.lazy(
5566
- () => z24.union([
5567
- z24.string(),
5568
- z24.number(),
5569
- z24.boolean(),
5570
- z24.null(),
5571
- z24.array(jsonValueSchema2),
5572
- z24.record(z24.string(), jsonValueSchema2)
5693
+ import { z as z25 } from "zod/v4";
5694
+ var jsonValueSchema2 = z25.lazy(
5695
+ () => z25.union([
5696
+ z25.string(),
5697
+ z25.number(),
5698
+ z25.boolean(),
5699
+ z25.null(),
5700
+ z25.array(jsonValueSchema2),
5701
+ z25.record(z25.string(), jsonValueSchema2)
5573
5702
  ])
5574
5703
  );
5575
- var mcpArgsSchema = lazySchema22(
5576
- () => zodSchema22(
5577
- z24.object({
5578
- serverLabel: z24.string(),
5579
- allowedTools: z24.union([
5580
- z24.array(z24.string()),
5581
- z24.object({
5582
- readOnly: z24.boolean().optional(),
5583
- toolNames: z24.array(z24.string()).optional()
5704
+ var mcpArgsSchema = lazySchema23(
5705
+ () => zodSchema23(
5706
+ z25.object({
5707
+ serverLabel: z25.string(),
5708
+ allowedTools: z25.union([
5709
+ z25.array(z25.string()),
5710
+ z25.object({
5711
+ readOnly: z25.boolean().optional(),
5712
+ toolNames: z25.array(z25.string()).optional()
5584
5713
  })
5585
5714
  ]).optional(),
5586
- authorization: z24.string().optional(),
5587
- connectorId: z24.string().optional(),
5588
- headers: z24.record(z24.string(), z24.string()).optional(),
5589
- requireApproval: z24.union([
5590
- z24.enum(["always", "never"]),
5591
- z24.object({
5592
- never: z24.object({
5593
- toolNames: z24.array(z24.string()).optional()
5715
+ authorization: z25.string().optional(),
5716
+ connectorId: z25.string().optional(),
5717
+ headers: z25.record(z25.string(), z25.string()).optional(),
5718
+ requireApproval: z25.union([
5719
+ z25.enum(["always", "never"]),
5720
+ z25.object({
5721
+ never: z25.object({
5722
+ toolNames: z25.array(z25.string()).optional()
5594
5723
  }).optional()
5595
5724
  })
5596
5725
  ]).optional(),
5597
- serverDescription: z24.string().optional(),
5598
- serverUrl: z24.string().optional()
5726
+ serverDescription: z25.string().optional(),
5727
+ serverUrl: z25.string().optional()
5599
5728
  }).refine(
5600
5729
  (v) => v.serverUrl != null || v.connectorId != null,
5601
5730
  "One of serverUrl or connectorId must be provided."
5602
5731
  )
5603
5732
  )
5604
5733
  );
5605
- var mcpInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
5606
- var mcpOutputSchema = lazySchema22(
5607
- () => zodSchema22(
5608
- z24.object({
5609
- type: z24.literal("call"),
5610
- serverLabel: z24.string(),
5611
- name: z24.string(),
5612
- arguments: z24.string(),
5613
- output: z24.string().nullish(),
5614
- error: z24.union([z24.string(), jsonValueSchema2]).optional()
5734
+ var mcpInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5735
+ var mcpOutputSchema = lazySchema23(
5736
+ () => zodSchema23(
5737
+ z25.object({
5738
+ type: z25.literal("call"),
5739
+ serverLabel: z25.string(),
5740
+ name: z25.string(),
5741
+ arguments: z25.string(),
5742
+ output: z25.string().nullish(),
5743
+ error: z25.union([z25.string(), jsonValueSchema2]).optional()
5615
5744
  })
5616
5745
  )
5617
5746
  );
5618
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
5747
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
5619
5748
  id: "openai.mcp",
5620
5749
  inputSchema: mcpInputSchema,
5621
5750
  outputSchema: mcpOutputSchema
5622
5751
  });
5623
5752
 
5624
- // src/tool/web-search.ts
5625
- import {
5626
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5627
- lazySchema as lazySchema23,
5628
- zodSchema as zodSchema23
5629
- } from "@ai-sdk/provider-utils";
5630
- import { z as z25 } from "zod/v4";
5631
- var webSearchArgsSchema = lazySchema23(
5632
- () => zodSchema23(
5633
- z25.object({
5634
- externalWebAccess: z25.boolean().optional(),
5635
- filters: z25.object({
5636
- allowedDomains: z25.array(z25.string()).optional(),
5637
- blockedDomains: z25.array(z25.string()).optional()
5638
- }).optional(),
5639
- searchContextSize: z25.enum(["low", "medium", "high"]).optional(),
5640
- userLocation: z25.object({
5641
- type: z25.literal("approximate"),
5642
- country: z25.string().optional(),
5643
- city: z25.string().optional(),
5644
- region: z25.string().optional(),
5645
- timezone: z25.string().optional()
5646
- }).optional()
5647
- })
5648
- )
5649
- );
5650
- var webSearchInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5651
- var webSearchOutputSchema = lazySchema23(
5652
- () => zodSchema23(
5653
- z25.object({
5654
- action: z25.discriminatedUnion("type", [
5655
- z25.object({
5656
- type: z25.literal("search"),
5657
- query: z25.string().optional(),
5658
- queries: z25.array(z25.string()).optional()
5659
- }),
5660
- z25.object({
5661
- type: z25.literal("openPage"),
5662
- url: z25.string().nullish()
5663
- }),
5664
- z25.object({
5665
- type: z25.literal("findInPage"),
5666
- url: z25.string().nullish(),
5667
- pattern: z25.string().nullish()
5668
- })
5669
- ]).optional(),
5670
- sources: z25.array(
5671
- z25.discriminatedUnion("type", [
5672
- z25.object({ type: z25.literal("url"), url: z25.string() }),
5673
- z25.object({ type: z25.literal("api"), name: z25.string() })
5674
- ])
5675
- ).optional()
5676
- })
5677
- )
5678
- );
5679
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema9({
5680
- id: "openai.web_search",
5681
- inputSchema: webSearchInputSchema,
5682
- outputSchema: webSearchOutputSchema
5683
- });
5684
- var webSearch = (args = {}) => webSearchToolFactory(args);
5685
-
5686
5753
  // src/tool/web-search-preview.ts
5687
5754
  import {
5688
5755
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
@@ -7203,6 +7270,11 @@ var OpenAIResponsesLanguageModel = class {
7203
7270
  id: value.item.call_id,
7204
7271
  toolName
7205
7272
  });
7273
+ controller.enqueue({
7274
+ type: "tool-input-delta",
7275
+ id: value.item.call_id,
7276
+ delta: '"'
7277
+ });
7206
7278
  } else if (value.item.type === "web_search_call") {
7207
7279
  ongoingToolCalls[value.output_index] = {
7208
7280
  toolName: toolNameMapping.toCustomToolName(
@@ -7491,6 +7563,11 @@ var OpenAIResponsesLanguageModel = class {
7491
7563
  const toolName = toolNameMapping.toCustomToolName(
7492
7564
  value.item.name
7493
7565
  );
7566
+ controller.enqueue({
7567
+ type: "tool-input-delta",
7568
+ id: value.item.call_id,
7569
+ delta: '"'
7570
+ });
7494
7571
  controller.enqueue({
7495
7572
  type: "tool-input-end",
7496
7573
  id: value.item.call_id
@@ -7817,7 +7894,7 @@ var OpenAIResponsesLanguageModel = class {
7817
7894
  controller.enqueue({
7818
7895
  type: "tool-input-delta",
7819
7896
  id: toolCall.toolCallId,
7820
- delta: value.delta
7897
+ delta: escapeJSONDelta(value.delta)
7821
7898
  });
7822
7899
  }
7823
7900
  } else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {