@ai-sdk/openai 3.0.0-beta.73 → 3.0.0-beta.75

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.
@@ -444,12 +444,6 @@ var openaiChatLanguageModelOptions = lazySchema2(
444
444
  * Parameters for prediction mode.
445
445
  */
446
446
  prediction: z3.record(z3.string(), z3.any()).optional(),
447
- /**
448
- * Whether to use structured outputs.
449
- *
450
- * @default true
451
- */
452
- structuredOutputs: z3.boolean().optional(),
453
447
  /**
454
448
  * Service tier for the request.
455
449
  * - 'auto': Default service tier. The request will be processed with the service tier configured in the
@@ -464,7 +458,7 @@ var openaiChatLanguageModelOptions = lazySchema2(
464
458
  /**
465
459
  * Whether to use strict JSON schema validation.
466
460
  *
467
- * @default false
461
+ * @default true
468
462
  */
469
463
  strictJsonSchema: z3.boolean().optional(),
470
464
  /**
@@ -505,7 +499,6 @@ import {
505
499
  function prepareChatTools({
506
500
  tools,
507
501
  toolChoice,
508
- structuredOutputs,
509
502
  strictJsonSchema
510
503
  }) {
511
504
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -523,7 +516,7 @@ function prepareChatTools({
523
516
  name: tool.name,
524
517
  description: tool.description,
525
518
  parameters: tool.inputSchema,
526
- strict: structuredOutputs ? strictJsonSchema : void 0
519
+ strict: strictJsonSchema
527
520
  }
528
521
  });
529
522
  break;
@@ -592,24 +585,16 @@ var OpenAIChatLanguageModel = class {
592
585
  toolChoice,
593
586
  providerOptions
594
587
  }) {
595
- var _a, _b, _c, _d;
588
+ var _a, _b, _c;
596
589
  const warnings = [];
597
590
  const openaiOptions = (_a = await parseProviderOptions({
598
591
  provider: "openai",
599
592
  providerOptions,
600
593
  schema: openaiChatLanguageModelOptions
601
594
  })) != null ? _a : {};
602
- const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
603
595
  if (topK != null) {
604
596
  warnings.push({ type: "unsupported", feature: "topK" });
605
597
  }
606
- if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
607
- warnings.push({
608
- type: "unsupported",
609
- feature: "responseFormat",
610
- details: "JSON response format schema is only supported with structuredOutputs"
611
- });
612
- }
613
598
  const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
614
599
  {
615
600
  prompt,
@@ -617,7 +602,7 @@ var OpenAIChatLanguageModel = class {
617
602
  }
618
603
  );
619
604
  warnings.push(...messageWarnings);
620
- const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
605
+ const strictJsonSchema = (_b = openaiOptions.strictJsonSchema) != null ? _b : true;
621
606
  const baseArgs = {
622
607
  // model id:
623
608
  model: this.modelId,
@@ -633,12 +618,12 @@ var OpenAIChatLanguageModel = class {
633
618
  top_p: topP,
634
619
  frequency_penalty: frequencyPenalty,
635
620
  presence_penalty: presencePenalty,
636
- response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? structuredOutputs && responseFormat.schema != null ? {
621
+ response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
637
622
  type: "json_schema",
638
623
  json_schema: {
639
624
  schema: responseFormat.schema,
640
625
  strict: strictJsonSchema,
641
- name: (_d = responseFormat.name) != null ? _d : "response",
626
+ name: (_c = responseFormat.name) != null ? _c : "response",
642
627
  description: responseFormat.description
643
628
  }
644
629
  } : { type: "json_object" } : void 0,
@@ -752,7 +737,6 @@ var OpenAIChatLanguageModel = class {
752
737
  } = prepareChatTools({
753
738
  tools,
754
739
  toolChoice,
755
- structuredOutputs,
756
740
  strictJsonSchema
757
741
  });
758
742
  return {
@@ -2144,33 +2128,79 @@ import {
2144
2128
  parseProviderOptions as parseProviderOptions6,
2145
2129
  validateTypes
2146
2130
  } from "@ai-sdk/provider-utils";
2147
- import { z as z13 } from "zod/v4";
2131
+ import { z as z14 } from "zod/v4";
2148
2132
 
2149
- // src/tool/local-shell.ts
2133
+ // src/tool/apply-patch.ts
2150
2134
  import {
2151
2135
  createProviderToolFactoryWithOutputSchema,
2152
2136
  lazySchema as lazySchema11,
2153
2137
  zodSchema as zodSchema11
2154
2138
  } from "@ai-sdk/provider-utils";
2155
2139
  import { z as z12 } from "zod/v4";
2156
- var localShellInputSchema = lazySchema11(
2140
+ var applyPatchInputSchema = lazySchema11(
2157
2141
  () => zodSchema11(
2158
2142
  z12.object({
2159
- action: z12.object({
2160
- type: z12.literal("exec"),
2161
- command: z12.array(z12.string()),
2162
- timeoutMs: z12.number().optional(),
2163
- user: z12.string().optional(),
2164
- workingDirectory: z12.string().optional(),
2165
- env: z12.record(z12.string(), z12.string()).optional()
2143
+ callId: z12.string(),
2144
+ operation: z12.discriminatedUnion("type", [
2145
+ z12.object({
2146
+ type: z12.literal("create_file"),
2147
+ path: z12.string(),
2148
+ diff: z12.string()
2149
+ }),
2150
+ z12.object({
2151
+ type: z12.literal("delete_file"),
2152
+ path: z12.string()
2153
+ }),
2154
+ z12.object({
2155
+ type: z12.literal("update_file"),
2156
+ path: z12.string(),
2157
+ diff: z12.string()
2158
+ })
2159
+ ])
2160
+ })
2161
+ )
2162
+ );
2163
+ var applyPatchOutputSchema = lazySchema11(
2164
+ () => zodSchema11(
2165
+ z12.object({
2166
+ status: z12.enum(["completed", "failed"]),
2167
+ output: z12.string().optional()
2168
+ })
2169
+ )
2170
+ );
2171
+ var applyPatchArgsSchema = lazySchema11(() => zodSchema11(z12.object({})));
2172
+ var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2173
+ id: "openai.apply_patch",
2174
+ inputSchema: applyPatchInputSchema,
2175
+ outputSchema: applyPatchOutputSchema
2176
+ });
2177
+ var applyPatch = () => applyPatchToolFactory({});
2178
+
2179
+ // src/tool/local-shell.ts
2180
+ import {
2181
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2182
+ lazySchema as lazySchema12,
2183
+ zodSchema as zodSchema12
2184
+ } from "@ai-sdk/provider-utils";
2185
+ import { z as z13 } from "zod/v4";
2186
+ var localShellInputSchema = lazySchema12(
2187
+ () => zodSchema12(
2188
+ z13.object({
2189
+ action: z13.object({
2190
+ type: z13.literal("exec"),
2191
+ command: z13.array(z13.string()),
2192
+ timeoutMs: z13.number().optional(),
2193
+ user: z13.string().optional(),
2194
+ workingDirectory: z13.string().optional(),
2195
+ env: z13.record(z13.string(), z13.string()).optional()
2166
2196
  })
2167
2197
  })
2168
2198
  )
2169
2199
  );
2170
- var localShellOutputSchema = lazySchema11(
2171
- () => zodSchema11(z12.object({ output: z12.string() }))
2200
+ var localShellOutputSchema = lazySchema12(
2201
+ () => zodSchema12(z13.object({ output: z13.string() }))
2172
2202
  );
2173
- var localShell = createProviderToolFactoryWithOutputSchema({
2203
+ var localShell = createProviderToolFactoryWithOutputSchema2({
2174
2204
  id: "openai.local_shell",
2175
2205
  inputSchema: localShellInputSchema,
2176
2206
  outputSchema: localShellOutputSchema
@@ -2187,7 +2217,8 @@ async function convertToOpenAIResponsesInput({
2187
2217
  systemMessageMode,
2188
2218
  fileIdPrefixes,
2189
2219
  store,
2190
- hasLocalShellTool = false
2220
+ hasLocalShellTool = false,
2221
+ hasApplyPatchTool = false
2191
2222
  }) {
2192
2223
  var _a, _b, _c, _d, _e;
2193
2224
  const input = [];
@@ -2410,6 +2441,19 @@ async function convertToOpenAIResponsesInput({
2410
2441
  });
2411
2442
  break;
2412
2443
  }
2444
+ if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
2445
+ const parsedOutput = await validateTypes({
2446
+ value: output.value,
2447
+ schema: applyPatchOutputSchema
2448
+ });
2449
+ input.push({
2450
+ type: "apply_patch_call_output",
2451
+ call_id: part.toolCallId,
2452
+ status: parsedOutput.status,
2453
+ output: parsedOutput.output
2454
+ });
2455
+ break;
2456
+ }
2413
2457
  let contentValue;
2414
2458
  switch (output.type) {
2415
2459
  case "text":
@@ -2470,9 +2514,9 @@ async function convertToOpenAIResponsesInput({
2470
2514
  }
2471
2515
  return { input, warnings };
2472
2516
  }
2473
- var openaiResponsesReasoningProviderOptionsSchema = z13.object({
2474
- itemId: z13.string().nullish(),
2475
- reasoningEncryptedContent: z13.string().nullish()
2517
+ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2518
+ itemId: z14.string().nullish(),
2519
+ reasoningEncryptedContent: z14.string().nullish()
2476
2520
  });
2477
2521
 
2478
2522
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2494,349 +2538,393 @@ function mapOpenAIResponseFinishReason({
2494
2538
  }
2495
2539
 
2496
2540
  // src/responses/openai-responses-api.ts
2497
- import { lazySchema as lazySchema12, zodSchema as zodSchema12 } from "@ai-sdk/provider-utils";
2498
- import { z as z14 } from "zod/v4";
2499
- var openaiResponsesChunkSchema = lazySchema12(
2500
- () => zodSchema12(
2501
- z14.union([
2502
- z14.object({
2503
- type: z14.literal("response.output_text.delta"),
2504
- item_id: z14.string(),
2505
- delta: z14.string(),
2506
- logprobs: z14.array(
2507
- z14.object({
2508
- token: z14.string(),
2509
- logprob: z14.number(),
2510
- top_logprobs: z14.array(
2511
- z14.object({
2512
- token: z14.string(),
2513
- logprob: z14.number()
2541
+ import { lazySchema as lazySchema13, zodSchema as zodSchema13 } from "@ai-sdk/provider-utils";
2542
+ import { z as z15 } from "zod/v4";
2543
+ var openaiResponsesChunkSchema = lazySchema13(
2544
+ () => zodSchema13(
2545
+ z15.union([
2546
+ z15.object({
2547
+ type: z15.literal("response.output_text.delta"),
2548
+ item_id: z15.string(),
2549
+ delta: z15.string(),
2550
+ logprobs: z15.array(
2551
+ z15.object({
2552
+ token: z15.string(),
2553
+ logprob: z15.number(),
2554
+ top_logprobs: z15.array(
2555
+ z15.object({
2556
+ token: z15.string(),
2557
+ logprob: z15.number()
2514
2558
  })
2515
2559
  )
2516
2560
  })
2517
2561
  ).nullish()
2518
2562
  }),
2519
- z14.object({
2520
- type: z14.enum(["response.completed", "response.incomplete"]),
2521
- response: z14.object({
2522
- incomplete_details: z14.object({ reason: z14.string() }).nullish(),
2523
- usage: z14.object({
2524
- input_tokens: z14.number(),
2525
- input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
2526
- output_tokens: z14.number(),
2527
- output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
2563
+ z15.object({
2564
+ type: z15.enum(["response.completed", "response.incomplete"]),
2565
+ response: z15.object({
2566
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
2567
+ usage: z15.object({
2568
+ input_tokens: z15.number(),
2569
+ input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
2570
+ output_tokens: z15.number(),
2571
+ output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
2528
2572
  }),
2529
- service_tier: z14.string().nullish()
2573
+ service_tier: z15.string().nullish()
2530
2574
  })
2531
2575
  }),
2532
- z14.object({
2533
- type: z14.literal("response.created"),
2534
- response: z14.object({
2535
- id: z14.string(),
2536
- created_at: z14.number(),
2537
- model: z14.string(),
2538
- service_tier: z14.string().nullish()
2576
+ z15.object({
2577
+ type: z15.literal("response.created"),
2578
+ response: z15.object({
2579
+ id: z15.string(),
2580
+ created_at: z15.number(),
2581
+ model: z15.string(),
2582
+ service_tier: z15.string().nullish()
2539
2583
  })
2540
2584
  }),
2541
- z14.object({
2542
- type: z14.literal("response.output_item.added"),
2543
- output_index: z14.number(),
2544
- item: z14.discriminatedUnion("type", [
2545
- z14.object({
2546
- type: z14.literal("message"),
2547
- id: z14.string()
2585
+ z15.object({
2586
+ type: z15.literal("response.output_item.added"),
2587
+ output_index: z15.number(),
2588
+ item: z15.discriminatedUnion("type", [
2589
+ z15.object({
2590
+ type: z15.literal("message"),
2591
+ id: z15.string()
2548
2592
  }),
2549
- z14.object({
2550
- type: z14.literal("reasoning"),
2551
- id: z14.string(),
2552
- encrypted_content: z14.string().nullish()
2593
+ z15.object({
2594
+ type: z15.literal("reasoning"),
2595
+ id: z15.string(),
2596
+ encrypted_content: z15.string().nullish()
2553
2597
  }),
2554
- z14.object({
2555
- type: z14.literal("function_call"),
2556
- id: z14.string(),
2557
- call_id: z14.string(),
2558
- name: z14.string(),
2559
- arguments: z14.string()
2598
+ z15.object({
2599
+ type: z15.literal("function_call"),
2600
+ id: z15.string(),
2601
+ call_id: z15.string(),
2602
+ name: z15.string(),
2603
+ arguments: z15.string()
2560
2604
  }),
2561
- z14.object({
2562
- type: z14.literal("web_search_call"),
2563
- id: z14.string(),
2564
- status: z14.string()
2605
+ z15.object({
2606
+ type: z15.literal("web_search_call"),
2607
+ id: z15.string(),
2608
+ status: z15.string()
2565
2609
  }),
2566
- z14.object({
2567
- type: z14.literal("computer_call"),
2568
- id: z14.string(),
2569
- status: z14.string()
2610
+ z15.object({
2611
+ type: z15.literal("computer_call"),
2612
+ id: z15.string(),
2613
+ status: z15.string()
2570
2614
  }),
2571
- z14.object({
2572
- type: z14.literal("file_search_call"),
2573
- id: z14.string()
2615
+ z15.object({
2616
+ type: z15.literal("file_search_call"),
2617
+ id: z15.string()
2574
2618
  }),
2575
- z14.object({
2576
- type: z14.literal("image_generation_call"),
2577
- id: z14.string()
2619
+ z15.object({
2620
+ type: z15.literal("image_generation_call"),
2621
+ id: z15.string()
2578
2622
  }),
2579
- z14.object({
2580
- type: z14.literal("code_interpreter_call"),
2581
- id: z14.string(),
2582
- container_id: z14.string(),
2583
- code: z14.string().nullable(),
2584
- outputs: z14.array(
2585
- z14.discriminatedUnion("type", [
2586
- z14.object({ type: z14.literal("logs"), logs: z14.string() }),
2587
- z14.object({ type: z14.literal("image"), url: z14.string() })
2623
+ z15.object({
2624
+ type: z15.literal("code_interpreter_call"),
2625
+ id: z15.string(),
2626
+ container_id: z15.string(),
2627
+ code: z15.string().nullable(),
2628
+ outputs: z15.array(
2629
+ z15.discriminatedUnion("type", [
2630
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2631
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2588
2632
  ])
2589
2633
  ).nullable(),
2590
- status: z14.string()
2634
+ status: z15.string()
2635
+ }),
2636
+ z15.object({
2637
+ type: z15.literal("mcp_call"),
2638
+ id: z15.string(),
2639
+ status: z15.string()
2591
2640
  }),
2592
- z14.object({
2593
- type: z14.literal("mcp_call"),
2594
- id: z14.string(),
2595
- status: z14.string()
2641
+ z15.object({
2642
+ type: z15.literal("mcp_list_tools"),
2643
+ id: z15.string()
2596
2644
  }),
2597
- z14.object({
2598
- type: z14.literal("mcp_list_tools"),
2599
- id: z14.string()
2645
+ z15.object({
2646
+ type: z15.literal("mcp_approval_request"),
2647
+ id: z15.string()
2600
2648
  }),
2601
- z14.object({
2602
- type: z14.literal("mcp_approval_request"),
2603
- id: z14.string()
2649
+ z15.object({
2650
+ type: z15.literal("apply_patch_call"),
2651
+ id: z15.string(),
2652
+ call_id: z15.string(),
2653
+ status: z15.enum(["in_progress", "completed"]),
2654
+ operation: z15.discriminatedUnion("type", [
2655
+ z15.object({
2656
+ type: z15.literal("create_file"),
2657
+ path: z15.string(),
2658
+ diff: z15.string()
2659
+ }),
2660
+ z15.object({
2661
+ type: z15.literal("delete_file"),
2662
+ path: z15.string()
2663
+ }),
2664
+ z15.object({
2665
+ type: z15.literal("update_file"),
2666
+ path: z15.string(),
2667
+ diff: z15.string()
2668
+ })
2669
+ ])
2604
2670
  })
2605
2671
  ])
2606
2672
  }),
2607
- z14.object({
2608
- type: z14.literal("response.output_item.done"),
2609
- output_index: z14.number(),
2610
- item: z14.discriminatedUnion("type", [
2611
- z14.object({
2612
- type: z14.literal("message"),
2613
- id: z14.string()
2673
+ z15.object({
2674
+ type: z15.literal("response.output_item.done"),
2675
+ output_index: z15.number(),
2676
+ item: z15.discriminatedUnion("type", [
2677
+ z15.object({
2678
+ type: z15.literal("message"),
2679
+ id: z15.string()
2614
2680
  }),
2615
- z14.object({
2616
- type: z14.literal("reasoning"),
2617
- id: z14.string(),
2618
- encrypted_content: z14.string().nullish()
2681
+ z15.object({
2682
+ type: z15.literal("reasoning"),
2683
+ id: z15.string(),
2684
+ encrypted_content: z15.string().nullish()
2619
2685
  }),
2620
- z14.object({
2621
- type: z14.literal("function_call"),
2622
- id: z14.string(),
2623
- call_id: z14.string(),
2624
- name: z14.string(),
2625
- arguments: z14.string(),
2626
- status: z14.literal("completed")
2686
+ z15.object({
2687
+ type: z15.literal("function_call"),
2688
+ id: z15.string(),
2689
+ call_id: z15.string(),
2690
+ name: z15.string(),
2691
+ arguments: z15.string(),
2692
+ status: z15.literal("completed")
2627
2693
  }),
2628
- z14.object({
2629
- type: z14.literal("code_interpreter_call"),
2630
- id: z14.string(),
2631
- code: z14.string().nullable(),
2632
- container_id: z14.string(),
2633
- outputs: z14.array(
2634
- z14.discriminatedUnion("type", [
2635
- z14.object({ type: z14.literal("logs"), logs: z14.string() }),
2636
- z14.object({ type: z14.literal("image"), url: z14.string() })
2694
+ z15.object({
2695
+ type: z15.literal("code_interpreter_call"),
2696
+ id: z15.string(),
2697
+ code: z15.string().nullable(),
2698
+ container_id: z15.string(),
2699
+ outputs: z15.array(
2700
+ z15.discriminatedUnion("type", [
2701
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2702
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2637
2703
  ])
2638
2704
  ).nullable()
2639
2705
  }),
2640
- z14.object({
2641
- type: z14.literal("image_generation_call"),
2642
- id: z14.string(),
2643
- result: z14.string()
2706
+ z15.object({
2707
+ type: z15.literal("image_generation_call"),
2708
+ id: z15.string(),
2709
+ result: z15.string()
2644
2710
  }),
2645
- z14.object({
2646
- type: z14.literal("web_search_call"),
2647
- id: z14.string(),
2648
- status: z14.string(),
2649
- action: z14.discriminatedUnion("type", [
2650
- z14.object({
2651
- type: z14.literal("search"),
2652
- query: z14.string().nullish(),
2653
- sources: z14.array(
2654
- z14.discriminatedUnion("type", [
2655
- z14.object({ type: z14.literal("url"), url: z14.string() }),
2656
- z14.object({ type: z14.literal("api"), name: z14.string() })
2711
+ z15.object({
2712
+ type: z15.literal("web_search_call"),
2713
+ id: z15.string(),
2714
+ status: z15.string(),
2715
+ action: z15.discriminatedUnion("type", [
2716
+ z15.object({
2717
+ type: z15.literal("search"),
2718
+ query: z15.string().nullish(),
2719
+ sources: z15.array(
2720
+ z15.discriminatedUnion("type", [
2721
+ z15.object({ type: z15.literal("url"), url: z15.string() }),
2722
+ z15.object({ type: z15.literal("api"), name: z15.string() })
2657
2723
  ])
2658
2724
  ).nullish()
2659
2725
  }),
2660
- z14.object({
2661
- type: z14.literal("open_page"),
2662
- url: z14.string()
2726
+ z15.object({
2727
+ type: z15.literal("open_page"),
2728
+ url: z15.string()
2663
2729
  }),
2664
- z14.object({
2665
- type: z14.literal("find"),
2666
- url: z14.string(),
2667
- pattern: z14.string()
2730
+ z15.object({
2731
+ type: z15.literal("find"),
2732
+ url: z15.string(),
2733
+ pattern: z15.string()
2668
2734
  })
2669
2735
  ])
2670
2736
  }),
2671
- z14.object({
2672
- type: z14.literal("file_search_call"),
2673
- id: z14.string(),
2674
- queries: z14.array(z14.string()),
2675
- results: z14.array(
2676
- z14.object({
2677
- attributes: z14.record(
2678
- z14.string(),
2679
- z14.union([z14.string(), z14.number(), z14.boolean()])
2737
+ z15.object({
2738
+ type: z15.literal("file_search_call"),
2739
+ id: z15.string(),
2740
+ queries: z15.array(z15.string()),
2741
+ results: z15.array(
2742
+ z15.object({
2743
+ attributes: z15.record(
2744
+ z15.string(),
2745
+ z15.union([z15.string(), z15.number(), z15.boolean()])
2680
2746
  ),
2681
- file_id: z14.string(),
2682
- filename: z14.string(),
2683
- score: z14.number(),
2684
- text: z14.string()
2747
+ file_id: z15.string(),
2748
+ filename: z15.string(),
2749
+ score: z15.number(),
2750
+ text: z15.string()
2685
2751
  })
2686
2752
  ).nullish()
2687
2753
  }),
2688
- z14.object({
2689
- type: z14.literal("local_shell_call"),
2690
- id: z14.string(),
2691
- call_id: z14.string(),
2692
- action: z14.object({
2693
- type: z14.literal("exec"),
2694
- command: z14.array(z14.string()),
2695
- timeout_ms: z14.number().optional(),
2696
- user: z14.string().optional(),
2697
- working_directory: z14.string().optional(),
2698
- env: z14.record(z14.string(), z14.string()).optional()
2754
+ z15.object({
2755
+ type: z15.literal("local_shell_call"),
2756
+ id: z15.string(),
2757
+ call_id: z15.string(),
2758
+ action: z15.object({
2759
+ type: z15.literal("exec"),
2760
+ command: z15.array(z15.string()),
2761
+ timeout_ms: z15.number().optional(),
2762
+ user: z15.string().optional(),
2763
+ working_directory: z15.string().optional(),
2764
+ env: z15.record(z15.string(), z15.string()).optional()
2699
2765
  })
2700
2766
  }),
2701
- z14.object({
2702
- type: z14.literal("computer_call"),
2703
- id: z14.string(),
2704
- status: z14.literal("completed")
2767
+ z15.object({
2768
+ type: z15.literal("computer_call"),
2769
+ id: z15.string(),
2770
+ status: z15.literal("completed")
2705
2771
  }),
2706
- z14.object({
2707
- type: z14.literal("mcp_call"),
2708
- id: z14.string(),
2709
- status: z14.string(),
2710
- arguments: z14.string(),
2711
- name: z14.string(),
2712
- server_label: z14.string(),
2713
- output: z14.string().nullish(),
2714
- error: z14.union([
2715
- z14.string(),
2716
- z14.object({
2717
- type: z14.string().optional(),
2718
- code: z14.union([z14.number(), z14.string()]).optional(),
2719
- message: z14.string().optional()
2772
+ z15.object({
2773
+ type: z15.literal("mcp_call"),
2774
+ id: z15.string(),
2775
+ status: z15.string(),
2776
+ arguments: z15.string(),
2777
+ name: z15.string(),
2778
+ server_label: z15.string(),
2779
+ output: z15.string().nullish(),
2780
+ error: z15.union([
2781
+ z15.string(),
2782
+ z15.object({
2783
+ type: z15.string().optional(),
2784
+ code: z15.union([z15.number(), z15.string()]).optional(),
2785
+ message: z15.string().optional()
2720
2786
  }).loose()
2721
2787
  ]).nullish()
2722
2788
  }),
2723
- z14.object({
2724
- type: z14.literal("mcp_list_tools"),
2725
- id: z14.string(),
2726
- server_label: z14.string(),
2727
- tools: z14.array(
2728
- z14.object({
2729
- name: z14.string(),
2730
- description: z14.string().optional(),
2731
- input_schema: z14.any(),
2732
- annotations: z14.record(z14.string(), z14.unknown()).optional()
2789
+ z15.object({
2790
+ type: z15.literal("mcp_list_tools"),
2791
+ id: z15.string(),
2792
+ server_label: z15.string(),
2793
+ tools: z15.array(
2794
+ z15.object({
2795
+ name: z15.string(),
2796
+ description: z15.string().optional(),
2797
+ input_schema: z15.any(),
2798
+ annotations: z15.record(z15.string(), z15.unknown()).optional()
2733
2799
  })
2734
2800
  ),
2735
- error: z14.union([
2736
- z14.string(),
2737
- z14.object({
2738
- type: z14.string().optional(),
2739
- code: z14.union([z14.number(), z14.string()]).optional(),
2740
- message: z14.string().optional()
2801
+ error: z15.union([
2802
+ z15.string(),
2803
+ z15.object({
2804
+ type: z15.string().optional(),
2805
+ code: z15.union([z15.number(), z15.string()]).optional(),
2806
+ message: z15.string().optional()
2741
2807
  }).loose()
2742
2808
  ]).optional()
2743
2809
  }),
2744
- z14.object({
2745
- type: z14.literal("mcp_approval_request"),
2746
- id: z14.string(),
2747
- server_label: z14.string(),
2748
- name: z14.string(),
2749
- arguments: z14.string(),
2750
- approval_request_id: z14.string()
2810
+ z15.object({
2811
+ type: z15.literal("mcp_approval_request"),
2812
+ id: z15.string(),
2813
+ server_label: z15.string(),
2814
+ name: z15.string(),
2815
+ arguments: z15.string(),
2816
+ approval_request_id: z15.string()
2817
+ }),
2818
+ z15.object({
2819
+ type: z15.literal("apply_patch_call"),
2820
+ id: z15.string(),
2821
+ call_id: z15.string(),
2822
+ status: z15.enum(["in_progress", "completed"]),
2823
+ operation: z15.discriminatedUnion("type", [
2824
+ z15.object({
2825
+ type: z15.literal("create_file"),
2826
+ path: z15.string(),
2827
+ diff: z15.string()
2828
+ }),
2829
+ z15.object({
2830
+ type: z15.literal("delete_file"),
2831
+ path: z15.string()
2832
+ }),
2833
+ z15.object({
2834
+ type: z15.literal("update_file"),
2835
+ path: z15.string(),
2836
+ diff: z15.string()
2837
+ })
2838
+ ])
2751
2839
  })
2752
2840
  ])
2753
2841
  }),
2754
- z14.object({
2755
- type: z14.literal("response.function_call_arguments.delta"),
2756
- item_id: z14.string(),
2757
- output_index: z14.number(),
2758
- delta: z14.string()
2842
+ z15.object({
2843
+ type: z15.literal("response.function_call_arguments.delta"),
2844
+ item_id: z15.string(),
2845
+ output_index: z15.number(),
2846
+ delta: z15.string()
2759
2847
  }),
2760
- z14.object({
2761
- type: z14.literal("response.image_generation_call.partial_image"),
2762
- item_id: z14.string(),
2763
- output_index: z14.number(),
2764
- partial_image_b64: z14.string()
2848
+ z15.object({
2849
+ type: z15.literal("response.image_generation_call.partial_image"),
2850
+ item_id: z15.string(),
2851
+ output_index: z15.number(),
2852
+ partial_image_b64: z15.string()
2765
2853
  }),
2766
- z14.object({
2767
- type: z14.literal("response.code_interpreter_call_code.delta"),
2768
- item_id: z14.string(),
2769
- output_index: z14.number(),
2770
- delta: z14.string()
2854
+ z15.object({
2855
+ type: z15.literal("response.code_interpreter_call_code.delta"),
2856
+ item_id: z15.string(),
2857
+ output_index: z15.number(),
2858
+ delta: z15.string()
2771
2859
  }),
2772
- z14.object({
2773
- type: z14.literal("response.code_interpreter_call_code.done"),
2774
- item_id: z14.string(),
2775
- output_index: z14.number(),
2776
- code: z14.string()
2860
+ z15.object({
2861
+ type: z15.literal("response.code_interpreter_call_code.done"),
2862
+ item_id: z15.string(),
2863
+ output_index: z15.number(),
2864
+ code: z15.string()
2777
2865
  }),
2778
- z14.object({
2779
- type: z14.literal("response.output_text.annotation.added"),
2780
- annotation: z14.discriminatedUnion("type", [
2781
- z14.object({
2782
- type: z14.literal("url_citation"),
2783
- start_index: z14.number(),
2784
- end_index: z14.number(),
2785
- url: z14.string(),
2786
- title: z14.string()
2866
+ z15.object({
2867
+ type: z15.literal("response.output_text.annotation.added"),
2868
+ annotation: z15.discriminatedUnion("type", [
2869
+ z15.object({
2870
+ type: z15.literal("url_citation"),
2871
+ start_index: z15.number(),
2872
+ end_index: z15.number(),
2873
+ url: z15.string(),
2874
+ title: z15.string()
2787
2875
  }),
2788
- z14.object({
2789
- type: z14.literal("file_citation"),
2790
- file_id: z14.string(),
2791
- filename: z14.string().nullish(),
2792
- index: z14.number().nullish(),
2793
- start_index: z14.number().nullish(),
2794
- end_index: z14.number().nullish(),
2795
- quote: z14.string().nullish()
2876
+ z15.object({
2877
+ type: z15.literal("file_citation"),
2878
+ file_id: z15.string(),
2879
+ filename: z15.string().nullish(),
2880
+ index: z15.number().nullish(),
2881
+ start_index: z15.number().nullish(),
2882
+ end_index: z15.number().nullish(),
2883
+ quote: z15.string().nullish()
2796
2884
  }),
2797
- z14.object({
2798
- type: z14.literal("container_file_citation"),
2799
- container_id: z14.string(),
2800
- file_id: z14.string(),
2801
- filename: z14.string().nullish(),
2802
- start_index: z14.number().nullish(),
2803
- end_index: z14.number().nullish(),
2804
- index: z14.number().nullish()
2885
+ z15.object({
2886
+ type: z15.literal("container_file_citation"),
2887
+ container_id: z15.string(),
2888
+ file_id: z15.string(),
2889
+ filename: z15.string().nullish(),
2890
+ start_index: z15.number().nullish(),
2891
+ end_index: z15.number().nullish(),
2892
+ index: z15.number().nullish()
2805
2893
  }),
2806
- z14.object({
2807
- type: z14.literal("file_path"),
2808
- file_id: z14.string(),
2809
- index: z14.number().nullish()
2894
+ z15.object({
2895
+ type: z15.literal("file_path"),
2896
+ file_id: z15.string(),
2897
+ index: z15.number().nullish()
2810
2898
  })
2811
2899
  ])
2812
2900
  }),
2813
- z14.object({
2814
- type: z14.literal("response.reasoning_summary_part.added"),
2815
- item_id: z14.string(),
2816
- summary_index: z14.number()
2901
+ z15.object({
2902
+ type: z15.literal("response.reasoning_summary_part.added"),
2903
+ item_id: z15.string(),
2904
+ summary_index: z15.number()
2817
2905
  }),
2818
- z14.object({
2819
- type: z14.literal("response.reasoning_summary_text.delta"),
2820
- item_id: z14.string(),
2821
- summary_index: z14.number(),
2822
- delta: z14.string()
2906
+ z15.object({
2907
+ type: z15.literal("response.reasoning_summary_text.delta"),
2908
+ item_id: z15.string(),
2909
+ summary_index: z15.number(),
2910
+ delta: z15.string()
2823
2911
  }),
2824
- z14.object({
2825
- type: z14.literal("response.reasoning_summary_part.done"),
2826
- item_id: z14.string(),
2827
- summary_index: z14.number()
2912
+ z15.object({
2913
+ type: z15.literal("response.reasoning_summary_part.done"),
2914
+ item_id: z15.string(),
2915
+ summary_index: z15.number()
2828
2916
  }),
2829
- z14.object({
2830
- type: z14.literal("error"),
2831
- sequence_number: z14.number(),
2832
- error: z14.object({
2833
- type: z14.string(),
2834
- code: z14.string(),
2835
- message: z14.string(),
2836
- param: z14.string().nullish()
2917
+ z15.object({
2918
+ type: z15.literal("error"),
2919
+ sequence_number: z15.number(),
2920
+ error: z15.object({
2921
+ type: z15.string(),
2922
+ code: z15.string(),
2923
+ message: z15.string(),
2924
+ param: z15.string().nullish()
2837
2925
  })
2838
2926
  }),
2839
- z14.object({ type: z14.string() }).loose().transform((value) => ({
2927
+ z15.object({ type: z15.string() }).loose().transform((value) => ({
2840
2928
  type: "unknown_chunk",
2841
2929
  message: value.type
2842
2930
  }))
@@ -2844,236 +2932,258 @@ var openaiResponsesChunkSchema = lazySchema12(
2844
2932
  ])
2845
2933
  )
2846
2934
  );
2847
- var openaiResponsesResponseSchema = lazySchema12(
2848
- () => zodSchema12(
2849
- z14.object({
2850
- id: z14.string().optional(),
2851
- created_at: z14.number().optional(),
2852
- error: z14.object({
2853
- message: z14.string(),
2854
- type: z14.string(),
2855
- param: z14.string().nullish(),
2856
- code: z14.string()
2935
+ var openaiResponsesResponseSchema = lazySchema13(
2936
+ () => zodSchema13(
2937
+ z15.object({
2938
+ id: z15.string().optional(),
2939
+ created_at: z15.number().optional(),
2940
+ error: z15.object({
2941
+ message: z15.string(),
2942
+ type: z15.string(),
2943
+ param: z15.string().nullish(),
2944
+ code: z15.string()
2857
2945
  }).nullish(),
2858
- model: z14.string().optional(),
2859
- output: z14.array(
2860
- z14.discriminatedUnion("type", [
2861
- z14.object({
2862
- type: z14.literal("message"),
2863
- role: z14.literal("assistant"),
2864
- id: z14.string(),
2865
- content: z14.array(
2866
- z14.object({
2867
- type: z14.literal("output_text"),
2868
- text: z14.string(),
2869
- logprobs: z14.array(
2870
- z14.object({
2871
- token: z14.string(),
2872
- logprob: z14.number(),
2873
- top_logprobs: z14.array(
2874
- z14.object({
2875
- token: z14.string(),
2876
- logprob: z14.number()
2946
+ model: z15.string().optional(),
2947
+ output: z15.array(
2948
+ z15.discriminatedUnion("type", [
2949
+ z15.object({
2950
+ type: z15.literal("message"),
2951
+ role: z15.literal("assistant"),
2952
+ id: z15.string(),
2953
+ content: z15.array(
2954
+ z15.object({
2955
+ type: z15.literal("output_text"),
2956
+ text: z15.string(),
2957
+ logprobs: z15.array(
2958
+ z15.object({
2959
+ token: z15.string(),
2960
+ logprob: z15.number(),
2961
+ top_logprobs: z15.array(
2962
+ z15.object({
2963
+ token: z15.string(),
2964
+ logprob: z15.number()
2877
2965
  })
2878
2966
  )
2879
2967
  })
2880
2968
  ).nullish(),
2881
- annotations: z14.array(
2882
- z14.discriminatedUnion("type", [
2883
- z14.object({
2884
- type: z14.literal("url_citation"),
2885
- start_index: z14.number(),
2886
- end_index: z14.number(),
2887
- url: z14.string(),
2888
- title: z14.string()
2969
+ annotations: z15.array(
2970
+ z15.discriminatedUnion("type", [
2971
+ z15.object({
2972
+ type: z15.literal("url_citation"),
2973
+ start_index: z15.number(),
2974
+ end_index: z15.number(),
2975
+ url: z15.string(),
2976
+ title: z15.string()
2889
2977
  }),
2890
- z14.object({
2891
- type: z14.literal("file_citation"),
2892
- file_id: z14.string(),
2893
- filename: z14.string().nullish(),
2894
- index: z14.number().nullish(),
2895
- start_index: z14.number().nullish(),
2896
- end_index: z14.number().nullish(),
2897
- quote: z14.string().nullish()
2978
+ z15.object({
2979
+ type: z15.literal("file_citation"),
2980
+ file_id: z15.string(),
2981
+ filename: z15.string().nullish(),
2982
+ index: z15.number().nullish(),
2983
+ start_index: z15.number().nullish(),
2984
+ end_index: z15.number().nullish(),
2985
+ quote: z15.string().nullish()
2898
2986
  }),
2899
- z14.object({
2900
- type: z14.literal("container_file_citation"),
2901
- container_id: z14.string(),
2902
- file_id: z14.string(),
2903
- filename: z14.string().nullish(),
2904
- start_index: z14.number().nullish(),
2905
- end_index: z14.number().nullish(),
2906
- index: z14.number().nullish()
2987
+ z15.object({
2988
+ type: z15.literal("container_file_citation"),
2989
+ container_id: z15.string(),
2990
+ file_id: z15.string(),
2991
+ filename: z15.string().nullish(),
2992
+ start_index: z15.number().nullish(),
2993
+ end_index: z15.number().nullish(),
2994
+ index: z15.number().nullish()
2907
2995
  }),
2908
- z14.object({
2909
- type: z14.literal("file_path"),
2910
- file_id: z14.string(),
2911
- index: z14.number().nullish()
2996
+ z15.object({
2997
+ type: z15.literal("file_path"),
2998
+ file_id: z15.string(),
2999
+ index: z15.number().nullish()
2912
3000
  })
2913
3001
  ])
2914
3002
  )
2915
3003
  })
2916
3004
  )
2917
3005
  }),
2918
- z14.object({
2919
- type: z14.literal("web_search_call"),
2920
- id: z14.string(),
2921
- status: z14.string(),
2922
- action: z14.discriminatedUnion("type", [
2923
- z14.object({
2924
- type: z14.literal("search"),
2925
- query: z14.string().nullish(),
2926
- sources: z14.array(
2927
- z14.discriminatedUnion("type", [
2928
- z14.object({ type: z14.literal("url"), url: z14.string() }),
2929
- z14.object({ type: z14.literal("api"), name: z14.string() })
3006
+ z15.object({
3007
+ type: z15.literal("web_search_call"),
3008
+ id: z15.string(),
3009
+ status: z15.string(),
3010
+ action: z15.discriminatedUnion("type", [
3011
+ z15.object({
3012
+ type: z15.literal("search"),
3013
+ query: z15.string().nullish(),
3014
+ sources: z15.array(
3015
+ z15.discriminatedUnion("type", [
3016
+ z15.object({ type: z15.literal("url"), url: z15.string() }),
3017
+ z15.object({ type: z15.literal("api"), name: z15.string() })
2930
3018
  ])
2931
3019
  ).nullish()
2932
3020
  }),
2933
- z14.object({
2934
- type: z14.literal("open_page"),
2935
- url: z14.string()
3021
+ z15.object({
3022
+ type: z15.literal("open_page"),
3023
+ url: z15.string()
2936
3024
  }),
2937
- z14.object({
2938
- type: z14.literal("find"),
2939
- url: z14.string(),
2940
- pattern: z14.string()
3025
+ z15.object({
3026
+ type: z15.literal("find"),
3027
+ url: z15.string(),
3028
+ pattern: z15.string()
2941
3029
  })
2942
3030
  ])
2943
3031
  }),
2944
- z14.object({
2945
- type: z14.literal("file_search_call"),
2946
- id: z14.string(),
2947
- queries: z14.array(z14.string()),
2948
- results: z14.array(
2949
- z14.object({
2950
- attributes: z14.record(
2951
- z14.string(),
2952
- z14.union([z14.string(), z14.number(), z14.boolean()])
3032
+ z15.object({
3033
+ type: z15.literal("file_search_call"),
3034
+ id: z15.string(),
3035
+ queries: z15.array(z15.string()),
3036
+ results: z15.array(
3037
+ z15.object({
3038
+ attributes: z15.record(
3039
+ z15.string(),
3040
+ z15.union([z15.string(), z15.number(), z15.boolean()])
2953
3041
  ),
2954
- file_id: z14.string(),
2955
- filename: z14.string(),
2956
- score: z14.number(),
2957
- text: z14.string()
3042
+ file_id: z15.string(),
3043
+ filename: z15.string(),
3044
+ score: z15.number(),
3045
+ text: z15.string()
2958
3046
  })
2959
3047
  ).nullish()
2960
3048
  }),
2961
- z14.object({
2962
- type: z14.literal("code_interpreter_call"),
2963
- id: z14.string(),
2964
- code: z14.string().nullable(),
2965
- container_id: z14.string(),
2966
- outputs: z14.array(
2967
- z14.discriminatedUnion("type", [
2968
- z14.object({ type: z14.literal("logs"), logs: z14.string() }),
2969
- z14.object({ type: z14.literal("image"), url: z14.string() })
3049
+ z15.object({
3050
+ type: z15.literal("code_interpreter_call"),
3051
+ id: z15.string(),
3052
+ code: z15.string().nullable(),
3053
+ container_id: z15.string(),
3054
+ outputs: z15.array(
3055
+ z15.discriminatedUnion("type", [
3056
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
3057
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2970
3058
  ])
2971
3059
  ).nullable()
2972
3060
  }),
2973
- z14.object({
2974
- type: z14.literal("image_generation_call"),
2975
- id: z14.string(),
2976
- result: z14.string()
3061
+ z15.object({
3062
+ type: z15.literal("image_generation_call"),
3063
+ id: z15.string(),
3064
+ result: z15.string()
2977
3065
  }),
2978
- z14.object({
2979
- type: z14.literal("local_shell_call"),
2980
- id: z14.string(),
2981
- call_id: z14.string(),
2982
- action: z14.object({
2983
- type: z14.literal("exec"),
2984
- command: z14.array(z14.string()),
2985
- timeout_ms: z14.number().optional(),
2986
- user: z14.string().optional(),
2987
- working_directory: z14.string().optional(),
2988
- env: z14.record(z14.string(), z14.string()).optional()
3066
+ z15.object({
3067
+ type: z15.literal("local_shell_call"),
3068
+ id: z15.string(),
3069
+ call_id: z15.string(),
3070
+ action: z15.object({
3071
+ type: z15.literal("exec"),
3072
+ command: z15.array(z15.string()),
3073
+ timeout_ms: z15.number().optional(),
3074
+ user: z15.string().optional(),
3075
+ working_directory: z15.string().optional(),
3076
+ env: z15.record(z15.string(), z15.string()).optional()
2989
3077
  })
2990
3078
  }),
2991
- z14.object({
2992
- type: z14.literal("function_call"),
2993
- call_id: z14.string(),
2994
- name: z14.string(),
2995
- arguments: z14.string(),
2996
- id: z14.string()
3079
+ z15.object({
3080
+ type: z15.literal("function_call"),
3081
+ call_id: z15.string(),
3082
+ name: z15.string(),
3083
+ arguments: z15.string(),
3084
+ id: z15.string()
2997
3085
  }),
2998
- z14.object({
2999
- type: z14.literal("computer_call"),
3000
- id: z14.string(),
3001
- status: z14.string().optional()
3086
+ z15.object({
3087
+ type: z15.literal("computer_call"),
3088
+ id: z15.string(),
3089
+ status: z15.string().optional()
3002
3090
  }),
3003
- z14.object({
3004
- type: z14.literal("reasoning"),
3005
- id: z14.string(),
3006
- encrypted_content: z14.string().nullish(),
3007
- summary: z14.array(
3008
- z14.object({
3009
- type: z14.literal("summary_text"),
3010
- text: z14.string()
3091
+ z15.object({
3092
+ type: z15.literal("reasoning"),
3093
+ id: z15.string(),
3094
+ encrypted_content: z15.string().nullish(),
3095
+ summary: z15.array(
3096
+ z15.object({
3097
+ type: z15.literal("summary_text"),
3098
+ text: z15.string()
3011
3099
  })
3012
3100
  )
3013
3101
  }),
3014
- z14.object({
3015
- type: z14.literal("mcp_call"),
3016
- id: z14.string(),
3017
- status: z14.string(),
3018
- arguments: z14.string(),
3019
- name: z14.string(),
3020
- server_label: z14.string(),
3021
- output: z14.string().nullish(),
3022
- error: z14.union([
3023
- z14.string(),
3024
- z14.object({
3025
- type: z14.string().optional(),
3026
- code: z14.union([z14.number(), z14.string()]).optional(),
3027
- message: z14.string().optional()
3102
+ z15.object({
3103
+ type: z15.literal("mcp_call"),
3104
+ id: z15.string(),
3105
+ status: z15.string(),
3106
+ arguments: z15.string(),
3107
+ name: z15.string(),
3108
+ server_label: z15.string(),
3109
+ output: z15.string().nullish(),
3110
+ error: z15.union([
3111
+ z15.string(),
3112
+ z15.object({
3113
+ type: z15.string().optional(),
3114
+ code: z15.union([z15.number(), z15.string()]).optional(),
3115
+ message: z15.string().optional()
3028
3116
  }).loose()
3029
3117
  ]).nullish()
3030
3118
  }),
3031
- z14.object({
3032
- type: z14.literal("mcp_list_tools"),
3033
- id: z14.string(),
3034
- server_label: z14.string(),
3035
- tools: z14.array(
3036
- z14.object({
3037
- name: z14.string(),
3038
- description: z14.string().optional(),
3039
- input_schema: z14.any(),
3040
- annotations: z14.record(z14.string(), z14.unknown()).optional()
3119
+ z15.object({
3120
+ type: z15.literal("mcp_list_tools"),
3121
+ id: z15.string(),
3122
+ server_label: z15.string(),
3123
+ tools: z15.array(
3124
+ z15.object({
3125
+ name: z15.string(),
3126
+ description: z15.string().optional(),
3127
+ input_schema: z15.any(),
3128
+ annotations: z15.record(z15.string(), z15.unknown()).optional()
3041
3129
  })
3042
3130
  ),
3043
- error: z14.union([
3044
- z14.string(),
3045
- z14.object({
3046
- type: z14.string().optional(),
3047
- code: z14.union([z14.number(), z14.string()]).optional(),
3048
- message: z14.string().optional()
3131
+ error: z15.union([
3132
+ z15.string(),
3133
+ z15.object({
3134
+ type: z15.string().optional(),
3135
+ code: z15.union([z15.number(), z15.string()]).optional(),
3136
+ message: z15.string().optional()
3049
3137
  }).loose()
3050
3138
  ]).optional()
3051
3139
  }),
3052
- z14.object({
3053
- type: z14.literal("mcp_approval_request"),
3054
- id: z14.string(),
3055
- server_label: z14.string(),
3056
- name: z14.string(),
3057
- arguments: z14.string(),
3058
- approval_request_id: z14.string()
3140
+ z15.object({
3141
+ type: z15.literal("mcp_approval_request"),
3142
+ id: z15.string(),
3143
+ server_label: z15.string(),
3144
+ name: z15.string(),
3145
+ arguments: z15.string(),
3146
+ approval_request_id: z15.string()
3147
+ }),
3148
+ z15.object({
3149
+ type: z15.literal("apply_patch_call"),
3150
+ id: z15.string(),
3151
+ call_id: z15.string(),
3152
+ status: z15.enum(["in_progress", "completed"]),
3153
+ operation: z15.discriminatedUnion("type", [
3154
+ z15.object({
3155
+ type: z15.literal("create_file"),
3156
+ path: z15.string(),
3157
+ diff: z15.string()
3158
+ }),
3159
+ z15.object({
3160
+ type: z15.literal("delete_file"),
3161
+ path: z15.string()
3162
+ }),
3163
+ z15.object({
3164
+ type: z15.literal("update_file"),
3165
+ path: z15.string(),
3166
+ diff: z15.string()
3167
+ })
3168
+ ])
3059
3169
  })
3060
3170
  ])
3061
3171
  ).optional(),
3062
- service_tier: z14.string().nullish(),
3063
- incomplete_details: z14.object({ reason: z14.string() }).nullish(),
3064
- usage: z14.object({
3065
- input_tokens: z14.number(),
3066
- input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
3067
- output_tokens: z14.number(),
3068
- output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
3172
+ service_tier: z15.string().nullish(),
3173
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
3174
+ usage: z15.object({
3175
+ input_tokens: z15.number(),
3176
+ input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
3177
+ output_tokens: z15.number(),
3178
+ output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
3069
3179
  }).optional()
3070
3180
  })
3071
3181
  )
3072
3182
  );
3073
3183
 
3074
3184
  // src/responses/openai-responses-options.ts
3075
- import { lazySchema as lazySchema13, zodSchema as zodSchema13 } from "@ai-sdk/provider-utils";
3076
- import { z as z15 } from "zod/v4";
3185
+ import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
3186
+ import { z as z16 } from "zod/v4";
3077
3187
  var TOP_LOGPROBS_MAX = 20;
3078
3188
  var openaiResponsesReasoningModelIds = [
3079
3189
  "o1",
@@ -3140,19 +3250,19 @@ var openaiResponsesModelIds = [
3140
3250
  "gpt-5-chat-latest",
3141
3251
  ...openaiResponsesReasoningModelIds
3142
3252
  ];
3143
- var openaiResponsesProviderOptionsSchema = lazySchema13(
3144
- () => zodSchema13(
3145
- z15.object({
3146
- conversation: z15.string().nullish(),
3147
- include: z15.array(
3148
- z15.enum([
3253
+ var openaiResponsesProviderOptionsSchema = lazySchema14(
3254
+ () => zodSchema14(
3255
+ z16.object({
3256
+ conversation: z16.string().nullish(),
3257
+ include: z16.array(
3258
+ z16.enum([
3149
3259
  "reasoning.encrypted_content",
3150
3260
  // handled internally by default, only needed for unknown reasoning models
3151
3261
  "file_search_call.results",
3152
3262
  "message.output_text.logprobs"
3153
3263
  ])
3154
3264
  ).nullish(),
3155
- instructions: z15.string().nullish(),
3265
+ instructions: z16.string().nullish(),
3156
3266
  /**
3157
3267
  * Return the log probabilities of the tokens.
3158
3268
  *
@@ -3165,17 +3275,17 @@ var openaiResponsesProviderOptionsSchema = lazySchema13(
3165
3275
  * @see https://platform.openai.com/docs/api-reference/responses/create
3166
3276
  * @see https://cookbook.openai.com/examples/using_logprobs
3167
3277
  */
3168
- logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3278
+ logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3169
3279
  /**
3170
3280
  * The maximum number of total calls to built-in tools that can be processed in a response.
3171
3281
  * This maximum number applies across all built-in tool calls, not per individual tool.
3172
3282
  * Any further attempts to call a tool by the model will be ignored.
3173
3283
  */
3174
- maxToolCalls: z15.number().nullish(),
3175
- metadata: z15.any().nullish(),
3176
- parallelToolCalls: z15.boolean().nullish(),
3177
- previousResponseId: z15.string().nullish(),
3178
- promptCacheKey: z15.string().nullish(),
3284
+ maxToolCalls: z16.number().nullish(),
3285
+ metadata: z16.any().nullish(),
3286
+ parallelToolCalls: z16.boolean().nullish(),
3287
+ previousResponseId: z16.string().nullish(),
3288
+ promptCacheKey: z16.string().nullish(),
3179
3289
  /**
3180
3290
  * The retention policy for the prompt cache.
3181
3291
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -3184,16 +3294,16 @@ var openaiResponsesProviderOptionsSchema = lazySchema13(
3184
3294
  *
3185
3295
  * @default 'in_memory'
3186
3296
  */
3187
- promptCacheRetention: z15.enum(["in_memory", "24h"]).nullish(),
3188
- reasoningEffort: z15.string().nullish(),
3189
- reasoningSummary: z15.string().nullish(),
3190
- safetyIdentifier: z15.string().nullish(),
3191
- serviceTier: z15.enum(["auto", "flex", "priority", "default"]).nullish(),
3192
- store: z15.boolean().nullish(),
3193
- strictJsonSchema: z15.boolean().nullish(),
3194
- textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
3195
- truncation: z15.enum(["auto", "disabled"]).nullish(),
3196
- user: z15.string().nullish()
3297
+ promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
3298
+ reasoningEffort: z16.string().nullish(),
3299
+ reasoningSummary: z16.string().nullish(),
3300
+ safetyIdentifier: z16.string().nullish(),
3301
+ serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
3302
+ store: z16.boolean().nullish(),
3303
+ strictJsonSchema: z16.boolean().nullish(),
3304
+ textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3305
+ truncation: z16.enum(["auto", "disabled"]).nullish(),
3306
+ user: z16.string().nullish()
3197
3307
  })
