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

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.
@@ -2144,33 +2144,79 @@ import {
2144
2144
  parseProviderOptions as parseProviderOptions6,
2145
2145
  validateTypes
2146
2146
  } from "@ai-sdk/provider-utils";
2147
- import { z as z13 } from "zod/v4";
2147
+ import { z as z14 } from "zod/v4";
2148
2148
 
2149
- // src/tool/local-shell.ts
2149
+ // src/tool/apply-patch.ts
2150
2150
  import {
2151
2151
  createProviderToolFactoryWithOutputSchema,
2152
2152
  lazySchema as lazySchema11,
2153
2153
  zodSchema as zodSchema11
2154
2154
  } from "@ai-sdk/provider-utils";
2155
2155
  import { z as z12 } from "zod/v4";
2156
- var localShellInputSchema = lazySchema11(
2156
+ var applyPatchInputSchema = lazySchema11(
2157
+ () => zodSchema11(
2158
+ z12.object({
2159
+ callId: z12.string(),
2160
+ operation: z12.discriminatedUnion("type", [
2161
+ z12.object({
2162
+ type: z12.literal("create_file"),
2163
+ path: z12.string(),
2164
+ diff: z12.string()
2165
+ }),
2166
+ z12.object({
2167
+ type: z12.literal("delete_file"),
2168
+ path: z12.string()
2169
+ }),
2170
+ z12.object({
2171
+ type: z12.literal("update_file"),
2172
+ path: z12.string(),
2173
+ diff: z12.string()
2174
+ })
2175
+ ])
2176
+ })
2177
+ )
2178
+ );
2179
+ var applyPatchOutputSchema = lazySchema11(
2157
2180
  () => zodSchema11(
2158
2181
  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()
2182
+ status: z12.enum(["completed", "failed"]),
2183
+ output: z12.string().optional()
2184
+ })
2185
+ )
2186
+ );
2187
+ var applyPatchArgsSchema = lazySchema11(() => zodSchema11(z12.object({})));
2188
+ var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2189
+ id: "openai.apply_patch",
2190
+ inputSchema: applyPatchInputSchema,
2191
+ outputSchema: applyPatchOutputSchema
2192
+ });
2193
+ var applyPatch = () => applyPatchToolFactory({});
2194
+
2195
+ // src/tool/local-shell.ts
2196
+ import {
2197
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2198
+ lazySchema as lazySchema12,
2199
+ zodSchema as zodSchema12
2200
+ } from "@ai-sdk/provider-utils";
2201
+ import { z as z13 } from "zod/v4";
2202
+ var localShellInputSchema = lazySchema12(
2203
+ () => zodSchema12(
2204
+ z13.object({
2205
+ action: z13.object({
2206
+ type: z13.literal("exec"),
2207
+ command: z13.array(z13.string()),
2208
+ timeoutMs: z13.number().optional(),
2209
+ user: z13.string().optional(),
2210
+ workingDirectory: z13.string().optional(),
2211
+ env: z13.record(z13.string(), z13.string()).optional()
2166
2212
  })
2167
2213
  })
2168
2214
  )
2169
2215
  );
