@ai-sdk/openai 2.0.133 → 2.0.134

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.
@@ -2350,9 +2350,10 @@ import {
2350
2350
  import {
2351
2351
  convertToBase64 as convertToBase642,
2352
2352
  parseProviderOptions as parseProviderOptions7,
2353
+ safeValidateTypes,
2353
2354
  validateTypes
2354
2355
  } from "@ai-sdk/provider-utils";
2355
- import { z as z15 } from "zod/v4";
2356
+ import { z as z16 } from "zod/v4";
2356
2357
 
2357
2358
  // src/responses/openai-responses-options.ts
2358
2359
  import {
@@ -2590,7 +2591,119 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema({
2590
2591
  outputSchema: localShellOutputSchema
2591
2592
  });
2592
2593
 
2594
+ // src/tool/web-search.ts
2595
+ import {
2596
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
2597
+ lazySchema as lazySchema2,
2598
+ zodSchema as zodSchema14
2599
+ } from "@ai-sdk/provider-utils";
2600
+ import { z as z15 } from "zod/v4";
2601
+ var webSearchArgsSchema = lazySchema2(
2602
+ () => zodSchema14(
2603
+ z15.object({
2604
+ externalWebAccess: z15.boolean().optional(),
2605
+ filters: z15.object({
2606
+ allowedDomains: z15.array(z15.string()).optional(),
2607
+ blockedDomains: z15.array(z15.string()).optional()
2608
+ }).optional(),
2609
+ searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2610
+ userLocation: z15.object({
2611
+ type: z15.literal("approximate"),
2612
+ country: z15.string().optional(),
2613
+ city: z15.string().optional(),
2614
+ region: z15.string().optional(),
2615
+ timezone: z15.string().optional()
2616
+ }).optional()
2617
+ })
2618
+ )
2619
+ );
2620
+ var webSearchInputSchema = lazySchema2(() => zodSchema14(z15.object({})));
2621
+ var webSearchOutputSchema = lazySchema2(
2622
+ () => zodSchema14(
2623
+ z15.object({
2624
+ action: z15.discriminatedUnion("type", [
2625
+ z15.object({
2626
+ type: z15.literal("search"),
2627
+ query: z15.string().optional()
2628
+ }),
2629
+ z15.object({
2630
+ type: z15.literal("openPage"),
2631
+ url: z15.string().nullish()
2632
+ }),
2633
+ z15.object({
2634
+ type: z15.literal("findInPage"),
2635
+ url: z15.string().nullish(),
2636
+ pattern: z15.string().nullish()
2637
+ })
2638
+ ]).optional(),
2639
+ sources: z15.array(
2640
+ z15.discriminatedUnion("type", [
2641
+ z15.object({ type: z15.literal("url"), url: z15.string() }),
2642
+ z15.object({ type: z15.literal("api"), name: z15.string() })
2643
+ ])
2644
+ ).optional()
2645
+ })
2646
+ )
2647
+ );
2648
+ var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
2649
+ id: "openai.web_search",
2650
+ name: "web_search",
2651
+ inputSchema: webSearchInputSchema,
2652
+ outputSchema: webSearchOutputSchema
2653
+ });
2654
+ var webSearch = (args = {}) => webSearchToolFactory(args);
2655
+
2593
2656
  // src/responses/convert-to-openai-responses-input.ts
