@ai-sdk/openai 2.0.38 → 2.0.40

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.
@@ -2026,13 +2026,38 @@ var OpenAISpeechModel = class {
2026
2026
 
2027
2027
  // src/responses/openai-responses-language-model.ts
2028
2028
  var import_provider8 = require("@ai-sdk/provider");
2029
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
2030
- var import_v418 = require("zod/v4");
2029
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
2030
+ var import_v419 = require("zod/v4");
2031
2031
 
2032
2032
  // src/responses/convert-to-openai-responses-input.ts
2033
2033
  var import_provider6 = require("@ai-sdk/provider");
2034
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
2035
+ var import_v413 = require("zod/v4");
2036
+
2037
+ // src/tool/local-shell.ts
2034
2038
  var import_provider_utils9 = require("@ai-sdk/provider-utils");
2035
2039
  var import_v412 = require("zod/v4");
2040
+ var localShellInputSchema = import_v412.z.object({
2041
+ action: import_v412.z.object({
2042
+ type: import_v412.z.literal("exec"),
2043
+ command: import_v412.z.array(import_v412.z.string()),
2044
+ timeoutMs: import_v412.z.number().optional(),
2045
+ user: import_v412.z.string().optional(),
2046
+ workingDirectory: import_v412.z.string().optional(),
2047
+ env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
2048
+ })
2049
+ });
2050
+ var localShellOutputSchema = import_v412.z.object({
2051
+ output: import_v412.z.string()
2052
+ });
2053
+ var localShell = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
2054
+ id: "openai.local_shell",
2055
+ name: "local_shell",
2056
+ inputSchema: localShellInputSchema,
2057
+ outputSchema: localShellOutputSchema
2058
+ });
2059
+
2060
+ // src/responses/convert-to-openai-responses-input.ts
2036
2061
  function isFileId(data, prefixes) {
2037
2062
  if (!prefixes) return false;
2038
2063
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2041,9 +2066,10 @@ async function convertToOpenAIResponsesInput({
2041
2066
  prompt,
2042
2067
  systemMessageMode,
2043
2068
  fileIdPrefixes,
2044
- store
2069
+ store,
2070
+ hasLocalShellTool = false
2045
2071
  }) {
2046
- var _a, _b, _c, _d, _e, _f;
2072
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2047
2073
  const input = [];
2048
2074
  const warnings = [];
2049
2075
  for (const { role, content } of prompt) {
@@ -2089,7 +2115,7 @@ async function convertToOpenAIResponsesInput({
2089
2115
  return {
2090
2116
  type: "input_image",
2091
2117
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2092
- image_url: `data:${mediaType};base64,${(0, import_provider_utils9.convertToBase64)(part.data)}`
2118
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
2093
2119
  },
2094
2120
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2095
2121
  };
@@ -2104,7 +2130,7 @@ async function convertToOpenAIResponsesInput({
2104
2130
  type: "input_file",
2105
2131
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2106
2132
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2107
- file_data: `data:application/pdf;base64,${(0, import_provider_utils9.convertToBase64)(part.data)}`
2133
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
2108
2134
  }
2109
2135
  };
2110
2136
  } else {
@@ -2136,15 +2162,33 @@ async function convertToOpenAIResponsesInput({
2136
2162
  if (part.providerExecuted) {
2137
2163
  break;
2138
2164
  }
2165
+ if (hasLocalShellTool && part.toolName === "local_shell") {
2166
+ const parsedInput = localShellInputSchema.parse(part.input);
2167
+ input.push({
2168
+ type: "local_shell_call",
2169
+ call_id: part.toolCallId,
2170
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2171
+ action: {
2172
+ type: "exec",
2173
+ command: parsedInput.action.command,
2174
+ timeout_ms: parsedInput.action.timeoutMs,
2175
+ user: parsedInput.action.user,
2176
+ working_directory: parsedInput.action.workingDirectory,
2177
+ env: parsedInput.action.env
2178
+ }
2179
+ });
2180
+ break;
2181
+ }
2139
2182
  input.push({
2140
2183
  type: "function_call",
2141
2184
  call_id: part.toolCallId,
2142
2185
  name: part.toolName,
2143
2186
  arguments: JSON.stringify(part.input),
2144
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0
2187
+ id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2145
2188
  });
2146
2189
  break;
2147
2190
  }
2191
+ // assistant tool result parts are from provider-executed tools:
2148
2192
  case "tool-result": {
2149
2193
  if (store) {
2150
2194
  input.push({ type: "item_reference", id: part.toolCallId });
@@ -2157,7 +2201,7 @@ async function convertToOpenAIResponsesInput({
2157
2201
  break;
2158
2202
  }
2159
2203
  case "reasoning": {
2160
- const providerOptions = await (0, import_provider_utils9.parseProviderOptions)({
2204
+ const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
2161
2205
  provider: "openai",
2162
2206
  providerOptions: part.providerOptions,
2163
2207
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2214,6 +2258,14 @@ async function convertToOpenAIResponsesInput({
2214
2258
  case "tool": {
2215
2259
  for (const part of content) {
2216
2260
  const output = part.output;
2261
+ if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2262
+ input.push({
2263
+ type: "local_shell_call_output",
2264
+ call_id: part.toolCallId,
2265
+ output: localShellOutputSchema.parse(output.value).output
2266
+ });
2267
+ break;
2268
+ }
2217
2269
  let contentValue;
2218
2270
  switch (output.type) {
2219
2271
  case "text":
@@ -2242,9 +2294,9 @@ async function convertToOpenAIResponsesInput({
2242
2294
  }
2243
2295
  return { input, warnings };
2244
2296
  }
2245
- var openaiResponsesReasoningProviderOptionsSchema = import_v412.z.object({
2246
- itemId: import_v412.z.string().nullish(),
2247
- reasoningEncryptedContent: import_v412.z.string().nullish()
2297
+ var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
2298
+ itemId: import_v413.z.string().nullish(),
2299
+ reasoningEncryptedContent: import_v413.z.string().nullish()
2248
2300
  });
2249
2301
 
2250
2302
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2269,29 +2321,29 @@ function mapOpenAIResponseFinishReason({
2269
2321
  var import_provider7 = require("@ai-sdk/provider");
2270
2322
 
2271
2323
  // src/tool/code-interpreter.ts
2272
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
2273
- var import_v413 = require("zod/v4");
2274
- var codeInterpreterInputSchema = import_v413.z.object({
2275
- code: import_v413.z.string().nullish(),
2276
- containerId: import_v413.z.string()
2324
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
2325
+ var import_v414 = require("zod/v4");
2326
+ var codeInterpreterInputSchema = import_v414.z.object({
2327
+ code: import_v414.z.string().nullish(),
2328
+ containerId: import_v414.z.string()
2277
2329
  });
2278
- var codeInterpreterOutputSchema = import_v413.z.object({
2279
- outputs: import_v413.z.array(
2280
- import_v413.z.discriminatedUnion("type", [
2281
- import_v413.z.object({ type: import_v413.z.literal("logs"), logs: import_v413.z.string() }),
2282
- import_v413.z.object({ type: import_v413.z.literal("image"), url: import_v413.z.string() })
2330
+ var codeInterpreterOutputSchema = import_v414.z.object({
2331
+ outputs: import_v414.z.array(
2332
+ import_v414.z.discriminatedUnion("type", [
2333
+ import_v414.z.object({ type: import_v414.z.literal("logs"), logs: import_v414.z.string() }),
2334
+ import_v414.z.object({ type: import_v414.z.literal("image"), url: import_v414.z.string() })
2283
2335
  ])
2284
2336
  ).nullish()
2285
2337
  });
2286
- var codeInterpreterArgsSchema = import_v413.z.object({
2287
- container: import_v413.z.union([
2288
- import_v413.z.string(),
2289
- import_v413.z.object({
2290
- fileIds: import_v413.z.array(import_v413.z.string()).optional()
2338
+ var codeInterpreterArgsSchema = import_v414.z.object({
2339
+ container: import_v414.z.union([
2340
+ import_v414.z.string(),
2341
+ import_v414.z.object({
2342
+ fileIds: import_v414.z.array(import_v414.z.string()).optional()
2291
2343
  })
2292
2344
  ]).optional()
2293
2345
  });
2294
- var codeInterpreterToolFactory = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
2346
+ var codeInterpreterToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
2295
2347
  id: "openai.code_interpreter",
2296
2348
  name: "code_interpreter",
2297
2349
  inputSchema: codeInterpreterInputSchema,
@@ -2302,168 +2354,168 @@ var codeInterpreter = (args = {}) => {
2302
2354
  };
2303
2355
 
2304
2356
  // src/tool/file-search.ts
2305
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
2306
- var import_v414 = require("zod/v4");
2307
- var comparisonFilterSchema = import_v414.z.object({
2308
- key: import_v414.z.string(),
2309
- type: import_v414.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
2310
- value: import_v414.z.union([import_v414.z.string(), import_v414.z.number(), import_v414.z.boolean()])
2357
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
2358
+ var import_v415 = require("zod/v4");
2359
+ var comparisonFilterSchema = import_v415.z.object({
2360
+ key: import_v415.z.string(),
2361
+ type: import_v415.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
2362
+ value: import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
2311
2363
  });
2312
- var compoundFilterSchema = import_v414.z.object({
2313
- type: import_v414.z.enum(["and", "or"]),
2314
- filters: import_v414.z.array(
2315
- import_v414.z.union([comparisonFilterSchema, import_v414.z.lazy(() => compoundFilterSchema)])
2364
+ var compoundFilterSchema = import_v415.z.object({
2365
+ type: import_v415.z.enum(["and", "or"]),
2366
+ filters: import_v415.z.array(
2367
+ import_v415.z.union([comparisonFilterSchema, import_v415.z.lazy(() => compoundFilterSchema)])
2316
2368
  )
2317
2369
  });
2318
- var fileSearchArgsSchema = import_v414.z.object({
2319
- vectorStoreIds: import_v414.z.array(import_v414.z.string()),
2320
- maxNumResults: import_v414.z.number().optional(),
2321
- ranking: import_v414.z.object({
2322
- ranker: import_v414.z.string().optional(),
2323
- scoreThreshold: import_v414.z.number().optional()
2370
+ var fileSearchArgsSchema = import_v415.z.object({
2371
+ vectorStoreIds: import_v415.z.array(import_v415.z.string()),
2372
+ maxNumResults: import_v415.z.number().optional(),
2373
+ ranking: import_v415.z.object({
2374
+ ranker: import_v415.z.string().optional(),
2375
+ scoreThreshold: import_v415.z.number().optional()
2324
2376
  }).optional(),
2325
- filters: import_v414.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2377
+ filters: import_v415.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2326
2378
  });
2327
- var fileSearchOutputSchema = import_v414.z.object({
2328
- queries: import_v414.z.array(import_v414.z.string()),
2329
- results: import_v414.z.array(
2330
- import_v414.z.object({
2331
- attributes: import_v414.z.record(import_v414.z.string(), import_v414.z.unknown()),
2332
- fileId: import_v414.z.string(),
2333
- filename: import_v414.z.string(),
2334
- score: import_v414.z.number(),
2335
- text: import_v414.z.string()
2379
+ var fileSearchOutputSchema = import_v415.z.object({
2380
+ queries: import_v415.z.array(import_v415.z.string()),
2381
+ results: import_v415.z.array(
2382
+ import_v415.z.object({
2383
+ attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
2384
+ fileId: import_v415.z.string(),
2385
+ filename: import_v415.z.string(),
2386
+ score: import_v415.z.number(),
2387
+ text: import_v415.z.string()
2336
2388
  })
2337
2389
  ).nullable()
2338
2390
  });
2339
- var fileSearch = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
2391
+ var fileSearch = (0, import_provider_utils12.createProviderDefinedToolFactoryWithOutputSchema)({
2340
2392
  id: "openai.file_search",
2341
2393
  name: "file_search",
2342
- inputSchema: import_v414.z.object({}),
2394
+ inputSchema: import_v415.z.object({}),
2343
2395
  outputSchema: fileSearchOutputSchema
2344
2396
  });
2345
2397
 
2346
2398
  // src/tool/web-search.ts
2347
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
2348
- var import_v415 = require("zod/v4");
2349
- var webSearchArgsSchema = import_v415.z.object({
2350
- filters: import_v415.z.object({
2351
- allowedDomains: import_v415.z.array(import_v415.z.string()).optional()
2399
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
2400
+ var import_v416 = require("zod/v4");
2401
+ var webSearchArgsSchema = import_v416.z.object({
2402
+ filters: import_v416.z.object({
2403
+ allowedDomains: import_v416.z.array(import_v416.z.string()).optional()
2352
2404
  }).optional(),
2353
- searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
2354
- userLocation: import_v415.z.object({
2355
- type: import_v415.z.literal("approximate"),
2356
- country: import_v415.z.string().optional(),
2357
- city: import_v415.z.string().optional(),
2358
- region: import_v415.z.string().optional(),
2359
- timezone: import_v415.z.string().optional()
2405
+ searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
2406
+ userLocation: import_v416.z.object({
2407
+ type: import_v416.z.literal("approximate"),
2408
+ country: import_v416.z.string().optional(),
2409
+ city: import_v416.z.string().optional(),
2410
+ region: import_v416.z.string().optional(),
2411
+ timezone: import_v416.z.string().optional()
2360
2412
  }).optional()
2361
2413
  });
2362
- var webSearchToolFactory = (0, import_provider_utils12.createProviderDefinedToolFactory)({
2414
+ var webSearchToolFactory = (0, import_provider_utils13.createProviderDefinedToolFactory)({
2363
2415
  id: "openai.web_search",
2364
2416
  name: "web_search",
2365
- inputSchema: import_v415.z.object({
2366
- action: import_v415.z.discriminatedUnion("type", [
2367
- import_v415.z.object({
2368
- type: import_v415.z.literal("search"),
2369
- query: import_v415.z.string().nullish()
2417
+ inputSchema: import_v416.z.object({
2418
+ action: import_v416.z.discriminatedUnion("type", [
2419
+ import_v416.z.object({
2420
+ type: import_v416.z.literal("search"),
2421
+ query: import_v416.z.string().nullish()
2370
2422
  }),
2371
- import_v415.z.object({
2372
- type: import_v415.z.literal("open_page"),
2373
- url: import_v415.z.string()
2423
+ import_v416.z.object({
2424
+ type: import_v416.z.literal("open_page"),
2425
+ url: import_v416.z.string()
2374
2426
  }),
2375
- import_v415.z.object({
2376
- type: import_v415.z.literal("find"),
2377
- url: import_v415.z.string(),
2378
- pattern: import_v415.z.string()
2427
+ import_v416.z.object({
2428
+ type: import_v416.z.literal("find"),
2429
+ url: import_v416.z.string(),
2430
+ pattern: import_v416.z.string()
2379
2431
  })
2380
2432
  ]).nullish()
2381
2433
  })
2382
2434
  });
2383
2435
 
2384
2436
  // src/tool/web-search-preview.ts
2385
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
2386
- var import_v416 = require("zod/v4");
2387
- var webSearchPreviewArgsSchema = import_v416.z.object({
2437
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2438
+ var import_v417 = require("zod/v4");
2439
+ var webSearchPreviewArgsSchema = import_v417.z.object({
2388
2440
  /**
2389
2441
  * Search context size to use for the web search.
2390
2442
  * - high: Most comprehensive context, highest cost, slower response
2391
2443
  * - medium: Balanced context, cost, and latency (default)
2392
2444
  * - low: Least context, lowest cost, fastest response
2393
2445
  */
2394
- searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
2446
+ searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
2395
2447
  /**
2396
2448
  * User location information to provide geographically relevant search results.
2397
2449
  */
2398
- userLocation: import_v416.z.object({
2450
+ userLocation: import_v417.z.object({
2399
2451
  /**
2400
2452
  * Type of location (always 'approximate')
2401
2453
  */
2402
- type: import_v416.z.literal("approximate"),
2454
+ type: import_v417.z.literal("approximate"),
2403
2455
  /**
2404
2456
  * Two-letter ISO country code (e.g., 'US', 'GB')
2405
2457
  */
2406
- country: import_v416.z.string().optional(),
2458
+ country: import_v417.z.string().optional(),
2407
2459
  /**
2408
2460
  * City name (free text, e.g., 'Minneapolis')
2409
2461
  */
2410
- city: import_v416.z.string().optional(),
2462
+ city: import_v417.z.string().optional(),
2411
2463
  /**
2412
2464
  * Region name (free text, e.g., 'Minnesota')
2413
2465
  */
2414
- region: import_v416.z.string().optional(),
2466
+ region: import_v417.z.string().optional(),
2415
2467
  /**
2416
2468
  * IANA timezone (e.g., 'America/Chicago')
2417
2469
  */
2418
- timezone: import_v416.z.string().optional()
2470
+ timezone: import_v417.z.string().optional()
2419
2471
  }).optional()
2420
2472
  });
2421
- var webSearchPreview = (0, import_provider_utils13.createProviderDefinedToolFactory)({
2473
+ var webSearchPreview = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2422
2474
  id: "openai.web_search_preview",
2423
2475
  name: "web_search_preview",
2424
- inputSchema: import_v416.z.object({
2425
- action: import_v416.z.discriminatedUnion("type", [
2426
- import_v416.z.object({
2427
- type: import_v416.z.literal("search"),
2428
- query: import_v416.z.string().nullish()
2476
+ inputSchema: import_v417.z.object({
2477
+ action: import_v417.z.discriminatedUnion("type", [
2478
+ import_v417.z.object({
2479
+ type: import_v417.z.literal("search"),
2480
+ query: import_v417.z.string().nullish()
2429
2481
  }),
2430
- import_v416.z.object({
2431
- type: import_v416.z.literal("open_page"),
2432
- url: import_v416.z.string()
2482
+ import_v417.z.object({
2483
+ type: import_v417.z.literal("open_page"),
2484
+ url: import_v417.z.string()
2433
2485
  }),
2434
- import_v416.z.object({
2435
- type: import_v416.z.literal("find"),
2436
- url: import_v416.z.string(),
2437
- pattern: import_v416.z.string()
2486
+ import_v417.z.object({
2487
+ type: import_v417.z.literal("find"),
2488
+ url: import_v417.z.string(),
2489
+ pattern: import_v417.z.string()
2438
2490
  })
2439
2491
  ]).nullish()
2440
2492
  })
2441
2493
  });
2442
2494
 
2443
2495
  // src/tool/image-generation.ts
2444
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2445
- var import_v417 = require("zod/v4");
2446
- var imageGenerationArgsSchema = import_v417.z.object({
2447
- background: import_v417.z.enum(["auto", "opaque", "transparent"]).optional(),
2448
- inputFidelity: import_v417.z.enum(["low", "high"]).optional(),
2449
- inputImageMask: import_v417.z.object({
2450
- fileId: import_v417.z.string().optional(),
2451
- imageUrl: import_v417.z.string().optional()
2496
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
2497
+ var import_v418 = require("zod/v4");
2498
+ var imageGenerationArgsSchema = import_v418.z.object({
2499
+ background: import_v418.z.enum(["auto", "opaque", "transparent"]).optional(),
2500
+ inputFidelity: import_v418.z.enum(["low", "high"]).optional(),
2501
+ inputImageMask: import_v418.z.object({
2502
+ fileId: import_v418.z.string().optional(),
2503
+ imageUrl: import_v418.z.string().optional()
2452
2504
  }).optional(),
2453
- model: import_v417.z.string().optional(),
2454
- moderation: import_v417.z.enum(["auto"]).optional(),
2455
- outputCompression: import_v417.z.number().int().min(0).max(100).optional(),
2456
- outputFormat: import_v417.z.enum(["png", "jpeg", "webp"]).optional(),
2457
- quality: import_v417.z.enum(["auto", "low", "medium", "high"]).optional(),
2458
- size: import_v417.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2505
+ model: import_v418.z.string().optional(),
2506
+ moderation: import_v418.z.enum(["auto"]).optional(),
2507
+ outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
2508
+ outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
2509
+ quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
2510
+ size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2459
2511
  }).strict();
2460
- var imageGenerationOutputSchema = import_v417.z.object({
2461
- result: import_v417.z.string()
2512
+ var imageGenerationOutputSchema = import_v418.z.object({
2513
+ result: import_v418.z.string()
2462
2514
  });
2463
- var imageGenerationToolFactory = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
2515
+ var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
2464
2516
  id: "openai.image_generation",
2465
2517
  name: "image_generation",
2466
- inputSchema: import_v417.z.object({}),
2518
+ inputSchema: import_v418.z.object({}),
2467
2519
  outputSchema: imageGenerationOutputSchema
2468
2520
  });
2469
2521
 
@@ -2506,6 +2558,12 @@ function prepareResponsesTools({
2506
2558
  });
2507
2559
  break;
2508
2560
  }
2561
+ case "openai.local_shell": {
2562
+ openaiTools.push({
2563
+ type: "local_shell"
2564
+ });
2565
+ break;
2566
+ }
2509
2567
  case "openai.web_search_preview": {
2510
2568
  const args = webSearchPreviewArgsSchema.parse(tool.args);
2511
2569
  openaiTools.push({
@@ -2585,66 +2643,79 @@ function prepareResponsesTools({
2585
2643
  }
2586
2644
 
2587
2645
  // src/responses/openai-responses-language-model.ts
2588
- var webSearchCallItem = import_v418.z.object({
2589
- type: import_v418.z.literal("web_search_call"),
2590
- id: import_v418.z.string(),
2591
- status: import_v418.z.string(),
2592
- action: import_v418.z.discriminatedUnion("type", [
2593
- import_v418.z.object({
2594
- type: import_v418.z.literal("search"),
2595
- query: import_v418.z.string().nullish()
2646
+ var webSearchCallItem = import_v419.z.object({
2647
+ type: import_v419.z.literal("web_search_call"),
2648
+ id: import_v419.z.string(),
2649
+ status: import_v419.z.string(),
2650
+ action: import_v419.z.discriminatedUnion("type", [
2651
+ import_v419.z.object({
2652
+ type: import_v419.z.literal("search"),
2653
+ query: import_v419.z.string().nullish()
2596
2654
  }),
2597
- import_v418.z.object({
2598
- type: import_v418.z.literal("open_page"),
2599
- url: import_v418.z.string()
2655
+ import_v419.z.object({
2656
+ type: import_v419.z.literal("open_page"),
2657
+ url: import_v419.z.string()
2600
2658
  }),
2601
- import_v418.z.object({
2602
- type: import_v418.z.literal("find"),
2603
- url: import_v418.z.string(),
2604
- pattern: import_v418.z.string()
2659
+ import_v419.z.object({
2660
+ type: import_v419.z.literal("find"),
2661
+ url: import_v419.z.string(),
2662
+ pattern: import_v419.z.string()
2605
2663
  })
2606
2664
  ]).nullish()
2607
2665
  });
2608
- var fileSearchCallItem = import_v418.z.object({
2609
- type: import_v418.z.literal("file_search_call"),
2610
- id: import_v418.z.string(),
2611
- queries: import_v418.z.array(import_v418.z.string()),
2612
- results: import_v418.z.array(
2613
- import_v418.z.object({
2614
- attributes: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()),
2615
- file_id: import_v418.z.string(),
2616
- filename: import_v418.z.string(),
2617
- score: import_v418.z.number(),
2618
- text: import_v418.z.string()
2666
+ var fileSearchCallItem = import_v419.z.object({
2667
+ type: import_v419.z.literal("file_search_call"),
2668
+ id: import_v419.z.string(),
2669
+ queries: import_v419.z.array(import_v419.z.string()),
2670
+ results: import_v419.z.array(
2671
+ import_v419.z.object({
2672
+ attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
2673
+ file_id: import_v419.z.string(),
2674
+ filename: import_v419.z.string(),
2675
+ score: import_v419.z.number(),
2676
+ text: import_v419.z.string()
2619
2677
  })
2620
2678
  ).nullish()
2621
2679
  });
2622
- var codeInterpreterCallItem = import_v418.z.object({
2623
- type: import_v418.z.literal("code_interpreter_call"),
2624
- id: import_v418.z.string(),
2625
- code: import_v418.z.string().nullable(),
2626
- container_id: import_v418.z.string(),
2627
- outputs: import_v418.z.array(
2628
- import_v418.z.discriminatedUnion("type", [
2629
- import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
2630
- import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
2680
+ var codeInterpreterCallItem = import_v419.z.object({
2681
+ type: import_v419.z.literal("code_interpreter_call"),
2682
+ id: import_v419.z.string(),
2683
+ code: import_v419.z.string().nullable(),
2684
+ container_id: import_v419.z.string(),
2685
+ outputs: import_v419.z.array(
2686
+ import_v419.z.discriminatedUnion("type", [
2687
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
2688
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
2631
2689
  ])
2632
2690
  ).nullable()
2633
2691
  });
2634
- var imageGenerationCallItem = import_v418.z.object({
2635
- type: import_v418.z.literal("image_generation_call"),
2636
- id: import_v418.z.string(),
2637
- result: import_v418.z.string()
2692
+ var localShellCallItem = import_v419.z.object({
2693
+ type: import_v419.z.literal("local_shell_call"),
2694
+ id: import_v419.z.string(),
2695
+ call_id: import_v419.z.string(),
2696
+ action: import_v419.z.object({
2697
+ type: import_v419.z.literal("exec"),
2698
+ command: import_v419.z.array(import_v419.z.string()),
2699
+ timeout_ms: import_v419.z.number().optional(),
2700
+ user: import_v419.z.string().optional(),
2701
+ working_directory: import_v419.z.string().optional(),
2702
+ env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
2703
+ })
2704
+ });
2705
+ var imageGenerationCallItem = import_v419.z.object({
2706
+ type: import_v419.z.literal("image_generation_call"),
2707
+ id: import_v419.z.string(),
2708
+ result: import_v419.z.string()
2638
2709
  });
2639
2710
  var TOP_LOGPROBS_MAX = 20;
2640
- var LOGPROBS_SCHEMA = import_v418.z.array(
2641
- import_v418.z.object({
2642
- token: import_v418.z.string(),
2643
- logprob: import_v418.z.number(),
2644
- top_logprobs: import_v418.z.array(
2645
- import_v418.z.object({
2646
- token: import_v418.z.string(),
2647
- logprob: import_v418.z.number()
2711
+ var LOGPROBS_SCHEMA = import_v419.z.array(
2712
+ import_v419.z.object({
2713
+ token: import_v419.z.string(),
2714
+ logprob: import_v419.z.number(),
2715
+ top_logprobs: import_v419.z.array(
2716
+ import_v419.z.object({
2717
+ token: import_v419.z.string(),
2718
+ logprob: import_v419.z.number()
2648
2719
  })
2649
2720
  )
2650
2721
  })
@@ -2701,7 +2772,7 @@ var OpenAIResponsesLanguageModel = class {
2701
2772
  if (stopSequences != null) {
2702
2773
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2703
2774
  }
2704
- const openaiOptions = await (0, import_provider_utils15.parseProviderOptions)({
2775
+ const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
2705
2776
  provider: "openai",
2706
2777
  providerOptions,
2707
2778
  schema: openaiResponsesProviderOptionsSchema
@@ -2710,7 +2781,8 @@ var OpenAIResponsesLanguageModel = class {
2710
2781
  prompt,
2711
2782
  systemMessageMode: modelConfig.systemMessageMode,
2712
2783
  fileIdPrefixes: this.config.fileIdPrefixes,
2713
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2784
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
2785
+ hasLocalShellTool: hasOpenAITool("openai.local_shell")
2714
2786
  });
2715
2787
  warnings.push(...inputWarnings);
2716
2788
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -2869,51 +2941,51 @@ var OpenAIResponsesLanguageModel = class {
2869
2941
  responseHeaders,
2870
2942
  value: response,
2871
2943
  rawValue: rawResponse
2872
- } = await (0, import_provider_utils15.postJsonToApi)({
2944
+ } = await (0, import_provider_utils16.postJsonToApi)({
2873
2945
  url,
2874
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
2946
+ headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
2875
2947
  body,
2876
2948
  failedResponseHandler: openaiFailedResponseHandler,
2877
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
2878
- import_v418.z.object({
2879
- id: import_v418.z.string(),
2880
- created_at: import_v418.z.number(),
2881
- error: import_v418.z.object({
2882
- code: import_v418.z.string(),
2883
- message: import_v418.z.string()
2949
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
2950
+ import_v419.z.object({
2951
+ id: import_v419.z.string(),
2952
+ created_at: import_v419.z.number(),
2953
+ error: import_v419.z.object({
2954
+ code: import_v419.z.string(),
2955
+ message: import_v419.z.string()
2884
2956
  }).nullish(),
2885
- model: import_v418.z.string(),
2886
- output: import_v418.z.array(
2887
- import_v418.z.discriminatedUnion("type", [
2888
- import_v418.z.object({
2889
- type: import_v418.z.literal("message"),
2890
- role: import_v418.z.literal("assistant"),
2891
- id: import_v418.z.string(),
2892
- content: import_v418.z.array(
2893
- import_v418.z.object({
2894
- type: import_v418.z.literal("output_text"),
2895
- text: import_v418.z.string(),
2957
+ model: import_v419.z.string(),
2958
+ output: import_v419.z.array(
2959
+ import_v419.z.discriminatedUnion("type", [
2960
+ import_v419.z.object({
2961
+ type: import_v419.z.literal("message"),
2962
+ role: import_v419.z.literal("assistant"),
2963
+ id: import_v419.z.string(),
2964
+ content: import_v419.z.array(
2965
+ import_v419.z.object({
2966
+ type: import_v419.z.literal("output_text"),
2967
+ text: import_v419.z.string(),
2896
2968
  logprobs: LOGPROBS_SCHEMA.nullish(),
2897
- annotations: import_v418.z.array(
2898
- import_v418.z.discriminatedUnion("type", [
2899
- import_v418.z.object({
2900
- type: import_v418.z.literal("url_citation"),
2901
- start_index: import_v418.z.number(),
2902
- end_index: import_v418.z.number(),
2903
- url: import_v418.z.string(),
2904
- title: import_v418.z.string()
2969
+ annotations: import_v419.z.array(
2970
+ import_v419.z.discriminatedUnion("type", [
2971
+ import_v419.z.object({
2972
+ type: import_v419.z.literal("url_citation"),
2973
+ start_index: import_v419.z.number(),
2974
+ end_index: import_v419.z.number(),
2975
+ url: import_v419.z.string(),
2976
+ title: import_v419.z.string()
2905
2977
  }),
2906
- import_v418.z.object({
2907
- type: import_v418.z.literal("file_citation"),
2908
- file_id: import_v418.z.string(),
2909
- filename: import_v418.z.string().nullish(),
2910
- index: import_v418.z.number().nullish(),
2911
- start_index: import_v418.z.number().nullish(),
2912
- end_index: import_v418.z.number().nullish(),
2913
- quote: import_v418.z.string().nullish()
2978
+ import_v419.z.object({
2979
+ type: import_v419.z.literal("file_citation"),
2980
+ file_id: import_v419.z.string(),
2981
+ filename: import_v419.z.string().nullish(),
2982
+ index: import_v419.z.number().nullish(),
2983
+ start_index: import_v419.z.number().nullish(),
2984
+ end_index: import_v419.z.number().nullish(),
2985
+ quote: import_v419.z.string().nullish()
2914
2986
  }),
2915
- import_v418.z.object({
2916
- type: import_v418.z.literal("container_file_citation")
2987
+ import_v419.z.object({
2988
+ type: import_v419.z.literal("container_file_citation")
2917
2989
  })
2918
2990
  ])
2919
2991
  )
@@ -2924,33 +2996,34 @@ var OpenAIResponsesLanguageModel = class {
2924
2996
  fileSearchCallItem,
2925
2997
  codeInterpreterCallItem,
2926
2998
  imageGenerationCallItem,
2927
- import_v418.z.object({
2928
- type: import_v418.z.literal("function_call"),
2929
- call_id: import_v418.z.string(),
2930
- name: import_v418.z.string(),
2931
- arguments: import_v418.z.string(),
2932
- id: import_v418.z.string()
2999
+ localShellCallItem,
3000
+ import_v419.z.object({
3001
+ type: import_v419.z.literal("function_call"),
3002
+ call_id: import_v419.z.string(),
3003
+ name: import_v419.z.string(),
3004
+ arguments: import_v419.z.string(),
3005
+ id: import_v419.z.string()
2933
3006
  }),
2934
- import_v418.z.object({
2935
- type: import_v418.z.literal("computer_call"),
2936
- id: import_v418.z.string(),
2937
- status: import_v418.z.string().optional()
3007
+ import_v419.z.object({
3008
+ type: import_v419.z.literal("computer_call"),
3009
+ id: import_v419.z.string(),
3010
+ status: import_v419.z.string().optional()
2938
3011
  }),
2939
- import_v418.z.object({
2940
- type: import_v418.z.literal("reasoning"),
2941
- id: import_v418.z.string(),
2942
- encrypted_content: import_v418.z.string().nullish(),
2943
- summary: import_v418.z.array(
2944
- import_v418.z.object({
2945
- type: import_v418.z.literal("summary_text"),
2946
- text: import_v418.z.string()
3012
+ import_v419.z.object({
3013
+ type: import_v419.z.literal("reasoning"),
3014
+ id: import_v419.z.string(),
3015
+ encrypted_content: import_v419.z.string().nullish(),
3016
+ summary: import_v419.z.array(
3017
+ import_v419.z.object({
3018
+ type: import_v419.z.literal("summary_text"),
3019
+ text: import_v419.z.string()
2947
3020
  })
2948
3021
  )
2949
3022
  })
2950
3023
  ])
2951
3024
  ),
2952
- service_tier: import_v418.z.string().nullish(),
2953
- incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
3025
+ service_tier: import_v419.z.string().nullish(),
3026
+ incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
2954
3027
  usage: usageSchema2
2955
3028
  })
2956
3029
  ),
@@ -3010,6 +3083,20 @@ var OpenAIResponsesLanguageModel = class {
3010
3083
  });
3011
3084
  break;
3012
3085
  }
3086
+ case "local_shell_call": {
3087
+ content.push({
3088
+ type: "tool-call",
3089
+ toolCallId: part.call_id,
3090
+ toolName: "local_shell",
3091
+ input: JSON.stringify({ action: part.action }),
3092
+ providerMetadata: {
3093
+ openai: {
3094
+ itemId: part.id
3095
+ }
3096
+ }
3097
+ });
3098
+ break;
3099
+ }
3013
3100
  case "message": {
3014
3101
  for (const contentPart of part.content) {
3015
3102
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -3029,7 +3116,7 @@ var OpenAIResponsesLanguageModel = class {
3029
3116
  content.push({
3030
3117
  type: "source",
3031
3118
  sourceType: "url",
3032
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils15.generateId)(),
3119
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils16.generateId)(),
3033
3120
  url: annotation.url,
3034
3121
  title: annotation.title
3035
3122
  });
@@ -3037,7 +3124,7 @@ var OpenAIResponsesLanguageModel = class {
3037
3124
  content.push({
3038
3125
  type: "source",
3039
3126
  sourceType: "document",
3040
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils15.generateId)(),
3127
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils16.generateId)(),
3041
3128
  mediaType: "text/plain",
3042
3129
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
3043
3130
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -3189,18 +3276,18 @@ var OpenAIResponsesLanguageModel = class {
3189
3276
  warnings,
3190
3277
  webSearchToolName
3191
3278
  } = await this.getArgs(options);
3192
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
3279
+ const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
3193
3280
  url: this.config.url({
3194
3281
  path: "/responses",
3195
3282
  modelId: this.modelId
3196
3283
  }),
3197
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3284
+ headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
3198
3285
  body: {
3199
3286
  ...body,
3200
3287
  stream: true
3201
3288
  },
3202
3289
  failedResponseHandler: openaiFailedResponseHandler,
3203
- successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
3290
+ successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
3204
3291
  openaiResponsesChunkSchema
3205
3292
  ),
3206
3293
  abortSignal: options.abortSignal,
@@ -3267,6 +3354,24 @@ var OpenAIResponsesLanguageModel = class {
3267
3354
  id: value.item.id,
3268
3355
  toolName: "computer_use"
3269
3356
  });
3357
+ } else if (value.item.type === "code_interpreter_call") {
3358
+ ongoingToolCalls[value.output_index] = {
3359
+ toolName: "code_interpreter",
3360
+ toolCallId: value.item.id,
3361
+ codeInterpreter: {
3362
+ containerId: value.item.container_id
3363
+ }
3364
+ };
3365
+ controller.enqueue({
3366
+ type: "tool-input-start",
3367
+ id: value.item.id,
3368
+ toolName: "code_interpreter"
3369
+ });
3370
+ controller.enqueue({
3371
+ type: "tool-input-delta",
3372
+ id: value.item.id,
3373
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3374
+ });
3270
3375
  } else if (value.item.type === "file_search_call") {
3271
3376
  controller.enqueue({
3272
3377
  type: "tool-call",
@@ -3390,16 +3495,7 @@ var OpenAIResponsesLanguageModel = class {
3390
3495
  providerExecuted: true
3391
3496
  });
3392
3497
  } else if (value.item.type === "code_interpreter_call") {
3393
- controller.enqueue({
3394
- type: "tool-call",
3395
- toolCallId: value.item.id,
3396
- toolName: "code_interpreter",
3397
- input: JSON.stringify({
3398
- code: value.item.code,
3399
- containerId: value.item.container_id
3400
- }),
3401
- providerExecuted: true
3402
- });
3498
+ ongoingToolCalls[value.output_index] = void 0;
3403
3499
  controller.enqueue({
3404
3500
  type: "tool-result",
3405
3501
  toolCallId: value.item.id,
@@ -3419,6 +3515,26 @@ var OpenAIResponsesLanguageModel = class {
3419
3515
  },
3420
3516
  providerExecuted: true
3421
3517
  });
3518
+ } else if (value.item.type === "local_shell_call") {
3519
+ ongoingToolCalls[value.output_index] = void 0;
3520
+ controller.enqueue({
3521
+ type: "tool-call",
3522
+ toolCallId: value.item.call_id,
3523
+ toolName: "local_shell",
3524
+ input: JSON.stringify({
3525
+ action: {
3526
+ type: "exec",
3527
+ command: value.item.action.command,
3528
+ timeoutMs: value.item.action.timeout_ms,
3529
+ user: value.item.action.user,
3530
+ workingDirectory: value.item.action.working_directory,
3531
+ env: value.item.action.env
3532
+ }
3533
+ }),
3534
+ providerMetadata: {
3535
+ openai: { itemId: value.item.id }
3536
+ }
3537
+ });
3422
3538
  } else if (value.item.type === "message") {
3423
3539
  controller.enqueue({
3424
3540
  type: "text-end",
@@ -3449,6 +3565,40 @@ var OpenAIResponsesLanguageModel = class {
3449
3565
  delta: value.delta
3450
3566
  });
3451
3567
  }
3568
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3569
+ const toolCall = ongoingToolCalls[value.output_index];
3570
+ if (toolCall != null) {
3571
+ controller.enqueue({
3572
+ type: "tool-input-delta",
3573
+ id: toolCall.toolCallId,
3574
+ // The delta is code, which is embedding in a JSON string.
3575
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3576
+ delta: JSON.stringify(value.delta).slice(1, -1)
3577
+ });
3578
+ }
3579
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3580
+ const toolCall = ongoingToolCalls[value.output_index];
3581
+ if (toolCall != null) {
3582
+ controller.enqueue({
3583
+ type: "tool-input-delta",
3584
+ id: toolCall.toolCallId,
3585
+ delta: '"}'
3586
+ });
3587
+ controller.enqueue({
3588
+ type: "tool-input-end",
3589
+ id: toolCall.toolCallId
3590
+ });
3591
+ controller.enqueue({
3592
+ type: "tool-call",
3593
+ toolCallId: toolCall.toolCallId,
3594
+ toolName: "code_interpreter",
3595
+ input: JSON.stringify({
3596
+ code: value.code,
3597
+ containerId: toolCall.codeInterpreter.containerId
3598
+ }),
3599
+ providerExecuted: true
3600
+ });
3601
+ }
3452
3602
  } else if (isResponseCreatedChunk(value)) {
3453
3603
  responseId = value.response.id;
3454
3604
  controller.enqueue({
@@ -3511,7 +3661,7 @@ var OpenAIResponsesLanguageModel = class {
3511
3661
  controller.enqueue({
3512
3662
  type: "source",
3513
3663
  sourceType: "url",
3514
- id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils15.generateId)(),
3664
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils16.generateId)(),
3515
3665
  url: value.annotation.url,
3516
3666
  title: value.annotation.title
3517
3667
  });
@@ -3519,7 +3669,7 @@ var OpenAIResponsesLanguageModel = class {
3519
3669
  controller.enqueue({
3520
3670
  type: "source",
3521
3671
  sourceType: "document",
3522
- id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils15.generateId)(),
3672
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils16.generateId)(),
3523
3673
  mediaType: "text/plain",
3524
3674
  title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3525
3675
  filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
@@ -3555,166 +3705,194 @@ var OpenAIResponsesLanguageModel = class {
3555
3705
  };
3556
3706
  }
3557
3707
  };
3558
- var usageSchema2 = import_v418.z.object({
3559
- input_tokens: import_v418.z.number(),
3560
- input_tokens_details: import_v418.z.object({ cached_tokens: import_v418.z.number().nullish() }).nullish(),
3561
- output_tokens: import_v418.z.number(),
3562
- output_tokens_details: import_v418.z.object({ reasoning_tokens: import_v418.z.number().nullish() }).nullish()
3708
+ var usageSchema2 = import_v419.z.object({
3709
+ input_tokens: import_v419.z.number(),
3710
+ input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
3711
+ output_tokens: import_v419.z.number(),
3712
+ output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
3563
3713
  });
3564
- var textDeltaChunkSchema = import_v418.z.object({
3565
- type: import_v418.z.literal("response.output_text.delta"),
3566
- item_id: import_v418.z.string(),
3567
- delta: import_v418.z.string(),
3714
+ var textDeltaChunkSchema = import_v419.z.object({
3715
+ type: import_v419.z.literal("response.output_text.delta"),
3716
+ item_id: import_v419.z.string(),
3717
+ delta: import_v419.z.string(),
3568
3718
  logprobs: LOGPROBS_SCHEMA.nullish()
3569
3719
  });
3570
- var errorChunkSchema = import_v418.z.object({
3571
- type: import_v418.z.literal("error"),
3572
- code: import_v418.z.string(),
3573
- message: import_v418.z.string(),
3574
- param: import_v418.z.string().nullish(),
3575
- sequence_number: import_v418.z.number()
3720
+ var errorChunkSchema = import_v419.z.object({
3721
+ type: import_v419.z.literal("error"),
3722
+ code: import_v419.z.string(),
3723
+ message: import_v419.z.string(),
3724
+ param: import_v419.z.string().nullish(),
3725
+ sequence_number: import_v419.z.number()
3576
3726
  });
3577
- var responseFinishedChunkSchema = import_v418.z.object({
3578
- type: import_v418.z.enum(["response.completed", "response.incomplete"]),
3579
- response: import_v418.z.object({
3580
- incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
3727
+ var responseFinishedChunkSchema = import_v419.z.object({
3728
+ type: import_v419.z.enum(["response.completed", "response.incomplete"]),
3729
+ response: import_v419.z.object({
3730
+ incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
3581
3731
  usage: usageSchema2,
3582
- service_tier: import_v418.z.string().nullish()
3732
+ service_tier: import_v419.z.string().nullish()
3583
3733
  })
3584
3734
  });
3585
- var responseCreatedChunkSchema = import_v418.z.object({
3586
- type: import_v418.z.literal("response.created"),
3587
- response: import_v418.z.object({
3588
- id: import_v418.z.string(),
3589
- created_at: import_v418.z.number(),
3590
- model: import_v418.z.string(),
3591
- service_tier: import_v418.z.string().nullish()
3735
+ var responseCreatedChunkSchema = import_v419.z.object({
3736
+ type: import_v419.z.literal("response.created"),
3737
+ response: import_v419.z.object({
3738
+ id: import_v419.z.string(),
3739
+ created_at: import_v419.z.number(),
3740
+ model: import_v419.z.string(),
3741
+ service_tier: import_v419.z.string().nullish()
3592
3742
  })
3593
3743
  });
3594
- var responseOutputItemAddedSchema = import_v418.z.object({
3595
- type: import_v418.z.literal("response.output_item.added"),
3596
- output_index: import_v418.z.number(),
3597
- item: import_v418.z.discriminatedUnion("type", [
3598
- import_v418.z.object({
3599
- type: import_v418.z.literal("message"),
3600
- id: import_v418.z.string()
3744
+ var responseOutputItemAddedSchema = import_v419.z.object({
3745
+ type: import_v419.z.literal("response.output_item.added"),
3746
+ output_index: import_v419.z.number(),
3747
+ item: import_v419.z.discriminatedUnion("type", [
3748
+ import_v419.z.object({
3749
+ type: import_v419.z.literal("message"),
3750
+ id: import_v419.z.string()
3601
3751
  }),
3602
- import_v418.z.object({
3603
- type: import_v418.z.literal("reasoning"),
3604
- id: import_v418.z.string(),
3605
- encrypted_content: import_v418.z.string().nullish()
3752
+ import_v419.z.object({
3753
+ type: import_v419.z.literal("reasoning"),
3754
+ id: import_v419.z.string(),
3755
+ encrypted_content: import_v419.z.string().nullish()
3606
3756
  }),
3607
- import_v418.z.object({
3608
- type: import_v418.z.literal("function_call"),
3609
- id: import_v418.z.string(),
3610
- call_id: import_v418.z.string(),
3611
- name: import_v418.z.string(),
3612
- arguments: import_v418.z.string()
3757
+ import_v419.z.object({
3758
+ type: import_v419.z.literal("function_call"),
3759
+ id: import_v419.z.string(),
3760
+ call_id: import_v419.z.string(),
3761
+ name: import_v419.z.string(),
3762
+ arguments: import_v419.z.string()
3613
3763
  }),
3614
- import_v418.z.object({
3615
- type: import_v418.z.literal("web_search_call"),
3616
- id: import_v418.z.string(),
3617
- status: import_v418.z.string(),
3618
- action: import_v418.z.object({
3619
- type: import_v418.z.literal("search"),
3620
- query: import_v418.z.string().optional()
3764
+ import_v419.z.object({
3765
+ type: import_v419.z.literal("web_search_call"),
3766
+ id: import_v419.z.string(),
3767
+ status: import_v419.z.string(),
3768
+ action: import_v419.z.object({
3769
+ type: import_v419.z.literal("search"),
3770
+ query: import_v419.z.string().optional()
3621
3771
  }).nullish()
3622
3772
  }),
3623
- import_v418.z.object({
3624
- type: import_v418.z.literal("computer_call"),
3625
- id: import_v418.z.string(),
3626
- status: import_v418.z.string()
3773
+ import_v419.z.object({
3774
+ type: import_v419.z.literal("computer_call"),
3775
+ id: import_v419.z.string(),
3776
+ status: import_v419.z.string()
3627
3777
  }),
3628
- import_v418.z.object({
3629
- type: import_v418.z.literal("file_search_call"),
3630
- id: import_v418.z.string()
3778
+ import_v419.z.object({
3779
+ type: import_v419.z.literal("file_search_call"),
3780
+ id: import_v419.z.string()
3631
3781
  }),
3632
- import_v418.z.object({
3633
- type: import_v418.z.literal("image_generation_call"),
3634
- id: import_v418.z.string()
3782
+ import_v419.z.object({
3783
+ type: import_v419.z.literal("image_generation_call"),
3784
+ id: import_v419.z.string()
3785
+ }),
3786
+ import_v419.z.object({
3787
+ type: import_v419.z.literal("code_interpreter_call"),
3788
+ id: import_v419.z.string(),
3789
+ container_id: import_v419.z.string(),
3790
+ code: import_v419.z.string().nullable(),
3791
+ outputs: import_v419.z.array(
3792
+ import_v419.z.discriminatedUnion("type", [
3793
+ import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
3794
+ import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
3795
+ ])
3796
+ ).nullable(),
3797
+ status: import_v419.z.string()
3635
3798
  })
3636
3799
  ])
3637
3800
  });
3638
- var responseOutputItemDoneSchema = import_v418.z.object({
3639
- type: import_v418.z.literal("response.output_item.done"),
3640
- output_index: import_v418.z.number(),
3641
- item: import_v418.z.discriminatedUnion("type", [
3642
- import_v418.z.object({
3643
- type: import_v418.z.literal("message"),
3644
- id: import_v418.z.string()
3801
+ var responseOutputItemDoneSchema = import_v419.z.object({
3802
+ type: import_v419.z.literal("response.output_item.done"),
3803
+ output_index: import_v419.z.number(),
3804
+ item: import_v419.z.discriminatedUnion("type", [
3805
+ import_v419.z.object({
3806
+ type: import_v419.z.literal("message"),
3807
+ id: import_v419.z.string()
3645
3808
  }),
3646
- import_v418.z.object({
3647
- type: import_v418.z.literal("reasoning"),
3648
- id: import_v418.z.string(),
3649
- encrypted_content: import_v418.z.string().nullish()
3809
+ import_v419.z.object({
3810
+ type: import_v419.z.literal("reasoning"),
3811
+ id: import_v419.z.string(),
3812
+ encrypted_content: import_v419.z.string().nullish()
3650
3813
  }),
3651
- import_v418.z.object({
3652
- type: import_v418.z.literal("function_call"),
3653
- id: import_v418.z.string(),
3654
- call_id: import_v418.z.string(),
3655
- name: import_v418.z.string(),
3656
- arguments: import_v418.z.string(),
3657
- status: import_v418.z.literal("completed")
3814
+ import_v419.z.object({
3815
+ type: import_v419.z.literal("function_call"),
3816
+ id: import_v419.z.string(),
3817
+ call_id: import_v419.z.string(),
3818
+ name: import_v419.z.string(),
3819
+ arguments: import_v419.z.string(),
3820
+ status: import_v419.z.literal("completed")
3658
3821
  }),
3659
3822
  codeInterpreterCallItem,
3660
3823
  imageGenerationCallItem,
3661
3824
  webSearchCallItem,
3662
3825
  fileSearchCallItem,
3663
- import_v418.z.object({
3664
- type: import_v418.z.literal("computer_call"),
3665
- id: import_v418.z.string(),
3666
- status: import_v418.z.literal("completed")
3826
+ localShellCallItem,
3827
+ import_v419.z.object({
3828
+ type: import_v419.z.literal("computer_call"),
3829
+ id: import_v419.z.string(),
3830
+ status: import_v419.z.literal("completed")
3667
3831
  })
3668
3832
  ])
3669
3833
  });
3670
- var responseFunctionCallArgumentsDeltaSchema = import_v418.z.object({
3671
- type: import_v418.z.literal("response.function_call_arguments.delta"),
3672
- item_id: import_v418.z.string(),
3673
- output_index: import_v418.z.number(),
3674
- delta: import_v418.z.string()
3834
+ var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
3835
+ type: import_v419.z.literal("response.function_call_arguments.delta"),
3836
+ item_id: import_v419.z.string(),
3837
+ output_index: import_v419.z.number(),
3838
+ delta: import_v419.z.string()
3839
+ });
3840
+ var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
3841
+ type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
3842
+ item_id: import_v419.z.string(),
3843
+ output_index: import_v419.z.number(),
3844
+ delta: import_v419.z.string()
3845
+ });
3846
+ var responseCodeInterpreterCallCodeDoneSchema = import_v419.z.object({
3847
+ type: import_v419.z.literal("response.code_interpreter_call_code.done"),
3848
+ item_id: import_v419.z.string(),
3849
+ output_index: import_v419.z.number(),
3850
+ code: import_v419.z.string()
3675
3851
  });
3676
- var responseAnnotationAddedSchema = import_v418.z.object({
3677
- type: import_v418.z.literal("response.output_text.annotation.added"),
3678
- annotation: import_v418.z.discriminatedUnion("type", [
3679
- import_v418.z.object({
3680
- type: import_v418.z.literal("url_citation"),
3681
- url: import_v418.z.string(),
3682
- title: import_v418.z.string()
3852
+ var responseAnnotationAddedSchema = import_v419.z.object({
3853
+ type: import_v419.z.literal("response.output_text.annotation.added"),
3854
+ annotation: import_v419.z.discriminatedUnion("type", [
3855
+ import_v419.z.object({
3856
+ type: import_v419.z.literal("url_citation"),
3857
+ url: import_v419.z.string(),
3858
+ title: import_v419.z.string()
3683
3859
  }),
3684
- import_v418.z.object({
3685
- type: import_v418.z.literal("file_citation"),
3686
- file_id: import_v418.z.string(),
3687
- filename: import_v418.z.string().nullish(),
3688
- index: import_v418.z.number().nullish(),
3689
- start_index: import_v418.z.number().nullish(),
3690
- end_index: import_v418.z.number().nullish(),
3691
- quote: import_v418.z.string().nullish()
3860
+ import_v419.z.object({
3861
+ type: import_v419.z.literal("file_citation"),
3862
+ file_id: import_v419.z.string(),
3863
+ filename: import_v419.z.string().nullish(),
3864
+ index: import_v419.z.number().nullish(),
3865
+ start_index: import_v419.z.number().nullish(),
3866
+ end_index: import_v419.z.number().nullish(),
3867
+ quote: import_v419.z.string().nullish()
3692
3868
  })
3693
3869
  ])
3694
3870
  });
3695
- var responseReasoningSummaryPartAddedSchema = import_v418.z.object({
3696
- type: import_v418.z.literal("response.reasoning_summary_part.added"),
3697
- item_id: import_v418.z.string(),
3698
- summary_index: import_v418.z.number()
3871
+ var responseReasoningSummaryPartAddedSchema = import_v419.z.object({
3872
+ type: import_v419.z.literal("response.reasoning_summary_part.added"),
3873
+ item_id: import_v419.z.string(),
3874
+ summary_index: import_v419.z.number()
3699
3875
  });
3700
- var responseReasoningSummaryTextDeltaSchema = import_v418.z.object({
3701
- type: import_v418.z.literal("response.reasoning_summary_text.delta"),
3702
- item_id: import_v418.z.string(),
3703
- summary_index: import_v418.z.number(),
3704
- delta: import_v418.z.string()
3876
+ var responseReasoningSummaryTextDeltaSchema = import_v419.z.object({
3877
+ type: import_v419.z.literal("response.reasoning_summary_text.delta"),
3878
+ item_id: import_v419.z.string(),
3879
+ summary_index: import_v419.z.number(),
3880
+ delta: import_v419.z.string()
3705
3881
  });
3706
- var openaiResponsesChunkSchema = import_v418.z.union([
3882
+ var openaiResponsesChunkSchema = import_v419.z.union([
3707
3883
  textDeltaChunkSchema,
3708
3884
  responseFinishedChunkSchema,
3709
3885
  responseCreatedChunkSchema,
3710
3886
  responseOutputItemAddedSchema,
3711
3887
  responseOutputItemDoneSchema,
3712
3888
  responseFunctionCallArgumentsDeltaSchema,
3889
+ responseCodeInterpreterCallCodeDeltaSchema,
3890
+ responseCodeInterpreterCallCodeDoneSchema,
3713
3891
  responseAnnotationAddedSchema,
3714
3892
  responseReasoningSummaryPartAddedSchema,
3715
3893
  responseReasoningSummaryTextDeltaSchema,
3716
3894
  errorChunkSchema,
3717
- import_v418.z.object({ type: import_v418.z.string() }).loose()
3895
+ import_v419.z.object({ type: import_v419.z.string() }).loose()
3718
3896
  // fallback for unknown chunks
3719
3897
  ]);
3720
3898
  function isTextDeltaChunk(chunk) {
@@ -3735,6 +3913,12 @@ function isResponseCreatedChunk(chunk) {
3735
3913
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3736
3914
  return chunk.type === "response.function_call_arguments.delta";
3737
3915
  }
3916
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3917
+ return chunk.type === "response.code_interpreter_call_code.delta";
3918
+ }
3919
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3920
+ return chunk.type === "response.code_interpreter_call_code.done";
3921
+ }
3738
3922
  function isResponseOutputItemAddedChunk(chunk) {
3739
3923
  return chunk.type === "response.output_item.added";
3740
3924
  }
@@ -3787,15 +3971,15 @@ function getResponsesModelConfig(modelId) {
3787
3971
  isReasoningModel: false
3788
3972
  };
3789
3973
  }
3790
- var openaiResponsesProviderOptionsSchema = import_v418.z.object({
3791
- include: import_v418.z.array(
3792
- import_v418.z.enum([
3974
+ var openaiResponsesProviderOptionsSchema = import_v419.z.object({
3975
+ include: import_v419.z.array(
3976
+ import_v419.z.enum([
3793
3977
  "reasoning.encrypted_content",
3794
3978
  "file_search_call.results",
3795
3979
  "message.output_text.logprobs"
3796
3980
  ])
3797
3981
  ).nullish(),
3798
- instructions: import_v418.z.string().nullish(),
3982
+ instructions: import_v419.z.string().nullish(),
3799
3983
  /**
3800
3984
  * Return the log probabilities of the tokens.
3801
3985
  *
@@ -3808,25 +3992,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
3808
3992
  * @see https://platform.openai.com/docs/api-reference/responses/create
3809
3993
  * @see https://cookbook.openai.com/examples/using_logprobs
3810
3994
  */
3811
- logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3995
+ logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3812
3996
  /**
3813
3997
  * The maximum number of total calls to built-in tools that can be processed in a response.
3814
3998
  * This maximum number applies across all built-in tool calls, not per individual tool.
3815
3999
  * Any further attempts to call a tool by the model will be ignored.
3816
4000
  */
3817
- maxToolCalls: import_v418.z.number().nullish(),
3818
- metadata: import_v418.z.any().nullish(),
3819
- parallelToolCalls: import_v418.z.boolean().nullish(),
3820
- previousResponseId: import_v418.z.string().nullish(),
3821
- promptCacheKey: import_v418.z.string().nullish(),
3822
- reasoningEffort: import_v418.z.string().nullish(),
3823
- reasoningSummary: import_v418.z.string().nullish(),
3824
- safetyIdentifier: import_v418.z.string().nullish(),
3825
- serviceTier: import_v418.z.enum(["auto", "flex", "priority"]).nullish(),
3826
- store: import_v418.z.boolean().nullish(),
3827
- strictJsonSchema: import_v418.z.boolean().nullish(),
3828
- textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
3829
- user: import_v418.z.string().nullish()
4001
+ maxToolCalls: import_v419.z.number().nullish(),
4002
+ metadata: import_v419.z.any().nullish(),
4003
+ parallelToolCalls: import_v419.z.boolean().nullish(),
4004
+ previousResponseId: import_v419.z.string().nullish(),
4005
+ promptCacheKey: import_v419.z.string().nullish(),
4006
+ reasoningEffort: import_v419.z.string().nullish(),
4007
+ reasoningSummary: import_v419.z.string().nullish(),
4008
+ safetyIdentifier: import_v419.z.string().nullish(),
4009
+ serviceTier: import_v419.z.enum(["auto", "flex", "priority"]).nullish(),
4010
+ store: import_v419.z.boolean().nullish(),
4011
+ strictJsonSchema: import_v419.z.boolean().nullish(),
4012
+ textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
4013
+ user: import_v419.z.string().nullish()
3830
4014
  });
3831
4015
  // Annotate the CommonJS export names for ESM import in node:
3832
4016
  0 && (module.exports = {