2170
- var localShellOutputSchema = lazySchema11(
2171
- () => zodSchema11(z12.object({ output: z12.string() }))
2216
+ var localShellOutputSchema = lazySchema12(
2217
+ () => zodSchema12(z13.object({ output: z13.string() }))
2172
2218
  );
2173
- var localShell = createProviderToolFactoryWithOutputSchema({
2219
+ var localShell = createProviderToolFactoryWithOutputSchema2({
2174
2220
  id: "openai.local_shell",
2175
2221
  inputSchema: localShellInputSchema,
2176
2222
  outputSchema: localShellOutputSchema
@@ -2187,7 +2233,8 @@ async function convertToOpenAIResponsesInput({
2187
2233
  systemMessageMode,
2188
2234
  fileIdPrefixes,
2189
2235
  store,
2190
- hasLocalShellTool = false
2236
+ hasLocalShellTool = false,
2237
+ hasApplyPatchTool = false
2191
2238
  }) {
2192
2239
  var _a, _b, _c, _d, _e;
2193
2240
  const input = [];
@@ -2410,6 +2457,19 @@ async function convertToOpenAIResponsesInput({
2410
2457
  });
2411
2458
  break;
2412
2459
  }
2460
+ if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
2461
+ const parsedOutput = await validateTypes({
2462
+ value: output.value,
2463
+ schema: applyPatchOutputSchema
2464
+ });
2465
+ input.push({
2466
+ type: "apply_patch_call_output",
2467
+ call_id: part.toolCallId,
2468
+ status: parsedOutput.status,
2469
+ output: parsedOutput.output
2470
+ });
2471
+ break;
2472
+ }
2413
2473
  let contentValue;
2414
2474
  switch (output.type) {
2415
2475
  case "text":
@@ -2470,9 +2530,9 @@ async function convertToOpenAIResponsesInput({
2470
2530
  }
2471
2531
  return { input, warnings };
2472
2532
  }
2473
- var openaiResponsesReasoningProviderOptionsSchema = z13.object({
2474
- itemId: z13.string().nullish(),
2475
- reasoningEncryptedContent: z13.string().nullish()
2533
+ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2534
+ itemId: z14.string().nullish(),
2535
+ reasoningEncryptedContent: z14.string().nullish()
2476
2536
  });
2477
2537
 
2478
2538
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2494,349 +2554,393 @@ function mapOpenAIResponseFinishReason({
2494
2554
  }
2495
2555
 
2496
2556
  // 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()
2557
+ import { lazySchema as lazySchema13, zodSchema as zodSchema13 } from "@ai-sdk/provider-utils";
2558
+ import { z as z15 } from "zod/v4";
2559
+ var openaiResponsesChunkSchema = lazySchema13(
2560
+ () => zodSchema13(
2561
+ z15.union([
2562
+ z15.object({
2563
+ type: z15.literal("response.output_text.delta"),
2564
+ item_id: z15.string(),
2565
+ delta: z15.string(),
2566
+ logprobs: z15.array(
2567
+ z15.object({
2568
+ token: z15.string(),
2569
+ logprob: z15.number(),
2570
+ top_logprobs: z15.array(
2571
+ z15.object({
2572
+ token: z15.string(),
2573
+ logprob: z15.number()
2514
2574
  })
2515
2575
  )
2516
2576
  })
2517
2577
  ).nullish()
2518
2578
  }),
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()
2579
+ z15.object({
2580
+ type: z15.enum(["response.completed", "response.incomplete"]),
2581
+ response: z15.object({
2582
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
2583
+ usage: z15.object({
2584
+ input_tokens: z15.number(),
2585
+ input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
2586
+ output_tokens: z15.number(),
2587
+ output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
2528
2588
  }),
2529
- service_tier: z14.string().nullish()
2589
+ service_tier: z15.string().nullish()
2530
2590
  })
2531
2591
  }),
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()
2592
+ z15.object({
2593
+ type: z15.literal("response.created"),
2594
+ response: z15.object({
2595
+ id: z15.string(),
2596
+ created_at: z15.number(),
2597
+ model: z15.string(),
2598
+ service_tier: z15.string().nullish()
2539
2599
  })
2540
2600
  }),
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()
2601
+ z15.object({
2602
+ type: z15.literal("response.output_item.added"),
2603
+ output_index: z15.number(),
2604
+ item: z15.discriminatedUnion("type", [
2605
+ z15.object({
2606
+ type: z15.literal("message"),
2607
+ id: z15.string()
2548
2608
  }),
2549
- z14.object({
2550
- type: z14.literal("reasoning"),
2551
- id: z14.string(),
2552
- encrypted_content: z14.string().nullish()
2609
+ z15.object({
2610
+ type: z15.literal("reasoning"),
2611
+ id: z15.string(),
2612
+ encrypted_content: z15.string().nullish()
2553
2613
  }),
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()
2614
+ z15.object({
2615
+ type: z15.literal("function_call"),
2616
+ id: z15.string(),
2617
+ call_id: z15.string(),
2618
+ name: z15.string(),
2619
+ arguments: z15.string()
2560
2620
  }),
2561
- z14.object({
2562
- type: z14.literal("web_search_call"),
2563
- id: z14.string(),
2564
- status: z14.string()
2621
+ z15.object({
2622
+ type: z15.literal("web_search_call"),
2623
+ id: z15.string(),
2624
+ status: z15.string()
2565
2625
  }),
2566
- z14.object({
2567
- type: z14.literal("computer_call"),
2568
- id: z14.string(),
2569
- status: z14.string()
2626
+ z15.object({
2627
+ type: z15.literal("computer_call"),
2628
+ id: z15.string(),
2629
+ status: z15.string()
2570
2630
  }),
2571
- z14.object({
2572
- type: z14.literal("file_search_call"),
2573
- id: z14.string()
2631
+ z15.object({
2632
+ type: z15.literal("file_search_call"),
2633
+ id: z15.string()
2574
2634
  }),
2575
- z14.object({
2576
- type: z14.literal("image_generation_call"),
2577
- id: z14.string()
2635
+ z15.object({
2636
+ type: z15.literal("image_generation_call"),
2637
+ id: z15.string()
2578
2638
  }),
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() })
2639
+ z15.object({
2640
+ type: z15.literal("code_interpreter_call"),
2641
+ id: z15.string(),
2642
+ container_id: z15.string(),
2643
+ code: z15.string().nullable(),
2644
+ outputs: z15.array(
2645
+ z15.discriminatedUnion("type", [
2646
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2647
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2588
2648
  ])
2589
2649
  ).nullable(),
2590
- status: z14.string()
2650
+ status: z15.string()
2591
2651
  }),
2592
- z14.object({
2593
- type: z14.literal("mcp_call"),
2594
- id: z14.string(),
2595
- status: z14.string()
2652
+ z15.object({
2653
+ type: z15.literal("mcp_call"),
2654
+ id: z15.string(),
2655
+ status: z15.string()
2596
2656
  }),
2597
- z14.object({
2598
- type: z14.literal("mcp_list_tools"),
2599
- id: z14.string()
2657
+ z15.object({
2658
+ type: z15.literal("mcp_list_tools"),
2659
+ id: z15.string()
2600
2660
  }),
2601
- z14.object({
2602
- type: z14.literal("mcp_approval_request"),
2603
- id: z14.string()
2661
+ z15.object({
2662
+ type: z15.literal("mcp_approval_request"),
2663
+ id: z15.string()
2664
+ }),
2665
+ z15.object({
2666
+ type: z15.literal("apply_patch_call"),
2667
+ id: z15.string(),
2668
+ call_id: z15.string(),
2669
+ status: z15.enum(["in_progress", "completed"]),
2670
+ operation: z15.discriminatedUnion("type", [
2671
+ z15.object({
2672
+ type: z15.literal("create_file"),
2673
+ path: z15.string(),
2674
+ diff: z15.string()
2675
+ }),
2676
+ z15.object({
2677
+ type: z15.literal("delete_file"),
2678
+ path: z15.string()
2679
+ }),
2680
+ z15.object({
2681
+ type: z15.literal("update_file"),
2682
+ path: z15.string(),
2683
+ diff: z15.string()
2684
+ })
2685
+ ])
2604
2686
  })
2605
2687
  ])
2606
2688
  }),
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()
2689
+ z15.object({
2690
+ type: z15.literal("response.output_item.done"),
2691
+ output_index: z15.number(),
2692
+ item: z15.discriminatedUnion("type", [
2693
+ z15.object({
2694
+ type: z15.literal("message"),
2695
+ id: z15.string()
2614
2696
  }),
2615
- z14.object({
2616
- type: z14.literal("reasoning"),
2617
- id: z14.string(),
2618
- encrypted_content: z14.string().nullish()
2697
+ z15.object({
2698
+ type: z15.literal("reasoning"),
2699
+ id: z15.string(),
2700
+ encrypted_content: z15.string().nullish()
2619
2701
  }),
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")
2702
+ z15.object({
2703
+ type: z15.literal("function_call"),
2704
+ id: z15.string(),
2705
+ call_id: z15.string(),
2706
+ name: z15.string(),
2707
+ arguments: z15.string(),
2708
+ status: z15.literal("completed")
2627
2709
  }),
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() })
2710
+ z15.object({
2711
+ type: z15.literal("code_interpreter_call"),
2712
+ id: z15.string(),
2713
+ code: z15.string().nullable(),
2714
+ container_id: z15.string(),
2715
+ outputs: z15.array(
2716
+ z15.discriminatedUnion("type", [
2717
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2718
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2637
2719
  ])
2638
2720
  ).nullable()
2639
2721
  }),
2640
- z14.object({
2641
- type: z14.literal("image_generation_call"),
2642
- id: z14.string(),
2643
- result: z14.string()
2722
+ z15.object({
2723
+ type: z15.literal("image_generation_call"),
2724
+ id: z15.string(),
2725
+ result: z15.string()
2644
2726
  }),
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() })
2727
+ z15.object({
2728
+ type: z15.literal("web_search_call"),
2729
+ id: z15.string(),
2730
+ status: z15.string(),
2731
+ action: z15.discriminatedUnion("type", [
2732
+ z15.object({
2733
+ type: z15.literal("search"),
2734
+ query: z15.string().nullish(),
2735
+ sources: z15.array(
2736
+ z15.discriminatedUnion("type", [
2737
+ z15.object({ type: z15.literal("url"), url: z15.string() }),
2738
+ z15.object({ type: z15.literal("api"), name: z15.string() })
2657
2739
  ])
2658
2740
  ).nullish()
2659
2741
  }),
2660
- z14.object({
2661
- type: z14.literal("open_page"),
2662
- url: z14.string()
2742
+ z15.object({
2743
+ type: z15.literal("open_page"),
2744
+ url: z15.string()
2663
2745
  }),
2664
- z14.object({
2665
- type: z14.literal("find"),
2666
- url: z14.string(),
2667
- pattern: z14.string()
2746
+ z15.object({
2747
+ type: z15.literal("find"),
2748
+ url: z15.string(),
2749
+ pattern: z15.string()
2668
2750
  })
2669
2751
  ])
2670
2752
  }),
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()])
2753
+ z15.object({
2754
+ type: z15.literal("file_search_call"),
2755
+ id: z15.string(),
2756
+ queries: z15.array(z15.string()),
2757
+ results: z15.array(
2758
+ z15.object({
2759
+ attributes: z15.record(
2760
+ z15.string(),
2761
+ z15.union([z15.string(), z15.number(), z15.boolean()])
2680
2762
  ),
2681
- file_id: z14.string(),
2682
- filename: z14.string(),
2683
- score: z14.number(),
2684
- text: z14.string()
2763
+ file_id: z15.string(),
2764
+ filename: z15.string(),
2765
+ score: z15.number(),
2766
+ text: z15.string()
2685
2767
  })
2686
2768
  ).nullish()
2687
2769
  }),
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()
2770
+ z15.object({
2771
+ type: z15.literal("local_shell_call"),
2772
+ id: z15.string(),
2773
+ call_id: z15.string(),
2774
+ action: z15.object({
2775
+ type: z15.literal("exec"),
2776
+ command: z15.array(z15.string()),
2777
+ timeout_ms: z15.number().optional(),
2778
+ user: z15.string().optional(),
2779
+ working_directory: z15.string().optional(),
2780
+ env: z15.record(z15.string(), z15.string()).optional()
2699
2781
  })
2700
2782
  }),
2701
- z14.object({
2702
- type: z14.literal("computer_call"),
2703
- id: z14.string(),
2704
- status: z14.literal("completed")
2783
+ z15.object({
2784
+ type: z15.literal("computer_call"),
2785
+ id: z15.string(),
2786
+ status: z15.literal("completed")
2705
2787
  }),
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()
2788
+ z15.object({
2789
+ type: z15.literal("mcp_call"),
2790
+ id: z15.string(),
2791
+ status: z15.string(),
2792
+ arguments: z15.string(),
2793
+ name: z15.string(),
2794
+ server_label: z15.string(),
2795
+ output: z15.string().nullish(),
2796
+ error: z15.union([
2797
+ z15.string(),
2798
+ z15.object({
2799
+ type: z15.string().optional(),
2800
+ code: z15.union([z15.number(), z15.string()]).optional(),
2801
+ message: z15.string().optional()
2720
2802
  }).loose()
2721
2803
  ]).nullish()
2722
2804
  }),
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()
2805
+ z15.object({
2806
+ type: z15.literal("mcp_list_tools"),
2807
+ id: z15.string(),
2808
+ server_label: z15.string(),
2809
+ tools: z15.array(
2810
+ z15.object({
2811
+ name: z15.string(),
2812
+ description: z15.string().optional(),
2813
+ input_schema: z15.any(),
2814
+ annotations: z15.record(z15.string(), z15.unknown()).optional()
2733
2815
  })
2734
2816
  ),
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()
2817
+ error: z15.union([
2818
+ z15.string(),
2819
+ z15.object({
2820
+ type: z15.string().optional(),
2821
+ code: z15.union([z15.number(), z15.string()]).optional(),
2822
+ message: z15.string().optional()
2741
2823
  }).loose()
2742
2824
  ]).optional()
2743
2825
  }),
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()
2826
+ z15.object({
2827
+ type: z15.literal("mcp_approval_request"),
2828
+ id: z15.string(),
2829
+ server_label: z15.string(),
2830
+ name: z15.string(),
2831
+ arguments: z15.string(),
2832
+ approval_request_id: z15.string()
2833
+ }),
2834
+ z15.object({
2835
+ type: z15.literal("apply_patch_call"),
2836
+ id: z15.string(),
2837
+ call_id: z15.string(),
2838
+ status: z15.enum(["in_progress", "completed"]),
2839
+ operation: z15.discriminatedUnion("type", [
2840
+ z15.object({
2841
+ type: z15.literal("create_file"),
2842
+ path: z15.string(),
2843
+ diff: z15.string()
2844
+ }),
2845
+ z15.object({
2846
+ type: z15.literal("delete_file"),
2847
+ path: z15.string()
2848
+ }),
2849
+ z15.object({
2850
+ type: z15.literal("update_file"),
2851
+ path: z15.string(),
2852
+ diff: z15.string()
2853
+ })
2854
+ ])
2751
2855
  })
2752
2856
  ])
2753
2857
  }),
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()
2858
+ z15.object({
2859
+ type: z15.literal("response.function_call_arguments.delta"),
2860
+ item_id: z15.string(),
2861
+ output_index: z15.number(),
2862
+ delta: z15.string()
2759
2863
  }),
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()
2864
+ z15.object({
2865
+ type: z15.literal("response.image_generation_call.partial_image"),
2866
+ item_id: z15.string(),
2867
+ output_index: z15.number(),
2868
+ partial_image_b64: z15.string()
2765
2869
  }),
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()
2870
+ z15.object({
2871
+ type: z15.literal("response.code_interpreter_call_code.delta"),
2872
+ item_id: z15.string(),
2873
+ output_index: z15.number(),
2874
+ delta: z15.string()
2771
2875
  }),
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()
2876
+ z15.object({
2877
+ type: z15.literal("response.code_interpreter_call_code.done"),
2878
+ item_id: z15.string(),
2879
+ output_index: z15.number(),
2880
+ code: z15.string()
2777
2881
  }),
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()
2882
+ z15.object({
2883
+ type: z15.literal("response.output_text.annotation.added"),
2884
+ annotation: z15.discriminatedUnion("type", [
2885
+ z15.object({
2886
+ type: z15.literal("url_citation"),
2887
+ start_index: z15.number(),
2888
+ end_index: z15.number(),
2889
+ url: z15.string(),
2890
+ title: z15.string()
2787
2891
  }),
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()
2892
+ z15.object({
2893
+ type: z15.literal("file_citation"),
2894
+ file_id: z15.string(),
2895
+ filename: z15.string().nullish(),
2896
+ index: z15.number().nullish(),
2897
+ start_index: z15.number().nullish(),
2898
+ end_index: z15.number().nullish(),
2899
+ quote: z15.string().nullish()
2796
2900
  }),
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()
2901
+ z15.object({
2902
+ type: z15.literal("container_file_citation"),
2903
+ container_id: z15.string(),
2904
+ file_id: z15.string(),
2905
+ filename: z15.string().nullish(),
2906
+ start_index: z15.number().nullish(),
2907
+ end_index: z15.number().nullish(),
2908
+ index: z15.number().nullish()
2805
2909
  }),
2806
- z14.object({
2807
- type: z14.literal("file_path"),
2808
- file_id: z14.string(),
2809
- index: z14.number().nullish()
2910
+ z15.object({
2911
+ type: z15.literal("file_path"),
2912
+ file_id: z15.string(),
2913
+ index: z15.number().nullish()
2810
2914
  })
2811
2915
  ])
2812
2916
  }),
2813
- z14.object({
2814
- type: z14.literal("response.reasoning_summary_part.added"),
2815
- item_id: z14.string(),
2816
- summary_index: z14.number()
2917
+ z15.object({
2918
+ type: z15.literal("response.reasoning_summary_part.added"),
2919
+ item_id: z15.string(),
2920
+ summary_index: z15.number()
2817
2921
  }),
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()
2922
+ z15.object({
2923
+ type: z15.literal("response.reasoning_summary_text.delta"),
2924
+ item_id: z15.string(),
2925
+ summary_index: z15.number(),
2926
+ delta: z15.string()
2823
2927
  }),
2824
- z14.object({
2825
- type: z14.literal("response.reasoning_summary_part.done"),
2826
- item_id: z14.string(),
2827
- summary_index: z14.number()
2928
+ z15.object({
2929
+ type: z15.literal("response.reasoning_summary_part.done"),
2930
+ item_id: z15.string(),
2931
+ summary_index: z15.number()
2828
2932
  }),
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()
2933
+ z15.object({
2934
+ type: z15.literal("error"),
2935
+ sequence_number: z15.number(),
2936
+ error: z15.object({
2937
+ type: z15.string(),
2938
+ code: z15.string(),
2939
+ message: z15.string(),
2940
+ param: z15.string().nullish()
2837
2941
  })
2838
2942
  }),
2839
- z14.object({ type: z14.string() }).loose().transform((value) => ({
2943
+ z15.object({ type: z15.string() }).loose().transform((value) => ({
2840
2944
  type: "unknown_chunk",
2841
2945
  message: value.type
2842
2946
  }))
@@ -2844,236 +2948,258 @@ var openaiResponsesChunkSchema = lazySchema12(
2844
2948
  ])
2845
2949
  )
2846
2950
  );
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()
2951
+ var openaiResponsesResponseSchema = lazySchema13(
2952
+ () => zodSchema13(
2953
+ z15.object({
2954
+ id: z15.string().optional(),
2955
+ created_at: z15.number().optional(),
2956
+ error: z15.object({
2957
+ message: z15.string(),
2958
+ type: z15.string(),
2959
+ param: z15.string().nullish(),
2960
+ code: z15.string()
2857
2961
  }).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()
2962
+ model: z15.string().optional(),
2963
+ output: z15.array(
2964
+ z15.discriminatedUnion("type", [
2965
+ z15.object({
2966
+ type: z15.literal("message"),
2967
+ role: z15.literal("assistant"),
2968
+ id: z15.string(),
2969
+ content: z15.array(
2970
+ z15.object({
2971
+ type: z15.literal("output_text"),
2972
+ text: z15.string(),
2973
+ logprobs: z15.array(
2974
+ z15.object({
2975
+ token: z15.string(),
2976
+ logprob: z15.number(),
2977
+ top_logprobs: z15.array(
2978
+ z15.object({
2979
+ token: z15.string(),
2980
+ logprob: z15.number()
2877
2981
  })
2878
2982
  )
2879
2983
  })
2880
2984
  ).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()
2985
+ annotations: z15.array(
2986
+ z15.discriminatedUnion("type", [
2987
+ z15.object({
2988
+ type: z15.literal("url_citation"),
2989
+ start_index: z15.number(),
2990
+ end_index: z15.number(),
2991
+ url: z15.string(),
2992
+ title: z15.string()
2889
2993
  }),
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()
2994
+ z15.object({
2995
+ type: z15.literal("file_citation"),
2996
+ file_id: z15.string(),
2997
+ filename: z15.string().nullish(),
2998
+ index: z15.number().nullish(),
2999
+ start_index: z15.number().nullish(),
3000
+ end_index: z15.number().nullish(),
3001
+ quote: z15.string().nullish()
2898
3002
  }),
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()
3003
+ z15.object({
3004
+ type: z15.literal("container_file_citation"),
3005
+ container_id: z15.string(),
3006
+ file_id: z15.string(),
3007
+ filename: z15.string().nullish(),
3008
+ start_index: z15.number().nullish(),
3009
+ end_index: z15.number().nullish(),
3010
+ index: z15.number().nullish()
2907
3011
  }),
2908
- z14.object({
2909
- type: z14.literal("file_path"),
2910
- file_id: z14.string(),
2911
- index: z14.number().nullish()
3012
+ z15.object({
3013
+ type: z15.literal("file_path"),
3014
+ file_id: z15.string(),
3015
+ index: z15.number().nullish()
2912
3016
  })
2913
3017
  ])
2914
3018
  )
2915
3019
  })
2916
3020
  )
2917
3021
  }),
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() })
3022
+ z15.object({
3023
+ type: z15.literal("web_search_call"),
3024
+ id: z15.string(),
3025
+ status: z15.string(),
3026
+ action: z15.discriminatedUnion("type", [
3027
+ z15.object({
3028
+ type: z15.literal("search"),
3029
+ query: z15.string().nullish(),
3030
+ sources: z15.array(
3031
+ z15.discriminatedUnion("type", [
3032
+ z15.object({ type: z15.literal("url"), url: z15.string() }),
3033
+ z15.object({ type: z15.literal("api"), name: z15.string() })
2930
3034
  ])
2931
3035
  ).nullish()
2932
3036
  }),
2933
- z14.object({
2934
- type: z14.literal("open_page"),
2935
- url: z14.string()
3037
+ z15.object({
3038
+ type: z15.literal("open_page"),
3039
+ url: z15.string()
2936
3040
  }),
2937
- z14.object({
2938
- type: z14.literal("find"),
2939
- url: z14.string(),
2940
- pattern: z14.string()
3041
+ z15.object({
3042
+ type: z15.literal("find"),
3043
+ url: z15.string(),
3044
+ pattern: z15.string()
2941
3045
  })
2942
3046
  ])
2943
3047
  }),
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()])
3048
+ z15.object({
3049
+ type: z15.literal("file_search_call"),
3050
+ id: z15.string(),
3051
+ queries: z15.array(z15.string()),
3052
+ results: z15.array(
3053
+ z15.object({
3054
+ attributes: z15.record(
3055
+ z15.string(),
3056
+ z15.union([z15.string(), z15.number(), z15.boolean()])
2953
3057
  ),
2954
- file_id: z14.string(),
2955
- filename: z14.string(),
2956
- score: z14.number(),
2957
- text: z14.string()
3058
+ file_id: z15.string(),
3059
+ filename: z15.string(),
3060
+ score: z15.number(),
3061
+ text: z15.string()
2958
3062
  })
2959
3063
  ).nullish()
2960
3064
  }),
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() })
3065
+ z15.object({
3066
+ type: z15.literal("code_interpreter_call"),
3067
+ id: z15.string(),
3068
+ code: z15.string().nullable(),
3069
+ container_id: z15.string(),
3070
+ outputs: z15.array(
3071
+ z15.discriminatedUnion("type", [
3072
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
3073
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2970
3074
  ])
2971
3075
  ).nullable()
2972
3076
  }),
2973
- z14.object({
2974
- type: z14.literal("image_generation_call"),
2975
- id: z14.string(),
2976
- result: z14.string()
3077
+ z15.object({
3078
+ type: z15.literal("image_generation_call"),
3079
+ id: z15.string(),
3080
+ result: z15.string()
2977
3081
  }),
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()
3082
+ z15.object({
3083
+ type: z15.literal("local_shell_call"),
3084
+ id: z15.string(),
3085
+ call_id: z15.string(),
3086
+ action: z15.object({
3087
+ type: z15.literal("exec"),
3088
+ command: z15.array(z15.string()),
3089
+ timeout_ms: z15.number().optional(),
3090
+ user: z15.string().optional(),
3091
+ working_directory: z15.string().optional(),
3092
+ env: z15.record(z15.string(), z15.string()).optional()
2989
3093
  })
2990
3094
  }),
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()
3095
+ z15.object({
3096
+ type: z15.literal("function_call"),
3097
+ call_id: z15.string(),
3098
+ name: z15.string(),
3099
+ arguments: z15.string(),
3100
+ id: z15.string()
2997
3101
  }),
2998
- z14.object({
2999
- type: z14.literal("computer_call"),
3000
- id: z14.string(),
3001
- status: z14.string().optional()
3102
+ z15.object({
3103
+ type: z15.literal("computer_call"),
3104
+ id: z15.string(),
3105
+ status: z15.string().optional()
3002
3106
  }),
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()
3107
+ z15.object({
3108
+ type: z15.literal("reasoning"),
3109
+ id: z15.string(),
3110
+ encrypted_content: z15.string().nullish(),
3111
+ summary: z15.array(
3112
+ z15.object({
3113
+ type: z15.literal("summary_text"),
3114
+ text: z15.string()
3011
3115
  })
3012
3116
  )
3013
3117
  }),
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()
3118
+ z15.object({
3119
+ type: z15.literal("mcp_call"),
3120
+ id: z15.string(),
3121
+ status: z15.string(),
3122
+ arguments: z15.string(),
3123
+ name: z15.string(),
3124
+ server_label: z15.string(),
3125
+ output: z15.string().nullish(),
3126
+ error: z15.union([
3127
+ z15.string(),
3128
+ z15.object({
3129
+ type: z15.string().optional(),
3130
+ code: z15.union([z15.number(), z15.string()]).optional(),
3131
+ message: z15.string().optional()
3028
3132
  }).loose()
3029
3133
  ]).nullish()
3030
3134
  }),
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()
3135
+ z15.object({
3136
+ type: z15.literal("mcp_list_tools"),
3137
+ id: z15.string(),
3138
+ server_label: z15.string(),
3139
+ tools: z15.array(
3140
+ z15.object({
3141
+ name: z15.string(),
3142
+ description: z15.string().optional(),
3143
+ input_schema: z15.any(),
3144
+ annotations: z15.record(z15.string(), z15.unknown()).optional()
3041
3145
  })
3042
3146
  ),
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()
3147
+ error: z15.union([
3148
+ z15.string(),
3149
+ z15.object({
3150
+ type: z15.string().optional(),
3151
+ code: z15.union([z15.number(), z15.string()]).optional(),
3152
+ message: z15.string().optional()
3049
3153
  }).loose()
3050
3154
  ]).optional()
3051
3155
  }),
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()
3156
+ z15.object({
3157
+ type: z15.literal("mcp_approval_request"),
3158
+ id: z15.string(),
3159
+ server_label: z15.string(),
3160
+ name: z15.string(),
3161
+ arguments: z15.string(),
3162
+ approval_request_id: z15.string()
3163
+ }),
3164
+ z15.object({
3165
+ type: z15.literal("apply_patch_call"),
3166
+ id: z15.string(),
3167
+ call_id: z15.string(),
3168
+ status: z15.enum(["in_progress", "completed"]),
3169
+ operation: z15.discriminatedUnion("type", [
3170
+ z15.object({
3171
+ type: z15.literal("create_file"),
3172
+ path: z15.string(),
3173
+ diff: z15.string()
3174
+ }),
3175
+ z15.object({
3176
+ type: z15.literal("delete_file"),
3177
+ path: z15.string()
3178
+ }),
3179
+ z15.object({
3180
+ type: z15.literal("update_file"),
3181
+ path: z15.string(),
3182
+ diff: z15.string()
3183
+ })
3184
+ ])
3059
3185
  })
3060
3186
  ])
3061
3187
  ).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()
3188
+ service_tier: z15.string().nullish(),
3189
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
3190
+ usage: z15.object({
3191
+ input_tokens: z15.number(),
3192
+ input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
3193
+ output_tokens: z15.number(),
3194
+ output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
3069
3195
  }).optional()
3070
3196
  })
3071
3197
  )
3072
3198
  );
3073
3199
 
3074
3200
  // 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";
3201
+ import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
3202
+ import { z as z16 } from "zod/v4";
3077
3203
  var TOP_LOGPROBS_MAX = 20;
3078
3204
  var openaiResponsesReasoningModelIds = [
3079
3205
  "o1",
@@ -3140,19 +3266,19 @@ var openaiResponsesModelIds = [
3140
3266
  "gpt-5-chat-latest",
3141
3267
  ...openaiResponsesReasoningModelIds
3142
3268
  ];
3143
- var openaiResponsesProviderOptionsSchema = lazySchema13(
3144
- () => zodSchema13(
3145
- z15.object({
3146
- conversation: z15.string().nullish(),
3147
- include: z15.array(
3148
- z15.enum([
3269
+ var openaiResponsesProviderOptionsSchema = lazySchema14(
3270
+ () => zodSchema14(
3271
+ z16.object({
3272
+ conversation: z16.string().nullish(),
3273
+ include: z16.array(
3274
+ z16.enum([
3149
3275
  "reasoning.encrypted_content",
3150
3276
  // handled internally by default, only needed for unknown reasoning models
3151
3277
  "file_search_call.results",
3152
3278
  "message.output_text.logprobs"
3153
3279
  ])
3154
3280
  ).nullish(),
3155
- instructions: z15.string().nullish(),
3281
+ instructions: z16.string().nullish(),
3156
3282
  /**
3157
3283
  * Return the log probabilities of the tokens.
3158
3284
  *
@@ -3165,17 +3291,17 @@ var openaiResponsesProviderOptionsSchema = lazySchema13(
3165
3291
  * @see https://platform.openai.com/docs/api-reference/responses/create
3166
3292
  * @see https://cookbook.openai.com/examples/using_logprobs
3167
3293
  */
3168
- logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3294
+ logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3169
3295
  /**
3170
3296
  * The maximum number of total calls to built-in tools that can be processed in a response.
3171
3297
  * This maximum number applies across all built-in tool calls, not per individual tool.
3172
3298
  * Any further attempts to call a tool by the model will be ignored.
3173
3299
  */
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(),
3300
+ maxToolCalls: z16.number().nullish(),
3301
+ metadata: z16.any().nullish(),
3302
+ parallelToolCalls: z16.boolean().nullish(),
3303
+ previousResponseId: z16.string().nullish(),
3304
+ promptCacheKey: z16.string().nullish(),
3179
3305
  /**
3180
3306
  * The retention policy for the prompt cache.
3181
3307
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -3184,16 +3310,16 @@ var openaiResponsesProviderOptionsSchema = lazySchema13(
3184
3310
  *
3185
3311
  * @default 'in_memory'
3186
3312
  */
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()
3313
+ promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
3314
+ reasoningEffort: z16.string().nullish(),
3315
+ reasoningSummary: z16.string().nullish(),
3316
+ safetyIdentifier: z16.string().nullish(),
3317
+ serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
3318
+ store: z16.boolean().nullish(),
3319
+ strictJsonSchema: z16.boolean().nullish(),
3320
+ textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3321
+ truncation: z16.enum(["auto", "disabled"]).nullish(),
3322
+ user: z16.string().nullish()
3197
3323
  })
3198
3324
  )
3199
3325
  );
@@ -3206,44 +3332,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
3206
3332
 
3207
3333
  // src/tool/code-interpreter.ts
3208
3334
  import {
3209
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
3210
- lazySchema as lazySchema14,
3211
- zodSchema as zodSchema14
3335
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
3336
+ lazySchema as lazySchema15,
3337
+ zodSchema as zodSchema15
3212
3338
  } 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()
3339
+ import { z as z17 } from "zod/v4";
3340
+ var codeInterpreterInputSchema = lazySchema15(
3341
+ () => zodSchema15(
3342
+ z17.object({
3343
+ code: z17.string().nullish(),
3344
+ containerId: z17.string()
3219
3345
  })
3220
3346
  )
3221
3347
  );
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() })
3348
+ var codeInterpreterOutputSchema = lazySchema15(
3349
+ () => zodSchema15(
3350
+ z17.object({
3351
+ outputs: z17.array(
3352
+ z17.discriminatedUnion("type", [
3353
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3354
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3229
3355
  ])
3230
3356
  ).nullish()
3231
3357
  })
3232
3358
  )
3233
3359
  );
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()
3360
+ var codeInterpreterArgsSchema = lazySchema15(
3361
+ () => zodSchema15(
3362
+ z17.object({
3363
+ container: z17.union([
3364
+ z17.string(),
3365
+ z17.object({
3366
+ fileIds: z17.array(z17.string()).optional()
3241
3367
  })
3242
3368
  ]).optional()
3243
3369
  })
3244
3370
  )
3245
3371
  );
3246
- var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema2({
3372
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema3({
3247
3373
  id: "openai.code_interpreter",
3248
3374
  inputSchema: codeInterpreterInputSchema,
3249
3375
  outputSchema: codeInterpreterOutputSchema
@@ -3254,88 +3380,88 @@ var codeInterpreter = (args = {}) => {
3254
3380
 
3255
3381
  // src/tool/file-search.ts
3256
3382
  import {
3257
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
3258
- lazySchema as lazySchema15,
3259
- zodSchema as zodSchema15
3383
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3384
+ lazySchema as lazySchema16,
3385
+ zodSchema as zodSchema16
3260
3386
  } 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()])
3387
+ import { z as z18 } from "zod/v4";
3388
+ var comparisonFilterSchema = z18.object({
3389
+ key: z18.string(),
3390
+ type: z18.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
3391
+ value: z18.union([z18.string(), z18.number(), z18.boolean()])
3266
3392
  });
3267
- var compoundFilterSchema = z17.object({
3268
- type: z17.enum(["and", "or"]),
3269
- filters: z17.array(
3270
- z17.union([comparisonFilterSchema, z17.lazy(() => compoundFilterSchema)])
3393
+ var compoundFilterSchema = z18.object({
3394
+ type: z18.enum(["and", "or"]),
3395
+ filters: z18.array(
3396
+ z18.union([comparisonFilterSchema, z18.lazy(() => compoundFilterSchema)])
3271
3397
  )
3272
3398
  });
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()
3399
+ var fileSearchArgsSchema = lazySchema16(
3400
+ () => zodSchema16(
3401
+ z18.object({
3402
+ vectorStoreIds: z18.array(z18.string()),
3403
+ maxNumResults: z18.number().optional(),
3404
+ ranking: z18.object({
3405
+ ranker: z18.string().optional(),
3406
+ scoreThreshold: z18.number().optional()
3281
3407
  }).optional(),
3282
- filters: z17.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3408
+ filters: z18.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3283
3409
  })
3284
3410
  )
3285
3411
  );
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()
3412
+ var fileSearchOutputSchema = lazySchema16(
3413
+ () => zodSchema16(
3414
+ z18.object({
3415
+ queries: z18.array(z18.string()),
3416
+ results: z18.array(
3417
+ z18.object({
3418
+ attributes: z18.record(z18.string(), z18.unknown()),
3419
+ fileId: z18.string(),
3420
+ filename: z18.string(),
3421
+ score: z18.number(),
3422
+ text: z18.string()
3297
3423
  })
3298
3424
  ).nullable()
3299
3425
  })
3300
3426
  )
3301
3427
  );
3302
- var fileSearch = createProviderToolFactoryWithOutputSchema3({
3428
+ var fileSearch = createProviderToolFactoryWithOutputSchema4({
3303
3429
  id: "openai.file_search",
3304
- inputSchema: z17.object({}),
3430
+ inputSchema: z18.object({}),
3305
3431
  outputSchema: fileSearchOutputSchema
3306
3432
  });
3307
3433
 
3308
3434
  // src/tool/image-generation.ts
3309
3435
  import {
3310
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3311
- lazySchema as lazySchema16,
3312
- zodSchema as zodSchema16
3436
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3437
+ lazySchema as lazySchema17,
3438
+ zodSchema as zodSchema17
3313
3439
  } 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()
3440
+ import { z as z19 } from "zod/v4";
3441
+ var imageGenerationArgsSchema = lazySchema17(
3442
+ () => zodSchema17(
3443
+ z19.object({
3444
+ background: z19.enum(["auto", "opaque", "transparent"]).optional(),
3445
+ inputFidelity: z19.enum(["low", "high"]).optional(),
3446
+ inputImageMask: z19.object({
3447
+ fileId: z19.string().optional(),
3448
+ imageUrl: z19.string().optional()
3323
3449
  }).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()
3450
+ model: z19.string().optional(),
3451
+ moderation: z19.enum(["auto"]).optional(),
3452
+ outputCompression: z19.number().int().min(0).max(100).optional(),
3453
+ outputFormat: z19.enum(["png", "jpeg", "webp"]).optional(),
3454
+ partialImages: z19.number().int().min(0).max(3).optional(),
3455
+ quality: z19.enum(["auto", "low", "medium", "high"]).optional(),
3456
+ size: z19.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
3331
3457
  }).strict()
3332
3458
  )
3333
3459
  );
3334
- var imageGenerationInputSchema = lazySchema16(() => zodSchema16(z18.object({})));
3335
- var imageGenerationOutputSchema = lazySchema16(
3336
- () => zodSchema16(z18.object({ result: z18.string() }))
3460
+ var imageGenerationInputSchema = lazySchema17(() => zodSchema17(z19.object({})));
3461
+ var imageGenerationOutputSchema = lazySchema17(
3462
+ () => zodSchema17(z19.object({ result: z19.string() }))
3337
3463
  );
3338
- var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
3464
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema5({
3339
3465
  id: "openai.image_generation",
3340
3466
  inputSchema: imageGenerationInputSchema,
3341
3467
  outputSchema: imageGenerationOutputSchema
@@ -3346,35 +3472,35 @@ var imageGeneration = (args = {}) => {
3346
3472
 
3347
3473
  // src/tool/mcp.ts
3348
3474
  import {
3349
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3350
- lazySchema as lazySchema17,
3351
- zodSchema as zodSchema17
3475
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
3476
+ lazySchema as lazySchema18,
3477
+ zodSchema as zodSchema18
3352
3478
  } 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)
3479
+ import { z as z20 } from "zod/v4";
3480
+ var jsonValueSchema = z20.lazy(
3481
+ () => z20.union([
3482
+ z20.string(),
3483
+ z20.number(),
3484
+ z20.boolean(),
3485
+ z20.null(),
3486
+ z20.array(jsonValueSchema),
3487
+ z20.record(z20.string(), jsonValueSchema)
3362
3488
  ])
3363
3489
  );
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()
3490
+ var mcpArgsSchema = lazySchema18(
3491
+ () => zodSchema18(
3492
+ z20.object({
3493
+ serverLabel: z20.string(),
3494
+ allowedTools: z20.union([
3495
+ z20.array(z20.string()),
3496
+ z20.object({
3497
+ readOnly: z20.boolean().optional(),
3498
+ toolNames: z20.array(z20.string()).optional()
3373
3499
  })
3374
3500
  ]).optional(),
3375
- authorization: z19.string().optional(),
3376
- connectorId: z19.string().optional(),
3377
- headers: z19.record(z19.string(), z19.string()).optional(),
3501
+ authorization: z20.string().optional(),
3502
+ connectorId: z20.string().optional(),
3503
+ headers: z20.record(z20.string(), z20.string()).optional(),
3378
3504
  // TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
3379
3505
  // requireApproval: z
3380
3506
  // .union([
@@ -3385,122 +3511,67 @@ var mcpArgsSchema = lazySchema17(
3385
3511
  // }),
3386
3512
  // ])
3387
3513
  // .optional(),
3388
- serverDescription: z19.string().optional(),
3389
- serverUrl: z19.string().optional()
3514
+ serverDescription: z20.string().optional(),
3515
+ serverUrl: z20.string().optional()
3390
3516
  }).refine(
3391
3517
  (v) => v.serverUrl != null || v.connectorId != null,
3392
3518
  "One of serverUrl or connectorId must be provided."
3393
3519
  )
3394
3520
  )
3395
3521
  );
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()
3522
+ var mcpInputSchema = lazySchema18(() => zodSchema18(z20.object({})));
3523
+ var mcpOutputSchema = lazySchema18(
3524
+ () => zodSchema18(
3525
+ z20.discriminatedUnion("type", [
3526
+ z20.object({
3527
+ type: z20.literal("call"),
3528
+ serverLabel: z20.string(),
3529
+ name: z20.string(),
3530
+ arguments: z20.string(),
3531
+ output: z20.string().nullable().optional(),
3532
+ error: z20.union([z20.string(), jsonValueSchema]).optional()
3407
3533
  }),
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(),
3534
+ z20.object({
3535
+ type: z20.literal("listTools"),
3536
+ serverLabel: z20.string(),
3537
+ tools: z20.array(
3538
+ z20.object({
3539
+ name: z20.string(),
3540
+ description: z20.string().optional(),
3415
3541
  inputSchema: jsonValueSchema,
3416
- annotations: z19.record(z19.string(), jsonValueSchema).optional()
3542
+ annotations: z20.record(z20.string(), jsonValueSchema).optional()
3417
3543
  })
3418
3544
  ),
3419
- error: z19.union([z19.string(), jsonValueSchema]).optional()
3545
+ error: z20.union([z20.string(), jsonValueSchema]).optional()
3420
3546
  }),
3421
- z19.object({
3422
- type: z19.literal("approvalRequest"),
3423
- serverLabel: z19.string(),
3424
- name: z19.string(),
3425
- arguments: z19.string(),
3426
- approvalRequestId: z19.string()
3547
+ z20.object({
3548
+ type: z20.literal("approvalRequest"),
3549
+ serverLabel: z20.string(),
3550
+ name: z20.string(),
3551
+ arguments: z20.string(),
3552
+ approvalRequestId: z20.string()
3427
3553
  })
3428
3554
  ])
3429
3555
  )
3430
3556
  );
3431
- var mcpToolFactory = createProviderToolFactoryWithOutputSchema5({
3557
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema6({
3432
3558
  id: "openai.mcp",
3433
3559
  inputSchema: mcpInputSchema,
3434
3560
  outputSchema: mcpOutputSchema
3435
3561
  });
3436
3562
 
3437
3563
  // 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
3564
  import {
3496
3565
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
3497
3566
  lazySchema as lazySchema19,
3498
3567
  zodSchema as zodSchema19
3499
3568
  } from "@ai-sdk/provider-utils";
3500
3569
  import { z as z21 } from "zod/v4";
3501
- var webSearchPreviewArgsSchema = lazySchema19(
3570
+ var webSearchArgsSchema = lazySchema19(
3502
3571
  () => zodSchema19(
3503
3572
  z21.object({
3573
+ externalWebAccess: z21.boolean().optional(),
3574
+ filters: z21.object({ allowedDomains: z21.array(z21.string()).optional() }).optional(),
3504
3575
  searchContextSize: z21.enum(["low", "medium", "high"]).optional(),
3505
3576
  userLocation: z21.object({
3506
3577
  type: z21.literal("approximate"),
@@ -3512,10 +3583,8 @@ var webSearchPreviewArgsSchema = lazySchema19(
3512
3583
  })
3513
3584
  )
3514
3585
  );
3515
- var webSearchPreviewInputSchema = lazySchema19(
3516
- () => zodSchema19(z21.object({}))
3517
- );
3518
- var webSearchPreviewOutputSchema = lazySchema19(
3586
+ var webSearchInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
3587
+ var webSearchOutputSchema = lazySchema19(
3519
3588
  () => zodSchema19(
3520
3589
  z21.object({
3521
3590
  action: z21.discriminatedUnion("type", [
@@ -3532,11 +3601,68 @@ var webSearchPreviewOutputSchema = lazySchema19(
3532
3601
  url: z21.string(),
3533
3602
  pattern: z21.string()
3534
3603
  })
3604
+ ]),
3605
+ sources: z21.array(
3606
+ z21.discriminatedUnion("type", [
3607
+ z21.object({ type: z21.literal("url"), url: z21.string() }),
3608
+ z21.object({ type: z21.literal("api"), name: z21.string() })
3609
+ ])
3610
+ ).optional()
3611
+ })
3612
+ )
3613
+ );
3614
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
3615
+ id: "openai.web_search",
3616
+ inputSchema: webSearchInputSchema,
3617
+ outputSchema: webSearchOutputSchema
3618
+ });
3619
+
3620
+ // src/tool/web-search-preview.ts
3621
+ import {
3622
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
3623
+ lazySchema as lazySchema20,
3624
+ zodSchema as zodSchema20
3625
+ } from "@ai-sdk/provider-utils";
3626
+ import { z as z22 } from "zod/v4";
3627
+ var webSearchPreviewArgsSchema = lazySchema20(
3628
+ () => zodSchema20(
3629
+ z22.object({
3630
+ searchContextSize: z22.enum(["low", "medium", "high"]).optional(),
3631
+ userLocation: z22.object({
3632
+ type: z22.literal("approximate"),
3633
+ country: z22.string().optional(),
3634
+ city: z22.string().optional(),
3635
+ region: z22.string().optional(),
3636
+ timezone: z22.string().optional()
3637
+ }).optional()
3638
+ })
3639
+ )
3640
+ );
3641
+ var webSearchPreviewInputSchema = lazySchema20(
3642
+ () => zodSchema20(z22.object({}))
3643
+ );
3644
+ var webSearchPreviewOutputSchema = lazySchema20(
3645
+ () => zodSchema20(
3646
+ z22.object({
3647
+ action: z22.discriminatedUnion("type", [
3648
+ z22.object({
3649
+ type: z22.literal("search"),
3650
+ query: z22.string().optional()
3651
+ }),
3652
+ z22.object({
3653
+ type: z22.literal("openPage"),
3654
+ url: z22.string()
3655
+ }),
3656
+ z22.object({
3657
+ type: z22.literal("find"),
3658
+ url: z22.string(),
3659
+ pattern: z22.string()
3660
+ })
3535
3661
  ])
3536
3662
  })
3537
3663
  )
3538
3664
  );
3539
- var webSearchPreview = createProviderToolFactoryWithOutputSchema7({
3665
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema8({
3540
3666
  id: "openai.web_search_preview",
3541
3667
  inputSchema: webSearchPreviewInputSchema,
3542
3668
  outputSchema: webSearchPreviewOutputSchema
@@ -3590,6 +3716,12 @@ async function prepareResponsesTools({
3590
3716
  });
3591
3717
  break;
3592
3718
  }
3719
+ case "openai.apply_patch": {
3720
+ openaiTools.push({
3721
+ type: "apply_patch"
3722
+ });
3723
+ break;
3724
+ }
3593
3725
  case "openai.web_search_preview": {
3594
3726
  const args = await validateTypes2({
3595
3727
  value: tool.args,
@@ -3694,7 +3826,7 @@ async function prepareResponsesTools({
3694
3826
  case "tool":
3695
3827
  return {
3696
3828
  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 },
3829
+ 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
3830
  toolWarnings
3699
3831
  };
3700
3832
  default: {
@@ -3774,7 +3906,8 @@ var OpenAIResponsesLanguageModel = class {
3774
3906
  "openai.local_shell": "local_shell",
3775
3907
  "openai.web_search": "web_search",
3776
3908
  "openai.web_search_preview": "web_search_preview",
3777
- "openai.mcp": "mcp"
3909
+ "openai.mcp": "mcp",
3910
+ "openai.apply_patch": "apply_patch"
3778
3911
  }
3779
3912
  });
3780
3913
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
@@ -3783,7 +3916,8 @@ var OpenAIResponsesLanguageModel = class {
3783
3916
  systemMessageMode: modelConfig.systemMessageMode,
3784
3917
  fileIdPrefixes: this.config.fileIdPrefixes,
3785
3918
  store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
3786
- hasLocalShellTool: hasOpenAITool("openai.local_shell")
3919
+ hasLocalShellTool: hasOpenAITool("openai.local_shell"),
3920
+ hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
3787
3921
  });
3788
3922
  warnings.push(...inputWarnings);
3789
3923
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -4284,6 +4418,23 @@ var OpenAIResponsesLanguageModel = class {
4284
4418
  });
4285
4419
  break;
4286
4420
  }
4421
+ case "apply_patch_call": {
4422
+ content.push({
4423
+ type: "tool-call",
4424
+ toolCallId: part.call_id,
4425
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4426
+ input: JSON.stringify({
4427
+ callId: part.call_id,
4428
+ operation: part.operation
4429
+ }),
4430
+ providerMetadata: {
4431
+ [providerKey]: {
4432
+ itemId: part.id
4433
+ }
4434
+ }
4435
+ });
4436
+ break;
4437
+ }
4287
4438
  }
4288
4439
  }
4289
4440
  const providerMetadata = {
@@ -4471,6 +4622,27 @@ var OpenAIResponsesLanguageModel = class {
4471
4622
  input: "{}",
4472
4623
  providerExecuted: true
4473
4624
  });
4625
+ } else if (value.item.type === "apply_patch_call") {
4626
+ ongoingToolCalls[value.output_index] = {
4627
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4628
+ toolCallId: value.item.call_id
4629
+ };
4630
+ if (value.item.status === "completed") {
4631
+ controller.enqueue({
4632
+ type: "tool-call",
4633
+ toolCallId: value.item.call_id,
4634
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4635
+ input: JSON.stringify({
4636
+ callId: value.item.call_id,
4637
+ operation: value.item.operation
4638
+ }),
4639
+ providerMetadata: {
4640
+ [providerKey]: {
4641
+ itemId: value.item.id
4642
+ }
4643
+ }
4644
+ });
4645
+ }
4474
4646
  } else if (value.item.type === "message") {
4475
4647
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
4476
4648
  controller.enqueue({
@@ -4634,6 +4806,24 @@ var OpenAIResponsesLanguageModel = class {
4634
4806
  ...value.item.error != null ? { error: value.item.error } : {}
4635
4807
  }
4636
4808
  });
4809
+ } else if (value.item.type === "apply_patch_call") {
4810
+ ongoingToolCalls[value.output_index] = void 0;
4811
+ if (value.item.status === "completed") {
4812
+ controller.enqueue({
4813
+ type: "tool-call",
4814
+ toolCallId: value.item.call_id,
4815
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4816
+ input: JSON.stringify({
4817
+ callId: value.item.call_id,
4818
+ operation: value.item.operation
4819
+ }),
4820
+ providerMetadata: {
4821
+ [providerKey]: {
4822
+ itemId: value.item.id
4823
+ }
4824
+ }
4825
+ });
4826
+ }
4637
4827
  } else if (value.item.type === "mcp_approval_request") {
4638
4828
  ongoingToolCalls[value.output_index] = void 0;
4639
4829
  controller.enqueue({
@@ -4983,6 +5173,11 @@ export {
4983
5173
  OpenAIResponsesLanguageModel,
4984
5174
  OpenAISpeechModel,
4985
5175
  OpenAITranscriptionModel,
5176
+ applyPatch,
5177
+ applyPatchArgsSchema,
5178
+ applyPatchInputSchema,
5179
+ applyPatchOutputSchema,
5180
+ applyPatchToolFactory,
4986
5181
  codeInterpreter,
4987
5182
  codeInterpreterArgsSchema,
4988
5183
  codeInterpreterInputSchema,