@ai-sdk/openai 2.1.0-beta.1 → 2.1.0-beta.11

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.
@@ -244,7 +244,7 @@ function mapOpenAIFinishReason(finishReason) {
244
244
 
245
245
  // src/chat/openai-chat-options.ts
246
246
  import { z as z2 } from "zod/v4";
247
- var openaiProviderOptions = z2.object({
247
+ var openaiChatLanguageModelOptions = z2.object({
248
248
  /**
249
249
  * Modify the likelihood of specified tokens appearing in the completion.
250
250
  *
@@ -398,7 +398,7 @@ function prepareChatTools({
398
398
  // src/chat/openai-chat-language-model.ts
399
399
  var OpenAIChatLanguageModel = class {
400
400
  constructor(modelId, config) {
401
- this.specificationVersion = "v2";
401
+ this.specificationVersion = "v3";
402
402
  this.supportedUrls = {
403
403
  "image/*": [/^https?:\/\/.*$/]
404
404
  };
@@ -428,7 +428,7 @@ var OpenAIChatLanguageModel = class {
428
428
  const openaiOptions = (_a = await parseProviderOptions({
429
429
  provider: "openai",
430
430
  providerOptions,
431
- schema: openaiProviderOptions
431
+ schema: openaiChatLanguageModelOptions
432
432
  })) != null ? _a : {};
433
433
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
434
434
  if (topK != null) {
@@ -1216,7 +1216,7 @@ var openaiCompletionProviderOptions = z4.object({
1216
1216
  // src/completion/openai-completion-language-model.ts
1217
1217
  var OpenAICompletionLanguageModel = class {
1218
1218
  constructor(modelId, config) {
1219
- this.specificationVersion = "v2";
1219
+ this.specificationVersion = "v3";
1220
1220
  this.supportedUrls = {
1221
1221
  // No URLs are supported for completion models.
1222
1222
  };
@@ -1516,7 +1516,7 @@ var openaiEmbeddingProviderOptions = z6.object({
1516
1516
  // src/embedding/openai-embedding-model.ts
1517
1517
  var OpenAIEmbeddingModel = class {
1518
1518
  constructor(modelId, config) {
1519
- this.specificationVersion = "v2";
1519
+ this.specificationVersion = "v3";
1520
1520
  this.maxEmbeddingsPerCall = 2048;
1521
1521
  this.supportsParallelCalls = true;
1522
1522
  this.modelId = modelId;
@@ -1602,7 +1602,7 @@ var OpenAIImageModel = class {
1602
1602
  constructor(modelId, config) {
1603
1603
  this.modelId = modelId;
1604
1604
  this.config = config;
1605
- this.specificationVersion = "v2";
1605
+ this.specificationVersion = "v3";
1606
1606
  }
1607
1607
  get maxImagesPerCall() {
1608
1608
  var _a;
@@ -2036,14 +2036,39 @@ import {
2036
2036
  parseProviderOptions as parseProviderOptions7,
2037
2037
  postJsonToApi as postJsonToApi6
2038
2038
  } from "@ai-sdk/provider-utils";
2039
- import { z as z18 } from "zod/v4";
2039
+ import { z as z19 } from "zod/v4";
2040
2040
 
2041
2041
  // src/responses/convert-to-openai-responses-input.ts
2042
2042
  import {
2043
2043
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2044
2044
  } from "@ai-sdk/provider";
2045
2045
  import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions6 } from "@ai-sdk/provider-utils";
2046
+ import { z as z13 } from "zod/v4";
2047
+
2048
+ // src/tool/local-shell.ts
2049
+ import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2046
2050
  import { z as z12 } from "zod/v4";
2051
+ var localShellInputSchema = z12.object({
2052
+ action: z12.object({
2053
+ type: z12.literal("exec"),
2054
+ command: z12.array(z12.string()),
2055
+ timeoutMs: z12.number().optional(),
2056
+ user: z12.string().optional(),
2057
+ workingDirectory: z12.string().optional(),
2058
+ env: z12.record(z12.string(), z12.string()).optional()
2059
+ })
2060
+ });
2061
+ var localShellOutputSchema = z12.object({
2062
+ output: z12.string()
2063
+ });
2064
+ var localShell = createProviderDefinedToolFactoryWithOutputSchema({
2065
+ id: "openai.local_shell",
2066
+ name: "local_shell",
2067
+ inputSchema: localShellInputSchema,
2068
+ outputSchema: localShellOutputSchema
2069
+ });
2070
+
2071
+ // src/responses/convert-to-openai-responses-input.ts
2047
2072
  function isFileId(data, prefixes) {
2048
2073
  if (!prefixes) return false;
2049
2074
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2052,9 +2077,10 @@ async function convertToOpenAIResponsesInput({
2052
2077
  prompt,
2053
2078
  systemMessageMode,
2054
2079
  fileIdPrefixes,
2055
- store
2080
+ store,
2081
+ hasLocalShellTool = false
2056
2082
  }) {
2057
- var _a, _b, _c, _d, _e, _f;
2083
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2058
2084
  const input = [];
2059
2085
  const warnings = [];
2060
2086
  for (const { role, content } of prompt) {
@@ -2147,12 +2173,29 @@ async function convertToOpenAIResponsesInput({
2147
2173
  if (part.providerExecuted) {
2148
2174
  break;
2149
2175
  }
2176
+ if (hasLocalShellTool && part.toolName === "local_shell") {
2177
+ const parsedInput = localShellInputSchema.parse(part.input);
2178
+ input.push({
2179
+ type: "local_shell_call",
2180
+ call_id: part.toolCallId,
2181
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2182
+ action: {
2183
+ type: "exec",
2184
+ command: parsedInput.action.command,
2185
+ timeout_ms: parsedInput.action.timeoutMs,
2186
+ user: parsedInput.action.user,
2187
+ working_directory: parsedInput.action.workingDirectory,
2188
+ env: parsedInput.action.env
2189
+ }
2190
+ });
2191
+ break;
2192
+ }
2150
2193
  input.push({
2151
2194
  type: "function_call",
2152
2195
  call_id: part.toolCallId,
2153
2196
  name: part.toolName,
2154
2197
  arguments: JSON.stringify(part.input),
2155
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0
2198
+ id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2156
2199
  });
2157
2200
  break;
2158
2201
  }
@@ -2176,26 +2219,40 @@ async function convertToOpenAIResponsesInput({
2176
2219
  });
2177
2220
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2178
2221
  if (reasoningId != null) {
2179
- const existingReasoningMessage = reasoningMessages[reasoningId];
2180
- const summaryParts = [];
2181
- if (part.text.length > 0) {
2182
- summaryParts.push({ type: "summary_text", text: part.text });
2183
- } else if (existingReasoningMessage !== void 0) {
2184
- warnings.push({
2185
- type: "other",
2186
- message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2187
- });
2188
- }
2189
- if (existingReasoningMessage === void 0) {
2190
- reasoningMessages[reasoningId] = {
2191
- type: "reasoning",
2192
- id: reasoningId,
2193
- encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2194
- summary: summaryParts
2195
- };
2196
- input.push(reasoningMessages[reasoningId]);
2222
+ const reasoningMessage = reasoningMessages[reasoningId];
2223
+ if (store) {
2224
+ if (reasoningMessage === void 0) {
2225
+ input.push({ type: "item_reference", id: reasoningId });
2226
+ reasoningMessages[reasoningId] = {
2227
+ type: "reasoning",
2228
+ id: reasoningId,
2229
+ summary: []
2230
+ };
2231
+ }
2197
2232
  } else {
2198
- existingReasoningMessage.summary.push(...summaryParts);
2233
+ const summaryParts = [];
2234
+ if (part.text.length > 0) {
2235
+ summaryParts.push({
2236
+ type: "summary_text",
2237
+ text: part.text
2238
+ });
2239
+ } else if (reasoningMessage !== void 0) {
2240
+ warnings.push({
2241
+ type: "other",
2242
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2243
+ });
2244
+ }
2245
+ if (reasoningMessage === void 0) {
2246
+ reasoningMessages[reasoningId] = {
2247
+ type: "reasoning",
2248
+ id: reasoningId,
2249
+ encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2250
+ summary: summaryParts
2251
+ };
2252
+ input.push(reasoningMessages[reasoningId]);
2253
+ } else {
2254
+ reasoningMessage.summary.push(...summaryParts);
2255
+ }
2199
2256
  }
2200
2257
  } else {
2201
2258
  warnings.push({
@@ -2212,6 +2269,14 @@ async function convertToOpenAIResponsesInput({
2212
2269
  case "tool": {
2213
2270
  for (const part of content) {
2214
2271
  const output = part.output;
2272
+ if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2273
+ input.push({
2274
+ type: "local_shell_call_output",
2275
+ call_id: part.toolCallId,
2276
+ output: localShellOutputSchema.parse(output.value).output
2277
+ });
2278
+ break;
2279
+ }
2215
2280
  let contentValue;
2216
2281
  switch (output.type) {
2217
2282
  case "text":
@@ -2240,9 +2305,9 @@ async function convertToOpenAIResponsesInput({
2240
2305
  }
2241
2306
  return { input, warnings };
2242
2307
  }
2243
- var openaiResponsesReasoningProviderOptionsSchema = z12.object({
2244
- itemId: z12.string().nullish(),
2245
- reasoningEncryptedContent: z12.string().nullish()
2308
+ var openaiResponsesReasoningProviderOptionsSchema = z13.object({
2309
+ itemId: z13.string().nullish(),
2310
+ reasoningEncryptedContent: z13.string().nullish()
2246
2311
  });
2247
2312
 
2248
2313
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2269,110 +2334,113 @@ import {
2269
2334
  } from "@ai-sdk/provider";
2270
2335
 
2271
2336
  // src/tool/code-interpreter.ts
2272
- import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2273
- import { z as z13 } from "zod/v4";
2274
- var codeInterpreterInputSchema = z13.object({
2275
- code: z13.string().nullish(),
2276
- containerId: z13.string()
2337
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
2338
+ import { z as z14 } from "zod/v4";
2339
+ var codeInterpreterInputSchema = z14.object({
2340
+ code: z14.string().nullish(),
2341
+ containerId: z14.string()
2277
2342
  });
2278
- var codeInterpreterOutputSchema = z13.object({
2279
- outputs: z13.array(
2280
- z13.discriminatedUnion("type", [
2281
- z13.object({ type: z13.literal("logs"), logs: z13.string() }),
2282
- z13.object({ type: z13.literal("image"), url: z13.string() })
2343
+ var codeInterpreterOutputSchema = z14.object({
2344
+ outputs: z14.array(
2345
+ z14.discriminatedUnion("type", [
2346
+ z14.object({ type: z14.literal("logs"), logs: z14.string() }),
2347
+ z14.object({ type: z14.literal("image"), url: z14.string() })
2283
2348
  ])
2284
2349
  ).nullish()
2285
2350
  });
2286
- var codeInterpreterArgsSchema = z13.object({
2287
- container: z13.union([
2288
- z13.string(),
2289
- z13.object({
2290
- fileIds: z13.array(z13.string()).optional()
2351
+ var codeInterpreterArgsSchema = z14.object({
2352
+ container: z14.union([
2353
+ z14.string(),
2354
+ z14.object({
2355
+ fileIds: z14.array(z14.string()).optional()
2291
2356
  })
2292
2357
  ]).optional()
2293
2358
  });
2294
- var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
2359
+ var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
2295
2360
  id: "openai.code_interpreter",
2296
2361
  name: "code_interpreter",
2297
2362
  inputSchema: codeInterpreterInputSchema,
2298
2363
  outputSchema: codeInterpreterOutputSchema
2299
2364
  });
2365
+ var codeInterpreter = (args = {}) => {
2366
+ return codeInterpreterToolFactory(args);
2367
+ };
2300
2368
 
2301
2369
  // src/tool/file-search.ts
2302
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
2303
- import { z as z14 } from "zod/v4";
2304
- var comparisonFilterSchema = z14.object({
2305
- key: z14.string(),
2306
- type: z14.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
2307
- value: z14.union([z14.string(), z14.number(), z14.boolean()])
2370
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
2371
+ import { z as z15 } from "zod/v4";
2372
+ var comparisonFilterSchema = z15.object({
2373
+ key: z15.string(),
2374
+ type: z15.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
2375
+ value: z15.union([z15.string(), z15.number(), z15.boolean()])
2308
2376
  });
2309
- var compoundFilterSchema = z14.object({
2310
- type: z14.enum(["and", "or"]),
2311
- filters: z14.array(
2312
- z14.union([comparisonFilterSchema, z14.lazy(() => compoundFilterSchema)])
2377
+ var compoundFilterSchema = z15.object({
2378
+ type: z15.enum(["and", "or"]),
2379
+ filters: z15.array(
2380
+ z15.union([comparisonFilterSchema, z15.lazy(() => compoundFilterSchema)])
2313
2381
  )
2314
2382
  });
2315
- var fileSearchArgsSchema = z14.object({
2316
- vectorStoreIds: z14.array(z14.string()),
2317
- maxNumResults: z14.number().optional(),
2318
- ranking: z14.object({
2319
- ranker: z14.string().optional(),
2320
- scoreThreshold: z14.number().optional()
2383
+ var fileSearchArgsSchema = z15.object({
2384
+ vectorStoreIds: z15.array(z15.string()),
2385
+ maxNumResults: z15.number().optional(),
2386
+ ranking: z15.object({
2387
+ ranker: z15.string().optional(),
2388
+ scoreThreshold: z15.number().optional()
2321
2389
  }).optional(),
2322
- filters: z14.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2390
+ filters: z15.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2323
2391
  });
2324
- var fileSearchOutputSchema = z14.object({
2325
- queries: z14.array(z14.string()),
2326
- results: z14.array(
2327
- z14.object({
2328
- attributes: z14.record(z14.string(), z14.unknown()),
2329
- fileId: z14.string(),
2330
- filename: z14.string(),
2331
- score: z14.number(),
2332
- text: z14.string()
2392
+ var fileSearchOutputSchema = z15.object({
2393
+ queries: z15.array(z15.string()),
2394
+ results: z15.array(
2395
+ z15.object({
2396
+ attributes: z15.record(z15.string(), z15.unknown()),
2397
+ fileId: z15.string(),
2398
+ filename: z15.string(),
2399
+ score: z15.number(),
2400
+ text: z15.string()
2333
2401
  })
2334
2402
  ).nullable()
2335
2403
  });
2336
- var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
2404
+ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
2337
2405
  id: "openai.file_search",
2338
2406
  name: "file_search",
2339
- inputSchema: z14.object({}),
2407
+ inputSchema: z15.object({}),
2340
2408
  outputSchema: fileSearchOutputSchema
2341
2409
  });
2342
2410
 
2343
2411
  // src/tool/web-search.ts
2344
2412
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
2345
- import { z as z15 } from "zod/v4";
2346
- var webSearchArgsSchema = z15.object({
2347
- filters: z15.object({
2348
- allowedDomains: z15.array(z15.string()).optional()
2413
+ import { z as z16 } from "zod/v4";
2414
+ var webSearchArgsSchema = z16.object({
2415
+ filters: z16.object({
2416
+ allowedDomains: z16.array(z16.string()).optional()
2349
2417
  }).optional(),
2350
- searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2351
- userLocation: z15.object({
2352
- type: z15.literal("approximate"),
2353
- country: z15.string().optional(),
2354
- city: z15.string().optional(),
2355
- region: z15.string().optional(),
2356
- timezone: z15.string().optional()
2418
+ searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
2419
+ userLocation: z16.object({
2420
+ type: z16.literal("approximate"),
2421
+ country: z16.string().optional(),
2422
+ city: z16.string().optional(),
2423
+ region: z16.string().optional(),
2424
+ timezone: z16.string().optional()
2357
2425
  }).optional()
2358
2426
  });
2359
2427
  var webSearchToolFactory = createProviderDefinedToolFactory({
2360
2428
  id: "openai.web_search",
2361
2429
  name: "web_search",
2362
- inputSchema: z15.object({
2363
- action: z15.discriminatedUnion("type", [
2364
- z15.object({
2365
- type: z15.literal("search"),
2366
- query: z15.string().nullish()
2430
+ inputSchema: z16.object({
2431
+ action: z16.discriminatedUnion("type", [
2432
+ z16.object({
2433
+ type: z16.literal("search"),
2434
+ query: z16.string().nullish()
2367
2435
  }),
2368
- z15.object({
2369
- type: z15.literal("open_page"),
2370
- url: z15.string()
2436
+ z16.object({
2437
+ type: z16.literal("open_page"),
2438
+ url: z16.string()
2371
2439
  }),
2372
- z15.object({
2373
- type: z15.literal("find"),
2374
- url: z15.string(),
2375
- pattern: z15.string()
2440
+ z16.object({
2441
+ type: z16.literal("find"),
2442
+ url: z16.string(),
2443
+ pattern: z16.string()
2376
2444
  })
2377
2445
  ]).nullish()
2378
2446
  })
@@ -2380,89 +2448,93 @@ var webSearchToolFactory = createProviderDefinedToolFactory({
2380
2448
 
2381
2449
  // src/tool/web-search-preview.ts
2382
2450
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
2383
- import { z as z16 } from "zod/v4";
2384
- var webSearchPreviewArgsSchema = z16.object({
2451
+ import { z as z17 } from "zod/v4";
2452
+ var webSearchPreviewArgsSchema = z17.object({
2385
2453
  /**
2386
2454
  * Search context size to use for the web search.
2387
2455
  * - high: Most comprehensive context, highest cost, slower response
2388
2456
  * - medium: Balanced context, cost, and latency (default)
2389
2457
  * - low: Least context, lowest cost, fastest response
2390
2458
  */
2391
- searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
2459
+ searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
2392
2460
  /**
2393
2461
  * User location information to provide geographically relevant search results.
2394
2462
  */
2395
- userLocation: z16.object({
2463
+ userLocation: z17.object({
2396
2464
  /**
2397
2465
  * Type of location (always 'approximate')
2398
2466
  */
2399
- type: z16.literal("approximate"),
2467
+ type: z17.literal("approximate"),
2400
2468
  /**
2401
2469
  * Two-letter ISO country code (e.g., 'US', 'GB')
2402
2470
  */
2403
- country: z16.string().optional(),
2471
+ country: z17.string().optional(),
2404
2472
  /**
2405
2473
  * City name (free text, e.g., 'Minneapolis')
2406
2474
  */
2407
- city: z16.string().optional(),
2475
+ city: z17.string().optional(),
2408
2476
  /**
2409
2477
  * Region name (free text, e.g., 'Minnesota')
2410
2478
  */
2411
- region: z16.string().optional(),
2479
+ region: z17.string().optional(),
2412
2480
  /**
2413
2481
  * IANA timezone (e.g., 'America/Chicago')
2414
2482
  */
2415
- timezone: z16.string().optional()
2483
+ timezone: z17.string().optional()
2416
2484
  }).optional()
2417
2485
  });
2418
2486
  var webSearchPreview = createProviderDefinedToolFactory2({
2419
2487
  id: "openai.web_search_preview",
2420
2488
  name: "web_search_preview",
2421
- inputSchema: z16.object({
2422
- action: z16.discriminatedUnion("type", [
2423
- z16.object({
2424
- type: z16.literal("search"),
2425
- query: z16.string().nullish()
2489
+ inputSchema: z17.object({
2490
+ action: z17.discriminatedUnion("type", [
2491
+ z17.object({
2492
+ type: z17.literal("search"),
2493
+ query: z17.string().nullish()
2426
2494
  }),
2427
- z16.object({
2428
- type: z16.literal("open_page"),
2429
- url: z16.string()
2495
+ z17.object({
2496
+ type: z17.literal("open_page"),
2497
+ url: z17.string()
2430
2498
  }),
2431
- z16.object({
2432
- type: z16.literal("find"),
2433
- url: z16.string(),
2434
- pattern: z16.string()
2499
+ z17.object({
2500
+ type: z17.literal("find"),
2501
+ url: z17.string(),
2502
+ pattern: z17.string()
2435
2503
  })
2436
2504
  ]).nullish()
2437
2505
  })
2438
2506
  });
2439
2507
 
2440
2508
  // src/tool/image-generation.ts
2441
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
2442
- import { z as z17 } from "zod/v4";
2443
- var imageGenerationArgsSchema = z17.object({
2444
- background: z17.enum(["auto", "opaque", "transparent"]).optional(),
2445
- inputFidelity: z17.enum(["low", "high"]).optional(),
2446
- inputImageMask: z17.object({
2447
- fileId: z17.string().optional(),
2448
- imageUrl: z17.string().optional()
2509
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4 } from "@ai-sdk/provider-utils";
2510
+ import { z as z18 } from "zod/v4";
2511
+ var imageGenerationArgsSchema = z18.object({
2512
+ background: z18.enum(["auto", "opaque", "transparent"]).optional(),
2513
+ inputFidelity: z18.enum(["low", "high"]).optional(),
2514
+ inputImageMask: z18.object({
2515
+ fileId: z18.string().optional(),
2516
+ imageUrl: z18.string().optional()
2449
2517
  }).optional(),
2450
- model: z17.string().optional(),
2451
- moderation: z17.enum(["auto"]).optional(),
2452
- outputCompression: z17.number().int().min(0).max(100).optional(),
2453
- outputFormat: z17.enum(["png", "jpeg", "webp"]).optional(),
2454
- quality: z17.enum(["auto", "low", "medium", "high"]).optional(),
2455
- size: z17.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2518
+ model: z18.string().optional(),
2519
+ moderation: z18.enum(["auto"]).optional(),
2520
+ outputCompression: z18.number().int().min(0).max(100).optional(),
2521
+ outputFormat: z18.enum(["png", "jpeg", "webp"]).optional(),
2522
+ partialImages: z18.number().int().min(0).max(3).optional(),
2523
+ quality: z18.enum(["auto", "low", "medium", "high"]).optional(),
2524
+ size: z18.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2456
2525
  }).strict();
2457
- var imageGenerationOutputSchema = z17.object({
2458
- result: z17.string()
2526
+ var imageGenerationOutputSchema = z18.object({
2527
+ result: z18.string()
2459
2528
  });
2460
- var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
2529
+ var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
2461
2530
  id: "openai.image_generation",
2462
2531
  name: "image_generation",
2463
- inputSchema: z17.object({}),
2532
+ inputSchema: z18.object({}),
2464
2533
  outputSchema: imageGenerationOutputSchema
2465
2534
  });
2535
+ var imageGeneration = (args = {}) => {
2536
+ return imageGenerationToolFactory(args);
2537
+ };
2466
2538
 
2467
2539
  // src/responses/openai-responses-prepare-tools.ts
2468
2540
  function prepareResponsesTools({
@@ -2503,6 +2575,12 @@ function prepareResponsesTools({
2503
2575
  });
2504
2576
  break;
2505
2577
  }
2578
+ case "openai.local_shell": {
2579
+ openaiTools.push({
2580
+ type: "local_shell"
2581
+ });
2582
+ break;
2583
+ }
2506
2584
  case "openai.web_search_preview": {
2507
2585
  const args = webSearchPreviewArgsSchema.parse(tool.args);
2508
2586
  openaiTools.push({
@@ -2541,11 +2619,12 @@ function prepareResponsesTools({
2541
2619
  image_url: args.inputImageMask.imageUrl
2542
2620
  } : void 0,
2543
2621
  model: args.model,
2544
- size: args.size,
2545
- quality: args.quality,
2546
2622
  moderation: args.moderation,
2623
+ partial_images: args.partialImages,
2624
+ quality: args.quality,
2625
+ output_compression: args.outputCompression,
2547
2626
  output_format: args.outputFormat,
2548
- output_compression: args.outputCompression
2627
+ size: args.size
2549
2628
  });
2550
2629
  break;
2551
2630
  }
@@ -2582,73 +2661,86 @@ function prepareResponsesTools({
2582
2661
  }
2583
2662
 
2584
2663
  // src/responses/openai-responses-language-model.ts
2585
- var webSearchCallItem = z18.object({
2586
- type: z18.literal("web_search_call"),
2587
- id: z18.string(),
2588
- status: z18.string(),
2589
- action: z18.discriminatedUnion("type", [
2590
- z18.object({
2591
- type: z18.literal("search"),
2592
- query: z18.string().nullish()
2664
+ var webSearchCallItem = z19.object({
2665
+ type: z19.literal("web_search_call"),
2666
+ id: z19.string(),
2667
+ status: z19.string(),
2668
+ action: z19.discriminatedUnion("type", [
2669
+ z19.object({
2670
+ type: z19.literal("search"),
2671
+ query: z19.string().nullish()
2593
2672
  }),
2594
- z18.object({
2595
- type: z18.literal("open_page"),
2596
- url: z18.string()
2673
+ z19.object({
2674
+ type: z19.literal("open_page"),
2675
+ url: z19.string()
2597
2676
  }),
2598
- z18.object({
2599
- type: z18.literal("find"),
2600
- url: z18.string(),
2601
- pattern: z18.string()
2677
+ z19.object({
2678
+ type: z19.literal("find"),
2679
+ url: z19.string(),
2680
+ pattern: z19.string()
2602
2681
  })
2603
2682
  ]).nullish()
2604
2683
  });
2605
- var fileSearchCallItem = z18.object({
2606
- type: z18.literal("file_search_call"),
2607
- id: z18.string(),
2608
- queries: z18.array(z18.string()),
2609
- results: z18.array(
2610
- z18.object({
2611
- attributes: z18.record(z18.string(), z18.unknown()),
2612
- file_id: z18.string(),
2613
- filename: z18.string(),
2614
- score: z18.number(),
2615
- text: z18.string()
2684
+ var fileSearchCallItem = z19.object({
2685
+ type: z19.literal("file_search_call"),
2686
+ id: z19.string(),
2687
+ queries: z19.array(z19.string()),
2688
+ results: z19.array(
2689
+ z19.object({
2690
+ attributes: z19.record(z19.string(), z19.unknown()),
2691
+ file_id: z19.string(),
2692
+ filename: z19.string(),
2693
+ score: z19.number(),
2694
+ text: z19.string()
2616
2695
  })
2617
2696
  ).nullish()
2618
2697
  });
2619
- var codeInterpreterCallItem = z18.object({
2620
- type: z18.literal("code_interpreter_call"),
2621
- id: z18.string(),
2622
- code: z18.string().nullable(),
2623
- container_id: z18.string(),
2624
- outputs: z18.array(
2625
- z18.discriminatedUnion("type", [
2626
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
2627
- z18.object({ type: z18.literal("image"), url: z18.string() })
2698
+ var codeInterpreterCallItem = z19.object({
2699
+ type: z19.literal("code_interpreter_call"),
2700
+ id: z19.string(),
2701
+ code: z19.string().nullable(),
2702
+ container_id: z19.string(),
2703
+ outputs: z19.array(
2704
+ z19.discriminatedUnion("type", [
2705
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
2706
+ z19.object({ type: z19.literal("image"), url: z19.string() })
2628
2707
  ])
2629
2708
  ).nullable()
2630
2709
  });
2631
- var imageGenerationCallItem = z18.object({
2632
- type: z18.literal("image_generation_call"),
2633
- id: z18.string(),
2634
- result: z18.string()
2710
+ var localShellCallItem = z19.object({
2711
+ type: z19.literal("local_shell_call"),
2712
+ id: z19.string(),
2713
+ call_id: z19.string(),
2714
+ action: z19.object({
2715
+ type: z19.literal("exec"),
2716
+ command: z19.array(z19.string()),
2717
+ timeout_ms: z19.number().optional(),
2718
+ user: z19.string().optional(),
2719
+ working_directory: z19.string().optional(),
2720
+ env: z19.record(z19.string(), z19.string()).optional()
2721
+ })
2722
+ });
2723
+ var imageGenerationCallItem = z19.object({
2724
+ type: z19.literal("image_generation_call"),
2725
+ id: z19.string(),
2726
+ result: z19.string()
2635
2727
  });
2636
2728
  var TOP_LOGPROBS_MAX = 20;
2637
- var LOGPROBS_SCHEMA = z18.array(
2638
- z18.object({
2639
- token: z18.string(),
2640
- logprob: z18.number(),
2641
- top_logprobs: z18.array(
2642
- z18.object({
2643
- token: z18.string(),
2644
- logprob: z18.number()
2729
+ var LOGPROBS_SCHEMA = z19.array(
2730
+ z19.object({
2731
+ token: z19.string(),
2732
+ logprob: z19.number(),
2733
+ top_logprobs: z19.array(
2734
+ z19.object({
2735
+ token: z19.string(),
2736
+ logprob: z19.number()
2645
2737
  })
2646
2738
  )
2647
2739
  })
2648
2740
  );
2649
2741
  var OpenAIResponsesLanguageModel = class {
2650
2742
  constructor(modelId, config) {
2651
- this.specificationVersion = "v2";
2743
+ this.specificationVersion = "v3";
2652
2744
  this.supportedUrls = {
2653
2745
  "image/*": [/^https?:\/\/.*$/],
2654
2746
  "application/pdf": [/^https?:\/\/.*$/]
@@ -2707,7 +2799,8 @@ var OpenAIResponsesLanguageModel = class {
2707
2799
  prompt,
2708
2800
  systemMessageMode: modelConfig.systemMessageMode,
2709
2801
  fileIdPrefixes: this.config.fileIdPrefixes,
2710
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2802
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
2803
+ hasLocalShellTool: hasOpenAITool("openai.local_shell")
2711
2804
  });
2712
2805
  warnings.push(...inputWarnings);
2713
2806
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -2872,45 +2965,45 @@ var OpenAIResponsesLanguageModel = class {
2872
2965
  body,
2873
2966
  failedResponseHandler: openaiFailedResponseHandler,
2874
2967
  successfulResponseHandler: createJsonResponseHandler6(
2875
- z18.object({
2876
- id: z18.string(),
2877
- created_at: z18.number(),
2878
- error: z18.object({
2879
- code: z18.string(),
2880
- message: z18.string()
2968
+ z19.object({
2969
+ id: z19.string(),
2970
+ created_at: z19.number(),
2971
+ error: z19.object({
2972
+ code: z19.string(),
2973
+ message: z19.string()
2881
2974
  }).nullish(),
2882
- model: z18.string(),
2883
- output: z18.array(
2884
- z18.discriminatedUnion("type", [
2885
- z18.object({
2886
- type: z18.literal("message"),
2887
- role: z18.literal("assistant"),
2888
- id: z18.string(),
2889
- content: z18.array(
2890
- z18.object({
2891
- type: z18.literal("output_text"),
2892
- text: z18.string(),
2975
+ model: z19.string(),
2976
+ output: z19.array(
2977
+ z19.discriminatedUnion("type", [
2978
+ z19.object({
2979
+ type: z19.literal("message"),
2980
+ role: z19.literal("assistant"),
2981
+ id: z19.string(),
2982
+ content: z19.array(
2983
+ z19.object({
2984
+ type: z19.literal("output_text"),
2985
+ text: z19.string(),
2893
2986
  logprobs: LOGPROBS_SCHEMA.nullish(),
2894
- annotations: z18.array(
2895
- z18.discriminatedUnion("type", [
2896
- z18.object({
2897
- type: z18.literal("url_citation"),
2898
- start_index: z18.number(),
2899
- end_index: z18.number(),
2900
- url: z18.string(),
2901
- title: z18.string()
2987
+ annotations: z19.array(
2988
+ z19.discriminatedUnion("type", [
2989
+ z19.object({
2990
+ type: z19.literal("url_citation"),
2991
+ start_index: z19.number(),
2992
+ end_index: z19.number(),
2993
+ url: z19.string(),
2994
+ title: z19.string()
2902
2995
  }),
2903
- z18.object({
2904
- type: z18.literal("file_citation"),
2905
- file_id: z18.string(),
2906
- filename: z18.string().nullish(),
2907
- index: z18.number().nullish(),
2908
- start_index: z18.number().nullish(),
2909
- end_index: z18.number().nullish(),
2910
- quote: z18.string().nullish()
2996
+ z19.object({
2997
+ type: z19.literal("file_citation"),
2998
+ file_id: z19.string(),
2999
+ filename: z19.string().nullish(),
3000
+ index: z19.number().nullish(),
3001
+ start_index: z19.number().nullish(),
3002
+ end_index: z19.number().nullish(),
3003
+ quote: z19.string().nullish()
2911
3004
  }),
2912
- z18.object({
2913
- type: z18.literal("container_file_citation")
3005
+ z19.object({
3006
+ type: z19.literal("container_file_citation")
2914
3007
  })
2915
3008
  ])
2916
3009
  )
@@ -2921,33 +3014,34 @@ var OpenAIResponsesLanguageModel = class {
2921
3014
  fileSearchCallItem,
2922
3015
  codeInterpreterCallItem,
2923
3016
  imageGenerationCallItem,
2924
- z18.object({
2925
- type: z18.literal("function_call"),
2926
- call_id: z18.string(),
2927
- name: z18.string(),
2928
- arguments: z18.string(),
2929
- id: z18.string()
3017
+ localShellCallItem,
3018
+ z19.object({
3019
+ type: z19.literal("function_call"),
3020
+ call_id: z19.string(),
3021
+ name: z19.string(),
3022
+ arguments: z19.string(),
3023
+ id: z19.string()
2930
3024
  }),
2931
- z18.object({
2932
- type: z18.literal("computer_call"),
2933
- id: z18.string(),
2934
- status: z18.string().optional()
3025
+ z19.object({
3026
+ type: z19.literal("computer_call"),
3027
+ id: z19.string(),
3028
+ status: z19.string().optional()
2935
3029
  }),
2936
- z18.object({
2937
- type: z18.literal("reasoning"),
2938
- id: z18.string(),
2939
- encrypted_content: z18.string().nullish(),
2940
- summary: z18.array(
2941
- z18.object({
2942
- type: z18.literal("summary_text"),
2943
- text: z18.string()
3030
+ z19.object({
3031
+ type: z19.literal("reasoning"),
3032
+ id: z19.string(),
3033
+ encrypted_content: z19.string().nullish(),
3034
+ summary: z19.array(
3035
+ z19.object({
3036
+ type: z19.literal("summary_text"),
3037
+ text: z19.string()
2944
3038
  })
2945
3039
  )
2946
3040
  })
2947
3041
  ])
2948
3042
  ),
2949
- service_tier: z18.string().nullish(),
2950
- incomplete_details: z18.object({ reason: z18.string() }).nullable(),
3043
+ service_tier: z19.string().nullish(),
3044
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
2951
3045
  usage: usageSchema2
2952
3046
  })
2953
3047
  ),
@@ -3007,6 +3101,20 @@ var OpenAIResponsesLanguageModel = class {
3007
3101
  });
3008
3102
  break;
3009
3103
  }
3104
+ case "local_shell_call": {
3105
+ content.push({
3106
+ type: "tool-call",
3107
+ toolCallId: part.call_id,
3108
+ toolName: "local_shell",
3109
+ input: JSON.stringify({ action: part.action }),
3110
+ providerMetadata: {
3111
+ openai: {
3112
+ itemId: part.id
3113
+ }
3114
+ }
3115
+ });
3116
+ break;
3117
+ }
3010
3118
  case "message": {
3011
3119
  for (const contentPart of part.content) {
3012
3120
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -3264,6 +3372,24 @@ var OpenAIResponsesLanguageModel = class {
3264
3372
  id: value.item.id,
3265
3373
  toolName: "computer_use"
3266
3374
  });
3375
+ } else if (value.item.type === "code_interpreter_call") {
3376
+ ongoingToolCalls[value.output_index] = {
3377
+ toolName: "code_interpreter",
3378
+ toolCallId: value.item.id,
3379
+ codeInterpreter: {
3380
+ containerId: value.item.container_id
3381
+ }
3382
+ };
3383
+ controller.enqueue({
3384
+ type: "tool-input-start",
3385
+ id: value.item.id,
3386
+ toolName: "code_interpreter"
3387
+ });
3388
+ controller.enqueue({
3389
+ type: "tool-input-delta",
3390
+ id: value.item.id,
3391
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3392
+ });
3267
3393
  } else if (value.item.type === "file_search_call") {
3268
3394
  controller.enqueue({
3269
3395
  type: "tool-call",
@@ -3387,16 +3513,7 @@ var OpenAIResponsesLanguageModel = class {
3387
3513
  providerExecuted: true
3388
3514
  });
3389
3515
  } else if (value.item.type === "code_interpreter_call") {
3390
- controller.enqueue({
3391
- type: "tool-call",
3392
- toolCallId: value.item.id,
3393
- toolName: "code_interpreter",
3394
- input: JSON.stringify({
3395
- code: value.item.code,
3396
- containerId: value.item.container_id
3397
- }),
3398
- providerExecuted: true
3399
- });
3516
+ ongoingToolCalls[value.output_index] = void 0;
3400
3517
  controller.enqueue({
3401
3518
  type: "tool-result",
3402
3519
  toolCallId: value.item.id,
@@ -3416,6 +3533,26 @@ var OpenAIResponsesLanguageModel = class {
3416
3533
  },
3417
3534
  providerExecuted: true
3418
3535
  });
3536
+ } else if (value.item.type === "local_shell_call") {
3537
+ ongoingToolCalls[value.output_index] = void 0;
3538
+ controller.enqueue({
3539
+ type: "tool-call",
3540
+ toolCallId: value.item.call_id,
3541
+ toolName: "local_shell",
3542
+ input: JSON.stringify({
3543
+ action: {
3544
+ type: "exec",
3545
+ command: value.item.action.command,
3546
+ timeoutMs: value.item.action.timeout_ms,
3547
+ user: value.item.action.user,
3548
+ workingDirectory: value.item.action.working_directory,
3549
+ env: value.item.action.env
3550
+ }
3551
+ }),
3552
+ providerMetadata: {
3553
+ openai: { itemId: value.item.id }
3554
+ }
3555
+ });
3419
3556
  } else if (value.item.type === "message") {
3420
3557
  controller.enqueue({
3421
3558
  type: "text-end",
@@ -3446,6 +3583,51 @@ var OpenAIResponsesLanguageModel = class {
3446
3583
  delta: value.delta
3447
3584
  });
3448
3585
  }
3586
+ } else if (isResponseImageGenerationCallPartialImageChunk(value)) {
3587
+ controller.enqueue({
3588
+ type: "tool-result",
3589
+ toolCallId: value.item_id,
3590
+ toolName: "image_generation",
3591
+ result: {
3592
+ result: value.partial_image_b64
3593
+ },
3594
+ providerExecuted: true,
3595
+ preliminary: true
3596
+ });
3597
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3598
+ const toolCall = ongoingToolCalls[value.output_index];
3599
+ if (toolCall != null) {
3600
+ controller.enqueue({
3601
+ type: "tool-input-delta",
3602
+ id: toolCall.toolCallId,
3603
+ // The delta is code, which is embedding in a JSON string.
3604
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3605
+ delta: JSON.stringify(value.delta).slice(1, -1)
3606
+ });
3607
+ }
3608
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3609
+ const toolCall = ongoingToolCalls[value.output_index];
3610
+ if (toolCall != null) {
3611
+ controller.enqueue({
3612
+ type: "tool-input-delta",
3613
+ id: toolCall.toolCallId,
3614
+ delta: '"}'
3615
+ });
3616
+ controller.enqueue({
3617
+ type: "tool-input-end",
3618
+ id: toolCall.toolCallId
3619
+ });
3620
+ controller.enqueue({
3621
+ type: "tool-call",
3622
+ toolCallId: toolCall.toolCallId,
3623
+ toolName: "code_interpreter",
3624
+ input: JSON.stringify({
3625
+ code: value.code,
3626
+ containerId: toolCall.codeInterpreter.containerId
3627
+ }),
3628
+ providerExecuted: true
3629
+ });
3630
+ }
3449
3631
  } else if (isResponseCreatedChunk(value)) {
3450
3632
  responseId = value.response.id;
3451
3633
  controller.enqueue({
@@ -3552,166 +3734,201 @@ var OpenAIResponsesLanguageModel = class {
3552
3734
  };
3553
3735
  }
3554
3736
  };
3555
- var usageSchema2 = z18.object({
3556
- input_tokens: z18.number(),
3557
- input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
3558
- output_tokens: z18.number(),
3559
- output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
3737
+ var usageSchema2 = z19.object({
3738
+ input_tokens: z19.number(),
3739
+ input_tokens_details: z19.object({ cached_tokens: z19.number().nullish() }).nullish(),
3740
+ output_tokens: z19.number(),
3741
+ output_tokens_details: z19.object({ reasoning_tokens: z19.number().nullish() }).nullish()
3560
3742
  });
3561
- var textDeltaChunkSchema = z18.object({
3562
- type: z18.literal("response.output_text.delta"),
3563
- item_id: z18.string(),
3564
- delta: z18.string(),
3743
+ var textDeltaChunkSchema = z19.object({
3744
+ type: z19.literal("response.output_text.delta"),
3745
+ item_id: z19.string(),
3746
+ delta: z19.string(),
3565
3747
  logprobs: LOGPROBS_SCHEMA.nullish()
3566
3748
  });
3567
- var errorChunkSchema = z18.object({
3568
- type: z18.literal("error"),
3569
- code: z18.string(),
3570
- message: z18.string(),
3571
- param: z18.string().nullish(),
3572
- sequence_number: z18.number()
3749
+ var errorChunkSchema = z19.object({
3750
+ type: z19.literal("error"),
3751
+ code: z19.string(),
3752
+ message: z19.string(),
3753
+ param: z19.string().nullish(),
3754
+ sequence_number: z19.number()
3573
3755
  });
3574
- var responseFinishedChunkSchema = z18.object({
3575
- type: z18.enum(["response.completed", "response.incomplete"]),
3576
- response: z18.object({
3577
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3756
+ var responseFinishedChunkSchema = z19.object({
3757
+ type: z19.enum(["response.completed", "response.incomplete"]),
3758
+ response: z19.object({
3759
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
3578
3760
  usage: usageSchema2,
3579
- service_tier: z18.string().nullish()
3761
+ service_tier: z19.string().nullish()
3580
3762
  })
3581
3763
  });
3582
- var responseCreatedChunkSchema = z18.object({
3583
- type: z18.literal("response.created"),
3584
- response: z18.object({
3585
- id: z18.string(),
3586
- created_at: z18.number(),
3587
- model: z18.string(),
3588
- service_tier: z18.string().nullish()
3764
+ var responseCreatedChunkSchema = z19.object({
3765
+ type: z19.literal("response.created"),
3766
+ response: z19.object({
3767
+ id: z19.string(),
3768
+ created_at: z19.number(),
3769
+ model: z19.string(),
3770
+ service_tier: z19.string().nullish()
3589
3771
  })
3590
3772
  });
3591
- var responseOutputItemAddedSchema = z18.object({
3592
- type: z18.literal("response.output_item.added"),
3593
- output_index: z18.number(),
3594
- item: z18.discriminatedUnion("type", [
3595
- z18.object({
3596
- type: z18.literal("message"),
3597
- id: z18.string()
3773
+ var responseOutputItemAddedSchema = z19.object({
3774
+ type: z19.literal("response.output_item.added"),
3775
+ output_index: z19.number(),
3776
+ item: z19.discriminatedUnion("type", [
3777
+ z19.object({
3778
+ type: z19.literal("message"),
3779
+ id: z19.string()
3598
3780
  }),
3599
- z18.object({
3600
- type: z18.literal("reasoning"),
3601
- id: z18.string(),
3602
- encrypted_content: z18.string().nullish()
3781
+ z19.object({
3782
+ type: z19.literal("reasoning"),
3783
+ id: z19.string(),
3784
+ encrypted_content: z19.string().nullish()
3603
3785
  }),
3604
- z18.object({
3605
- type: z18.literal("function_call"),
3606
- id: z18.string(),
3607
- call_id: z18.string(),
3608
- name: z18.string(),
3609
- arguments: z18.string()
3786
+ z19.object({
3787
+ type: z19.literal("function_call"),
3788
+ id: z19.string(),
3789
+ call_id: z19.string(),
3790
+ name: z19.string(),
3791
+ arguments: z19.string()
3610
3792
  }),
3611
- z18.object({
3612
- type: z18.literal("web_search_call"),
3613
- id: z18.string(),
3614
- status: z18.string(),
3615
- action: z18.object({
3616
- type: z18.literal("search"),
3617
- query: z18.string().optional()
3793
+ z19.object({
3794
+ type: z19.literal("web_search_call"),
3795
+ id: z19.string(),
3796
+ status: z19.string(),
3797
+ action: z19.object({
3798
+ type: z19.literal("search"),
3799
+ query: z19.string().optional()
3618
3800
  }).nullish()
3619
3801
  }),
3620
- z18.object({
3621
- type: z18.literal("computer_call"),
3622
- id: z18.string(),
3623
- status: z18.string()
3802
+ z19.object({
3803
+ type: z19.literal("computer_call"),
3804
+ id: z19.string(),
3805
+ status: z19.string()
3806
+ }),
3807
+ z19.object({
3808
+ type: z19.literal("file_search_call"),
3809
+ id: z19.string()
3624
3810
  }),
3625
- z18.object({
3626
- type: z18.literal("file_search_call"),
3627
- id: z18.string()
3811
+ z19.object({
3812
+ type: z19.literal("image_generation_call"),
3813
+ id: z19.string()
3628
3814
  }),
3629
- z18.object({
3630
- type: z18.literal("image_generation_call"),
3631
- id: z18.string()
3815
+ z19.object({
3816
+ type: z19.literal("code_interpreter_call"),
3817
+ id: z19.string(),
3818
+ container_id: z19.string(),
3819
+ code: z19.string().nullable(),
3820
+ outputs: z19.array(
3821
+ z19.discriminatedUnion("type", [
3822
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3823
+ z19.object({ type: z19.literal("image"), url: z19.string() })
3824
+ ])
3825
+ ).nullable(),
3826
+ status: z19.string()
3632
3827
  })
3633
3828
  ])
3634
3829
  });
3635
- var responseOutputItemDoneSchema = z18.object({
3636
- type: z18.literal("response.output_item.done"),
3637
- output_index: z18.number(),
3638
- item: z18.discriminatedUnion("type", [
3639
- z18.object({
3640
- type: z18.literal("message"),
3641
- id: z18.string()
3830
+ var responseOutputItemDoneSchema = z19.object({
3831
+ type: z19.literal("response.output_item.done"),
3832
+ output_index: z19.number(),
3833
+ item: z19.discriminatedUnion("type", [
3834
+ z19.object({
3835
+ type: z19.literal("message"),
3836
+ id: z19.string()
3642
3837
  }),
3643
- z18.object({
3644
- type: z18.literal("reasoning"),
3645
- id: z18.string(),
3646
- encrypted_content: z18.string().nullish()
3838
+ z19.object({
3839
+ type: z19.literal("reasoning"),
3840
+ id: z19.string(),
3841
+ encrypted_content: z19.string().nullish()
3647
3842
  }),
3648
- z18.object({
3649
- type: z18.literal("function_call"),
3650
- id: z18.string(),
3651
- call_id: z18.string(),
3652
- name: z18.string(),
3653
- arguments: z18.string(),
3654
- status: z18.literal("completed")
3843
+ z19.object({
3844
+ type: z19.literal("function_call"),
3845
+ id: z19.string(),
3846
+ call_id: z19.string(),
3847
+ name: z19.string(),
3848
+ arguments: z19.string(),
3849
+ status: z19.literal("completed")
3655
3850
  }),
3656
3851
  codeInterpreterCallItem,
3657
3852
  imageGenerationCallItem,
3658
3853
  webSearchCallItem,
3659
3854
  fileSearchCallItem,
3660
- z18.object({
3661
- type: z18.literal("computer_call"),
3662
- id: z18.string(),
3663
- status: z18.literal("completed")
3855
+ localShellCallItem,
3856
+ z19.object({
3857
+ type: z19.literal("computer_call"),
3858
+ id: z19.string(),
3859
+ status: z19.literal("completed")
3664
3860
  })
3665
3861
  ])
3666
3862
  });
3667
- var responseFunctionCallArgumentsDeltaSchema = z18.object({
3668
- type: z18.literal("response.function_call_arguments.delta"),
3669
- item_id: z18.string(),
3670
- output_index: z18.number(),
3671
- delta: z18.string()
3863
+ var responseFunctionCallArgumentsDeltaSchema = z19.object({
3864
+ type: z19.literal("response.function_call_arguments.delta"),
3865
+ item_id: z19.string(),
3866
+ output_index: z19.number(),
3867
+ delta: z19.string()
3868
+ });
3869
+ var responseImageGenerationCallPartialImageSchema = z19.object({
3870
+ type: z19.literal("response.image_generation_call.partial_image"),
3871
+ item_id: z19.string(),
3872
+ output_index: z19.number(),
3873
+ partial_image_b64: z19.string()
3672
3874
  });
3673
- var responseAnnotationAddedSchema = z18.object({
3674
- type: z18.literal("response.output_text.annotation.added"),
3675
- annotation: z18.discriminatedUnion("type", [
3676
- z18.object({
3677
- type: z18.literal("url_citation"),
3678
- url: z18.string(),
3679
- title: z18.string()
3875
+ var responseCodeInterpreterCallCodeDeltaSchema = z19.object({
3876
+ type: z19.literal("response.code_interpreter_call_code.delta"),
3877
+ item_id: z19.string(),
3878
+ output_index: z19.number(),
3879
+ delta: z19.string()
3880
+ });
3881
+ var responseCodeInterpreterCallCodeDoneSchema = z19.object({
3882
+ type: z19.literal("response.code_interpreter_call_code.done"),
3883
+ item_id: z19.string(),
3884
+ output_index: z19.number(),
3885
+ code: z19.string()
3886
+ });
3887
+ var responseAnnotationAddedSchema = z19.object({
3888
+ type: z19.literal("response.output_text.annotation.added"),
3889
+ annotation: z19.discriminatedUnion("type", [
3890
+ z19.object({
3891
+ type: z19.literal("url_citation"),
3892
+ url: z19.string(),
3893
+ title: z19.string()
3680
3894
  }),
3681
- z18.object({
3682
- type: z18.literal("file_citation"),
3683
- file_id: z18.string(),
3684
- filename: z18.string().nullish(),
3685
- index: z18.number().nullish(),
3686
- start_index: z18.number().nullish(),
3687
- end_index: z18.number().nullish(),
3688
- quote: z18.string().nullish()
3895
+ z19.object({
3896
+ type: z19.literal("file_citation"),
3897
+ file_id: z19.string(),
3898
+ filename: z19.string().nullish(),
3899
+ index: z19.number().nullish(),
3900
+ start_index: z19.number().nullish(),
3901
+ end_index: z19.number().nullish(),
3902
+ quote: z19.string().nullish()
3689
3903
  })
3690
3904
  ])
3691
3905
  });
3692
- var responseReasoningSummaryPartAddedSchema = z18.object({
3693
- type: z18.literal("response.reasoning_summary_part.added"),
3694
- item_id: z18.string(),
3695
- summary_index: z18.number()
3906
+ var responseReasoningSummaryPartAddedSchema = z19.object({
3907
+ type: z19.literal("response.reasoning_summary_part.added"),
3908
+ item_id: z19.string(),
3909
+ summary_index: z19.number()
3696
3910
  });
3697
- var responseReasoningSummaryTextDeltaSchema = z18.object({
3698
- type: z18.literal("response.reasoning_summary_text.delta"),
3699
- item_id: z18.string(),
3700
- summary_index: z18.number(),
3701
- delta: z18.string()
3911
+ var responseReasoningSummaryTextDeltaSchema = z19.object({
3912
+ type: z19.literal("response.reasoning_summary_text.delta"),
3913
+ item_id: z19.string(),
3914
+ summary_index: z19.number(),
3915
+ delta: z19.string()
3702
3916
  });
3703
- var openaiResponsesChunkSchema = z18.union([
3917
+ var openaiResponsesChunkSchema = z19.union([
3704
3918
  textDeltaChunkSchema,
3705
3919
  responseFinishedChunkSchema,
3706
3920
  responseCreatedChunkSchema,
3707
3921
  responseOutputItemAddedSchema,
3708
3922
  responseOutputItemDoneSchema,
3709
3923
  responseFunctionCallArgumentsDeltaSchema,
3924
+ responseImageGenerationCallPartialImageSchema,
3925
+ responseCodeInterpreterCallCodeDeltaSchema,
3926
+ responseCodeInterpreterCallCodeDoneSchema,
3710
3927
  responseAnnotationAddedSchema,
3711
3928
  responseReasoningSummaryPartAddedSchema,
3712
3929
  responseReasoningSummaryTextDeltaSchema,
3713
3930
  errorChunkSchema,
3714
- z18.object({ type: z18.string() }).loose()
3931
+ z19.object({ type: z19.string() }).loose()
3715
3932
  // fallback for unknown chunks
3716
3933
  ]);
3717
3934
  function isTextDeltaChunk(chunk) {
@@ -3732,6 +3949,15 @@ function isResponseCreatedChunk(chunk) {
3732
3949
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3733
3950
  return chunk.type === "response.function_call_arguments.delta";
3734
3951
  }
3952
+ function isResponseImageGenerationCallPartialImageChunk(chunk) {
3953
+ return chunk.type === "response.image_generation_call.partial_image";
3954
+ }
3955
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3956
+ return chunk.type === "response.code_interpreter_call_code.delta";
3957
+ }
3958
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3959
+ return chunk.type === "response.code_interpreter_call_code.done";
3960
+ }
3735
3961
  function isResponseOutputItemAddedChunk(chunk) {
3736
3962
  return chunk.type === "response.output_item.added";
3737
3963
  }
@@ -3784,15 +4010,15 @@ function getResponsesModelConfig(modelId) {
3784
4010
  isReasoningModel: false
3785
4011
  };
3786
4012
  }
3787
- var openaiResponsesProviderOptionsSchema = z18.object({
3788
- include: z18.array(
3789
- z18.enum([
4013
+ var openaiResponsesProviderOptionsSchema = z19.object({
4014
+ include: z19.array(
4015
+ z19.enum([
3790
4016
  "reasoning.encrypted_content",
3791
4017
  "file_search_call.results",
3792
4018
  "message.output_text.logprobs"
3793
4019
  ])
3794
4020
  ).nullish(),
3795
- instructions: z18.string().nullish(),
4021
+ instructions: z19.string().nullish(),
3796
4022
  /**
3797
4023
  * Return the log probabilities of the tokens.
3798
4024
  *
@@ -3805,25 +4031,25 @@ var openaiResponsesProviderOptionsSchema = z18.object({
3805
4031
  * @see https://platform.openai.com/docs/api-reference/responses/create
3806
4032
  * @see https://cookbook.openai.com/examples/using_logprobs
3807
4033
  */
3808
- logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4034
+ logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3809
4035
  /**
3810
4036
  * The maximum number of total calls to built-in tools that can be processed in a response.
3811
4037
  * This maximum number applies across all built-in tool calls, not per individual tool.
3812
4038
  * Any further attempts to call a tool by the model will be ignored.
3813
4039
  */
3814
- maxToolCalls: z18.number().nullish(),
3815
- metadata: z18.any().nullish(),
3816
- parallelToolCalls: z18.boolean().nullish(),
3817
- previousResponseId: z18.string().nullish(),
3818
- promptCacheKey: z18.string().nullish(),
3819
- reasoningEffort: z18.string().nullish(),
3820
- reasoningSummary: z18.string().nullish(),
3821
- safetyIdentifier: z18.string().nullish(),
3822
- serviceTier: z18.enum(["auto", "flex", "priority"]).nullish(),
3823
- store: z18.boolean().nullish(),
3824
- strictJsonSchema: z18.boolean().nullish(),
3825
- textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
3826
- user: z18.string().nullish()
4040
+ maxToolCalls: z19.number().nullish(),
4041
+ metadata: z19.any().nullish(),
4042
+ parallelToolCalls: z19.boolean().nullish(),
4043
+ previousResponseId: z19.string().nullish(),
4044
+ promptCacheKey: z19.string().nullish(),
4045
+ reasoningEffort: z19.string().nullish(),
4046
+ reasoningSummary: z19.string().nullish(),
4047
+ safetyIdentifier: z19.string().nullish(),
4048
+ serviceTier: z19.enum(["auto", "flex", "priority"]).nullish(),
4049
+ store: z19.boolean().nullish(),
4050
+ strictJsonSchema: z19.boolean().nullish(),
4051
+ textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
4052
+ user: z19.string().nullish()
3827
4053
  });
3828
4054
  export {
3829
4055
  OpenAIChatLanguageModel,
@@ -3833,11 +4059,22 @@ export {
3833
4059
  OpenAIResponsesLanguageModel,
3834
4060
  OpenAISpeechModel,
3835
4061
  OpenAITranscriptionModel,
4062
+ codeInterpreter,
4063
+ codeInterpreterArgsSchema,
4064
+ codeInterpreterInputSchema,
4065
+ codeInterpreterOutputSchema,
4066
+ codeInterpreterToolFactory,
4067
+ fileSearch,
4068
+ fileSearchArgsSchema,
4069
+ fileSearchOutputSchema,
3836
4070
  hasDefaultResponseFormat,
4071
+ imageGeneration,
4072
+ imageGenerationArgsSchema,
4073
+ imageGenerationOutputSchema,
3837
4074
  modelMaxImagesPerCall,
3838
4075
  openAITranscriptionProviderOptions,
4076
+ openaiChatLanguageModelOptions,
3839
4077
  openaiCompletionProviderOptions,
3840
- openaiEmbeddingProviderOptions,
3841
- openaiProviderOptions
4078
+ openaiEmbeddingProviderOptions
3842
4079
  };
3843
4080
  //# sourceMappingURL=index.mjs.map