3198
3308
  )
3199
3309
  );
@@ -3206,44 +3316,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
3206
3316
 
3207
3317
  // src/tool/code-interpreter.ts
3208
3318
  import {
3209
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
3210
- lazySchema as lazySchema14,
3211
- zodSchema as zodSchema14
3319
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
3320
+ lazySchema as lazySchema15,
3321
+ zodSchema as zodSchema15
3212
3322
  } from "@ai-sdk/provider-utils";
3213
- import { z as z16 } from "zod/v4";
3214
- var codeInterpreterInputSchema = lazySchema14(
3215
- () => zodSchema14(
3216
- z16.object({
3217
- code: z16.string().nullish(),
3218
- containerId: z16.string()
3323
+ import { z as z17 } from "zod/v4";
3324
+ var codeInterpreterInputSchema = lazySchema15(
3325
+ () => zodSchema15(
3326
+ z17.object({
3327
+ code: z17.string().nullish(),
3328
+ containerId: z17.string()
3219
3329
  })
3220
3330
  )
3221
3331
  );
3222
- var codeInterpreterOutputSchema = lazySchema14(
3223
- () => zodSchema14(
3224
- z16.object({
3225
- outputs: z16.array(
3226
- z16.discriminatedUnion("type", [
3227
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3228
- z16.object({ type: z16.literal("image"), url: z16.string() })
3332
+ var codeInterpreterOutputSchema = lazySchema15(
3333
+ () => zodSchema15(
3334
+ z17.object({
3335
+ outputs: z17.array(
3336
+ z17.discriminatedUnion("type", [
3337
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3338
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3229
3339
  ])
3230
3340
  ).nullish()
3231
3341
  })
3232
3342
  )
3233
3343
  );
3234
- var codeInterpreterArgsSchema = lazySchema14(
3235
- () => zodSchema14(
3236
- z16.object({
3237
- container: z16.union([
3238
- z16.string(),
3239
- z16.object({
3240
- fileIds: z16.array(z16.string()).optional()
3344
+ var codeInterpreterArgsSchema = lazySchema15(
3345
+ () => zodSchema15(
3346
+ z17.object({
3347
+ container: z17.union([
3348
+ z17.string(),
3349
+ z17.object({
3350
+ fileIds: z17.array(z17.string()).optional()
3241
3351
  })
3242
3352
  ]).optional()
3243
3353
  })
3244
3354
  )
3245
3355
  );
3246
- var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema2({
3356
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema3({
3247
3357
  id: "openai.code_interpreter",
3248
3358
  inputSchema: codeInterpreterInputSchema,
3249
3359
  outputSchema: codeInterpreterOutputSchema
@@ -3254,88 +3364,88 @@ var codeInterpreter = (args = {}) => {
3254
3364
 
3255
3365
  // src/tool/file-search.ts
3256
3366
  import {
3257
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
3258
- lazySchema as lazySchema15,
3259
- zodSchema as zodSchema15
3367
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3368
+ lazySchema as lazySchema16,
3369
+ zodSchema as zodSchema16
3260
3370
  } from "@ai-sdk/provider-utils";
3261
- import { z as z17 } from "zod/v4";
3262
- var comparisonFilterSchema = z17.object({
3263
- key: z17.string(),
3264
- type: z17.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
3265
- value: z17.union([z17.string(), z17.number(), z17.boolean()])
3371
+ import { z as z18 } from "zod/v4";
3372
+ var comparisonFilterSchema = z18.object({
3373
+ key: z18.string(),
3374
+ type: z18.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
3375
+ value: z18.union([z18.string(), z18.number(), z18.boolean()])
3266
3376
  });
3267
- var compoundFilterSchema = z17.object({
3268
- type: z17.enum(["and", "or"]),
3269
- filters: z17.array(
3270
- z17.union([comparisonFilterSchema, z17.lazy(() => compoundFilterSchema)])
3377
+ var compoundFilterSchema = z18.object({
3378
+ type: z18.enum(["and", "or"]),
3379
+ filters: z18.array(
3380
+ z18.union([comparisonFilterSchema, z18.lazy(() => compoundFilterSchema)])
3271
3381
  )
3272
3382
  });
3273
- var fileSearchArgsSchema = lazySchema15(
3274
- () => zodSchema15(
3275
- z17.object({
3276
- vectorStoreIds: z17.array(z17.string()),
3277
- maxNumResults: z17.number().optional(),
3278
- ranking: z17.object({
3279
- ranker: z17.string().optional(),
3280
- scoreThreshold: z17.number().optional()
3383
+ var fileSearchArgsSchema = lazySchema16(
3384
+ () => zodSchema16(
3385
+ z18.object({
3386
+ vectorStoreIds: z18.array(z18.string()),
3387
+ maxNumResults: z18.number().optional(),
3388
+ ranking: z18.object({
3389
+ ranker: z18.string().optional(),
3390
+ scoreThreshold: z18.number().optional()
3281
3391
  }).optional(),
3282
- filters: z17.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3392
+ filters: z18.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3283
3393
  })
3284
3394
  )
3285
3395
  );
3286
- var fileSearchOutputSchema = lazySchema15(
3287
- () => zodSchema15(
3288
- z17.object({
3289
- queries: z17.array(z17.string()),
3290
- results: z17.array(
3291
- z17.object({
3292
- attributes: z17.record(z17.string(), z17.unknown()),
3293
- fileId: z17.string(),
3294
- filename: z17.string(),
3295
- score: z17.number(),
3296
- text: z17.string()
3396
+ var fileSearchOutputSchema = lazySchema16(
3397
+ () => zodSchema16(
3398
+ z18.object({
3399
+ queries: z18.array(z18.string()),
3400
+ results: z18.array(
3401
+ z18.object({
3402
+ attributes: z18.record(z18.string(), z18.unknown()),
3403
+ fileId: z18.string(),
3404
+ filename: z18.string(),
3405
+ score: z18.number(),
3406
+ text: z18.string()
3297
3407
  })
3298
3408
  ).nullable()
3299
3409
  })
3300
3410
  )
3301
3411
  );
3302
- var fileSearch = createProviderToolFactoryWithOutputSchema3({
3412
+ var fileSearch = createProviderToolFactoryWithOutputSchema4({
3303
3413
  id: "openai.file_search",
3304
- inputSchema: z17.object({}),
3414
+ inputSchema: z18.object({}),
3305
3415
  outputSchema: fileSearchOutputSchema
3306
3416
  });
3307
3417
 
3308
3418
  // src/tool/image-generation.ts
3309
3419
  import {
3310
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3311
- lazySchema as lazySchema16,
3312
- zodSchema as zodSchema16
3420
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3421
+ lazySchema as lazySchema17,
3422
+ zodSchema as zodSchema17
3313
3423
  } from "@ai-sdk/provider-utils";
3314
- import { z as z18 } from "zod/v4";
3315
- var imageGenerationArgsSchema = lazySchema16(
3316
- () => zodSchema16(
3317
- z18.object({
3318
- background: z18.enum(["auto", "opaque", "transparent"]).optional(),
3319
- inputFidelity: z18.enum(["low", "high"]).optional(),
3320
- inputImageMask: z18.object({
3321
- fileId: z18.string().optional(),
3322
- imageUrl: z18.string().optional()
3424
+ import { z as z19 } from "zod/v4";
3425
+ var imageGenerationArgsSchema = lazySchema17(
3426
+ () => zodSchema17(
3427
+ z19.object({
3428
+ background: z19.enum(["auto", "opaque", "transparent"]).optional(),
3429
+ inputFidelity: z19.enum(["low", "high"]).optional(),
3430
+ inputImageMask: z19.object({
3431
+ fileId: z19.string().optional(),
3432
+ imageUrl: z19.string().optional()
3323
3433
  }).optional(),
3324
- model: z18.string().optional(),
3325
- moderation: z18.enum(["auto"]).optional(),
3326
- outputCompression: z18.number().int().min(0).max(100).optional(),
3327
- outputFormat: z18.enum(["png", "jpeg", "webp"]).optional(),
3328
- partialImages: z18.number().int().min(0).max(3).optional(),
3329
- quality: z18.enum(["auto", "low", "medium", "high"]).optional(),
3330
- size: z18.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
3434
+ model: z19.string().optional(),
3435
+ moderation: z19.enum(["auto"]).optional(),
3436
+ outputCompression: z19.number().int().min(0).max(100).optional(),
3437
+ outputFormat: z19.enum(["png", "jpeg", "webp"]).optional(),
3438
+ partialImages: z19.number().int().min(0).max(3).optional(),
3439
+ quality: z19.enum(["auto", "low", "medium", "high"]).optional(),
3440
+ size: z19.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
3331
3441
  }).strict()
3332
3442
  )
3333
3443
  );
3334
- var imageGenerationInputSchema = lazySchema16(() => zodSchema16(z18.object({})));
3335
- var imageGenerationOutputSchema = lazySchema16(
3336
- () => zodSchema16(z18.object({ result: z18.string() }))
3444
+ var imageGenerationInputSchema = lazySchema17(() => zodSchema17(z19.object({})));
3445
+ var imageGenerationOutputSchema = lazySchema17(
3446
+ () => zodSchema17(z19.object({ result: z19.string() }))
3337
3447
  );
3338
- var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
3448
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema5({
3339
3449
  id: "openai.image_generation",
3340
3450
  inputSchema: imageGenerationInputSchema,
3341
3451
  outputSchema: imageGenerationOutputSchema
@@ -3346,35 +3456,35 @@ var imageGeneration = (args = {}) => {
3346
3456
 
3347
3457
  // src/tool/mcp.ts
3348
3458
  import {
3349
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3350
- lazySchema as lazySchema17,
3351
- zodSchema as zodSchema17
3459
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
3460
+ lazySchema as lazySchema18,
3461
+ zodSchema as zodSchema18
3352
3462
  } from "@ai-sdk/provider-utils";
3353
- import { z as z19 } from "zod/v4";
3354
- var jsonValueSchema = z19.lazy(
3355
- () => z19.union([
3356
- z19.string(),
3357
- z19.number(),
3358
- z19.boolean(),
3359
- z19.null(),
3360
- z19.array(jsonValueSchema),
3361
- z19.record(z19.string(), jsonValueSchema)
3463
+ import { z as z20 } from "zod/v4";
3464
+ var jsonValueSchema = z20.lazy(
3465
+ () => z20.union([
3466
+ z20.string(),
3467
+ z20.number(),
3468
+ z20.boolean(),
3469
+ z20.null(),
3470
+ z20.array(jsonValueSchema),
3471
+ z20.record(z20.string(), jsonValueSchema)
3362
3472
  ])
3363
3473
  );
3364
- var mcpArgsSchema = lazySchema17(
3365
- () => zodSchema17(
3366
- z19.object({
3367
- serverLabel: z19.string(),
3368
- allowedTools: z19.union([
3369
- z19.array(z19.string()),
3370
- z19.object({
3371
- readOnly: z19.boolean().optional(),
3372
- toolNames: z19.array(z19.string()).optional()
3474
+ var mcpArgsSchema = lazySchema18(
3475
+ () => zodSchema18(
3476
+ z20.object({
3477
+ serverLabel: z20.string(),
3478
+ allowedTools: z20.union([
3479
+ z20.array(z20.string()),
3480
+ z20.object({
3481
+ readOnly: z20.boolean().optional(),
3482
+ toolNames: z20.array(z20.string()).optional()
3373
3483
  })
3374
3484
  ]).optional(),
3375
- authorization: z19.string().optional(),
3376
- connectorId: z19.string().optional(),
3377
- headers: z19.record(z19.string(), z19.string()).optional(),
3485
+ authorization: z20.string().optional(),
3486
+ connectorId: z20.string().optional(),
3487
+ headers: z20.record(z20.string(), z20.string()).optional(),
3378
3488
  // TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
3379
3489
  // requireApproval: z
3380
3490
  // .union([
@@ -3385,122 +3495,67 @@ var mcpArgsSchema = lazySchema17(
3385
3495
  // }),
3386
3496
  // ])
3387
3497
  // .optional(),
3388
- serverDescription: z19.string().optional(),
3389
- serverUrl: z19.string().optional()
3498
+ serverDescription: z20.string().optional(),
3499
+ serverUrl: z20.string().optional()
3390
3500
  }).refine(
3391
3501
  (v) => v.serverUrl != null || v.connectorId != null,
3392
3502
  "One of serverUrl or connectorId must be provided."
3393
3503
  )
3394
3504
  )
3395
3505
  );
3396
- var mcpInputSchema = lazySchema17(() => zodSchema17(z19.object({})));
3397
- var mcpOutputSchema = lazySchema17(
3398
- () => zodSchema17(
3399
- z19.discriminatedUnion("type", [
3400
- z19.object({
3401
- type: z19.literal("call"),
3402
- serverLabel: z19.string(),
3403
- name: z19.string(),
3404
- arguments: z19.string(),
3405
- output: z19.string().nullable().optional(),
3406
- error: z19.union([z19.string(), jsonValueSchema]).optional()
3506
+ var mcpInputSchema = lazySchema18(() => zodSchema18(z20.object({})));
3507
+ var mcpOutputSchema = lazySchema18(
3508
+ () => zodSchema18(
3509
+ z20.discriminatedUnion("type", [
3510
+ z20.object({
3511
+ type: z20.literal("call"),
3512
+ serverLabel: z20.string(),
3513
+ name: z20.string(),
3514
+ arguments: z20.string(),
3515
+ output: z20.string().nullable().optional(),
3516
+ error: z20.union([z20.string(), jsonValueSchema]).optional()
3407
3517
  }),
3408
- z19.object({
3409
- type: z19.literal("listTools"),
3410
- serverLabel: z19.string(),
3411
- tools: z19.array(
3412
- z19.object({
3413
- name: z19.string(),
3414
- description: z19.string().optional(),
3518
+ z20.object({
3519
+ type: z20.literal("listTools"),
3520
+ serverLabel: z20.string(),
3521
+ tools: z20.array(
3522
+ z20.object({
3523
+ name: z20.string(),
3524
+ description: z20.string().optional(),
3415
3525
  inputSchema: jsonValueSchema,
3416
- annotations: z19.record(z19.string(), jsonValueSchema).optional()
3526
+ annotations: z20.record(z20.string(), jsonValueSchema).optional()
3417
3527
  })
3418
3528
  ),
3419
- error: z19.union([z19.string(), jsonValueSchema]).optional()
3529
+ error: z20.union([z20.string(), jsonValueSchema]).optional()
3420
3530
  }),
3421
- z19.object({
3422
- type: z19.literal("approvalRequest"),
3423
- serverLabel: z19.string(),
3424
- name: z19.string(),
3425
- arguments: z19.string(),
3426
- approvalRequestId: z19.string()
3531
+ z20.object({
3532
+ type: z20.literal("approvalRequest"),
3533
+ serverLabel: z20.string(),
3534
+ name: z20.string(),
3535
+ arguments: z20.string(),
3536
+ approvalRequestId: z20.string()
3427
3537
  })
3428
3538
  ])
3429
3539
  )
3430
3540
  );
3431
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema5({
3541
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema6({
3432
3542
  id: "openai.mcp",
3433
3543
  inputSchema: mcpInputSchema,
3434
3544
  outputSchema: mcpOutputSchema
3435
3545
  });
3436
3546
 
3437
3547
  // src/tool/web-search.ts
3438
- import {
3439
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
3440
- lazySchema as lazySchema18,
3441
- zodSchema as zodSchema18
3442
- } from "@ai-sdk/provider-utils";
3443
- import { z as z20 } from "zod/v4";
3444
- var webSearchArgsSchema = lazySchema18(
3445
- () => zodSchema18(
3446
- z20.object({
3447
- externalWebAccess: z20.boolean().optional(),
3448
- filters: z20.object({ allowedDomains: z20.array(z20.string()).optional() }).optional(),
3449
- searchContextSize: z20.enum(["low", "medium", "high"]).optional(),
3450
- userLocation: z20.object({
3451
- type: z20.literal("approximate"),
3452
- country: z20.string().optional(),
3453
- city: z20.string().optional(),
3454
- region: z20.string().optional(),
3455
- timezone: z20.string().optional()
3456
- }).optional()
3457
- })
3458
- )
3459
- );
3460
- var webSearchInputSchema = lazySchema18(() => zodSchema18(z20.object({})));
3461
- var webSearchOutputSchema = lazySchema18(
3462
- () => zodSchema18(
3463
- z20.object({
3464
- action: z20.discriminatedUnion("type", [
3465
- z20.object({
3466
- type: z20.literal("search"),
3467
- query: z20.string().optional()
3468
- }),
3469
- z20.object({
3470
- type: z20.literal("openPage"),
3471
- url: z20.string()
3472
- }),
3473
- z20.object({
3474
- type: z20.literal("find"),
3475
- url: z20.string(),
3476
- pattern: z20.string()
3477
- })
3478
- ]),
3479
- sources: z20.array(
3480
- z20.discriminatedUnion("type", [
3481
- z20.object({ type: z20.literal("url"), url: z20.string() }),
3482
- z20.object({ type: z20.literal("api"), name: z20.string() })
3483
- ])
3484
- ).optional()
3485
- })
3486
- )
3487
- );
3488
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
3489
- id: "openai.web_search",
3490
- inputSchema: webSearchInputSchema,
3491
- outputSchema: webSearchOutputSchema
3492
- });
3493
-
3494
- // src/tool/web-search-preview.ts
3495
3548
  import {
3496
3549
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
3497
3550
  lazySchema as lazySchema19,
3498
3551
  zodSchema as zodSchema19
3499
3552
  } from "@ai-sdk/provider-utils";
3500
3553
  import { z as z21 } from "zod/v4";
3501
- var webSearchPreviewArgsSchema = lazySchema19(
3554
+ var webSearchArgsSchema = lazySchema19(
3502
3555
  () => zodSchema19(
3503
3556
  z21.object({
3557
+ externalWebAccess: z21.boolean().optional(),
3558
+ filters: z21.object({ allowedDomains: z21.array(z21.string()).optional() }).optional(),
3504
3559
  searchContextSize: z21.enum(["low", "medium", "high"]).optional(),
3505
3560
  userLocation: z21.object({
3506
3561
  type: z21.literal("approximate"),
@@ -3512,10 +3567,8 @@ var webSearchPreviewArgsSchema = lazySchema19(
3512
3567
  })
3513
3568
  )
3514
3569
  );
3515
- var webSearchPreviewInputSchema = lazySchema19(
3516
- () => zodSchema19(z21.object({}))
3517
- );
3518
- var webSearchPreviewOutputSchema = lazySchema19(
3570
+ var webSearchInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
3571
+ var webSearchOutputSchema = lazySchema19(
3519
3572
  () => zodSchema19(
3520
3573
  z21.object({
3521
3574
  action: z21.discriminatedUnion("type", [
@@ -3532,11 +3585,68 @@ var webSearchPreviewOutputSchema = lazySchema19(
3532
3585
  url: z21.string(),
3533
3586
  pattern: z21.string()
3534
3587
  })
3588
+ ]),
3589
+ sources: z21.array(
3590
+ z21.discriminatedUnion("type", [
3591
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3592
+ z21.object({ type: z21.literal("api"), name: z21.string() })
3593
+ ])
3594
+ ).optional()
3595
+ })
3596
+ )
3597
+ );
3598
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
3599
+ id: "openai.web_search",
3600
+ inputSchema: webSearchInputSchema,
3601
+ outputSchema: webSearchOutputSchema
3602
+ });
3603
+
3604
+ // src/tool/web-search-preview.ts
3605
+ import {
3606
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
3607
+ lazySchema as lazySchema20,
3608
+ zodSchema as zodSchema20
3609
+ } from "@ai-sdk/provider-utils";
3610
+ import { z as z22 } from "zod/v4";
3611
+ var webSearchPreviewArgsSchema = lazySchema20(
3612
+ () => zodSchema20(
3613
+ z22.object({
3614
+ searchContextSize: z22.enum(["low", "medium", "high"]).optional(),
3615
+ userLocation: z22.object({
3616
+ type: z22.literal("approximate"),
3617
+ country: z22.string().optional(),
3618
+ city: z22.string().optional(),
3619
+ region: z22.string().optional(),
3620
+ timezone: z22.string().optional()
3621
+ }).optional()
3622
+ })
3623
+ )
3624
+ );
3625
+ var webSearchPreviewInputSchema = lazySchema20(
3626
+ () => zodSchema20(z22.object({}))
3627
+ );
3628
+ var webSearchPreviewOutputSchema = lazySchema20(
3629
+ () => zodSchema20(
3630
+ z22.object({
3631
+ action: z22.discriminatedUnion("type", [
3632
+ z22.object({
3633
+ type: z22.literal("search"),
3634
+ query: z22.string().optional()
3635
+ }),
3636
+ z22.object({
3637
+ type: z22.literal("openPage"),
3638
+ url: z22.string()
3639
+ }),
3640
+ z22.object({
3641
+ type: z22.literal("find"),
3642
+ url: z22.string(),
3643
+ pattern: z22.string()
3644
+ })
3535
3645
  ])
3536
3646
  })
3537
3647
  )
3538
3648
  );
3539
- var webSearchPreview = createProviderToolFactoryWithOutputSchema7({
3649
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema8({
3540
3650
  id: "openai.web_search_preview",
3541
3651
  inputSchema: webSearchPreviewInputSchema,
3542
3652
  outputSchema: webSearchPreviewOutputSchema
@@ -3590,6 +3700,12 @@ async function prepareResponsesTools({
3590
3700
  });
3591
3701
  break;
3592
3702
  }
3703
+ case "openai.apply_patch": {
3704
+ openaiTools.push({
3705
+ type: "apply_patch"
3706
+ });
3707
+ break;
3708
+ }
3593
3709
  case "openai.web_search_preview": {
3594
3710
  const args = await validateTypes2({
3595
3711
  value: tool.args,
@@ -3694,7 +3810,7 @@ async function prepareResponsesTools({
3694
3810
  case "tool":
3695
3811
  return {
3696
3812
  tools: openaiTools,
3697
- toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3813
+ toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" || toolChoice.toolName === "apply_patch" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3698
3814
  toolWarnings
3699
3815
  };
3700
3816
  default: {
@@ -3774,7 +3890,8 @@ var OpenAIResponsesLanguageModel = class {
3774
3890
  "openai.local_shell": "local_shell",
3775
3891
  "openai.web_search": "web_search",
3776
3892
  "openai.web_search_preview": "web_search_preview",
3777
- "openai.mcp": "mcp"
3893
+ "openai.mcp": "mcp",
3894
+ "openai.apply_patch": "apply_patch"
3778
3895
  }
3779
3896
  });
3780
3897
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
@@ -3783,10 +3900,11 @@ var OpenAIResponsesLanguageModel = class {
3783
3900
  systemMessageMode: modelConfig.systemMessageMode,
3784
3901
  fileIdPrefixes: this.config.fileIdPrefixes,
3785
3902
  store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
3786
- hasLocalShellTool: hasOpenAITool("openai.local_shell")
3903
+ hasLocalShellTool: hasOpenAITool("openai.local_shell"),
3904
+ hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
3787
3905
  });
3788
3906
  warnings.push(...inputWarnings);
3789
- const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3907
+ const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : true;
3790
3908
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3791
3909
  function addInclude(key) {
3792
3910
  if (include == null) {
@@ -4284,6 +4402,23 @@ var OpenAIResponsesLanguageModel = class {
4284
4402
  });
4285
4403
  break;
4286
4404
  }
4405
+ case "apply_patch_call": {
4406
+ content.push({
4407
+ type: "tool-call",
4408
+ toolCallId: part.call_id,
4409
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4410
+ input: JSON.stringify({
4411
+ callId: part.call_id,
4412
+ operation: part.operation
4413
+ }),
4414
+ providerMetadata: {
4415
+ [providerKey]: {
4416
+ itemId: part.id
4417
+ }
4418
+ }
4419
+ });
4420
+ break;
4421
+ }
4287
4422
  }
4288
4423
  }
4289
4424
  const providerMetadata = {
@@ -4471,6 +4606,27 @@ var OpenAIResponsesLanguageModel = class {
4471
4606
  input: "{}",
4472
4607
  providerExecuted: true
4473
4608
  });
4609
+ } else if (value.item.type === "apply_patch_call") {
4610
+ ongoingToolCalls[value.output_index] = {
4611
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4612
+ toolCallId: value.item.call_id
4613
+ };
4614
+ if (value.item.status === "completed") {
4615
+ controller.enqueue({
4616
+ type: "tool-call",
4617
+ toolCallId: value.item.call_id,
4618
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4619
+ input: JSON.stringify({
4620
+ callId: value.item.call_id,
4621
+ operation: value.item.operation
4622
+ }),
4623
+ providerMetadata: {
4624
+ [providerKey]: {
4625
+ itemId: value.item.id
4626
+ }
4627
+ }
4628
+ });
4629
+ }
4474
4630
  } else if (value.item.type === "message") {
4475
4631
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
4476
4632
  controller.enqueue({
@@ -4634,6 +4790,24 @@ var OpenAIResponsesLanguageModel = class {
4634
4790
  ...value.item.error != null ? { error: value.item.error } : {}
4635
4791
  }
4636
4792
  });
4793
+ } else if (value.item.type === "apply_patch_call") {
4794
+ ongoingToolCalls[value.output_index] = void 0;
4795
+ if (value.item.status === "completed") {
4796
+ controller.enqueue({
4797
+ type: "tool-call",
4798
+ toolCallId: value.item.call_id,
4799
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4800
+ input: JSON.stringify({
4801
+ callId: value.item.call_id,
4802
+ operation: value.item.operation
4803
+ }),
4804
+ providerMetadata: {
4805
+ [providerKey]: {
4806
+ itemId: value.item.id
4807
+ }
4808
+ }
4809
+ });
4810
+ }
4637
4811
  } else if (value.item.type === "mcp_approval_request") {
4638
4812
  ongoingToolCalls[value.output_index] = void 0;
4639
4813
  controller.enqueue({
@@ -4983,6 +5157,11 @@ export {
4983
5157
  OpenAIResponsesLanguageModel,
4984
5158
  OpenAISpeechModel,
4985
5159
  OpenAITranscriptionModel,
5160
+ applyPatch,
5161
+ applyPatchArgsSchema,
5162
+ applyPatchInputSchema,
5163
+ applyPatchOutputSchema,
5164
+ applyPatchToolFactory,
4986
5165
  codeInterpreter,
4987
5166
  codeInterpreterArgsSchema,
4988
5167
  codeInterpreterInputSchema,