2657
+ async function convertWebSearchToolResultOutput({
2658
+ output,
2659
+ id
2660
+ }) {
2661
+ if (output.type !== "json") {
2662
+ return void 0;
2663
+ }
2664
+ const validation = await safeValidateTypes({
2665
+ value: output.value,
2666
+ schema: webSearchOutputSchema
2667
+ });
2668
+ if (!validation.success || validation.value.action == null) {
2669
+ return void 0;
2670
+ }
2671
+ const { action, sources } = validation.value;
2672
+ switch (action.type) {
2673
+ case "search":
2674
+ return {
2675
+ type: "web_search_call",
2676
+ id,
2677
+ status: "completed",
2678
+ action: {
2679
+ type: "search",
2680
+ ...action.query != null && { query: action.query },
2681
+ ...sources != null && { sources }
2682
+ }
2683
+ };
2684
+ case "openPage":
2685
+ return {
2686
+ type: "web_search_call",
2687
+ id,
2688
+ status: "completed",
2689
+ action: {
2690
+ type: "open_page",
2691
+ url: action.url
2692
+ }
2693
+ };
2694
+ case "findInPage":
2695
+ return {
2696
+ type: "web_search_call",
2697
+ id,
2698
+ status: "completed",
2699
+ action: {
2700
+ type: "find_in_page",
2701
+ url: action.url,
2702
+ pattern: action.pattern
2703
+ }
2704
+ };
2705
+ }
2706
+ }
2594
2707
  function getPromptCacheBreakpoint2(providerOptions) {
2595
2708
  var _a2;
2596
2709
  return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
@@ -2607,9 +2720,10 @@ async function convertToOpenAIResponsesInput({
2607
2720
  fileIdPrefixes,
2608
2721
  store,
2609
2722
  configurationUpdateUnsupportedReason,
2610
- hasLocalShellTool = false
2723
+ hasLocalShellTool = false,
2724
+ webSearchToolName
2611
2725
  }) {
2612
- var _a2, _b, _c, _d, _e, _f, _g, _h;
2726
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2613
2727
  let input = [];
2614
2728
  const warnings = [];
2615
2729
  for (const { role, content, providerOptions } of prompt) {
@@ -2819,6 +2933,21 @@ async function convertToOpenAIResponsesInput({
2819
2933
  }
2820
2934
  // assistant tool result parts are from provider-executed tools:
2821
2935
  case "tool-result": {
2936
+ if (part.toolName === "web_search" || part.toolName === "web_search_preview" || part.toolName === webSearchToolName) {
2937
+ const itemId = (_k = (_j = (_i = part.providerOptions) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.itemId) != null ? _k : part.toolCallId;
2938
+ if (store) {
2939
+ input.push({ type: "item_reference", id: itemId });
2940
+ break;
2941
+ }
2942
+ const webSearchCall = await convertWebSearchToolResultOutput({
2943
+ output: part.output,
2944
+ id: itemId
2945
+ });
2946
+ if (webSearchCall != null) {
2947
+ input.push(webSearchCall);
2948
+ break;
2949
+ }
2950
+ }
2822
2951
  if (store) {
2823
2952
  input.push({ type: "item_reference", id: part.toolCallId });
2824
2953
  } else {
@@ -2987,9 +3116,9 @@ async function convertToOpenAIResponsesInput({
2987
3116
  }
2988
3117
  return { input, warnings };
2989
3118
  }
2990
- var openaiResponsesReasoningProviderOptionsSchema = z15.object({
2991
- itemId: z15.string().nullish(),
2992
- reasoningEncryptedContent: z15.string().nullish()
3119
+ var openaiResponsesReasoningProviderOptionsSchema = z16.object({
3120
+ itemId: z16.string().nullish(),
3121
+ reasoningEncryptedContent: z16.string().nullish()
2993
3122
  });
2994
3123
 
2995
3124
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3013,289 +3142,289 @@ function mapOpenAIResponseFinishReason({
3013
3142
  // src/responses/openai-responses-api.ts
3014
3143
  import {
3015
3144
  lazyValidator as lazyValidator13,
3016
- zodSchema as zodSchema14
3145
+ zodSchema as zodSchema15
3017
3146
  } from "@ai-sdk/provider-utils";
3018
- import { z as z16 } from "zod/v4";
3147
+ import { z as z17 } from "zod/v4";
3019
3148
  var openaiResponsesChunkSchema = lazyValidator13(
3020
- () => zodSchema14(
3021
- z16.union([
3022
- z16.object({
3023
- type: z16.literal("response.output_text.delta"),
3024
- item_id: z16.string(),
3025
- delta: z16.string(),
3026
- logprobs: z16.array(
3027
- z16.object({
3028
- token: z16.string(),
3029
- logprob: z16.number(),
3030
- top_logprobs: z16.array(
3031
- z16.object({
3032
- token: z16.string(),
3033
- logprob: z16.number()
3149
+ () => zodSchema15(
3150
+ z17.union([
3151
+ z17.object({
3152
+ type: z17.literal("response.output_text.delta"),
3153
+ item_id: z17.string(),
3154
+ delta: z17.string(),
3155
+ logprobs: z17.array(
3156
+ z17.object({
3157
+ token: z17.string(),
3158
+ logprob: z17.number(),
3159
+ top_logprobs: z17.array(
3160
+ z17.object({
3161
+ token: z17.string(),
3162
+ logprob: z17.number()
3034
3163
  })
3035
3164
  )
3036
3165
  })
3037
3166
  ).nullish()
3038
3167
  }),
3039
- z16.object({
3040
- type: z16.enum(["response.completed", "response.incomplete"]),
3041
- response: z16.object({
3042
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3043
- usage: z16.object({
3044
- input_tokens: z16.number(),
3045
- input_tokens_details: z16.object({
3046
- cached_tokens: z16.number().nullish(),
3047
- cache_write_tokens: z16.number().nullish(),
3048
- orchestration_input_tokens: z16.number().nullish(),
3049
- orchestration_input_cached_tokens: z16.number().nullish()
3168
+ z17.object({
3169
+ type: z17.enum(["response.completed", "response.incomplete"]),
3170
+ response: z17.object({
3171
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3172
+ usage: z17.object({
3173
+ input_tokens: z17.number(),
3174
+ input_tokens_details: z17.object({
3175
+ cached_tokens: z17.number().nullish(),
3176
+ cache_write_tokens: z17.number().nullish(),
3177
+ orchestration_input_tokens: z17.number().nullish(),
3178
+ orchestration_input_cached_tokens: z17.number().nullish()
3050
3179
  }).nullish(),
3051
- output_tokens: z16.number(),
3052
- output_tokens_details: z16.object({
3053
- reasoning_tokens: z16.number().nullish(),
3054
- orchestration_output_tokens: z16.number().nullish()
3180
+ output_tokens: z17.number(),
3181
+ output_tokens_details: z17.object({
3182
+ reasoning_tokens: z17.number().nullish(),
3183
+ orchestration_output_tokens: z17.number().nullish()
3055
3184
  }).nullish()
3056
3185
  }),
3057
- reasoning: z16.object({
3058
- context: z16.string().nullish()
3186
+ reasoning: z17.object({
3187
+ context: z17.string().nullish()
3059
3188
  }).nullish(),
3060
- service_tier: z16.string().nullish()
3189
+ service_tier: z17.string().nullish()
3061
3190
  })
3062
3191
  }),
3063
- z16.object({
3064
- type: z16.literal("response.created"),
3065
- response: z16.object({
3066
- id: z16.string(),
3067
- created_at: z16.number(),
3068
- model: z16.string(),
3069
- service_tier: z16.string().nullish()
3192
+ z17.object({
3193
+ type: z17.literal("response.created"),
3194
+ response: z17.object({
3195
+ id: z17.string(),
3196
+ created_at: z17.number(),
3197
+ model: z17.string(),
3198
+ service_tier: z17.string().nullish()
3070
3199
  })
3071
3200
  }),
3072
- z16.object({
3073
- type: z16.literal("response.output_item.added"),
3074
- output_index: z16.number(),
3075
- item: z16.discriminatedUnion("type", [
3076
- z16.object({
3077
- type: z16.literal("message"),
3078
- id: z16.string(),
3079
- phase: z16.enum(["commentary", "final_answer"]).nullish()
3201
+ z17.object({
3202
+ type: z17.literal("response.output_item.added"),
3203
+ output_index: z17.number(),
3204
+ item: z17.discriminatedUnion("type", [
3205
+ z17.object({
3206
+ type: z17.literal("message"),
3207
+ id: z17.string(),
3208
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3080
3209
  }),
3081
- z16.object({
3082
- type: z16.literal("reasoning"),
3083
- id: z16.string(),
3084
- encrypted_content: z16.string().nullish()
3210
+ z17.object({
3211
+ type: z17.literal("reasoning"),
3212
+ id: z17.string(),
3213
+ encrypted_content: z17.string().nullish()
3085
3214
  }),
3086
- z16.object({
3087
- type: z16.literal("function_call"),
3088
- id: z16.string(),
3089
- call_id: z16.string(),
3090
- name: z16.string(),
3091
- arguments: z16.string(),
3092
- async: z16.boolean().nullish()
3215
+ z17.object({
3216
+ type: z17.literal("function_call"),
3217
+ id: z17.string(),
3218
+ call_id: z17.string(),
3219
+ name: z17.string(),
3220
+ arguments: z17.string(),
3221
+ async: z17.boolean().nullish()
3093
3222
  }),
3094
- z16.object({
3095
- type: z16.literal("web_search_call"),
3096
- id: z16.string(),
3097
- status: z16.string()
3223
+ z17.object({
3224
+ type: z17.literal("web_search_call"),
3225
+ id: z17.string(),
3226
+ status: z17.string()
3098
3227
  }),
3099
- z16.object({
3100
- type: z16.literal("computer_call"),
3101
- id: z16.string(),
3102
- status: z16.string()
3228
+ z17.object({
3229
+ type: z17.literal("computer_call"),
3230
+ id: z17.string(),
3231
+ status: z17.string()
3103
3232
  }),
3104
- z16.object({
3105
- type: z16.literal("file_search_call"),
3106
- id: z16.string()
3233
+ z17.object({
3234
+ type: z17.literal("file_search_call"),
3235
+ id: z17.string()
3107
3236
  }),
3108
- z16.object({
3109
- type: z16.literal("image_generation_call"),
3110
- id: z16.string()
3237
+ z17.object({
3238
+ type: z17.literal("image_generation_call"),
3239
+ id: z17.string()
3111
3240
  }),
3112
- z16.object({
3113
- type: z16.literal("code_interpreter_call"),
3114
- id: z16.string(),
3115
- container_id: z16.string(),
3116
- code: z16.string().nullable(),
3117
- outputs: z16.array(
3118
- z16.discriminatedUnion("type", [
3119
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3120
- z16.object({ type: z16.literal("image"), url: z16.string() })
3241
+ z17.object({
3242
+ type: z17.literal("code_interpreter_call"),
3243
+ id: z17.string(),
3244
+ container_id: z17.string(),
3245
+ code: z17.string().nullable(),
3246
+ outputs: z17.array(
3247
+ z17.discriminatedUnion("type", [
3248
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3249
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3121
3250
  ])
3122
3251
  ).nullable(),
3123
- status: z16.string()
3252
+ status: z17.string()
3124
3253
  })
3125
3254
  ])
3126
3255
  }),
3127
- z16.object({
3128
- type: z16.literal("response.output_item.done"),
3129
- output_index: z16.number(),
3130
- item: z16.discriminatedUnion("type", [
3131
- z16.object({
3132
- type: z16.literal("message"),
3133
- id: z16.string(),
3134
- phase: z16.enum(["commentary", "final_answer"]).nullish()
3256
+ z17.object({
3257
+ type: z17.literal("response.output_item.done"),
3258
+ output_index: z17.number(),
3259
+ item: z17.discriminatedUnion("type", [
3260
+ z17.object({
3261
+ type: z17.literal("message"),
3262
+ id: z17.string(),
3263
+ phase: z17.enum(["commentary", "final_answer"]).nullish()
3135
3264
  }),
3136
- z16.object({
3137
- type: z16.literal("reasoning"),
3138
- id: z16.string(),
3139
- encrypted_content: z16.string().nullish()
3265
+ z17.object({
3266
+ type: z17.literal("reasoning"),
3267
+ id: z17.string(),
3268
+ encrypted_content: z17.string().nullish()
3140
3269
  }),
3141
- z16.object({
3142
- type: z16.literal("function_call"),
3143
- id: z16.string(),
3144
- call_id: z16.string(),
3145
- name: z16.string(),
3146
- arguments: z16.string(),
3147
- async: z16.boolean().nullish(),
3148
- status: z16.enum(["in_progress", "completed", "incomplete"])
3270
+ z17.object({
3271
+ type: z17.literal("function_call"),
3272
+ id: z17.string(),
3273
+ call_id: z17.string(),
3274
+ name: z17.string(),
3275
+ arguments: z17.string(),
3276
+ async: z17.boolean().nullish(),
3277
+ status: z17.enum(["in_progress", "completed", "incomplete"])
3149
3278
  }),
3150
- z16.object({
3151
- type: z16.literal("code_interpreter_call"),
3152
- id: z16.string(),
3153
- code: z16.string().nullable(),
3154
- container_id: z16.string(),
3155
- outputs: z16.array(
3156
- z16.discriminatedUnion("type", [
3157
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3158
- z16.object({ type: z16.literal("image"), url: z16.string() })
3279
+ z17.object({
3280
+ type: z17.literal("code_interpreter_call"),
3281
+ id: z17.string(),
3282
+ code: z17.string().nullable(),
3283
+ container_id: z17.string(),
3284
+ outputs: z17.array(
3285
+ z17.discriminatedUnion("type", [
3286
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3287
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3159
3288
  ])
3160
3289
  ).nullable()
3161
3290
  }),
3162
- z16.object({
3163
- type: z16.literal("image_generation_call"),
3164
- id: z16.string(),
3165
- result: z16.string()
3291
+ z17.object({
3292
+ type: z17.literal("image_generation_call"),
3293
+ id: z17.string(),
3294
+ result: z17.string()
3166
3295
  }),
3167
- z16.object({
3168
- type: z16.literal("web_search_call"),
3169
- id: z16.string(),
3170
- status: z16.string(),
3171
- action: z16.discriminatedUnion("type", [
3172
- z16.object({
3173
- type: z16.literal("search"),
3174
- query: z16.string().nullish(),
3175
- sources: z16.array(
3176
- z16.discriminatedUnion("type", [
3177
- z16.object({ type: z16.literal("url"), url: z16.string() }),
3178
- z16.object({ type: z16.literal("api"), name: z16.string() })
3296
+ z17.object({
3297
+ type: z17.literal("web_search_call"),
3298
+ id: z17.string(),
3299
+ status: z17.string(),
3300
+ action: z17.discriminatedUnion("type", [
3301
+ z17.object({
3302
+ type: z17.literal("search"),
3303
+ query: z17.string().nullish(),
3304
+ sources: z17.array(
3305
+ z17.discriminatedUnion("type", [
3306
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3307
+ z17.object({ type: z17.literal("api"), name: z17.string() })
3179
3308
  ])
3180
3309
  ).nullish()
3181
3310
  }),
3182
- z16.object({
3183
- type: z16.literal("open_page"),
3184
- url: z16.string().nullish()
3311
+ z17.object({
3312
+ type: z17.literal("open_page"),
3313
+ url: z17.string().nullish()
3185
3314
  }),
3186
- z16.object({
3187
- type: z16.literal("find_in_page"),
3188
- url: z16.string().nullish(),
3189
- pattern: z16.string().nullish()
3315
+ z17.object({
3316
+ type: z17.literal("find_in_page"),
3317
+ url: z17.string().nullish(),
3318
+ pattern: z17.string().nullish()
3190
3319
  })
3191
3320
  ]).nullish()
3192
3321
  }),
3193
- z16.object({
3194
- type: z16.literal("file_search_call"),
3195
- id: z16.string(),
3196
- queries: z16.array(z16.string()),
3197
- results: z16.array(
3198
- z16.object({
3199
- attributes: z16.record(z16.string(), z16.unknown()),
3200
- file_id: z16.string(),
3201
- filename: z16.string(),
3202
- score: z16.number(),
3203
- text: z16.string()
3322
+ z17.object({
3323
+ type: z17.literal("file_search_call"),
3324
+ id: z17.string(),
3325
+ queries: z17.array(z17.string()),
3326
+ results: z17.array(
3327
+ z17.object({
3328
+ attributes: z17.record(z17.string(), z17.unknown()),
3329
+ file_id: z17.string(),
3330
+ filename: z17.string(),
3331
+ score: z17.number(),
3332
+ text: z17.string()
3204
3333
  })
3205
3334
  ).nullish()
3206
3335
  }),
3207
- z16.object({
3208
- type: z16.literal("local_shell_call"),
3209
- id: z16.string(),
3210
- call_id: z16.string(),
3211
- action: z16.object({
3212
- type: z16.literal("exec"),
3213
- command: z16.array(z16.string()),
3214
- timeout_ms: z16.number().optional(),
3215
- user: z16.string().optional(),
3216
- working_directory: z16.string().optional(),
3217
- env: z16.record(z16.string(), z16.string()).optional()
3336
+ z17.object({
3337
+ type: z17.literal("local_shell_call"),
3338
+ id: z17.string(),
3339
+ call_id: z17.string(),
3340
+ action: z17.object({
3341
+ type: z17.literal("exec"),
3342
+ command: z17.array(z17.string()),
3343
+ timeout_ms: z17.number().optional(),
3344
+ user: z17.string().optional(),
3345
+ working_directory: z17.string().optional(),
3346
+ env: z17.record(z17.string(), z17.string()).optional()
3218
3347
  })
3219
3348
  }),
3220
- z16.object({
3221
- type: z16.literal("computer_call"),
3222
- id: z16.string(),
3223
- status: z16.literal("completed")
3349
+ z17.object({
3350
+ type: z17.literal("computer_call"),
3351
+ id: z17.string(),
3352
+ status: z17.literal("completed")
3224
3353
  })
3225
3354
  ])
3226
3355
  }),
3227
- z16.object({
3228
- type: z16.literal("response.function_call_arguments.delta"),
3229
- item_id: z16.string(),
3230
- output_index: z16.number(),
3231
- delta: z16.string()
3356
+ z17.object({
3357
+ type: z17.literal("response.function_call_arguments.delta"),
3358
+ item_id: z17.string(),
3359
+ output_index: z17.number(),
3360
+ delta: z17.string()
3232
3361
  }),
3233
- z16.object({
3234
- type: z16.literal("response.image_generation_call.partial_image"),
3235
- item_id: z16.string(),
3236
- output_index: z16.number(),
3237
- partial_image_b64: z16.string()
3362
+ z17.object({
3363
+ type: z17.literal("response.image_generation_call.partial_image"),
3364
+ item_id: z17.string(),
3365
+ output_index: z17.number(),
3366
+ partial_image_b64: z17.string()
3238
3367
  }),
3239
- z16.object({
3240
- type: z16.literal("response.code_interpreter_call_code.delta"),
3241
- item_id: z16.string(),
3242
- output_index: z16.number(),
3243
- delta: z16.string()
3368
+ z17.object({
3369
+ type: z17.literal("response.code_interpreter_call_code.delta"),
3370
+ item_id: z17.string(),
3371
+ output_index: z17.number(),
3372
+ delta: z17.string()
3244
3373
  }),
3245
- z16.object({
3246
- type: z16.literal("response.code_interpreter_call_code.done"),
3247
- item_id: z16.string(),
3248
- output_index: z16.number(),
3249
- code: z16.string()
3374
+ z17.object({
3375
+ type: z17.literal("response.code_interpreter_call_code.done"),
3376
+ item_id: z17.string(),
3377
+ output_index: z17.number(),
3378
+ code: z17.string()
3250
3379
  }),
3251
- z16.object({
3252
- type: z16.literal("response.output_text.annotation.added"),
3253
- annotation: z16.discriminatedUnion("type", [
3254
- z16.object({
3255
- type: z16.literal("url_citation"),
3256
- start_index: z16.number(),
3257
- end_index: z16.number(),
3258
- url: z16.string(),
3259
- title: z16.string()
3380
+ z17.object({
3381
+ type: z17.literal("response.output_text.annotation.added"),
3382
+ annotation: z17.discriminatedUnion("type", [
3383
+ z17.object({
3384
+ type: z17.literal("url_citation"),
3385
+ start_index: z17.number(),
3386
+ end_index: z17.number(),
3387
+ url: z17.string(),
3388
+ title: z17.string()
3260
3389
  }),
3261
- z16.object({
3262
- type: z16.literal("file_citation"),
3263
- file_id: z16.string(),
3264
- filename: z16.string().nullish(),
3265
- index: z16.number().nullish(),
3266
- start_index: z16.number().nullish(),
3267
- end_index: z16.number().nullish(),
3268
- quote: z16.string().nullish()
3390
+ z17.object({
3391
+ type: z17.literal("file_citation"),
3392
+ file_id: z17.string(),
3393
+ filename: z17.string().nullish(),
3394
+ index: z17.number().nullish(),
3395
+ start_index: z17.number().nullish(),
3396
+ end_index: z17.number().nullish(),
3397
+ quote: z17.string().nullish()
3269
3398
  })
3270
3399
  ])
3271
3400
  }),
3272
- z16.object({
3273
- type: z16.literal("response.reasoning_summary_part.added"),
3274
- item_id: z16.string(),
3275
- summary_index: z16.number()
3401
+ z17.object({
3402
+ type: z17.literal("response.reasoning_summary_part.added"),
3403
+ item_id: z17.string(),
3404
+ summary_index: z17.number()
3276
3405
  }),
3277
- z16.object({
3278
- type: z16.literal("response.reasoning_summary_text.delta"),
3279
- item_id: z16.string(),
3280
- summary_index: z16.number(),
3281
- delta: z16.string()
3406
+ z17.object({
3407
+ type: z17.literal("response.reasoning_summary_text.delta"),
3408
+ item_id: z17.string(),
3409
+ summary_index: z17.number(),
3410
+ delta: z17.string()
3282
3411
  }),
3283
- z16.object({
3284
- type: z16.literal("response.reasoning_summary_part.done"),
3285
- item_id: z16.string(),
3286
- summary_index: z16.number()
3412
+ z17.object({
3413
+ type: z17.literal("response.reasoning_summary_part.done"),
3414
+ item_id: z17.string(),
3415
+ summary_index: z17.number()
3287
3416
  }),
3288
- z16.object({
3289
- type: z16.literal("error"),
3290
- sequence_number: z16.number(),
3291
- error: z16.object({
3292
- type: z16.string(),
3293
- code: z16.string(),
3294
- message: z16.string(),
3295
- param: z16.string().nullish()
3417
+ z17.object({
3418
+ type: z17.literal("error"),
3419
+ sequence_number: z17.number(),
3420
+ error: z17.object({
3421
+ type: z17.string(),
3422
+ code: z17.string(),
3423
+ message: z17.string(),
3424
+ param: z17.string().nullish()
3296
3425
  })
3297
3426
  }),
3298
- z16.object({ type: z16.string() }).loose().transform((value) => ({
3427
+ z17.object({ type: z17.string() }).loose().transform((value) => ({
3299
3428
  type: "unknown_chunk",
3300
3429
  message: value.type
3301
3430
  }))
@@ -3304,196 +3433,196 @@ var openaiResponsesChunkSchema = lazyValidator13(
3304
3433
  )
3305
3434
  );
3306
3435
  var openaiResponsesResponseSchema = lazyValidator13(
3307
- () => zodSchema14(
3308
- z16.object({
3309
- id: z16.string().optional(),
3310
- created_at: z16.number().optional(),
3311
- error: z16.object({
3312
- message: z16.string(),
3313
- type: z16.string(),
3314
- param: z16.string().nullish(),
3315
- code: z16.string()
3436
+ () => zodSchema15(
3437
+ z17.object({
3438
+ id: z17.string().optional(),
3439
+ created_at: z17.number().optional(),
3440
+ error: z17.object({
3441
+ message: z17.string(),
3442
+ type: z17.string(),
3443
+ param: z17.string().nullish(),
3444
+ code: z17.string()
3316
3445
  }).nullish(),
3317
- model: z16.string().optional(),
3318
- output: z16.array(
3319
- z16.discriminatedUnion("type", [
3320
- z16.object({
3321
- type: z16.literal("message"),
3322
- role: z16.literal("assistant"),
3323
- id: z16.string(),
3324
- phase: z16.enum(["commentary", "final_answer"]).nullish(),
3325
- content: z16.array(
3326
- z16.object({
3327
- type: z16.literal("output_text"),
3328
- text: z16.string(),
3329
- logprobs: z16.array(
3330
- z16.object({
3331
- token: z16.string(),
3332
- logprob: z16.number(),
3333
- top_logprobs: z16.array(
3334
- z16.object({
3335
- token: z16.string(),
3336
- logprob: z16.number()
3446
+ model: z17.string().optional(),
3447
+ output: z17.array(
3448
+ z17.discriminatedUnion("type", [
3449
+ z17.object({
3450
+ type: z17.literal("message"),
3451
+ role: z17.literal("assistant"),
3452
+ id: z17.string(),
3453
+ phase: z17.enum(["commentary", "final_answer"]).nullish(),
3454
+ content: z17.array(
3455
+ z17.object({
3456
+ type: z17.literal("output_text"),
3457
+ text: z17.string(),
3458
+ logprobs: z17.array(
3459
+ z17.object({
3460
+ token: z17.string(),
3461
+ logprob: z17.number(),
3462
+ top_logprobs: z17.array(
3463
+ z17.object({
3464
+ token: z17.string(),
3465
+ logprob: z17.number()
3337
3466
  })
3338
3467
  )
3339
3468
  })
3340
3469
  ).nullish(),
3341
- annotations: z16.array(
3342
- z16.discriminatedUnion("type", [
3343
- z16.object({
3344
- type: z16.literal("url_citation"),
3345
- start_index: z16.number(),
3346
- end_index: z16.number(),
3347
- url: z16.string(),
3348
- title: z16.string()
3470
+ annotations: z17.array(
3471
+ z17.discriminatedUnion("type", [
3472
+ z17.object({
3473
+ type: z17.literal("url_citation"),
3474
+ start_index: z17.number(),
3475
+ end_index: z17.number(),
3476
+ url: z17.string(),
3477
+ title: z17.string()
3349
3478
  }),
3350
- z16.object({
3351
- type: z16.literal("file_citation"),
3352
- file_id: z16.string(),
3353
- filename: z16.string().nullish(),
3354
- index: z16.number().nullish(),
3355
- start_index: z16.number().nullish(),
3356
- end_index: z16.number().nullish(),
3357
- quote: z16.string().nullish()
3479
+ z17.object({
3480
+ type: z17.literal("file_citation"),
3481
+ file_id: z17.string(),
3482
+ filename: z17.string().nullish(),
3483
+ index: z17.number().nullish(),
3484
+ start_index: z17.number().nullish(),
3485
+ end_index: z17.number().nullish(),
3486
+ quote: z17.string().nullish()
3358
3487
  }),
3359
- z16.object({
3360
- type: z16.literal("container_file_citation"),
3361
- container_id: z16.string(),
3362
- file_id: z16.string(),
3363
- filename: z16.string().nullish(),
3364
- start_index: z16.number().nullish(),
3365
- end_index: z16.number().nullish(),
3366
- index: z16.number().nullish()
3488
+ z17.object({
3489
+ type: z17.literal("container_file_citation"),
3490
+ container_id: z17.string(),
3491
+ file_id: z17.string(),
3492
+ filename: z17.string().nullish(),
3493
+ start_index: z17.number().nullish(),
3494
+ end_index: z17.number().nullish(),
3495
+ index: z17.number().nullish()
3367
3496
  }),
3368
- z16.object({
3369
- type: z16.literal("file_path"),
3370
- file_id: z16.string(),
3371
- index: z16.number().nullish()
3497
+ z17.object({
3498
+ type: z17.literal("file_path"),
3499
+ file_id: z17.string(),
3500
+ index: z17.number().nullish()
3372
3501
  })
3373
3502
  ])
3374
3503
  )
3375
3504
  })
3376
3505
  )
3377
3506
  }),
3378
- z16.object({
3379
- type: z16.literal("web_search_call"),
3380
- id: z16.string(),
3381
- status: z16.string(),
3382
- action: z16.discriminatedUnion("type", [
3383
- z16.object({
3384
- type: z16.literal("search"),
3385
- query: z16.string().nullish(),
3386
- sources: z16.array(
3387
- z16.discriminatedUnion("type", [
3388
- z16.object({ type: z16.literal("url"), url: z16.string() }),
3389
- z16.object({
3390
- type: z16.literal("api"),
3391
- name: z16.string()
3507
+ z17.object({
3508
+ type: z17.literal("web_search_call"),
3509
+ id: z17.string(),
3510
+ status: z17.string(),
3511
+ action: z17.discriminatedUnion("type", [
3512
+ z17.object({
3513
+ type: z17.literal("search"),
3514
+ query: z17.string().nullish(),
3515
+ sources: z17.array(
3516
+ z17.discriminatedUnion("type", [
3517
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
3518
+ z17.object({
3519
+ type: z17.literal("api"),
3520
+ name: z17.string()
3392
3521
  })
3393
3522
  ])
3394
3523
  ).nullish()
3395
3524
  }),
3396
- z16.object({
3397
- type: z16.literal("open_page"),
3398
- url: z16.string().nullish()
3525
+ z17.object({
3526
+ type: z17.literal("open_page"),
3527
+ url: z17.string().nullish()
3399
3528
  }),
3400
- z16.object({
3401
- type: z16.literal("find_in_page"),
3402
- url: z16.string().nullish(),
3403
- pattern: z16.string().nullish()
3529
+ z17.object({
3530
+ type: z17.literal("find_in_page"),
3531
+ url: z17.string().nullish(),
3532
+ pattern: z17.string().nullish()
3404
3533
  })
3405
3534
  ]).nullish()
3406
3535
  }),
3407
- z16.object({
3408
- type: z16.literal("file_search_call"),
3409
- id: z16.string(),
3410
- queries: z16.array(z16.string()),
3411
- results: z16.array(
3412
- z16.object({
3413
- attributes: z16.record(
3414
- z16.string(),
3415
- z16.union([z16.string(), z16.number(), z16.boolean()])
3536
+ z17.object({
3537
+ type: z17.literal("file_search_call"),
3538
+ id: z17.string(),
3539
+ queries: z17.array(z17.string()),
3540
+ results: z17.array(
3541
+ z17.object({
3542
+ attributes: z17.record(
3543
+ z17.string(),
3544
+ z17.union([z17.string(), z17.number(), z17.boolean()])
3416
3545
  ),
3417
- file_id: z16.string(),
3418
- filename: z16.string(),
3419
- score: z16.number(),
3420
- text: z16.string()
3546
+ file_id: z17.string(),
3547
+ filename: z17.string(),
3548
+ score: z17.number(),
3549
+ text: z17.string()
3421
3550
  })
3422
3551
  ).nullish()
3423
3552
  }),
3424
- z16.object({
3425
- type: z16.literal("code_interpreter_call"),
3426
- id: z16.string(),
3427
- code: z16.string().nullable(),
3428
- container_id: z16.string(),
3429
- outputs: z16.array(
3430
- z16.discriminatedUnion("type", [
3431
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3432
- z16.object({ type: z16.literal("image"), url: z16.string() })
3553
+ z17.object({
3554
+ type: z17.literal("code_interpreter_call"),
3555
+ id: z17.string(),
3556
+ code: z17.string().nullable(),
3557
+ container_id: z17.string(),
3558
+ outputs: z17.array(
3559
+ z17.discriminatedUnion("type", [
3560
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3561
+ z17.object({ type: z17.literal("image"), url: z17.string() })
3433
3562
  ])
3434
3563
  ).nullable()
3435
3564
  }),
3436
- z16.object({
3437
- type: z16.literal("image_generation_call"),
3438
- id: z16.string(),
3439
- result: z16.string()
3565
+ z17.object({
3566
+ type: z17.literal("image_generation_call"),
3567
+ id: z17.string(),
3568
+ result: z17.string()
3440
3569
  }),
3441
- z16.object({
3442
- type: z16.literal("local_shell_call"),
3443
- id: z16.string(),
3444
- call_id: z16.string(),
3445
- action: z16.object({
3446
- type: z16.literal("exec"),
3447
- command: z16.array(z16.string()),
3448
- timeout_ms: z16.number().optional(),
3449
- user: z16.string().optional(),
3450
- working_directory: z16.string().optional(),
3451
- env: z16.record(z16.string(), z16.string()).optional()
3570
+ z17.object({
3571
+ type: z17.literal("local_shell_call"),
3572
+ id: z17.string(),
3573
+ call_id: z17.string(),
3574
+ action: z17.object({
3575
+ type: z17.literal("exec"),
3576
+ command: z17.array(z17.string()),
3577
+ timeout_ms: z17.number().optional(),
3578
+ user: z17.string().optional(),
3579
+ working_directory: z17.string().optional(),
3580
+ env: z17.record(z17.string(), z17.string()).optional()
3452
3581
  })
3453
3582
  }),
3454
- z16.object({
3455
- type: z16.literal("function_call"),
3456
- call_id: z16.string(),
3457
- name: z16.string(),
3458
- arguments: z16.string(),
3459
- id: z16.string(),
3460
- async: z16.boolean().nullish()
3583
+ z17.object({
3584
+ type: z17.literal("function_call"),
3585
+ call_id: z17.string(),
3586
+ name: z17.string(),
3587
+ arguments: z17.string(),
3588
+ id: z17.string(),
3589
+ async: z17.boolean().nullish()
3461
3590
  }),
3462
- z16.object({
3463
- type: z16.literal("computer_call"),
3464
- id: z16.string(),
3465
- status: z16.string().optional()
3591
+ z17.object({
3592
+ type: z17.literal("computer_call"),
3593
+ id: z17.string(),
3594
+ status: z17.string().optional()
3466
3595
  }),
3467
- z16.object({
3468
- type: z16.literal("reasoning"),
3469
- id: z16.string(),
3470
- encrypted_content: z16.string().nullish(),
3471
- summary: z16.array(
3472
- z16.object({
3473
- type: z16.literal("summary_text"),
3474
- text: z16.string()
3596
+ z17.object({
3597
+ type: z17.literal("reasoning"),
3598
+ id: z17.string(),
3599
+ encrypted_content: z17.string().nullish(),
3600
+ summary: z17.array(
3601
+ z17.object({
3602
+ type: z17.literal("summary_text"),
3603
+ text: z17.string()
3475
3604
  })
3476
3605
  )
3477
3606
  })
3478
3607
  ])
3479
3608
  ).optional(),
3480
- service_tier: z16.string().nullish(),
3481
- reasoning: z16.object({
3482
- context: z16.string().nullish()
3609
+ service_tier: z17.string().nullish(),
3610
+ reasoning: z17.object({
3611
+ context: z17.string().nullish()
3483
3612
  }).nullish(),
3484
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3485
- usage: z16.object({
3486
- input_tokens: z16.number(),
3487
- input_tokens_details: z16.object({
3488
- cached_tokens: z16.number().nullish(),
3489
- cache_write_tokens: z16.number().nullish(),
3490
- orchestration_input_tokens: z16.number().nullish(),
3491
- orchestration_input_cached_tokens: z16.number().nullish()
3613
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3614
+ usage: z17.object({
3615
+ input_tokens: z17.number(),
3616
+ input_tokens_details: z17.object({
3617
+ cached_tokens: z17.number().nullish(),
3618
+ cache_write_tokens: z17.number().nullish(),
3619
+ orchestration_input_tokens: z17.number().nullish(),
3620
+ orchestration_input_cached_tokens: z17.number().nullish()
3492
3621
  }).nullish(),
3493
- output_tokens: z16.number(),
3494
- output_tokens_details: z16.object({
3495
- reasoning_tokens: z16.number().nullish(),
3496
- orchestration_output_tokens: z16.number().nullish()
3622
+ output_tokens: z17.number(),
3623
+ output_tokens_details: z17.object({
3624
+ reasoning_tokens: z17.number().nullish(),
3625
+ orchestration_output_tokens: z17.number().nullish()
3497
3626
  }).nullish()
3498
3627
  }).optional()
3499
3628
  })
@@ -3507,44 +3636,44 @@ import {
3507
3636
 
3508
3637
  // src/tool/code-interpreter.ts
3509
3638
  import {
3510
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
3511
- lazySchema as lazySchema2,
3512
- zodSchema as zodSchema15
3639
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
3640
+ lazySchema as lazySchema3,
3641
+ zodSchema as zodSchema16
3513
3642
  } from "@ai-sdk/provider-utils";
3514
- import { z as z17 } from "zod/v4";
3515
- var codeInterpreterInputSchema = lazySchema2(
3516
- () => zodSchema15(
3517
- z17.object({
3518
- code: z17.string().nullish(),
3519
- containerId: z17.string()
3643
+ import { z as z18 } from "zod/v4";
3644
+ var codeInterpreterInputSchema = lazySchema3(
3645
+ () => zodSchema16(
3646
+ z18.object({
3647
+ code: z18.string().nullish(),
3648
+ containerId: z18.string()
3520
3649
  })
3521
3650
  )
3522
3651
  );
3523
- var codeInterpreterOutputSchema = lazySchema2(
3524
- () => zodSchema15(
3525
- z17.object({
3526
- outputs: z17.array(
3527
- z17.discriminatedUnion("type", [
3528
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3529
- z17.object({ type: z17.literal("image"), url: z17.string() })
3652
+ var codeInterpreterOutputSchema = lazySchema3(
3653
+ () => zodSchema16(
3654
+ z18.object({
3655
+ outputs: z18.array(
3656
+ z18.discriminatedUnion("type", [
3657
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3658
+ z18.object({ type: z18.literal("image"), url: z18.string() })
3530
3659
  ])
3531
3660
  ).nullish()
3532
3661
  })
3533
3662
  )
3534
3663
  );
3535
- var codeInterpreterArgsSchema = lazySchema2(
3536
- () => zodSchema15(
3537
- z17.object({
3538
- container: z17.union([
3539
- z17.string(),
3540
- z17.object({
3541
- fileIds: z17.array(z17.string()).optional()
3664
+ var codeInterpreterArgsSchema = lazySchema3(
3665
+ () => zodSchema16(
3666
+ z18.object({
3667
+ container: z18.union([
3668
+ z18.string(),
3669
+ z18.object({
3670
+ fileIds: z18.array(z18.string()).optional()
3542
3671
  })
3543
3672
  ]).optional()
3544
3673
  })
3545
3674
  )
3546
3675
  );
3547
- var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
3676
+ var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
3548
3677
  id: "openai.code_interpreter",
3549
3678
  name: "code_interpreter",
3550
3679
  inputSchema: codeInterpreterInputSchema,
@@ -3555,120 +3684,58 @@ var codeInterpreter = (args = {}) => {
3555
3684
  };
3556
3685
 
3557
3686
  // src/tool/file-search.ts
3558
- import {
3559
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
3560
- lazySchema as lazySchema3,
3561
- zodSchema as zodSchema16
3562
- } from "@ai-sdk/provider-utils";
3563
- import { z as z18 } from "zod/v4";
3564
- var comparisonFilterSchema = z18.object({
3565
- key: z18.string(),
3566
- type: z18.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
3567
- value: z18.union([z18.string(), z18.number(), z18.boolean(), z18.array(z18.string())])
3568
- });
3569
- var compoundFilterSchema = z18.object({
3570
- type: z18.enum(["and", "or"]),
3571
- filters: z18.array(
3572
- z18.union([comparisonFilterSchema, z18.lazy(() => compoundFilterSchema)])
3573
- )
3574
- });
3575
- var fileSearchArgsSchema = lazySchema3(
3576
- () => zodSchema16(
3577
- z18.object({
3578
- vectorStoreIds: z18.array(z18.string()),
3579
- maxNumResults: z18.number().optional(),
3580
- ranking: z18.object({
3581
- ranker: z18.string().optional(),
3582
- scoreThreshold: z18.number().optional()
3583
- }).optional(),
3584
- filters: z18.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3585
- })
3586
- )
3587
- );
3588
- var fileSearchOutputSchema = lazySchema3(
3589
- () => zodSchema16(
3590
- z18.object({
3591
- queries: z18.array(z18.string()),
3592
- results: z18.array(
3593
- z18.object({
3594
- attributes: z18.record(z18.string(), z18.unknown()),
3595
- fileId: z18.string(),
3596
- filename: z18.string(),
3597
- score: z18.number(),
3598
- text: z18.string()
3599
- })
3600
- ).nullable()
3601
- })
3602
- )
3603
- );
3604
- var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
3605
- id: "openai.file_search",
3606
- name: "file_search",
3607
- inputSchema: z18.object({}),
3608
- outputSchema: fileSearchOutputSchema
3609
- });
3610
-
3611
- // src/tool/web-search.ts
3612
3687
  import {
3613
3688
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
3614
3689
  lazySchema as lazySchema4,
3615
3690
  zodSchema as zodSchema17
3616
3691
  } from "@ai-sdk/provider-utils";
3617
3692
  import { z as z19 } from "zod/v4";
3618
- var webSearchArgsSchema = lazySchema4(
3693
+ var comparisonFilterSchema = z19.object({
3694
+ key: z19.string(),
3695
+ type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
3696
+ value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
3697
+ });
3698
+ var compoundFilterSchema = z19.object({
3699
+ type: z19.enum(["and", "or"]),
3700
+ filters: z19.array(
3701
+ z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
3702
+ )
3703
+ });
3704
+ var fileSearchArgsSchema = lazySchema4(
3619
3705
  () => zodSchema17(
3620
3706
  z19.object({
3621
- externalWebAccess: z19.boolean().optional(),
3622
- filters: z19.object({
3623
- allowedDomains: z19.array(z19.string()).optional(),
3624
- blockedDomains: z19.array(z19.string()).optional()
3707
+ vectorStoreIds: z19.array(z19.string()),
3708
+ maxNumResults: z19.number().optional(),
3709
+ ranking: z19.object({
3710
+ ranker: z19.string().optional(),
3711
+ scoreThreshold: z19.number().optional()
3625
3712
  }).optional(),
3626
- searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
3627
- userLocation: z19.object({
3628
- type: z19.literal("approximate"),
3629
- country: z19.string().optional(),
3630
- city: z19.string().optional(),
3631
- region: z19.string().optional(),
3632
- timezone: z19.string().optional()
3633
- }).optional()
3713
+ filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
3634
3714
  })
3635
3715
  )
3636
3716
  );
3637
- var webSearchInputSchema = lazySchema4(() => zodSchema17(z19.object({})));
3638
- var webSearchOutputSchema = lazySchema4(
3717
+ var fileSearchOutputSchema = lazySchema4(
3639
3718
  () => zodSchema17(
3640
3719
  z19.object({
3641
- action: z19.discriminatedUnion("type", [
3642
- z19.object({
3643
- type: z19.literal("search"),
3644
- query: z19.string().optional()
3645
- }),
3646
- z19.object({
3647
- type: z19.literal("openPage"),
3648
- url: z19.string().nullish()
3649
- }),
3720
+ queries: z19.array(z19.string()),
3721
+ results: z19.array(
3650
3722
  z19.object({
3651
- type: z19.literal("findInPage"),
3652
- url: z19.string().nullish(),
3653
- pattern: z19.string().nullish()
3723
+ attributes: z19.record(z19.string(), z19.unknown()),
3724
+ fileId: z19.string(),
3725
+ filename: z19.string(),
3726
+ score: z19.number(),
3727
+ text: z19.string()
3654
3728
  })
3655
- ]).optional(),
3656
- sources: z19.array(
3657
- z19.discriminatedUnion("type", [
3658
- z19.object({ type: z19.literal("url"), url: z19.string() }),
3659
- z19.object({ type: z19.literal("api"), name: z19.string() })
3660
- ])
3661
- ).optional()
3729
+ ).nullable()
3662
3730
  })
3663
3731
  )
3664
3732
  );
3665
- var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
3666
- id: "openai.web_search",
3667
- name: "web_search",
3668
- inputSchema: webSearchInputSchema,
3669
- outputSchema: webSearchOutputSchema
3733
+ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema4({
3734
+ id: "openai.file_search",
3735
+ name: "file_search",
3736
+ inputSchema: z19.object({}),
3737
+ outputSchema: fileSearchOutputSchema
3670
3738
  });
3671
- var webSearch = (args = {}) => webSearchToolFactory(args);
3672
3739
 
3673
3740
  // src/tool/web-search-preview.ts
3674
3741
  import {
@@ -4013,6 +4080,9 @@ var OpenAIResponsesLanguageModel = class {
4013
4080
  modelCapabilities,
4014
4081
  options: openaiOptions
4015
4082
  });
4083
+ const webSearchToolName = (_a2 = tools == null ? void 0 : tools.find(
4084
+ (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4085
+ )) == null ? void 0 : _a2.name;
4016
4086
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
4017
4087
  prompt,
4018
4088
  configurationUpdateUnsupportedReason,
@@ -4020,8 +4090,9 @@ var OpenAIResponsesLanguageModel = class {
4020
4090
  systemMessageMode: modelCapabilities.systemMessageMode,
4021
4091
  explicitMessageItemType: this.config.explicitMessageItemType,
4022
4092
  fileIdPrefixes: this.config.fileIdPrefixes,
4023
- store: (_a2 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a2 : true,
4024
- hasLocalShellTool: hasOpenAITool("openai.local_shell")
4093
+ store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
4094
+ hasLocalShellTool: hasOpenAITool("openai.local_shell"),
4095
+ webSearchToolName
4025
4096
  });
4026
4097
  warnings.push(...inputWarnings);
4027
4098
  let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
@@ -4058,7 +4129,7 @@ var OpenAIResponsesLanguageModel = class {
4058
4129
  });
4059
4130
  }
4060
4131
  }
4061
- const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
4132
+ const strictJsonSchema = (_c = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _c : false;
4062
4133
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
4063
4134
  function addInclude(key) {
4064
4135
  if (include == null) {
@@ -4076,9 +4147,6 @@ var OpenAIResponsesLanguageModel = class {
4076
4147
  if (topLogprobs) {
4077
4148
  addInclude("message.output_text.logprobs");
4078
4149
  }
4079
- const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
4080
- (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4081
- )) == null ? void 0 : _c.name;
4082
4150
  if (webSearchToolName) {
4083
4151
  addInclude("web_search_call.action.sources");
4084
4152
  }