@ai-sdk/openai 3.0.36 → 3.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -43,7 +43,7 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
43
43
  function getOpenAILanguageModelCapabilities(modelId) {
44
44
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
45
45
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
46
- const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("codex-mini") || modelId.startsWith("computer-use-preview") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
46
+ const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
47
47
  const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
48
48
  const systemMessageMode = isReasoningModel ? "developer" : "system";
49
49
  return {
@@ -2066,48 +2066,80 @@ var codeInterpreter = (args = {}) => {
2066
2066
  return codeInterpreterToolFactory(args);
2067
2067
  };
2068
2068
 
2069
- // src/tool/file-search.ts
2069
+ // src/tool/custom.ts
2070
2070
  import {
2071
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2071
+ createProviderToolFactory,
2072
2072
  lazySchema as lazySchema10,
2073
2073
  zodSchema as zodSchema10
2074
2074
  } from "@ai-sdk/provider-utils";
2075
2075
  import { z as z11 } from "zod/v4";
2076
- var comparisonFilterSchema = z11.object({
2077
- key: z11.string(),
2078
- type: z11.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2079
- value: z11.union([z11.string(), z11.number(), z11.boolean(), z11.array(z11.string())])
2076
+ var customArgsSchema = lazySchema10(
2077
+ () => zodSchema10(
2078
+ z11.object({
2079
+ name: z11.string(),
2080
+ description: z11.string().optional(),
2081
+ format: z11.union([
2082
+ z11.object({
2083
+ type: z11.literal("grammar"),
2084
+ syntax: z11.enum(["regex", "lark"]),
2085
+ definition: z11.string()
2086
+ }),
2087
+ z11.object({
2088
+ type: z11.literal("text")
2089
+ })
2090
+ ]).optional()
2091
+ })
2092
+ )
2093
+ );
2094
+ var customInputSchema = lazySchema10(() => zodSchema10(z11.string()));
2095
+ var customToolFactory = createProviderToolFactory({
2096
+ id: "openai.custom",
2097
+ inputSchema: customInputSchema
2080
2098
  });
2081
- var compoundFilterSchema = z11.object({
2082
- type: z11.enum(["and", "or"]),
2083
- filters: z11.array(
2084
- z11.union([comparisonFilterSchema, z11.lazy(() => compoundFilterSchema)])
2099
+ var customTool = (args) => customToolFactory(args);
2100
+
2101
+ // src/tool/file-search.ts
2102
+ import {
2103
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2104
+ lazySchema as lazySchema11,
2105
+ zodSchema as zodSchema11
2106
+ } from "@ai-sdk/provider-utils";
2107
+ import { z as z12 } from "zod/v4";
2108
+ var comparisonFilterSchema = z12.object({
2109
+ key: z12.string(),
2110
+ type: z12.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2111
+ value: z12.union([z12.string(), z12.number(), z12.boolean(), z12.array(z12.string())])
2112
+ });
2113
+ var compoundFilterSchema = z12.object({
2114
+ type: z12.enum(["and", "or"]),
2115
+ filters: z12.array(
2116
+ z12.union([comparisonFilterSchema, z12.lazy(() => compoundFilterSchema)])
2085
2117
  )
2086
2118
  });
2087
- var fileSearchArgsSchema = lazySchema10(
2088
- () => zodSchema10(
2089
- z11.object({
2090
- vectorStoreIds: z11.array(z11.string()),
2091
- maxNumResults: z11.number().optional(),
2092
- ranking: z11.object({
2093
- ranker: z11.string().optional(),
2094
- scoreThreshold: z11.number().optional()
2119
+ var fileSearchArgsSchema = lazySchema11(
2120
+ () => zodSchema11(
2121
+ z12.object({
2122
+ vectorStoreIds: z12.array(z12.string()),
2123
+ maxNumResults: z12.number().optional(),
2124
+ ranking: z12.object({
2125
+ ranker: z12.string().optional(),
2126
+ scoreThreshold: z12.number().optional()
2095
2127
  }).optional(),
2096
- filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2128
+ filters: z12.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2097
2129
  })
2098
2130
  )
2099
2131
  );
2100
- var fileSearchOutputSchema = lazySchema10(
2101
- () => zodSchema10(
2102
- z11.object({
2103
- queries: z11.array(z11.string()),
2104
- results: z11.array(
2105
- z11.object({
2106
- attributes: z11.record(z11.string(), z11.unknown()),
2107
- fileId: z11.string(),
2108
- filename: z11.string(),
2109
- score: z11.number(),
2110
- text: z11.string()
2132
+ var fileSearchOutputSchema = lazySchema11(
2133
+ () => zodSchema11(
2134
+ z12.object({
2135
+ queries: z12.array(z12.string()),
2136
+ results: z12.array(
2137
+ z12.object({
2138
+ attributes: z12.record(z12.string(), z12.unknown()),
2139
+ fileId: z12.string(),
2140
+ filename: z12.string(),
2141
+ score: z12.number(),
2142
+ text: z12.string()
2111
2143
  })
2112
2144
  ).nullable()
2113
2145
  })
@@ -2115,39 +2147,39 @@ var fileSearchOutputSchema = lazySchema10(
2115
2147
  );
2116
2148
  var fileSearch = createProviderToolFactoryWithOutputSchema3({
2117
2149
  id: "openai.file_search",
2118
- inputSchema: z11.object({}),
2150
+ inputSchema: z12.object({}),
2119
2151
  outputSchema: fileSearchOutputSchema
2120
2152
  });
2121
2153
 
2122
2154
  // src/tool/image-generation.ts
2123
2155
  import {
2124
2156
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2125
- lazySchema as lazySchema11,
2126
- zodSchema as zodSchema11
2157
+ lazySchema as lazySchema12,
2158
+ zodSchema as zodSchema12
2127
2159
  } from "@ai-sdk/provider-utils";
2128
- import { z as z12 } from "zod/v4";
2129
- var imageGenerationArgsSchema = lazySchema11(
2130
- () => zodSchema11(
2131
- z12.object({
2132
- background: z12.enum(["auto", "opaque", "transparent"]).optional(),
2133
- inputFidelity: z12.enum(["low", "high"]).optional(),
2134
- inputImageMask: z12.object({
2135
- fileId: z12.string().optional(),
2136
- imageUrl: z12.string().optional()
2160
+ import { z as z13 } from "zod/v4";
2161
+ var imageGenerationArgsSchema = lazySchema12(
2162
+ () => zodSchema12(
2163
+ z13.object({
2164
+ background: z13.enum(["auto", "opaque", "transparent"]).optional(),
2165
+ inputFidelity: z13.enum(["low", "high"]).optional(),
2166
+ inputImageMask: z13.object({
2167
+ fileId: z13.string().optional(),
2168
+ imageUrl: z13.string().optional()
2137
2169
  }).optional(),
2138
- model: z12.string().optional(),
2139
- moderation: z12.enum(["auto"]).optional(),
2140
- outputCompression: z12.number().int().min(0).max(100).optional(),
2141
- outputFormat: z12.enum(["png", "jpeg", "webp"]).optional(),
2142
- partialImages: z12.number().int().min(0).max(3).optional(),
2143
- quality: z12.enum(["auto", "low", "medium", "high"]).optional(),
2144
- size: z12.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2170
+ model: z13.string().optional(),
2171
+ moderation: z13.enum(["auto"]).optional(),
2172
+ outputCompression: z13.number().int().min(0).max(100).optional(),
2173
+ outputFormat: z13.enum(["png", "jpeg", "webp"]).optional(),
2174
+ partialImages: z13.number().int().min(0).max(3).optional(),
2175
+ quality: z13.enum(["auto", "low", "medium", "high"]).optional(),
2176
+ size: z13.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2145
2177
  }).strict()
2146
2178
  )
2147
2179
  );
2148
- var imageGenerationInputSchema = lazySchema11(() => zodSchema11(z12.object({})));
2149
- var imageGenerationOutputSchema = lazySchema11(
2150
- () => zodSchema11(z12.object({ result: z12.string() }))
2180
+ var imageGenerationInputSchema = lazySchema12(() => zodSchema12(z13.object({})));
2181
+ var imageGenerationOutputSchema = lazySchema12(
2182
+ () => zodSchema12(z13.object({ result: z13.string() }))
2151
2183
  );
2152
2184
  var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
2153
2185
  id: "openai.image_generation",
@@ -2161,26 +2193,26 @@ var imageGeneration = (args = {}) => {
2161
2193
  // src/tool/local-shell.ts
2162
2194
  import {
2163
2195
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
2164
- lazySchema as lazySchema12,
2165
- zodSchema as zodSchema12
2196
+ lazySchema as lazySchema13,
2197
+ zodSchema as zodSchema13
2166
2198
  } from "@ai-sdk/provider-utils";
2167
- import { z as z13 } from "zod/v4";
2168
- var localShellInputSchema = lazySchema12(
2169
- () => zodSchema12(
2170
- z13.object({
2171
- action: z13.object({
2172
- type: z13.literal("exec"),
2173
- command: z13.array(z13.string()),
2174
- timeoutMs: z13.number().optional(),
2175
- user: z13.string().optional(),
2176
- workingDirectory: z13.string().optional(),
2177
- env: z13.record(z13.string(), z13.string()).optional()
2199
+ import { z as z14 } from "zod/v4";
2200
+ var localShellInputSchema = lazySchema13(
2201
+ () => zodSchema13(
2202
+ z14.object({
2203
+ action: z14.object({
2204
+ type: z14.literal("exec"),
2205
+ command: z14.array(z14.string()),
2206
+ timeoutMs: z14.number().optional(),
2207
+ user: z14.string().optional(),
2208
+ workingDirectory: z14.string().optional(),
2209
+ env: z14.record(z14.string(), z14.string()).optional()
2178
2210
  })
2179
2211
  })
2180
2212
  )
2181
2213
  );
2182
- var localShellOutputSchema = lazySchema12(
2183
- () => zodSchema12(z13.object({ output: z13.string() }))
2214
+ var localShellOutputSchema = lazySchema13(
2215
+ () => zodSchema13(z14.object({ output: z14.string() }))
2184
2216
  );
2185
2217
  var localShell = createProviderToolFactoryWithOutputSchema5({
2186
2218
  id: "openai.local_shell",
@@ -2191,91 +2223,91 @@ var localShell = createProviderToolFactoryWithOutputSchema5({
2191
2223
  // src/tool/shell.ts
2192
2224
  import {
2193
2225
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
2194
- lazySchema as lazySchema13,
2195
- zodSchema as zodSchema13
2226
+ lazySchema as lazySchema14,
2227
+ zodSchema as zodSchema14
2196
2228
  } from "@ai-sdk/provider-utils";
2197
- import { z as z14 } from "zod/v4";
2198
- var shellInputSchema = lazySchema13(
2199
- () => zodSchema13(
2200
- z14.object({
2201
- action: z14.object({
2202
- commands: z14.array(z14.string()),
2203
- timeoutMs: z14.number().optional(),
2204
- maxOutputLength: z14.number().optional()
2229
+ import { z as z15 } from "zod/v4";
2230
+ var shellInputSchema = lazySchema14(
2231
+ () => zodSchema14(
2232
+ z15.object({
2233
+ action: z15.object({
2234
+ commands: z15.array(z15.string()),
2235
+ timeoutMs: z15.number().optional(),
2236
+ maxOutputLength: z15.number().optional()
2205
2237
  })
2206
2238
  })
2207
2239
  )
2208
2240
  );
2209
- var shellOutputSchema = lazySchema13(
2210
- () => zodSchema13(
2211
- z14.object({
2212
- output: z14.array(
2213
- z14.object({
2214
- stdout: z14.string(),
2215
- stderr: z14.string(),
2216
- outcome: z14.discriminatedUnion("type", [
2217
- z14.object({ type: z14.literal("timeout") }),
2218
- z14.object({ type: z14.literal("exit"), exitCode: z14.number() })
2241
+ var shellOutputSchema = lazySchema14(
2242
+ () => zodSchema14(
2243
+ z15.object({
2244
+ output: z15.array(
2245
+ z15.object({
2246
+ stdout: z15.string(),
2247
+ stderr: z15.string(),
2248
+ outcome: z15.discriminatedUnion("type", [
2249
+ z15.object({ type: z15.literal("timeout") }),
2250
+ z15.object({ type: z15.literal("exit"), exitCode: z15.number() })
2219
2251
  ])
2220
2252
  })
2221
2253
  )
2222
2254
  })
2223
2255
  )
2224
2256
  );
2225
- var shellSkillsSchema = z14.array(
2226
- z14.discriminatedUnion("type", [
2227
- z14.object({
2228
- type: z14.literal("skillReference"),
2229
- skillId: z14.string(),
2230
- version: z14.string().optional()
2257
+ var shellSkillsSchema = z15.array(
2258
+ z15.discriminatedUnion("type", [
2259
+ z15.object({
2260
+ type: z15.literal("skillReference"),
2261
+ skillId: z15.string(),
2262
+ version: z15.string().optional()
2231
2263
  }),
2232
- z14.object({
2233
- type: z14.literal("inline"),
2234
- name: z14.string(),
2235
- description: z14.string(),
2236
- source: z14.object({
2237
- type: z14.literal("base64"),
2238
- mediaType: z14.literal("application/zip"),
2239
- data: z14.string()
2264
+ z15.object({
2265
+ type: z15.literal("inline"),
2266
+ name: z15.string(),
2267
+ description: z15.string(),
2268
+ source: z15.object({
2269
+ type: z15.literal("base64"),
2270
+ mediaType: z15.literal("application/zip"),
2271
+ data: z15.string()
2240
2272
  })
2241
2273
  })
2242
2274
  ])
2243
2275
  ).optional();
2244
- var shellArgsSchema = lazySchema13(
2245
- () => zodSchema13(
2246
- z14.object({
2247
- environment: z14.union([
2248
- z14.object({
2249
- type: z14.literal("containerAuto"),
2250
- fileIds: z14.array(z14.string()).optional(),
2251
- memoryLimit: z14.enum(["1g", "4g", "16g", "64g"]).optional(),
2252
- networkPolicy: z14.discriminatedUnion("type", [
2253
- z14.object({ type: z14.literal("disabled") }),
2254
- z14.object({
2255
- type: z14.literal("allowlist"),
2256
- allowedDomains: z14.array(z14.string()),
2257
- domainSecrets: z14.array(
2258
- z14.object({
2259
- domain: z14.string(),
2260
- name: z14.string(),
2261
- value: z14.string()
2276
+ var shellArgsSchema = lazySchema14(
2277
+ () => zodSchema14(
2278
+ z15.object({
2279
+ environment: z15.union([
2280
+ z15.object({
2281
+ type: z15.literal("containerAuto"),
2282
+ fileIds: z15.array(z15.string()).optional(),
2283
+ memoryLimit: z15.enum(["1g", "4g", "16g", "64g"]).optional(),
2284
+ networkPolicy: z15.discriminatedUnion("type", [
2285
+ z15.object({ type: z15.literal("disabled") }),
2286
+ z15.object({
2287
+ type: z15.literal("allowlist"),
2288
+ allowedDomains: z15.array(z15.string()),
2289
+ domainSecrets: z15.array(
2290
+ z15.object({
2291
+ domain: z15.string(),
2292
+ name: z15.string(),
2293
+ value: z15.string()
2262
2294
  })
2263
2295
  ).optional()
2264
2296
  })
2265
2297
  ]).optional(),
2266
2298
  skills: shellSkillsSchema
2267
2299
  }),
2268
- z14.object({
2269
- type: z14.literal("containerReference"),
2270
- containerId: z14.string()
2300
+ z15.object({
2301
+ type: z15.literal("containerReference"),
2302
+ containerId: z15.string()
2271
2303
  }),
2272
- z14.object({
2273
- type: z14.literal("local").optional(),
2274
- skills: z14.array(
2275
- z14.object({
2276
- name: z14.string(),
2277
- description: z14.string(),
2278
- path: z14.string()
2304
+ z15.object({
2305
+ type: z15.literal("local").optional(),
2306
+ skills: z15.array(
2307
+ z15.object({
2308
+ name: z15.string(),
2309
+ description: z15.string(),
2310
+ path: z15.string()
2279
2311
  })
2280
2312
  ).optional()
2281
2313
  })
@@ -2292,71 +2324,15 @@ var shell = createProviderToolFactoryWithOutputSchema6({
2292
2324
  // src/tool/web-search.ts
2293
2325
  import {
2294
2326
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2295
- lazySchema as lazySchema14,
2296
- zodSchema as zodSchema14
2297
- } from "@ai-sdk/provider-utils";
2298
- import { z as z15 } from "zod/v4";
2299
- var webSearchArgsSchema = lazySchema14(
2300
- () => zodSchema14(
2301
- z15.object({
2302
- externalWebAccess: z15.boolean().optional(),
2303
- filters: z15.object({ allowedDomains: z15.array(z15.string()).optional() }).optional(),
2304
- searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2305
- userLocation: z15.object({
2306
- type: z15.literal("approximate"),
2307
- country: z15.string().optional(),
2308
- city: z15.string().optional(),
2309
- region: z15.string().optional(),
2310
- timezone: z15.string().optional()
2311
- }).optional()
2312
- })
2313
- )
2314
- );
2315
- var webSearchInputSchema = lazySchema14(() => zodSchema14(z15.object({})));
2316
- var webSearchOutputSchema = lazySchema14(
2317
- () => zodSchema14(
2318
- z15.object({
2319
- action: z15.discriminatedUnion("type", [
2320
- z15.object({
2321
- type: z15.literal("search"),
2322
- query: z15.string().optional()
2323
- }),
2324
- z15.object({
2325
- type: z15.literal("openPage"),
2326
- url: z15.string().nullish()
2327
- }),
2328
- z15.object({
2329
- type: z15.literal("findInPage"),
2330
- url: z15.string().nullish(),
2331
- pattern: z15.string().nullish()
2332
- })
2333
- ]).optional(),
2334
- sources: z15.array(
2335
- z15.discriminatedUnion("type", [
2336
- z15.object({ type: z15.literal("url"), url: z15.string() }),
2337
- z15.object({ type: z15.literal("api"), name: z15.string() })
2338
- ])
2339
- ).optional()
2340
- })
2341
- )
2342
- );
2343
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2344
- id: "openai.web_search",
2345
- inputSchema: webSearchInputSchema,
2346
- outputSchema: webSearchOutputSchema
2347
- });
2348
- var webSearch = (args = {}) => webSearchToolFactory(args);
2349
-
2350
- // src/tool/web-search-preview.ts
2351
- import {
2352
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2353
2327
  lazySchema as lazySchema15,
2354
2328
  zodSchema as zodSchema15
2355
2329
  } from "@ai-sdk/provider-utils";
2356
2330
  import { z as z16 } from "zod/v4";
2357
- var webSearchPreviewArgsSchema = lazySchema15(
2331
+ var webSearchArgsSchema = lazySchema15(
2358
2332
  () => zodSchema15(
2359
2333
  z16.object({
2334
+ externalWebAccess: z16.boolean().optional(),
2335
+ filters: z16.object({ allowedDomains: z16.array(z16.string()).optional() }).optional(),
2360
2336
  searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
2361
2337
  userLocation: z16.object({
2362
2338
  type: z16.literal("approximate"),
@@ -2368,10 +2344,8 @@ var webSearchPreviewArgsSchema = lazySchema15(
2368
2344
  })
2369
2345
  )
2370
2346
  );
2371
- var webSearchPreviewInputSchema = lazySchema15(
2372
- () => zodSchema15(z16.object({}))
2373
- );
2374
- var webSearchPreviewOutputSchema = lazySchema15(
2347
+ var webSearchInputSchema = lazySchema15(() => zodSchema15(z16.object({})));
2348
+ var webSearchOutputSchema = lazySchema15(
2375
2349
  () => zodSchema15(
2376
2350
  z16.object({
2377
2351
  action: z16.discriminatedUnion("type", [
@@ -2388,6 +2362,64 @@ var webSearchPreviewOutputSchema = lazySchema15(
2388
2362
  url: z16.string().nullish(),
2389
2363
  pattern: z16.string().nullish()
2390
2364
  })
2365
+ ]).optional(),
2366
+ sources: z16.array(
2367
+ z16.discriminatedUnion("type", [
2368
+ z16.object({ type: z16.literal("url"), url: z16.string() }),
2369
+ z16.object({ type: z16.literal("api"), name: z16.string() })
2370
+ ])
2371
+ ).optional()
2372
+ })
2373
+ )
2374
+ );
2375
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2376
+ id: "openai.web_search",
2377
+ inputSchema: webSearchInputSchema,
2378
+ outputSchema: webSearchOutputSchema
2379
+ });
2380
+ var webSearch = (args = {}) => webSearchToolFactory(args);
2381
+
2382
+ // src/tool/web-search-preview.ts
2383
+ import {
2384
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2385
+ lazySchema as lazySchema16,
2386
+ zodSchema as zodSchema16
2387
+ } from "@ai-sdk/provider-utils";
2388
+ import { z as z17 } from "zod/v4";
2389
+ var webSearchPreviewArgsSchema = lazySchema16(
2390
+ () => zodSchema16(
2391
+ z17.object({
2392
+ searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
2393
+ userLocation: z17.object({
2394
+ type: z17.literal("approximate"),
2395
+ country: z17.string().optional(),
2396
+ city: z17.string().optional(),
2397
+ region: z17.string().optional(),
2398
+ timezone: z17.string().optional()
2399
+ }).optional()
2400
+ })
2401
+ )
2402
+ );
2403
+ var webSearchPreviewInputSchema = lazySchema16(
2404
+ () => zodSchema16(z17.object({}))
2405
+ );
2406
+ var webSearchPreviewOutputSchema = lazySchema16(
2407
+ () => zodSchema16(
2408
+ z17.object({
2409
+ action: z17.discriminatedUnion("type", [
2410
+ z17.object({
2411
+ type: z17.literal("search"),
2412
+ query: z17.string().optional()
2413
+ }),
2414
+ z17.object({
2415
+ type: z17.literal("openPage"),
2416
+ url: z17.string().nullish()
2417
+ }),
2418
+ z17.object({
2419
+ type: z17.literal("findInPage"),
2420
+ url: z17.string().nullish(),
2421
+ pattern: z17.string().nullish()
2422
+ })
2391
2423
  ]).optional()
2392
2424
  })
2393
2425
  )
@@ -2401,60 +2433,60 @@ var webSearchPreview = createProviderToolFactoryWithOutputSchema8({
2401
2433
  // src/tool/mcp.ts
2402
2434
  import {
2403
2435
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2404
- lazySchema as lazySchema16,
2405
- zodSchema as zodSchema16
2436
+ lazySchema as lazySchema17,
2437
+ zodSchema as zodSchema17
2406
2438
  } from "@ai-sdk/provider-utils";
2407
- import { z as z17 } from "zod/v4";
2408
- var jsonValueSchema = z17.lazy(
2409
- () => z17.union([
2410
- z17.string(),
2411
- z17.number(),
2412
- z17.boolean(),
2413
- z17.null(),
2414
- z17.array(jsonValueSchema),
2415
- z17.record(z17.string(), jsonValueSchema)
2439
+ import { z as z18 } from "zod/v4";
2440
+ var jsonValueSchema = z18.lazy(
2441
+ () => z18.union([
2442
+ z18.string(),
2443
+ z18.number(),
2444
+ z18.boolean(),
2445
+ z18.null(),
2446
+ z18.array(jsonValueSchema),
2447
+ z18.record(z18.string(), jsonValueSchema)
2416
2448
  ])
2417
2449
  );
2418
- var mcpArgsSchema = lazySchema16(
2419
- () => zodSchema16(
2420
- z17.object({
2421
- serverLabel: z17.string(),
2422
- allowedTools: z17.union([
2423
- z17.array(z17.string()),
2424
- z17.object({
2425
- readOnly: z17.boolean().optional(),
2426
- toolNames: z17.array(z17.string()).optional()
2450
+ var mcpArgsSchema = lazySchema17(
2451
+ () => zodSchema17(
2452
+ z18.object({
2453
+ serverLabel: z18.string(),
2454
+ allowedTools: z18.union([
2455
+ z18.array(z18.string()),
2456
+ z18.object({
2457
+ readOnly: z18.boolean().optional(),
2458
+ toolNames: z18.array(z18.string()).optional()
2427
2459
  })
2428
2460
  ]).optional(),
2429
- authorization: z17.string().optional(),
2430
- connectorId: z17.string().optional(),
2431
- headers: z17.record(z17.string(), z17.string()).optional(),
2432
- requireApproval: z17.union([
2433
- z17.enum(["always", "never"]),
2434
- z17.object({
2435
- never: z17.object({
2436
- toolNames: z17.array(z17.string()).optional()
2461
+ authorization: z18.string().optional(),
2462
+ connectorId: z18.string().optional(),
2463
+ headers: z18.record(z18.string(), z18.string()).optional(),
2464
+ requireApproval: z18.union([
2465
+ z18.enum(["always", "never"]),
2466
+ z18.object({
2467
+ never: z18.object({
2468
+ toolNames: z18.array(z18.string()).optional()
2437
2469
  }).optional()
2438
2470
  })
2439
2471
  ]).optional(),
2440
- serverDescription: z17.string().optional(),
2441
- serverUrl: z17.string().optional()
2472
+ serverDescription: z18.string().optional(),
2473
+ serverUrl: z18.string().optional()
2442
2474
  }).refine(
2443
2475
  (v) => v.serverUrl != null || v.connectorId != null,
2444
2476
  "One of serverUrl or connectorId must be provided."
2445
2477
  )
2446
2478
  )
2447
2479
  );
2448
- var mcpInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
2449
- var mcpOutputSchema = lazySchema16(
2450
- () => zodSchema16(
2451
- z17.object({
2452
- type: z17.literal("call"),
2453
- serverLabel: z17.string(),
2454
- name: z17.string(),
2455
- arguments: z17.string(),
2456
- output: z17.string().nullish(),
2457
- error: z17.union([z17.string(), jsonValueSchema]).optional()
2480
+ var mcpInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
2481
+ var mcpOutputSchema = lazySchema17(
2482
+ () => zodSchema17(
2483
+ z18.object({
2484
+ type: z18.literal("call"),
2485
+ serverLabel: z18.string(),
2486
+ name: z18.string(),
2487
+ arguments: z18.string(),
2488
+ output: z18.string().nullish(),
2489
+ error: z18.union([z18.string(), jsonValueSchema]).optional()
2458
2490
  })
2459
2491
  )
2460
2492
  );
@@ -2475,6 +2507,16 @@ var openaiTools = {
2475
2507
  *
2476
2508
  */
2477
2509
  applyPatch,
2510
+ /**
2511
+ * Custom tools let callers constrain model output to a grammar (regex or
2512
+ * Lark syntax). The model returns a `custom_tool_call` output item whose
2513
+ * `input` field is a string matching the specified grammar.
2514
+ *
2515
+ * @param name - The name of the custom tool.
2516
+ * @param description - An optional description of the tool.
2517
+ * @param format - The output format constraint (grammar type, syntax, and definition).
2518
+ */
2519
+ customTool,
2478
2520
  /**
2479
2521
  * The Code Interpreter tool allows models to write and run Python code in a
2480
2522
  * sandboxed environment to solve complex problems in domains like data analysis,
@@ -2515,7 +2557,7 @@ var openaiTools = {
2515
2557
  * Local shell is a tool that allows agents to run shell commands locally
2516
2558
  * on a machine you or the user provides.
2517
2559
  *
2518
- * Supported models: `gpt-5-codex` and `codex-mini-latest`
2560
+ * Supported models: `gpt-5-codex`
2519
2561
  */
2520
2562
  localShell,
2521
2563
  /**
@@ -2626,7 +2668,7 @@ import {
2626
2668
  parseProviderOptions as parseProviderOptions4,
2627
2669
  validateTypes
2628
2670
  } from "@ai-sdk/provider-utils";
2629
- import { z as z18 } from "zod/v4";
2671
+ import { z as z19 } from "zod/v4";
2630
2672
  function isFileId(data, prefixes) {
2631
2673
  if (!prefixes) return false;
2632
2674
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2641,9 +2683,10 @@ async function convertToOpenAIResponsesInput({
2641
2683
  hasConversation = false,
2642
2684
  hasLocalShellTool = false,
2643
2685
  hasShellTool = false,
2644
- hasApplyPatchTool = false
2686
+ hasApplyPatchTool = false,
2687
+ customProviderToolNames
2645
2688
  }) {
2646
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2689
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2647
2690
  const input = [];
2648
2691
  const warnings = [];
2649
2692
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -2812,6 +2855,16 @@ async function convertToOpenAIResponsesInput({
2812
2855
  });
2813
2856
  break;
2814
2857
  }
2858
+ if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
2859
+ input.push({
2860
+ type: "custom_tool_call",
2861
+ call_id: part.toolCallId,
2862
+ name: resolvedToolName,
2863
+ input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
2864
+ id
2865
+ });
2866
+ break;
2867
+ }
2815
2868
  input.push({
2816
2869
  type: "function_call",
2817
2870
  call_id: part.toolCallId,
@@ -3016,6 +3069,61 @@ async function convertToOpenAIResponsesInput({
3016
3069
  });
3017
3070
  continue;
3018
3071
  }
3072
+ if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
3073
+ let outputValue;
3074
+ switch (output.type) {
3075
+ case "text":
3076
+ case "error-text":
3077
+ outputValue = output.value;
3078
+ break;
3079
+ case "execution-denied":
3080
+ outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3081
+ break;
3082
+ case "json":
3083
+ case "error-json":
3084
+ outputValue = JSON.stringify(output.value);
3085
+ break;
3086
+ case "content":
3087
+ outputValue = output.value.map((item) => {
3088
+ var _a2;
3089
+ switch (item.type) {
3090
+ case "text":
3091
+ return { type: "input_text", text: item.text };
3092
+ case "image-data":
3093
+ return {
3094
+ type: "input_image",
3095
+ image_url: `data:${item.mediaType};base64,${item.data}`
3096
+ };
3097
+ case "image-url":
3098
+ return {
3099
+ type: "input_image",
3100
+ image_url: item.url
3101
+ };
3102
+ case "file-data":
3103
+ return {
3104
+ type: "input_file",
3105
+ filename: (_a2 = item.filename) != null ? _a2 : "data",
3106
+ file_data: `data:${item.mediaType};base64,${item.data}`
3107
+ };
3108
+ default:
3109
+ warnings.push({
3110
+ type: "other",
3111
+ message: `unsupported custom tool content part type: ${item.type}`
3112
+ });
3113
+ return void 0;
3114
+ }
3115
+ }).filter(isNonNullable);
3116
+ break;
3117
+ default:
3118
+ outputValue = "";
3119
+ }
3120
+ input.push({
3121
+ type: "custom_tool_call_output",
3122
+ call_id: part.toolCallId,
3123
+ output: outputValue
3124
+ });
3125
+ continue;
3126
+ }
3019
3127
  let contentValue;
3020
3128
  switch (output.type) {
3021
3129
  case "text":
@@ -3023,7 +3131,7 @@ async function convertToOpenAIResponsesInput({
3023
3131
  contentValue = output.value;
3024
3132
  break;
3025
3133
  case "execution-denied":
3026
- contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
3134
+ contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
3027
3135
  break;
3028
3136
  case "json":
3029
3137
  case "error-json":
@@ -3082,9 +3190,9 @@ async function convertToOpenAIResponsesInput({
3082
3190
  }
3083
3191
  return { input, warnings };
3084
3192
  }
3085
- var openaiResponsesReasoningProviderOptionsSchema = z18.object({
3086
- itemId: z18.string().nullish(),
3087
- reasoningEncryptedContent: z18.string().nullish()
3193
+ var openaiResponsesReasoningProviderOptionsSchema = z19.object({
3194
+ itemId: z19.string().nullish(),
3195
+ reasoningEncryptedContent: z19.string().nullish()
3088
3196
  });
3089
3197
 
3090
3198
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3106,161 +3214,168 @@ function mapOpenAIResponseFinishReason({
3106
3214
  }
3107
3215
 
3108
3216
  // src/responses/openai-responses-api.ts
3109
- import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
3110
- import { z as z19 } from "zod/v4";
3111
- var openaiResponsesChunkSchema = lazySchema17(
3112
- () => zodSchema17(
3113
- z19.union([
3114
- z19.object({
3115
- type: z19.literal("response.output_text.delta"),
3116
- item_id: z19.string(),
3117
- delta: z19.string(),
3118
- logprobs: z19.array(
3119
- z19.object({
3120
- token: z19.string(),
3121
- logprob: z19.number(),
3122
- top_logprobs: z19.array(
3123
- z19.object({
3124
- token: z19.string(),
3125
- logprob: z19.number()
3217
+ import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
3218
+ import { z as z20 } from "zod/v4";
3219
+ var openaiResponsesChunkSchema = lazySchema18(
3220
+ () => zodSchema18(
3221
+ z20.union([
3222
+ z20.object({
3223
+ type: z20.literal("response.output_text.delta"),
3224
+ item_id: z20.string(),
3225
+ delta: z20.string(),
3226
+ logprobs: z20.array(
3227
+ z20.object({
3228
+ token: z20.string(),
3229
+ logprob: z20.number(),
3230
+ top_logprobs: z20.array(
3231
+ z20.object({
3232
+ token: z20.string(),
3233
+ logprob: z20.number()
3126
3234
  })
3127
3235
  )
3128
3236
  })
3129
3237
  ).nullish()
3130
3238
  }),
3131
- z19.object({
3132
- type: z19.enum(["response.completed", "response.incomplete"]),
3133
- response: z19.object({
3134
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
3135
- usage: z19.object({
3136
- input_tokens: z19.number(),
3137
- input_tokens_details: z19.object({ cached_tokens: z19.number().nullish() }).nullish(),
3138
- output_tokens: z19.number(),
3139
- output_tokens_details: z19.object({ reasoning_tokens: z19.number().nullish() }).nullish()
3239
+ z20.object({
3240
+ type: z20.enum(["response.completed", "response.incomplete"]),
3241
+ response: z20.object({
3242
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3243
+ usage: z20.object({
3244
+ input_tokens: z20.number(),
3245
+ input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3246
+ output_tokens: z20.number(),
3247
+ output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
3140
3248
  }),
3141
- service_tier: z19.string().nullish()
3249
+ service_tier: z20.string().nullish()
3142
3250
  })
3143
3251
  }),
3144
- z19.object({
3145
- type: z19.literal("response.created"),
3146
- response: z19.object({
3147
- id: z19.string(),
3148
- created_at: z19.number(),
3149
- model: z19.string(),
3150
- service_tier: z19.string().nullish()
3252
+ z20.object({
3253
+ type: z20.literal("response.created"),
3254
+ response: z20.object({
3255
+ id: z20.string(),
3256
+ created_at: z20.number(),
3257
+ model: z20.string(),
3258
+ service_tier: z20.string().nullish()
3151
3259
  })
3152
3260
  }),
3153
- z19.object({
3154
- type: z19.literal("response.output_item.added"),
3155
- output_index: z19.number(),
3156
- item: z19.discriminatedUnion("type", [
3157
- z19.object({
3158
- type: z19.literal("message"),
3159
- id: z19.string(),
3160
- phase: z19.enum(["commentary", "final_answer"]).nullish()
3261
+ z20.object({
3262
+ type: z20.literal("response.output_item.added"),
3263
+ output_index: z20.number(),
3264
+ item: z20.discriminatedUnion("type", [
3265
+ z20.object({
3266
+ type: z20.literal("message"),
3267
+ id: z20.string(),
3268
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
3161
3269
  }),
3162
- z19.object({
3163
- type: z19.literal("reasoning"),
3164
- id: z19.string(),
3165
- encrypted_content: z19.string().nullish()
3270
+ z20.object({
3271
+ type: z20.literal("reasoning"),
3272
+ id: z20.string(),
3273
+ encrypted_content: z20.string().nullish()
3166
3274
  }),
3167
- z19.object({
3168
- type: z19.literal("function_call"),
3169
- id: z19.string(),
3170
- call_id: z19.string(),
3171
- name: z19.string(),
3172
- arguments: z19.string()
3275
+ z20.object({
3276
+ type: z20.literal("function_call"),
3277
+ id: z20.string(),
3278
+ call_id: z20.string(),
3279
+ name: z20.string(),
3280
+ arguments: z20.string()
3173
3281
  }),
3174
- z19.object({
3175
- type: z19.literal("web_search_call"),
3176
- id: z19.string(),
3177
- status: z19.string()
3282
+ z20.object({
3283
+ type: z20.literal("web_search_call"),
3284
+ id: z20.string(),
3285
+ status: z20.string()
3178
3286
  }),
3179
- z19.object({
3180
- type: z19.literal("computer_call"),
3181
- id: z19.string(),
3182
- status: z19.string()
3287
+ z20.object({
3288
+ type: z20.literal("computer_call"),
3289
+ id: z20.string(),
3290
+ status: z20.string()
3183
3291
  }),
3184
- z19.object({
3185
- type: z19.literal("file_search_call"),
3186
- id: z19.string()
3292
+ z20.object({
3293
+ type: z20.literal("file_search_call"),
3294
+ id: z20.string()
3187
3295
  }),
3188
- z19.object({
3189
- type: z19.literal("image_generation_call"),
3190
- id: z19.string()
3296
+ z20.object({
3297
+ type: z20.literal("image_generation_call"),
3298
+ id: z20.string()
3191
3299
  }),
3192
- z19.object({
3193
- type: z19.literal("code_interpreter_call"),
3194
- id: z19.string(),
3195
- container_id: z19.string(),
3196
- code: z19.string().nullable(),
3197
- outputs: z19.array(
3198
- z19.discriminatedUnion("type", [
3199
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3200
- z19.object({ type: z19.literal("image"), url: z19.string() })
3300
+ z20.object({
3301
+ type: z20.literal("code_interpreter_call"),
3302
+ id: z20.string(),
3303
+ container_id: z20.string(),
3304
+ code: z20.string().nullable(),
3305
+ outputs: z20.array(
3306
+ z20.discriminatedUnion("type", [
3307
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3308
+ z20.object({ type: z20.literal("image"), url: z20.string() })
3201
3309
  ])
3202
3310
  ).nullable(),
3203
- status: z19.string()
3311
+ status: z20.string()
3204
3312
  }),
3205
- z19.object({
3206
- type: z19.literal("mcp_call"),
3207
- id: z19.string(),
3208
- status: z19.string(),
3209
- approval_request_id: z19.string().nullish()
3313
+ z20.object({
3314
+ type: z20.literal("mcp_call"),
3315
+ id: z20.string(),
3316
+ status: z20.string(),
3317
+ approval_request_id: z20.string().nullish()
3210
3318
  }),
3211
- z19.object({
3212
- type: z19.literal("mcp_list_tools"),
3213
- id: z19.string()
3319
+ z20.object({
3320
+ type: z20.literal("mcp_list_tools"),
3321
+ id: z20.string()
3214
3322
  }),
3215
- z19.object({
3216
- type: z19.literal("mcp_approval_request"),
3217
- id: z19.string()
3323
+ z20.object({
3324
+ type: z20.literal("mcp_approval_request"),
3325
+ id: z20.string()
3218
3326
  }),
3219
- z19.object({
3220
- type: z19.literal("apply_patch_call"),
3221
- id: z19.string(),
3222
- call_id: z19.string(),
3223
- status: z19.enum(["in_progress", "completed"]),
3224
- operation: z19.discriminatedUnion("type", [
3225
- z19.object({
3226
- type: z19.literal("create_file"),
3227
- path: z19.string(),
3228
- diff: z19.string()
3327
+ z20.object({
3328
+ type: z20.literal("apply_patch_call"),
3329
+ id: z20.string(),
3330
+ call_id: z20.string(),
3331
+ status: z20.enum(["in_progress", "completed"]),
3332
+ operation: z20.discriminatedUnion("type", [
3333
+ z20.object({
3334
+ type: z20.literal("create_file"),
3335
+ path: z20.string(),
3336
+ diff: z20.string()
3229
3337
  }),
3230
- z19.object({
3231
- type: z19.literal("delete_file"),
3232
- path: z19.string()
3338
+ z20.object({
3339
+ type: z20.literal("delete_file"),
3340
+ path: z20.string()
3233
3341
  }),
3234
- z19.object({
3235
- type: z19.literal("update_file"),
3236
- path: z19.string(),
3237
- diff: z19.string()
3342
+ z20.object({
3343
+ type: z20.literal("update_file"),
3344
+ path: z20.string(),
3345
+ diff: z20.string()
3238
3346
  })
3239
3347
  ])
3240
3348
  }),
3241
- z19.object({
3242
- type: z19.literal("shell_call"),
3243
- id: z19.string(),
3244
- call_id: z19.string(),
3245
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3246
- action: z19.object({
3247
- commands: z19.array(z19.string())
3349
+ z20.object({
3350
+ type: z20.literal("custom_tool_call"),
3351
+ id: z20.string(),
3352
+ call_id: z20.string(),
3353
+ name: z20.string(),
3354
+ input: z20.string()
3355
+ }),
3356
+ z20.object({
3357
+ type: z20.literal("shell_call"),
3358
+ id: z20.string(),
3359
+ call_id: z20.string(),
3360
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3361
+ action: z20.object({
3362
+ commands: z20.array(z20.string())
3248
3363
  })
3249
3364
  }),
3250
- z19.object({
3251
- type: z19.literal("shell_call_output"),
3252
- id: z19.string(),
3253
- call_id: z19.string(),
3254
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3255
- output: z19.array(
3256
- z19.object({
3257
- stdout: z19.string(),
3258
- stderr: z19.string(),
3259
- outcome: z19.discriminatedUnion("type", [
3260
- z19.object({ type: z19.literal("timeout") }),
3261
- z19.object({
3262
- type: z19.literal("exit"),
3263
- exit_code: z19.number()
3365
+ z20.object({
3366
+ type: z20.literal("shell_call_output"),
3367
+ id: z20.string(),
3368
+ call_id: z20.string(),
3369
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3370
+ output: z20.array(
3371
+ z20.object({
3372
+ stdout: z20.string(),
3373
+ stderr: z20.string(),
3374
+ outcome: z20.discriminatedUnion("type", [
3375
+ z20.object({ type: z20.literal("timeout") }),
3376
+ z20.object({
3377
+ type: z20.literal("exit"),
3378
+ exit_code: z20.number()
3264
3379
  })
3265
3380
  ])
3266
3381
  })
@@ -3268,198 +3383,206 @@ var openaiResponsesChunkSchema = lazySchema17(
3268
3383
  })
3269
3384
  ])
3270
3385
  }),
3271
- z19.object({
3272
- type: z19.literal("response.output_item.done"),
3273
- output_index: z19.number(),
3274
- item: z19.discriminatedUnion("type", [
3275
- z19.object({
3276
- type: z19.literal("message"),
3277
- id: z19.string(),
3278
- phase: z19.enum(["commentary", "final_answer"]).nullish()
3386
+ z20.object({
3387
+ type: z20.literal("response.output_item.done"),
3388
+ output_index: z20.number(),
3389
+ item: z20.discriminatedUnion("type", [
3390
+ z20.object({
3391
+ type: z20.literal("message"),
3392
+ id: z20.string(),
3393
+ phase: z20.enum(["commentary", "final_answer"]).nullish()
3394
+ }),
3395
+ z20.object({
3396
+ type: z20.literal("reasoning"),
3397
+ id: z20.string(),
3398
+ encrypted_content: z20.string().nullish()
3279
3399
  }),
3280
- z19.object({
3281
- type: z19.literal("reasoning"),
3282
- id: z19.string(),
3283
- encrypted_content: z19.string().nullish()
3400
+ z20.object({
3401
+ type: z20.literal("function_call"),
3402
+ id: z20.string(),
3403
+ call_id: z20.string(),
3404
+ name: z20.string(),
3405
+ arguments: z20.string(),
3406
+ status: z20.literal("completed")
3284
3407
  }),
3285
- z19.object({
3286
- type: z19.literal("function_call"),
3287
- id: z19.string(),
3288
- call_id: z19.string(),
3289
- name: z19.string(),
3290
- arguments: z19.string(),
3291
- status: z19.literal("completed")
3408
+ z20.object({
3409
+ type: z20.literal("custom_tool_call"),
3410
+ id: z20.string(),
3411
+ call_id: z20.string(),
3412
+ name: z20.string(),
3413
+ input: z20.string(),
3414
+ status: z20.literal("completed")
3292
3415
  }),
3293
- z19.object({
3294
- type: z19.literal("code_interpreter_call"),
3295
- id: z19.string(),
3296
- code: z19.string().nullable(),
3297
- container_id: z19.string(),
3298
- outputs: z19.array(
3299
- z19.discriminatedUnion("type", [
3300
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3301
- z19.object({ type: z19.literal("image"), url: z19.string() })
3416
+ z20.object({
3417
+ type: z20.literal("code_interpreter_call"),
3418
+ id: z20.string(),
3419
+ code: z20.string().nullable(),
3420
+ container_id: z20.string(),
3421
+ outputs: z20.array(
3422
+ z20.discriminatedUnion("type", [
3423
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3424
+ z20.object({ type: z20.literal("image"), url: z20.string() })
3302
3425
  ])
3303
3426
  ).nullable()
3304
3427
  }),
3305
- z19.object({
3306
- type: z19.literal("image_generation_call"),
3307
- id: z19.string(),
3308
- result: z19.string()
3428
+ z20.object({
3429
+ type: z20.literal("image_generation_call"),
3430
+ id: z20.string(),
3431
+ result: z20.string()
3309
3432
  }),
3310
- z19.object({
3311
- type: z19.literal("web_search_call"),
3312
- id: z19.string(),
3313
- status: z19.string(),
3314
- action: z19.discriminatedUnion("type", [
3315
- z19.object({
3316
- type: z19.literal("search"),
3317
- query: z19.string().nullish(),
3318
- sources: z19.array(
3319
- z19.discriminatedUnion("type", [
3320
- z19.object({ type: z19.literal("url"), url: z19.string() }),
3321
- z19.object({ type: z19.literal("api"), name: z19.string() })
3433
+ z20.object({
3434
+ type: z20.literal("web_search_call"),
3435
+ id: z20.string(),
3436
+ status: z20.string(),
3437
+ action: z20.discriminatedUnion("type", [
3438
+ z20.object({
3439
+ type: z20.literal("search"),
3440
+ query: z20.string().nullish(),
3441
+ sources: z20.array(
3442
+ z20.discriminatedUnion("type", [
3443
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
3444
+ z20.object({ type: z20.literal("api"), name: z20.string() })
3322
3445
  ])
3323
3446
  ).nullish()
3324
3447
  }),
3325
- z19.object({
3326
- type: z19.literal("open_page"),
3327
- url: z19.string().nullish()
3448
+ z20.object({
3449
+ type: z20.literal("open_page"),
3450
+ url: z20.string().nullish()
3328
3451
  }),
3329
- z19.object({
3330
- type: z19.literal("find_in_page"),
3331
- url: z19.string().nullish(),
3332
- pattern: z19.string().nullish()
3452
+ z20.object({
3453
+ type: z20.literal("find_in_page"),
3454
+ url: z20.string().nullish(),
3455
+ pattern: z20.string().nullish()
3333
3456
  })
3334
3457
  ]).nullish()
3335
3458
  }),
3336
- z19.object({
3337
- type: z19.literal("file_search_call"),
3338
- id: z19.string(),
3339
- queries: z19.array(z19.string()),
3340
- results: z19.array(
3341
- z19.object({
3342
- attributes: z19.record(
3343
- z19.string(),
3344
- z19.union([z19.string(), z19.number(), z19.boolean()])
3459
+ z20.object({
3460
+ type: z20.literal("file_search_call"),
3461
+ id: z20.string(),
3462
+ queries: z20.array(z20.string()),
3463
+ results: z20.array(
3464
+ z20.object({
3465
+ attributes: z20.record(
3466
+ z20.string(),
3467
+ z20.union([z20.string(), z20.number(), z20.boolean()])
3345
3468
  ),
3346
- file_id: z19.string(),
3347
- filename: z19.string(),
3348
- score: z19.number(),
3349
- text: z19.string()
3469
+ file_id: z20.string(),
3470
+ filename: z20.string(),
3471
+ score: z20.number(),
3472
+ text: z20.string()
3350
3473
  })
3351
3474
  ).nullish()
3352
3475
  }),
3353
- z19.object({
3354
- type: z19.literal("local_shell_call"),
3355
- id: z19.string(),
3356
- call_id: z19.string(),
3357
- action: z19.object({
3358
- type: z19.literal("exec"),
3359
- command: z19.array(z19.string()),
3360
- timeout_ms: z19.number().optional(),
3361
- user: z19.string().optional(),
3362
- working_directory: z19.string().optional(),
3363
- env: z19.record(z19.string(), z19.string()).optional()
3476
+ z20.object({
3477
+ type: z20.literal("local_shell_call"),
3478
+ id: z20.string(),
3479
+ call_id: z20.string(),
3480
+ action: z20.object({
3481
+ type: z20.literal("exec"),
3482
+ command: z20.array(z20.string()),
3483
+ timeout_ms: z20.number().optional(),
3484
+ user: z20.string().optional(),
3485
+ working_directory: z20.string().optional(),
3486
+ env: z20.record(z20.string(), z20.string()).optional()
3364
3487
  })
3365
3488
  }),
3366
- z19.object({
3367
- type: z19.literal("computer_call"),
3368
- id: z19.string(),
3369
- status: z19.literal("completed")
3489
+ z20.object({
3490
+ type: z20.literal("computer_call"),
3491
+ id: z20.string(),
3492
+ status: z20.literal("completed")
3370
3493
  }),
3371
- z19.object({
3372
- type: z19.literal("mcp_call"),
3373
- id: z19.string(),
3374
- status: z19.string(),
3375
- arguments: z19.string(),
3376
- name: z19.string(),
3377
- server_label: z19.string(),
3378
- output: z19.string().nullish(),
3379
- error: z19.union([
3380
- z19.string(),
3381
- z19.object({
3382
- type: z19.string().optional(),
3383
- code: z19.union([z19.number(), z19.string()]).optional(),
3384
- message: z19.string().optional()
3494
+ z20.object({
3495
+ type: z20.literal("mcp_call"),
3496
+ id: z20.string(),
3497
+ status: z20.string(),
3498
+ arguments: z20.string(),
3499
+ name: z20.string(),
3500
+ server_label: z20.string(),
3501
+ output: z20.string().nullish(),
3502
+ error: z20.union([
3503
+ z20.string(),
3504
+ z20.object({
3505
+ type: z20.string().optional(),
3506
+ code: z20.union([z20.number(), z20.string()]).optional(),
3507
+ message: z20.string().optional()
3385
3508
  }).loose()
3386
3509
  ]).nullish(),
3387
- approval_request_id: z19.string().nullish()
3510
+ approval_request_id: z20.string().nullish()
3388
3511
  }),
3389
- z19.object({
3390
- type: z19.literal("mcp_list_tools"),
3391
- id: z19.string(),
3392
- server_label: z19.string(),
3393
- tools: z19.array(
3394
- z19.object({
3395
- name: z19.string(),
3396
- description: z19.string().optional(),
3397
- input_schema: z19.any(),
3398
- annotations: z19.record(z19.string(), z19.unknown()).optional()
3512
+ z20.object({
3513
+ type: z20.literal("mcp_list_tools"),
3514
+ id: z20.string(),
3515
+ server_label: z20.string(),
3516
+ tools: z20.array(
3517
+ z20.object({
3518
+ name: z20.string(),
3519
+ description: z20.string().optional(),
3520
+ input_schema: z20.any(),
3521
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
3399
3522
  })
3400
3523
  ),
3401
- error: z19.union([
3402
- z19.string(),
3403
- z19.object({
3404
- type: z19.string().optional(),
3405
- code: z19.union([z19.number(), z19.string()]).optional(),
3406
- message: z19.string().optional()
3524
+ error: z20.union([
3525
+ z20.string(),
3526
+ z20.object({
3527
+ type: z20.string().optional(),
3528
+ code: z20.union([z20.number(), z20.string()]).optional(),
3529
+ message: z20.string().optional()
3407
3530
  }).loose()
3408
3531
  ]).optional()
3409
3532
  }),
3410
- z19.object({
3411
- type: z19.literal("mcp_approval_request"),
3412
- id: z19.string(),
3413
- server_label: z19.string(),
3414
- name: z19.string(),
3415
- arguments: z19.string(),
3416
- approval_request_id: z19.string().optional()
3533
+ z20.object({
3534
+ type: z20.literal("mcp_approval_request"),
3535
+ id: z20.string(),
3536
+ server_label: z20.string(),
3537
+ name: z20.string(),
3538
+ arguments: z20.string(),
3539
+ approval_request_id: z20.string().optional()
3417
3540
  }),
3418
- z19.object({
3419
- type: z19.literal("apply_patch_call"),
3420
- id: z19.string(),
3421
- call_id: z19.string(),
3422
- status: z19.enum(["in_progress", "completed"]),
3423
- operation: z19.discriminatedUnion("type", [
3424
- z19.object({
3425
- type: z19.literal("create_file"),
3426
- path: z19.string(),
3427
- diff: z19.string()
3541
+ z20.object({
3542
+ type: z20.literal("apply_patch_call"),
3543
+ id: z20.string(),
3544
+ call_id: z20.string(),
3545
+ status: z20.enum(["in_progress", "completed"]),
3546
+ operation: z20.discriminatedUnion("type", [
3547
+ z20.object({
3548
+ type: z20.literal("create_file"),
3549
+ path: z20.string(),
3550
+ diff: z20.string()
3428
3551
  }),
3429
- z19.object({
3430
- type: z19.literal("delete_file"),
3431
- path: z19.string()
3552
+ z20.object({
3553
+ type: z20.literal("delete_file"),
3554
+ path: z20.string()
3432
3555
  }),
3433
- z19.object({
3434
- type: z19.literal("update_file"),
3435
- path: z19.string(),
3436
- diff: z19.string()
3556
+ z20.object({
3557
+ type: z20.literal("update_file"),
3558
+ path: z20.string(),
3559
+ diff: z20.string()
3437
3560
  })
3438
3561
  ])
3439
3562
  }),
3440
- z19.object({
3441
- type: z19.literal("shell_call"),
3442
- id: z19.string(),
3443
- call_id: z19.string(),
3444
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3445
- action: z19.object({
3446
- commands: z19.array(z19.string())
3563
+ z20.object({
3564
+ type: z20.literal("shell_call"),
3565
+ id: z20.string(),
3566
+ call_id: z20.string(),
3567
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3568
+ action: z20.object({
3569
+ commands: z20.array(z20.string())
3447
3570
  })
3448
3571
  }),
3449
- z19.object({
3450
- type: z19.literal("shell_call_output"),
3451
- id: z19.string(),
3452
- call_id: z19.string(),
3453
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3454
- output: z19.array(
3455
- z19.object({
3456
- stdout: z19.string(),
3457
- stderr: z19.string(),
3458
- outcome: z19.discriminatedUnion("type", [
3459
- z19.object({ type: z19.literal("timeout") }),
3460
- z19.object({
3461
- type: z19.literal("exit"),
3462
- exit_code: z19.number()
3572
+ z20.object({
3573
+ type: z20.literal("shell_call_output"),
3574
+ id: z20.string(),
3575
+ call_id: z20.string(),
3576
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3577
+ output: z20.array(
3578
+ z20.object({
3579
+ stdout: z20.string(),
3580
+ stderr: z20.string(),
3581
+ outcome: z20.discriminatedUnion("type", [
3582
+ z20.object({ type: z20.literal("timeout") }),
3583
+ z20.object({
3584
+ type: z20.literal("exit"),
3585
+ exit_code: z20.number()
3463
3586
  })
3464
3587
  ])
3465
3588
  })
@@ -3467,101 +3590,107 @@ var openaiResponsesChunkSchema = lazySchema17(
3467
3590
  })
3468
3591
  ])
3469
3592
  }),
3470
- z19.object({
3471
- type: z19.literal("response.function_call_arguments.delta"),
3472
- item_id: z19.string(),
3473
- output_index: z19.number(),
3474
- delta: z19.string()
3593
+ z20.object({
3594
+ type: z20.literal("response.function_call_arguments.delta"),
3595
+ item_id: z20.string(),
3596
+ output_index: z20.number(),
3597
+ delta: z20.string()
3475
3598
  }),
3476
- z19.object({
3477
- type: z19.literal("response.image_generation_call.partial_image"),
3478
- item_id: z19.string(),
3479
- output_index: z19.number(),
3480
- partial_image_b64: z19.string()
3599
+ z20.object({
3600
+ type: z20.literal("response.custom_tool_call_input.delta"),
3601
+ item_id: z20.string(),
3602
+ output_index: z20.number(),
3603
+ delta: z20.string()
3481
3604
  }),
3482
- z19.object({
3483
- type: z19.literal("response.code_interpreter_call_code.delta"),
3484
- item_id: z19.string(),
3485
- output_index: z19.number(),
3486
- delta: z19.string()
3605
+ z20.object({
3606
+ type: z20.literal("response.image_generation_call.partial_image"),
3607
+ item_id: z20.string(),
3608
+ output_index: z20.number(),
3609
+ partial_image_b64: z20.string()
3487
3610
  }),
3488
- z19.object({
3489
- type: z19.literal("response.code_interpreter_call_code.done"),
3490
- item_id: z19.string(),
3491
- output_index: z19.number(),
3492
- code: z19.string()
3611
+ z20.object({
3612
+ type: z20.literal("response.code_interpreter_call_code.delta"),
3613
+ item_id: z20.string(),
3614
+ output_index: z20.number(),
3615
+ delta: z20.string()
3493
3616
  }),
3494
- z19.object({
3495
- type: z19.literal("response.output_text.annotation.added"),
3496
- annotation: z19.discriminatedUnion("type", [
3497
- z19.object({
3498
- type: z19.literal("url_citation"),
3499
- start_index: z19.number(),
3500
- end_index: z19.number(),
3501
- url: z19.string(),
3502
- title: z19.string()
3617
+ z20.object({
3618
+ type: z20.literal("response.code_interpreter_call_code.done"),
3619
+ item_id: z20.string(),
3620
+ output_index: z20.number(),
3621
+ code: z20.string()
3622
+ }),
3623
+ z20.object({
3624
+ type: z20.literal("response.output_text.annotation.added"),
3625
+ annotation: z20.discriminatedUnion("type", [
3626
+ z20.object({
3627
+ type: z20.literal("url_citation"),
3628
+ start_index: z20.number(),
3629
+ end_index: z20.number(),
3630
+ url: z20.string(),
3631
+ title: z20.string()
3503
3632
  }),
3504
- z19.object({
3505
- type: z19.literal("file_citation"),
3506
- file_id: z19.string(),
3507
- filename: z19.string(),
3508
- index: z19.number()
3633
+ z20.object({
3634
+ type: z20.literal("file_citation"),
3635
+ file_id: z20.string(),
3636
+ filename: z20.string(),
3637
+ index: z20.number()
3509
3638
  }),
3510
- z19.object({
3511
- type: z19.literal("container_file_citation"),
3512
- container_id: z19.string(),
3513
- file_id: z19.string(),
3514
- filename: z19.string(),
3515
- start_index: z19.number(),
3516
- end_index: z19.number()
3639
+ z20.object({
3640
+ type: z20.literal("container_file_citation"),
3641
+ container_id: z20.string(),
3642
+ file_id: z20.string(),
3643
+ filename: z20.string(),
3644
+ start_index: z20.number(),
3645
+ end_index: z20.number()
3517
3646
  }),
3518
- z19.object({
3519
- type: z19.literal("file_path"),
3520
- file_id: z19.string(),
3521
- index: z19.number()
3647
+ z20.object({
3648
+ type: z20.literal("file_path"),
3649
+ file_id: z20.string(),
3650
+ index: z20.number()
3522
3651
  })
3523
3652
  ])
3524
3653
  }),
3525
- z19.object({
3526
- type: z19.literal("response.reasoning_summary_part.added"),
3527
- item_id: z19.string(),
3528
- summary_index: z19.number()
3654
+ z20.object({
3655
+ type: z20.literal("response.reasoning_summary_part.added"),
3656
+ item_id: z20.string(),
3657
+ summary_index: z20.number()
3529
3658
  }),
3530
- z19.object({
3531
- type: z19.literal("response.reasoning_summary_text.delta"),
3532
- item_id: z19.string(),
3533
- summary_index: z19.number(),
3534
- delta: z19.string()
3659
+ z20.object({
3660
+ type: z20.literal("response.reasoning_summary_text.delta"),
3661
+ item_id: z20.string(),
3662
+ summary_index: z20.number(),
3663
+ delta: z20.string()
3535
3664
  }),
3536
- z19.object({
3537
- type: z19.literal("response.reasoning_summary_part.done"),
3538
- item_id: z19.string(),
3539
- summary_index: z19.number()
3665
+ z20.object({
3666
+ type: z20.literal("response.reasoning_summary_part.done"),
3667
+ item_id: z20.string(),
3668
+ summary_index: z20.number()
3540
3669
  }),
3541
- z19.object({
3542
- type: z19.literal("response.apply_patch_call_operation_diff.delta"),
3543
- item_id: z19.string(),
3544
- output_index: z19.number(),
3545
- delta: z19.string(),
3546
- obfuscation: z19.string().nullish()
3670
+ z20.object({
3671
+ type: z20.literal("response.apply_patch_call_operation_diff.delta"),
3672
+ item_id: z20.string(),
3673
+ output_index: z20.number(),
3674
+ delta: z20.string(),
3675
+ obfuscation: z20.string().nullish()
3547
3676
  }),
3548
- z19.object({
3549
- type: z19.literal("response.apply_patch_call_operation_diff.done"),
3550
- item_id: z19.string(),
3551
- output_index: z19.number(),
3552
- diff: z19.string()
3677
+ z20.object({
3678
+ type: z20.literal("response.apply_patch_call_operation_diff.done"),
3679
+ item_id: z20.string(),
3680
+ output_index: z20.number(),
3681
+ diff: z20.string()
3553
3682
  }),
3554
- z19.object({
3555
- type: z19.literal("error"),
3556
- sequence_number: z19.number(),
3557
- error: z19.object({
3558
- type: z19.string(),
3559
- code: z19.string(),
3560
- message: z19.string(),
3561
- param: z19.string().nullish()
3683
+ z20.object({
3684
+ type: z20.literal("error"),
3685
+ sequence_number: z20.number(),
3686
+ error: z20.object({
3687
+ type: z20.string(),
3688
+ code: z20.string(),
3689
+ message: z20.string(),
3690
+ param: z20.string().nullish()
3562
3691
  })
3563
3692
  }),
3564
- z19.object({ type: z19.string() }).loose().transform((value) => ({
3693
+ z20.object({ type: z20.string() }).loose().transform((value) => ({
3565
3694
  type: "unknown_chunk",
3566
3695
  message: value.type
3567
3696
  }))
@@ -3569,265 +3698,272 @@ var openaiResponsesChunkSchema = lazySchema17(
3569
3698
  ])
3570
3699
  )
3571
3700
  );
3572
- var openaiResponsesResponseSchema = lazySchema17(
3573
- () => zodSchema17(
3574
- z19.object({
3575
- id: z19.string().optional(),
3576
- created_at: z19.number().optional(),
3577
- error: z19.object({
3578
- message: z19.string(),
3579
- type: z19.string(),
3580
- param: z19.string().nullish(),
3581
- code: z19.string()
3701
+ var openaiResponsesResponseSchema = lazySchema18(
3702
+ () => zodSchema18(
3703
+ z20.object({
3704
+ id: z20.string().optional(),
3705
+ created_at: z20.number().optional(),
3706
+ error: z20.object({
3707
+ message: z20.string(),
3708
+ type: z20.string(),
3709
+ param: z20.string().nullish(),
3710
+ code: z20.string()
3582
3711
  }).nullish(),
3583
- model: z19.string().optional(),
3584
- output: z19.array(
3585
- z19.discriminatedUnion("type", [
3586
- z19.object({
3587
- type: z19.literal("message"),
3588
- role: z19.literal("assistant"),
3589
- id: z19.string(),
3590
- phase: z19.enum(["commentary", "final_answer"]).nullish(),
3591
- content: z19.array(
3592
- z19.object({
3593
- type: z19.literal("output_text"),
3594
- text: z19.string(),
3595
- logprobs: z19.array(
3596
- z19.object({
3597
- token: z19.string(),
3598
- logprob: z19.number(),
3599
- top_logprobs: z19.array(
3600
- z19.object({
3601
- token: z19.string(),
3602
- logprob: z19.number()
3712
+ model: z20.string().optional(),
3713
+ output: z20.array(
3714
+ z20.discriminatedUnion("type", [
3715
+ z20.object({
3716
+ type: z20.literal("message"),
3717
+ role: z20.literal("assistant"),
3718
+ id: z20.string(),
3719
+ phase: z20.enum(["commentary", "final_answer"]).nullish(),
3720
+ content: z20.array(
3721
+ z20.object({
3722
+ type: z20.literal("output_text"),
3723
+ text: z20.string(),
3724
+ logprobs: z20.array(
3725
+ z20.object({
3726
+ token: z20.string(),
3727
+ logprob: z20.number(),
3728
+ top_logprobs: z20.array(
3729
+ z20.object({
3730
+ token: z20.string(),
3731
+ logprob: z20.number()
3603
3732
  })
3604
3733
  )
3605
3734
  })
3606
3735
  ).nullish(),
3607
- annotations: z19.array(
3608
- z19.discriminatedUnion("type", [
3609
- z19.object({
3610
- type: z19.literal("url_citation"),
3611
- start_index: z19.number(),
3612
- end_index: z19.number(),
3613
- url: z19.string(),
3614
- title: z19.string()
3736
+ annotations: z20.array(
3737
+ z20.discriminatedUnion("type", [
3738
+ z20.object({
3739
+ type: z20.literal("url_citation"),
3740
+ start_index: z20.number(),
3741
+ end_index: z20.number(),
3742
+ url: z20.string(),
3743
+ title: z20.string()
3615
3744
  }),
3616
- z19.object({
3617
- type: z19.literal("file_citation"),
3618
- file_id: z19.string(),
3619
- filename: z19.string(),
3620
- index: z19.number()
3745
+ z20.object({
3746
+ type: z20.literal("file_citation"),
3747
+ file_id: z20.string(),
3748
+ filename: z20.string(),
3749
+ index: z20.number()
3621
3750
  }),
3622
- z19.object({
3623
- type: z19.literal("container_file_citation"),
3624
- container_id: z19.string(),
3625
- file_id: z19.string(),
3626
- filename: z19.string(),
3627
- start_index: z19.number(),
3628
- end_index: z19.number()
3751
+ z20.object({
3752
+ type: z20.literal("container_file_citation"),
3753
+ container_id: z20.string(),
3754
+ file_id: z20.string(),
3755
+ filename: z20.string(),
3756
+ start_index: z20.number(),
3757
+ end_index: z20.number()
3629
3758
  }),
3630
- z19.object({
3631
- type: z19.literal("file_path"),
3632
- file_id: z19.string(),
3633
- index: z19.number()
3759
+ z20.object({
3760
+ type: z20.literal("file_path"),
3761
+ file_id: z20.string(),
3762
+ index: z20.number()
3634
3763
  })
3635
3764
  ])
3636
3765
  )
3637
3766
  })
3638
3767
  )
3639
3768
  }),
3640
- z19.object({
3641
- type: z19.literal("web_search_call"),
3642
- id: z19.string(),
3643
- status: z19.string(),
3644
- action: z19.discriminatedUnion("type", [
3645
- z19.object({
3646
- type: z19.literal("search"),
3647
- query: z19.string().nullish(),
3648
- sources: z19.array(
3649
- z19.discriminatedUnion("type", [
3650
- z19.object({ type: z19.literal("url"), url: z19.string() }),
3651
- z19.object({
3652
- type: z19.literal("api"),
3653
- name: z19.string()
3769
+ z20.object({
3770
+ type: z20.literal("web_search_call"),
3771
+ id: z20.string(),
3772
+ status: z20.string(),
3773
+ action: z20.discriminatedUnion("type", [
3774
+ z20.object({
3775
+ type: z20.literal("search"),
3776
+ query: z20.string().nullish(),
3777
+ sources: z20.array(
3778
+ z20.discriminatedUnion("type", [
3779
+ z20.object({ type: z20.literal("url"), url: z20.string() }),
3780
+ z20.object({
3781
+ type: z20.literal("api"),
3782
+ name: z20.string()
3654
3783
  })
3655
3784
  ])
3656
3785
  ).nullish()
3657
3786
  }),
3658
- z19.object({
3659
- type: z19.literal("open_page"),
3660
- url: z19.string().nullish()
3787
+ z20.object({
3788
+ type: z20.literal("open_page"),
3789
+ url: z20.string().nullish()
3661
3790
  }),
3662
- z19.object({
3663
- type: z19.literal("find_in_page"),
3664
- url: z19.string().nullish(),
3665
- pattern: z19.string().nullish()
3791
+ z20.object({
3792
+ type: z20.literal("find_in_page"),
3793
+ url: z20.string().nullish(),
3794
+ pattern: z20.string().nullish()
3666
3795
  })
3667
3796
  ]).nullish()
3668
3797
  }),
3669
- z19.object({
3670
- type: z19.literal("file_search_call"),
3671
- id: z19.string(),
3672
- queries: z19.array(z19.string()),
3673
- results: z19.array(
3674
- z19.object({
3675
- attributes: z19.record(
3676
- z19.string(),
3677
- z19.union([z19.string(), z19.number(), z19.boolean()])
3798
+ z20.object({
3799
+ type: z20.literal("file_search_call"),
3800
+ id: z20.string(),
3801
+ queries: z20.array(z20.string()),
3802
+ results: z20.array(
3803
+ z20.object({
3804
+ attributes: z20.record(
3805
+ z20.string(),
3806
+ z20.union([z20.string(), z20.number(), z20.boolean()])
3678
3807
  ),
3679
- file_id: z19.string(),
3680
- filename: z19.string(),
3681
- score: z19.number(),
3682
- text: z19.string()
3808
+ file_id: z20.string(),
3809
+ filename: z20.string(),
3810
+ score: z20.number(),
3811
+ text: z20.string()
3683
3812
  })
3684
3813
  ).nullish()
3685
3814
  }),
3686
- z19.object({
3687
- type: z19.literal("code_interpreter_call"),
3688
- id: z19.string(),
3689
- code: z19.string().nullable(),
3690
- container_id: z19.string(),
3691
- outputs: z19.array(
3692
- z19.discriminatedUnion("type", [
3693
- z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3694
- z19.object({ type: z19.literal("image"), url: z19.string() })
3815
+ z20.object({
3816
+ type: z20.literal("code_interpreter_call"),
3817
+ id: z20.string(),
3818
+ code: z20.string().nullable(),
3819
+ container_id: z20.string(),
3820
+ outputs: z20.array(
3821
+ z20.discriminatedUnion("type", [
3822
+ z20.object({ type: z20.literal("logs"), logs: z20.string() }),
3823
+ z20.object({ type: z20.literal("image"), url: z20.string() })
3695
3824
  ])
3696
3825
  ).nullable()
3697
3826
  }),
3698
- z19.object({
3699
- type: z19.literal("image_generation_call"),
3700
- id: z19.string(),
3701
- result: z19.string()
3827
+ z20.object({
3828
+ type: z20.literal("image_generation_call"),
3829
+ id: z20.string(),
3830
+ result: z20.string()
3702
3831
  }),
3703
- z19.object({
3704
- type: z19.literal("local_shell_call"),
3705
- id: z19.string(),
3706
- call_id: z19.string(),
3707
- action: z19.object({
3708
- type: z19.literal("exec"),
3709
- command: z19.array(z19.string()),
3710
- timeout_ms: z19.number().optional(),
3711
- user: z19.string().optional(),
3712
- working_directory: z19.string().optional(),
3713
- env: z19.record(z19.string(), z19.string()).optional()
3832
+ z20.object({
3833
+ type: z20.literal("local_shell_call"),
3834
+ id: z20.string(),
3835
+ call_id: z20.string(),
3836
+ action: z20.object({
3837
+ type: z20.literal("exec"),
3838
+ command: z20.array(z20.string()),
3839
+ timeout_ms: z20.number().optional(),
3840
+ user: z20.string().optional(),
3841
+ working_directory: z20.string().optional(),
3842
+ env: z20.record(z20.string(), z20.string()).optional()
3714
3843
  })
3715
3844
  }),
3716
- z19.object({
3717
- type: z19.literal("function_call"),
3718
- call_id: z19.string(),
3719
- name: z19.string(),
3720
- arguments: z19.string(),
3721
- id: z19.string()
3845
+ z20.object({
3846
+ type: z20.literal("function_call"),
3847
+ call_id: z20.string(),
3848
+ name: z20.string(),
3849
+ arguments: z20.string(),
3850
+ id: z20.string()
3851
+ }),
3852
+ z20.object({
3853
+ type: z20.literal("custom_tool_call"),
3854
+ call_id: z20.string(),
3855
+ name: z20.string(),
3856
+ input: z20.string(),
3857
+ id: z20.string()
3722
3858
  }),
3723
- z19.object({
3724
- type: z19.literal("computer_call"),
3725
- id: z19.string(),
3726
- status: z19.string().optional()
3859
+ z20.object({
3860
+ type: z20.literal("computer_call"),
3861
+ id: z20.string(),
3862
+ status: z20.string().optional()
3727
3863
  }),
3728
- z19.object({
3729
- type: z19.literal("reasoning"),
3730
- id: z19.string(),
3731
- encrypted_content: z19.string().nullish(),
3732
- summary: z19.array(
3733
- z19.object({
3734
- type: z19.literal("summary_text"),
3735
- text: z19.string()
3864
+ z20.object({
3865
+ type: z20.literal("reasoning"),
3866
+ id: z20.string(),
3867
+ encrypted_content: z20.string().nullish(),
3868
+ summary: z20.array(
3869
+ z20.object({
3870
+ type: z20.literal("summary_text"),
3871
+ text: z20.string()
3736
3872
  })
3737
3873
  )
3738
3874
  }),
3739
- z19.object({
3740
- type: z19.literal("mcp_call"),
3741
- id: z19.string(),
3742
- status: z19.string(),
3743
- arguments: z19.string(),
3744
- name: z19.string(),
3745
- server_label: z19.string(),
3746
- output: z19.string().nullish(),
3747
- error: z19.union([
3748
- z19.string(),
3749
- z19.object({
3750
- type: z19.string().optional(),
3751
- code: z19.union([z19.number(), z19.string()]).optional(),
3752
- message: z19.string().optional()
3875
+ z20.object({
3876
+ type: z20.literal("mcp_call"),
3877
+ id: z20.string(),
3878
+ status: z20.string(),
3879
+ arguments: z20.string(),
3880
+ name: z20.string(),
3881
+ server_label: z20.string(),
3882
+ output: z20.string().nullish(),
3883
+ error: z20.union([
3884
+ z20.string(),
3885
+ z20.object({
3886
+ type: z20.string().optional(),
3887
+ code: z20.union([z20.number(), z20.string()]).optional(),
3888
+ message: z20.string().optional()
3753
3889
  }).loose()
3754
3890
  ]).nullish(),
3755
- approval_request_id: z19.string().nullish()
3891
+ approval_request_id: z20.string().nullish()
3756
3892
  }),
3757
- z19.object({
3758
- type: z19.literal("mcp_list_tools"),
3759
- id: z19.string(),
3760
- server_label: z19.string(),
3761
- tools: z19.array(
3762
- z19.object({
3763
- name: z19.string(),
3764
- description: z19.string().optional(),
3765
- input_schema: z19.any(),
3766
- annotations: z19.record(z19.string(), z19.unknown()).optional()
3893
+ z20.object({
3894
+ type: z20.literal("mcp_list_tools"),
3895
+ id: z20.string(),
3896
+ server_label: z20.string(),
3897
+ tools: z20.array(
3898
+ z20.object({
3899
+ name: z20.string(),
3900
+ description: z20.string().optional(),
3901
+ input_schema: z20.any(),
3902
+ annotations: z20.record(z20.string(), z20.unknown()).optional()
3767
3903
  })
3768
3904
  ),
3769
- error: z19.union([
3770
- z19.string(),
3771
- z19.object({
3772
- type: z19.string().optional(),
3773
- code: z19.union([z19.number(), z19.string()]).optional(),
3774
- message: z19.string().optional()
3905
+ error: z20.union([
3906
+ z20.string(),
3907
+ z20.object({
3908
+ type: z20.string().optional(),
3909
+ code: z20.union([z20.number(), z20.string()]).optional(),
3910
+ message: z20.string().optional()
3775
3911
  }).loose()
3776
3912
  ]).optional()
3777
3913
  }),
3778
- z19.object({
3779
- type: z19.literal("mcp_approval_request"),
3780
- id: z19.string(),
3781
- server_label: z19.string(),
3782
- name: z19.string(),
3783
- arguments: z19.string(),
3784
- approval_request_id: z19.string().optional()
3914
+ z20.object({
3915
+ type: z20.literal("mcp_approval_request"),
3916
+ id: z20.string(),
3917
+ server_label: z20.string(),
3918
+ name: z20.string(),
3919
+ arguments: z20.string(),
3920
+ approval_request_id: z20.string().optional()
3785
3921
  }),
3786
- z19.object({
3787
- type: z19.literal("apply_patch_call"),
3788
- id: z19.string(),
3789
- call_id: z19.string(),
3790
- status: z19.enum(["in_progress", "completed"]),
3791
- operation: z19.discriminatedUnion("type", [
3792
- z19.object({
3793
- type: z19.literal("create_file"),
3794
- path: z19.string(),
3795
- diff: z19.string()
3922
+ z20.object({
3923
+ type: z20.literal("apply_patch_call"),
3924
+ id: z20.string(),
3925
+ call_id: z20.string(),
3926
+ status: z20.enum(["in_progress", "completed"]),
3927
+ operation: z20.discriminatedUnion("type", [
3928
+ z20.object({
3929
+ type: z20.literal("create_file"),
3930
+ path: z20.string(),
3931
+ diff: z20.string()
3796
3932
  }),
3797
- z19.object({
3798
- type: z19.literal("delete_file"),
3799
- path: z19.string()
3933
+ z20.object({
3934
+ type: z20.literal("delete_file"),
3935
+ path: z20.string()
3800
3936
  }),
3801
- z19.object({
3802
- type: z19.literal("update_file"),
3803
- path: z19.string(),
3804
- diff: z19.string()
3937
+ z20.object({
3938
+ type: z20.literal("update_file"),
3939
+ path: z20.string(),
3940
+ diff: z20.string()
3805
3941
  })
3806
3942
  ])
3807
3943
  }),
3808
- z19.object({
3809
- type: z19.literal("shell_call"),
3810
- id: z19.string(),
3811
- call_id: z19.string(),
3812
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3813
- action: z19.object({
3814
- commands: z19.array(z19.string())
3944
+ z20.object({
3945
+ type: z20.literal("shell_call"),
3946
+ id: z20.string(),
3947
+ call_id: z20.string(),
3948
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3949
+ action: z20.object({
3950
+ commands: z20.array(z20.string())
3815
3951
  })
3816
3952
  }),
3817
- z19.object({
3818
- type: z19.literal("shell_call_output"),
3819
- id: z19.string(),
3820
- call_id: z19.string(),
3821
- status: z19.enum(["in_progress", "completed", "incomplete"]),
3822
- output: z19.array(
3823
- z19.object({
3824
- stdout: z19.string(),
3825
- stderr: z19.string(),
3826
- outcome: z19.discriminatedUnion("type", [
3827
- z19.object({ type: z19.literal("timeout") }),
3828
- z19.object({
3829
- type: z19.literal("exit"),
3830
- exit_code: z19.number()
3953
+ z20.object({
3954
+ type: z20.literal("shell_call_output"),
3955
+ id: z20.string(),
3956
+ call_id: z20.string(),
3957
+ status: z20.enum(["in_progress", "completed", "incomplete"]),
3958
+ output: z20.array(
3959
+ z20.object({
3960
+ stdout: z20.string(),
3961
+ stderr: z20.string(),
3962
+ outcome: z20.discriminatedUnion("type", [
3963
+ z20.object({ type: z20.literal("timeout") }),
3964
+ z20.object({
3965
+ type: z20.literal("exit"),
3966
+ exit_code: z20.number()
3831
3967
  })
3832
3968
  ])
3833
3969
  })
@@ -3835,37 +3971,31 @@ var openaiResponsesResponseSchema = lazySchema17(
3835
3971
  })
3836
3972
  ])
3837
3973
  ).optional(),
3838
- service_tier: z19.string().nullish(),
3839
- incomplete_details: z19.object({ reason: z19.string() }).nullish(),
3840
- usage: z19.object({
3841
- input_tokens: z19.number(),
3842
- input_tokens_details: z19.object({ cached_tokens: z19.number().nullish() }).nullish(),
3843
- output_tokens: z19.number(),
3844
- output_tokens_details: z19.object({ reasoning_tokens: z19.number().nullish() }).nullish()
3974
+ service_tier: z20.string().nullish(),
3975
+ incomplete_details: z20.object({ reason: z20.string() }).nullish(),
3976
+ usage: z20.object({
3977
+ input_tokens: z20.number(),
3978
+ input_tokens_details: z20.object({ cached_tokens: z20.number().nullish() }).nullish(),
3979
+ output_tokens: z20.number(),
3980
+ output_tokens_details: z20.object({ reasoning_tokens: z20.number().nullish() }).nullish()
3845
3981
  }).optional()
3846
3982
  })
3847
3983
  )
3848
3984
  );
3849
3985
 
3850
3986
  // src/responses/openai-responses-options.ts
3851
- import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
3852
- import { z as z20 } from "zod/v4";
3987
+ import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3988
+ import { z as z21 } from "zod/v4";
3853
3989
  var TOP_LOGPROBS_MAX = 20;
3854
3990
  var openaiResponsesReasoningModelIds = [
3855
3991
  "o1",
3856
3992
  "o1-2024-12-17",
3857
3993
  "o3",
3858
3994
  "o3-2025-04-16",
3859
- "o3-deep-research",
3860
- "o3-deep-research-2025-06-26",
3861
3995
  "o3-mini",
3862
3996
  "o3-mini-2025-01-31",
3863
3997
  "o4-mini",
3864
3998
  "o4-mini-2025-04-16",
3865
- "o4-mini-deep-research",
3866
- "o4-mini-deep-research-2025-06-26",
3867
- "codex-mini-latest",
3868
- "computer-use-preview",
3869
3999
  "gpt-5",
3870
4000
  "gpt-5-2025-08-07",
3871
4001
  "gpt-5-codex",
@@ -3898,7 +4028,6 @@ var openaiResponsesModelIds = [
3898
4028
  "gpt-4o-2024-08-06",
3899
4029
  "gpt-4o-2024-11-20",
3900
4030
  "gpt-4o-audio-preview",
3901
- "gpt-4o-audio-preview-2024-10-01",
3902
4031
  "gpt-4o-audio-preview-2024-12-17",
3903
4032
  "gpt-4o-search-preview",
3904
4033
  "gpt-4o-search-preview-2025-03-11",
@@ -3906,25 +4035,15 @@ var openaiResponsesModelIds = [
3906
4035
  "gpt-4o-mini-search-preview-2025-03-11",
3907
4036
  "gpt-4o-mini",
3908
4037
  "gpt-4o-mini-2024-07-18",
3909
- "gpt-4-turbo",
3910
- "gpt-4-turbo-2024-04-09",
3911
- "gpt-4-turbo-preview",
3912
- "gpt-4-0125-preview",
3913
- "gpt-4-1106-preview",
3914
- "gpt-4",
3915
- "gpt-4-0613",
3916
- "gpt-4.5-preview",
3917
- "gpt-4.5-preview-2025-02-27",
3918
4038
  "gpt-3.5-turbo-0125",
3919
4039
  "gpt-3.5-turbo",
3920
4040
  "gpt-3.5-turbo-1106",
3921
- "chatgpt-4o-latest",
3922
4041
  "gpt-5-chat-latest",
3923
4042
  ...openaiResponsesReasoningModelIds
3924
4043
  ];
3925
- var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
3926
- () => zodSchema18(
3927
- z20.object({
4044
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
4045
+ () => zodSchema19(
4046
+ z21.object({
3928
4047
  /**
3929
4048
  * The ID of the OpenAI Conversation to continue.
3930
4049
  * You must create a conversation first via the OpenAI API.
@@ -3932,13 +4051,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
3932
4051
  * Defaults to `undefined`.
3933
4052
  * @see https://platform.openai.com/docs/api-reference/conversations/create
3934
4053
  */
3935
- conversation: z20.string().nullish(),
4054
+ conversation: z21.string().nullish(),
3936
4055
  /**
3937
4056
  * The set of extra fields to include in the response (advanced, usually not needed).
3938
4057
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
3939
4058
  */
3940
- include: z20.array(
3941
- z20.enum([
4059
+ include: z21.array(
4060
+ z21.enum([
3942
4061
  "reasoning.encrypted_content",
3943
4062
  // handled internally by default, only needed for unknown reasoning models
3944
4063
  "file_search_call.results",
@@ -3950,7 +4069,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
3950
4069
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
3951
4070
  * Defaults to `undefined`.
3952
4071
  */
3953
- instructions: z20.string().nullish(),
4072
+ instructions: z21.string().nullish(),
3954
4073
  /**
3955
4074
  * Return the log probabilities of the tokens. Including logprobs will increase
3956
4075
  * the response size and can slow down response times. However, it can
@@ -3965,30 +4084,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
3965
4084
  * @see https://platform.openai.com/docs/api-reference/responses/create
3966
4085
  * @see https://cookbook.openai.com/examples/using_logprobs
3967
4086
  */
3968
- logprobs: z20.union([z20.boolean(), z20.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4087
+ logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3969
4088
  /**
3970
4089
  * The maximum number of total calls to built-in tools that can be processed in a response.
3971
4090
  * This maximum number applies across all built-in tool calls, not per individual tool.
3972
4091
  * Any further attempts to call a tool by the model will be ignored.
3973
4092
  */
3974
- maxToolCalls: z20.number().nullish(),
4093
+ maxToolCalls: z21.number().nullish(),
3975
4094
  /**
3976
4095
  * Additional metadata to store with the generation.
3977
4096
  */
3978
- metadata: z20.any().nullish(),
4097
+ metadata: z21.any().nullish(),
3979
4098
  /**
3980
4099
  * Whether to use parallel tool calls. Defaults to `true`.
3981
4100
  */
3982
- parallelToolCalls: z20.boolean().nullish(),
4101
+ parallelToolCalls: z21.boolean().nullish(),
3983
4102
  /**
3984
4103
  * The ID of the previous response. You can use it to continue a conversation.
3985
4104
  * Defaults to `undefined`.
3986
4105
  */
3987
- previousResponseId: z20.string().nullish(),
4106
+ previousResponseId: z21.string().nullish(),
3988
4107
  /**
3989
4108
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
3990
4109
  */
3991
- promptCacheKey: z20.string().nullish(),
4110
+ promptCacheKey: z21.string().nullish(),
3992
4111
  /**
3993
4112
  * The retention policy for the prompt cache.
3994
4113
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -3997,7 +4116,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
3997
4116
  *
3998
4117
  * @default 'in_memory'
3999
4118
  */
4000
- promptCacheRetention: z20.enum(["in_memory", "24h"]).nullish(),
4119
+ promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
4001
4120
  /**
4002
4121
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4003
4122
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4008,17 +4127,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
4008
4127
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4009
4128
  * an error.
4010
4129
  */
4011
- reasoningEffort: z20.string().nullish(),
4130
+ reasoningEffort: z21.string().nullish(),
4012
4131
  /**
4013
4132
  * Controls reasoning summary output from the model.
4014
4133
  * Set to "auto" to automatically receive the richest level available,
4015
4134
  * or "detailed" for comprehensive summaries.
4016
4135
  */
4017
- reasoningSummary: z20.string().nullish(),
4136
+ reasoningSummary: z21.string().nullish(),
4018
4137
  /**
4019
4138
  * The identifier for safety monitoring and tracking.
4020
4139
  */
4021
- safetyIdentifier: z20.string().nullish(),
4140
+ safetyIdentifier: z21.string().nullish(),
4022
4141
  /**
4023
4142
  * Service tier for the request.
4024
4143
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4026,34 +4145,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
4026
4145
  *
4027
4146
  * Defaults to 'auto'.
4028
4147
  */
4029
- serviceTier: z20.enum(["auto", "flex", "priority", "default"]).nullish(),
4148
+ serviceTier: z21.enum(["auto", "flex", "priority", "default"]).nullish(),
4030
4149
  /**
4031
4150
  * Whether to store the generation. Defaults to `true`.
4032
4151
  */
4033
- store: z20.boolean().nullish(),
4152
+ store: z21.boolean().nullish(),
4034
4153
  /**
4035
4154
  * Whether to use strict JSON schema validation.
4036
4155
  * Defaults to `true`.
4037
4156
  */
4038
- strictJsonSchema: z20.boolean().nullish(),
4157
+ strictJsonSchema: z21.boolean().nullish(),
4039
4158
  /**
4040
4159
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4041
4160
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4042
4161
  * Valid values: 'low', 'medium', 'high'.
4043
4162
  */
4044
- textVerbosity: z20.enum(["low", "medium", "high"]).nullish(),
4163
+ textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
4045
4164
  /**
4046
4165
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4047
4166
  * 'disabled' turns truncation off.
4048
4167
  */
4049
- truncation: z20.enum(["auto", "disabled"]).nullish(),
4168
+ truncation: z21.enum(["auto", "disabled"]).nullish(),
4050
4169
  /**
4051
4170
  * A unique identifier representing your end-user, which can help OpenAI to
4052
4171
  * monitor and detect abuse.
4053
4172
  * Defaults to `undefined`.
4054
4173
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4055
4174
  */
4056
- user: z20.string().nullish(),
4175
+ user: z21.string().nullish(),
4057
4176
  /**
4058
4177
  * Override the system message mode for this model.
4059
4178
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4062,7 +4181,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
4062
4181
  *
4063
4182
  * If not specified, the mode is automatically determined based on the model.
4064
4183
  */
4065
- systemMessageMode: z20.enum(["system", "developer", "remove"]).optional(),
4184
+ systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
4066
4185
  /**
4067
4186
  * Force treating this model as a reasoning model.
4068
4187
  *
@@ -4072,7 +4191,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema18(
4072
4191
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4073
4192
  * and defaults `systemMessageMode` to `developer` unless overridden.
4074
4193
  */
4075
- forceReasoning: z20.boolean().optional()
4194
+ forceReasoning: z21.boolean().optional()
4076
4195
  })
4077
4196
  )
4078
4197
  );
@@ -4084,14 +4203,18 @@ import {
4084
4203
  import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
4085
4204
  async function prepareResponsesTools({
4086
4205
  tools,
4087
- toolChoice
4206
+ toolChoice,
4207
+ toolNameMapping,
4208
+ customProviderToolNames
4088
4209
  }) {
4210
+ var _a;
4089
4211
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
4090
4212
  const toolWarnings = [];
4091
4213
  if (tools == null) {
4092
4214
  return { tools: void 0, toolChoice: void 0, toolWarnings };
4093
4215
  }
4094
4216
  const openaiTools2 = [];
4217
+ const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4095
4218
  for (const tool of tools) {
4096
4219
  switch (tool.type) {
4097
4220
  case "function":
@@ -4233,6 +4356,20 @@ async function prepareResponsesTools({
4233
4356
  });
4234
4357
  break;
4235
4358
  }
4359
+ case "openai.custom": {
4360
+ const args = await validateTypes2({
4361
+ value: tool.args,
4362
+ schema: customArgsSchema
4363
+ });
4364
+ openaiTools2.push({
4365
+ type: "custom",
4366
+ name: args.name,
4367
+ description: args.description,
4368
+ format: args.format
4369
+ });
4370
+ resolvedCustomProviderToolNames.add(args.name);
4371
+ break;
4372
+ }
4236
4373
  }
4237
4374
  break;
4238
4375
  }
@@ -4253,12 +4390,14 @@ async function prepareResponsesTools({
4253
4390
  case "none":
4254
4391
  case "required":
4255
4392
  return { tools: openaiTools2, toolChoice: type, toolWarnings };
4256
- case "tool":
4393
+ case "tool": {
4394
+ const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
4257
4395
  return {
4258
4396
  tools: openaiTools2,
4259
- 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 },
4397
+ toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
4260
4398
  toolWarnings
4261
4399
  };
4400
+ }
4262
4401
  default: {
4263
4402
  const _exhaustiveCheck = type;
4264
4403
  throw new UnsupportedFunctionalityError5({
@@ -4409,7 +4548,19 @@ var OpenAIResponsesLanguageModel = class {
4409
4548
  "openai.web_search_preview": "web_search_preview",
4410
4549
  "openai.mcp": "mcp",
4411
4550
  "openai.apply_patch": "apply_patch"
4412
- }
4551
+ },
4552
+ resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
4553
+ });
4554
+ const customProviderToolNames = /* @__PURE__ */ new Set();
4555
+ const {
4556
+ tools: openaiTools2,
4557
+ toolChoice: openaiToolChoice,
4558
+ toolWarnings
4559
+ } = await prepareResponsesTools({
4560
+ tools,
4561
+ toolChoice,
4562
+ toolNameMapping,
4563
+ customProviderToolNames
4413
4564
  });
4414
4565
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
4415
4566
  prompt,
@@ -4421,7 +4572,8 @@ var OpenAIResponsesLanguageModel = class {
4421
4572
  hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
4422
4573
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
4423
4574
  hasShellTool: hasOpenAITool("openai.shell"),
4424
- hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
4575
+ hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
4576
+ customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
4425
4577
  });
4426
4578
  warnings.push(...inputWarnings);
4427
4579
  const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;
@@ -4554,14 +4706,6 @@ var OpenAIResponsesLanguageModel = class {
4554
4706
  });
4555
4707
  delete baseArgs.service_tier;
4556
4708
  }
4557
- const {
4558
- tools: openaiTools2,
4559
- toolChoice: openaiToolChoice,
4560
- toolWarnings
4561
- } = await prepareResponsesTools({
4562
- tools,
4563
- toolChoice
4564
- });
4565
4709
  const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
4566
4710
  (tool) => tool.type === "provider" && tool.id === "openai.shell"
4567
4711
  )) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
@@ -4811,6 +4955,22 @@ var OpenAIResponsesLanguageModel = class {
4811
4955
  });
4812
4956
  break;
4813
4957
  }
4958
+ case "custom_tool_call": {
4959
+ hasFunctionCall = true;
4960
+ const toolName = toolNameMapping.toCustomToolName(part.name);
4961
+ content.push({
4962
+ type: "tool-call",
4963
+ toolCallId: part.call_id,
4964
+ toolName,
4965
+ input: JSON.stringify(part.input),
4966
+ providerMetadata: {
4967
+ [providerOptionsName]: {
4968
+ itemId: part.id
4969
+ }
4970
+ }
4971
+ });
4972
+ break;
4973
+ }
4814
4974
  case "web_search_call": {
4815
4975
  content.push({
4816
4976
  type: "tool-call",
@@ -5069,6 +5229,19 @@ var OpenAIResponsesLanguageModel = class {
5069
5229
  id: value.item.call_id,
5070
5230
  toolName: value.item.name
5071
5231
  });
5232
+ } else if (value.item.type === "custom_tool_call") {
5233
+ const toolName = toolNameMapping.toCustomToolName(
5234
+ value.item.name
5235
+ );
5236
+ ongoingToolCalls[value.output_index] = {
5237
+ toolName,
5238
+ toolCallId: value.item.call_id
5239
+ };
5240
+ controller.enqueue({
5241
+ type: "tool-input-start",
5242
+ id: value.item.call_id,
5243
+ toolName
5244
+ });
5072
5245
  } else if (value.item.type === "web_search_call") {
5073
5246
  ongoingToolCalls[value.output_index] = {
5074
5247
  toolName: toolNameMapping.toCustomToolName(
@@ -5253,6 +5426,27 @@ var OpenAIResponsesLanguageModel = class {
5253
5426
  }
5254
5427
  }
5255
5428
  });
5429
+ } else if (value.item.type === "custom_tool_call") {
5430
+ ongoingToolCalls[value.output_index] = void 0;
5431
+ hasFunctionCall = true;
5432
+ const toolName = toolNameMapping.toCustomToolName(
5433
+ value.item.name
5434
+ );
5435
+ controller.enqueue({
5436
+ type: "tool-input-end",
5437
+ id: value.item.call_id
5438
+ });
5439
+ controller.enqueue({
5440
+ type: "tool-call",
5441
+ toolCallId: value.item.call_id,
5442
+ toolName,
5443
+ input: JSON.stringify(value.item.input),
5444
+ providerMetadata: {
5445
+ [providerOptionsName]: {
5446
+ itemId: value.item.id
5447
+ }
5448
+ }
5449
+ });
5256
5450
  } else if (value.item.type === "web_search_call") {
5257
5451
  ongoingToolCalls[value.output_index] = void 0;
5258
5452
  controller.enqueue({
@@ -5502,6 +5696,15 @@ var OpenAIResponsesLanguageModel = class {
5502
5696
  delta: value.delta
5503
5697
  });
5504
5698
  }
5699
+ } else if (isResponseCustomToolCallInputDeltaChunk(value)) {
5700
+ const toolCall = ongoingToolCalls[value.output_index];
5701
+ if (toolCall != null) {
5702
+ controller.enqueue({
5703
+ type: "tool-input-delta",
5704
+ id: toolCall.toolCallId,
5705
+ delta: value.delta
5706
+ });
5707
+ }
5505
5708
  } else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
5506
5709
  const toolCall = ongoingToolCalls[value.output_index];
5507
5710
  if (toolCall == null ? void 0 : toolCall.applyPatch) {
@@ -5762,6 +5965,9 @@ function isResponseCreatedChunk(chunk) {
5762
5965
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
5763
5966
  return chunk.type === "response.function_call_arguments.delta";
5764
5967
  }
5968
+ function isResponseCustomToolCallInputDeltaChunk(chunk) {
5969
+ return chunk.type === "response.custom_tool_call_input.delta";
5970
+ }
5765
5971
  function isResponseImageGenerationCallPartialImageChunk(chunk) {
5766
5972
  return chunk.type === "response.image_generation_call.partial_image";
5767
5973
  }
@@ -5823,13 +6029,13 @@ import {
5823
6029
  } from "@ai-sdk/provider-utils";
5824
6030
 
5825
6031
  // src/speech/openai-speech-options.ts
5826
- import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
5827
- import { z as z21 } from "zod/v4";
5828
- var openaiSpeechModelOptionsSchema = lazySchema19(
5829
- () => zodSchema19(
5830
- z21.object({
5831
- instructions: z21.string().nullish(),
5832
- speed: z21.number().min(0.25).max(4).default(1).nullish()
6032
+ import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
6033
+ import { z as z22 } from "zod/v4";
6034
+ var openaiSpeechModelOptionsSchema = lazySchema20(
6035
+ () => zodSchema20(
6036
+ z22.object({
6037
+ instructions: z22.string().nullish(),
6038
+ speed: z22.number().min(0.25).max(4).default(1).nullish()
5833
6039
  })
5834
6040
  )
5835
6041
  );
@@ -5946,33 +6152,33 @@ import {
5946
6152
  } from "@ai-sdk/provider-utils";
5947
6153
 
5948
6154
  // src/transcription/openai-transcription-api.ts
5949
- import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
5950
- import { z as z22 } from "zod/v4";
5951
- var openaiTranscriptionResponseSchema = lazySchema20(
5952
- () => zodSchema20(
5953
- z22.object({
5954
- text: z22.string(),
5955
- language: z22.string().nullish(),
5956
- duration: z22.number().nullish(),
5957
- words: z22.array(
5958
- z22.object({
5959
- word: z22.string(),
5960
- start: z22.number(),
5961
- end: z22.number()
6155
+ import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6156
+ import { z as z23 } from "zod/v4";
6157
+ var openaiTranscriptionResponseSchema = lazySchema21(
6158
+ () => zodSchema21(
6159
+ z23.object({
6160
+ text: z23.string(),
6161
+ language: z23.string().nullish(),
6162
+ duration: z23.number().nullish(),
6163
+ words: z23.array(
6164
+ z23.object({
6165
+ word: z23.string(),
6166
+ start: z23.number(),
6167
+ end: z23.number()
5962
6168
  })
5963
6169
  ).nullish(),
5964
- segments: z22.array(
5965
- z22.object({
5966
- id: z22.number(),
5967
- seek: z22.number(),
5968
- start: z22.number(),
5969
- end: z22.number(),
5970
- text: z22.string(),
5971
- tokens: z22.array(z22.number()),
5972
- temperature: z22.number(),
5973
- avg_logprob: z22.number(),
5974
- compression_ratio: z22.number(),
5975
- no_speech_prob: z22.number()
6170
+ segments: z23.array(
6171
+ z23.object({
6172
+ id: z23.number(),
6173
+ seek: z23.number(),
6174
+ start: z23.number(),
6175
+ end: z23.number(),
6176
+ text: z23.string(),
6177
+ tokens: z23.array(z23.number()),
6178
+ temperature: z23.number(),
6179
+ avg_logprob: z23.number(),
6180
+ compression_ratio: z23.number(),
6181
+ no_speech_prob: z23.number()
5976
6182
  })
5977
6183
  ).nullish()
5978
6184
  })
@@ -5980,33 +6186,33 @@ var openaiTranscriptionResponseSchema = lazySchema20(
5980
6186
  );
5981
6187
 
5982
6188
  // src/transcription/openai-transcription-options.ts
5983
- import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
5984
- import { z as z23 } from "zod/v4";
5985
- var openAITranscriptionModelOptions = lazySchema21(
5986
- () => zodSchema21(
5987
- z23.object({
6189
+ import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6190
+ import { z as z24 } from "zod/v4";
6191
+ var openAITranscriptionModelOptions = lazySchema22(
6192
+ () => zodSchema22(
6193
+ z24.object({
5988
6194
  /**
5989
6195
  * Additional information to include in the transcription response.
5990
6196
  */
5991
- include: z23.array(z23.string()).optional(),
6197
+ include: z24.array(z24.string()).optional(),
5992
6198
  /**
5993
6199
  * The language of the input audio in ISO-639-1 format.
5994
6200
  */
5995
- language: z23.string().optional(),
6201
+ language: z24.string().optional(),
5996
6202
  /**
5997
6203
  * An optional text to guide the model's style or continue a previous audio segment.
5998
6204
  */
5999
- prompt: z23.string().optional(),
6205
+ prompt: z24.string().optional(),
6000
6206
  /**
6001
6207
  * The sampling temperature, between 0 and 1.
6002
6208
  * @default 0
6003
6209
  */
6004
- temperature: z23.number().min(0).max(1).default(0).optional(),
6210
+ temperature: z24.number().min(0).max(1).default(0).optional(),
6005
6211
  /**
6006
6212
  * The timestamp granularities to populate for this transcription.
6007
6213
  * @default ['segment']
6008
6214
  */
6009
- timestampGranularities: z23.array(z23.enum(["word", "segment"])).default(["segment"]).optional()
6215
+ timestampGranularities: z24.array(z24.enum(["word", "segment"])).default(["segment"]).optional()
6010
6216
  })
6011
6217
  )
6012
6218
  );
@@ -6179,7 +6385,7 @@ var OpenAITranscriptionModel = class {
6179
6385
  };
6180
6386
 
6181
6387
  // src/version.ts
6182
- var VERSION = true ? "3.0.36" : "0.0.0-test";
6388
+ var VERSION = true ? "3.0.38" : "0.0.0-test";
6183
6389
 
6184
6390
  // src/openai-provider.ts
6185
6391
  function createOpenAI(options = {}) {