@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.
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ __export(src_exports, {
27
27
  module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/openai-provider.ts
30
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
30
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/chat/openai-chat-language-model.ts
33
33
  var import_provider3 = require("@ai-sdk/provider");
@@ -1783,39 +1783,62 @@ var imageGeneration = (args = {}) => {
1783
1783
  return imageGenerationToolFactory(args);
1784
1784
  };
1785
1785
 
1786
- // src/tool/web-search.ts
1786
+ // src/tool/local-shell.ts
1787
1787
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
1788
1788
  var import_v412 = require("zod/v4");
1789
- var webSearchArgsSchema = import_v412.z.object({
1790
- filters: import_v412.z.object({
1791
- allowedDomains: import_v412.z.array(import_v412.z.string()).optional()
1789
+ var localShellInputSchema = import_v412.z.object({
1790
+ action: import_v412.z.object({
1791
+ type: import_v412.z.literal("exec"),
1792
+ command: import_v412.z.array(import_v412.z.string()),
1793
+ timeoutMs: import_v412.z.number().optional(),
1794
+ user: import_v412.z.string().optional(),
1795
+ workingDirectory: import_v412.z.string().optional(),
1796
+ env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
1797
+ })
1798
+ });
1799
+ var localShellOutputSchema = import_v412.z.object({
1800
+ output: import_v412.z.string()
1801
+ });
1802
+ var localShell = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1803
+ id: "openai.local_shell",
1804
+ name: "local_shell",
1805
+ inputSchema: localShellInputSchema,
1806
+ outputSchema: localShellOutputSchema
1807
+ });
1808
+
1809
+ // src/tool/web-search.ts
1810
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1811
+ var import_v413 = require("zod/v4");
1812
+ var webSearchArgsSchema = import_v413.z.object({
1813
+ filters: import_v413.z.object({
1814
+ allowedDomains: import_v413.z.array(import_v413.z.string()).optional()
1792
1815
  }).optional(),
1793
- searchContextSize: import_v412.z.enum(["low", "medium", "high"]).optional(),
1794
- userLocation: import_v412.z.object({
1795
- type: import_v412.z.literal("approximate"),
1796
- country: import_v412.z.string().optional(),
1797
- city: import_v412.z.string().optional(),
1798
- region: import_v412.z.string().optional(),
1799
- timezone: import_v412.z.string().optional()
1816
+ searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1817
+ userLocation: import_v413.z.object({
1818
+ type: import_v413.z.literal("approximate"),
1819
+ country: import_v413.z.string().optional(),
1820
+ city: import_v413.z.string().optional(),
1821
+ region: import_v413.z.string().optional(),
1822
+ timezone: import_v413.z.string().optional()
1800
1823
  }).optional()
1801
1824
  });
1802
- var webSearchToolFactory = (0, import_provider_utils10.createProviderDefinedToolFactory)({
1825
+ var webSearchToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1803
1826
  id: "openai.web_search",
1804
1827
  name: "web_search",
1805
- inputSchema: import_v412.z.object({
1806
- action: import_v412.z.discriminatedUnion("type", [
1807
- import_v412.z.object({
1808
- type: import_v412.z.literal("search"),
1809
- query: import_v412.z.string().nullish()
1828
+ inputSchema: import_v413.z.object({
1829
+ action: import_v413.z.discriminatedUnion("type", [
1830
+ import_v413.z.object({
1831
+ type: import_v413.z.literal("search"),
1832
+ query: import_v413.z.string().nullish()
1810
1833
  }),
1811
- import_v412.z.object({
1812
- type: import_v412.z.literal("open_page"),
1813
- url: import_v412.z.string()
1834
+ import_v413.z.object({
1835
+ type: import_v413.z.literal("open_page"),
1836
+ url: import_v413.z.string()
1814
1837
  }),
1815
- import_v412.z.object({
1816
- type: import_v412.z.literal("find"),
1817
- url: import_v412.z.string(),
1818
- pattern: import_v412.z.string()
1838
+ import_v413.z.object({
1839
+ type: import_v413.z.literal("find"),
1840
+ url: import_v413.z.string(),
1841
+ pattern: import_v413.z.string()
1819
1842
  })
1820
1843
  ]).nullish()
1821
1844
  })
@@ -1825,59 +1848,59 @@ var webSearch = (args = {}) => {
1825
1848
  };
1826
1849
 
1827
1850
  // src/tool/web-search-preview.ts
1828
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1829
- var import_v413 = require("zod/v4");
1830
- var webSearchPreviewArgsSchema = import_v413.z.object({
1851
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1852
+ var import_v414 = require("zod/v4");
1853
+ var webSearchPreviewArgsSchema = import_v414.z.object({
1831
1854
  /**
1832
1855
  * Search context size to use for the web search.
1833
1856
  * - high: Most comprehensive context, highest cost, slower response
1834
1857
  * - medium: Balanced context, cost, and latency (default)
1835
1858
  * - low: Least context, lowest cost, fastest response
1836
1859
  */
1837
- searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1860
+ searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
1838
1861
  /**
1839
1862
  * User location information to provide geographically relevant search results.
1840
1863
  */
1841
- userLocation: import_v413.z.object({
1864
+ userLocation: import_v414.z.object({
1842
1865
  /**
1843
1866
  * Type of location (always 'approximate')
1844
1867
  */
1845
- type: import_v413.z.literal("approximate"),
1868
+ type: import_v414.z.literal("approximate"),
1846
1869
  /**
1847
1870
  * Two-letter ISO country code (e.g., 'US', 'GB')
1848
1871
  */
1849
- country: import_v413.z.string().optional(),
1872
+ country: import_v414.z.string().optional(),
1850
1873
  /**
1851
1874
  * City name (free text, e.g., 'Minneapolis')
1852
1875
  */
1853
- city: import_v413.z.string().optional(),
1876
+ city: import_v414.z.string().optional(),
1854
1877
  /**
1855
1878
  * Region name (free text, e.g., 'Minnesota')
1856
1879
  */
1857
- region: import_v413.z.string().optional(),
1880
+ region: import_v414.z.string().optional(),
1858
1881
  /**
1859
1882
  * IANA timezone (e.g., 'America/Chicago')
1860
1883
  */
1861
- timezone: import_v413.z.string().optional()
1884
+ timezone: import_v414.z.string().optional()
1862
1885
  }).optional()
1863
1886
  });
1864
- var webSearchPreview = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1887
+ var webSearchPreview = (0, import_provider_utils12.createProviderDefinedToolFactory)({
1865
1888
  id: "openai.web_search_preview",
1866
1889
  name: "web_search_preview",
1867
- inputSchema: import_v413.z.object({
1868
- action: import_v413.z.discriminatedUnion("type", [
1869
- import_v413.z.object({
1870
- type: import_v413.z.literal("search"),
1871
- query: import_v413.z.string().nullish()
1890
+ inputSchema: import_v414.z.object({
1891
+ action: import_v414.z.discriminatedUnion("type", [
1892
+ import_v414.z.object({
1893
+ type: import_v414.z.literal("search"),
1894
+ query: import_v414.z.string().nullish()
1872
1895
  }),
1873
- import_v413.z.object({
1874
- type: import_v413.z.literal("open_page"),
1875
- url: import_v413.z.string()
1896
+ import_v414.z.object({
1897
+ type: import_v414.z.literal("open_page"),
1898
+ url: import_v414.z.string()
1876
1899
  }),
1877
- import_v413.z.object({
1878
- type: import_v413.z.literal("find"),
1879
- url: import_v413.z.string(),
1880
- pattern: import_v413.z.string()
1900
+ import_v414.z.object({
1901
+ type: import_v414.z.literal("find"),
1902
+ url: import_v414.z.string(),
1903
+ pattern: import_v414.z.string()
1881
1904
  })
1882
1905
  ]).nullish()
1883
1906
  })
@@ -1922,6 +1945,15 @@ var openaiTools = {
1922
1945
  * @param background - Transparent or opaque
1923
1946
  */
1924
1947
  imageGeneration,
1948
+ /**
1949
+ * Local shell is a tool that allows agents to run shell commands locally
1950
+ * on a machine you or the user provides.
1951
+ *
1952
+ * Supported models: `gpt-5-codex` and `codex-mini-latest`
1953
+ *
1954
+ * Must have name `local_shell`.
1955
+ */
1956
+ localShell,
1925
1957
  /**
1926
1958
  * Web search allows models to access up-to-date information from the internet
1927
1959
  * and provide answers with sourced citations.
@@ -1949,13 +1981,13 @@ var openaiTools = {
1949
1981
 
1950
1982
  // src/responses/openai-responses-language-model.ts
1951
1983
  var import_provider8 = require("@ai-sdk/provider");
1952
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1953
- var import_v415 = require("zod/v4");
1984
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1985
+ var import_v416 = require("zod/v4");
1954
1986
 
1955
1987
  // src/responses/convert-to-openai-responses-input.ts
1956
1988
  var import_provider6 = require("@ai-sdk/provider");
1957
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1958
- var import_v414 = require("zod/v4");
1989
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1990
+ var import_v415 = require("zod/v4");
1959
1991
  function isFileId(data, prefixes) {
1960
1992
  if (!prefixes) return false;
1961
1993
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -1964,9 +1996,10 @@ async function convertToOpenAIResponsesInput({
1964
1996
  prompt,
1965
1997
  systemMessageMode,
1966
1998
  fileIdPrefixes,
1967
- store
1999
+ store,
2000
+ hasLocalShellTool = false
1968
2001
  }) {
1969
- var _a, _b, _c, _d, _e, _f;
2002
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1970
2003
  const input = [];
1971
2004
  const warnings = [];
1972
2005
  for (const { role, content } of prompt) {
@@ -2012,7 +2045,7 @@ async function convertToOpenAIResponsesInput({
2012
2045
  return {
2013
2046
  type: "input_image",
2014
2047
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2015
- image_url: `data:${mediaType};base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2048
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2016
2049
  },
2017
2050
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2018
2051
  };
@@ -2027,7 +2060,7 @@ async function convertToOpenAIResponsesInput({
2027
2060
  type: "input_file",
2028
2061
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2029
2062
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2030
- file_data: `data:application/pdf;base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2063
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2031
2064
  }
2032
2065
  };
2033
2066
  } else {
@@ -2059,15 +2092,33 @@ async function convertToOpenAIResponsesInput({
2059
2092
  if (part.providerExecuted) {
2060
2093
  break;
2061
2094
  }
2095
+ if (hasLocalShellTool && part.toolName === "local_shell") {
2096
+ const parsedInput = localShellInputSchema.parse(part.input);
2097
+ input.push({
2098
+ type: "local_shell_call",
2099
+ call_id: part.toolCallId,
2100
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2101
+ action: {
2102
+ type: "exec",
2103
+ command: parsedInput.action.command,
2104
+ timeout_ms: parsedInput.action.timeoutMs,
2105
+ user: parsedInput.action.user,
2106
+ working_directory: parsedInput.action.workingDirectory,
2107
+ env: parsedInput.action.env
2108
+ }
2109
+ });
2110
+ break;
2111
+ }
2062
2112
  input.push({
2063
2113
  type: "function_call",
2064
2114
  call_id: part.toolCallId,
2065
2115
  name: part.toolName,
2066
2116
  arguments: JSON.stringify(part.input),
2067
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0
2117
+ id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2068
2118
  });
2069
2119
  break;
2070
2120
  }
2121
+ // assistant tool result parts are from provider-executed tools:
2071
2122
  case "tool-result": {
2072
2123
  if (store) {
2073
2124
  input.push({ type: "item_reference", id: part.toolCallId });
@@ -2080,7 +2131,7 @@ async function convertToOpenAIResponsesInput({
2080
2131
  break;
2081
2132
  }
2082
2133
  case "reasoning": {
2083
- const providerOptions = await (0, import_provider_utils12.parseProviderOptions)({
2134
+ const providerOptions = await (0, import_provider_utils13.parseProviderOptions)({
2084
2135
  provider: "openai",
2085
2136
  providerOptions: part.providerOptions,
2086
2137
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2137,6 +2188,14 @@ async function convertToOpenAIResponsesInput({
2137
2188
  case "tool": {
2138
2189
  for (const part of content) {
2139
2190
  const output = part.output;
2191
+ if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2192
+ input.push({
2193
+ type: "local_shell_call_output",
2194
+ call_id: part.toolCallId,
2195
+ output: localShellOutputSchema.parse(output.value).output
2196
+ });
2197
+ break;
2198
+ }
2140
2199
  let contentValue;
2141
2200
  switch (output.type) {
2142
2201
  case "text":
@@ -2165,9 +2224,9 @@ async function convertToOpenAIResponsesInput({
2165
2224
  }
2166
2225
  return { input, warnings };
2167
2226
  }
2168
- var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2169
- itemId: import_v414.z.string().nullish(),
2170
- reasoningEncryptedContent: import_v414.z.string().nullish()
2227
+ var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
2228
+ itemId: import_v415.z.string().nullish(),
2229
+ reasoningEncryptedContent: import_v415.z.string().nullish()
2171
2230
  });
2172
2231
 
2173
2232
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2228,6 +2287,12 @@ function prepareResponsesTools({
2228
2287
  });
2229
2288
  break;
2230
2289
  }
2290
+ case "openai.local_shell": {
2291
+ openaiTools2.push({
2292
+ type: "local_shell"
2293
+ });
2294
+ break;
2295
+ }
2231
2296
  case "openai.web_search_preview": {
2232
2297
  const args = webSearchPreviewArgsSchema.parse(tool.args);
2233
2298
  openaiTools2.push({
@@ -2307,66 +2372,79 @@ function prepareResponsesTools({
2307
2372
  }
2308
2373
 
2309
2374
  // src/responses/openai-responses-language-model.ts
2310
- var webSearchCallItem = import_v415.z.object({
2311
- type: import_v415.z.literal("web_search_call"),
2312
- id: import_v415.z.string(),
2313
- status: import_v415.z.string(),
2314
- action: import_v415.z.discriminatedUnion("type", [
2315
- import_v415.z.object({
2316
- type: import_v415.z.literal("search"),
2317
- query: import_v415.z.string().nullish()
2375
+ var webSearchCallItem = import_v416.z.object({
2376
+ type: import_v416.z.literal("web_search_call"),
2377
+ id: import_v416.z.string(),
2378
+ status: import_v416.z.string(),
2379
+ action: import_v416.z.discriminatedUnion("type", [
2380
+ import_v416.z.object({
2381
+ type: import_v416.z.literal("search"),
2382
+ query: import_v416.z.string().nullish()
2318
2383
  }),
2319
- import_v415.z.object({
2320
- type: import_v415.z.literal("open_page"),
2321
- url: import_v415.z.string()
2384
+ import_v416.z.object({
2385
+ type: import_v416.z.literal("open_page"),
2386
+ url: import_v416.z.string()
2322
2387
  }),
2323
- import_v415.z.object({
2324
- type: import_v415.z.literal("find"),
2325
- url: import_v415.z.string(),
2326
- pattern: import_v415.z.string()
2388
+ import_v416.z.object({
2389
+ type: import_v416.z.literal("find"),
2390
+ url: import_v416.z.string(),
2391
+ pattern: import_v416.z.string()
2327
2392
  })
2328
2393
  ]).nullish()
2329
2394
  });
2330
- var fileSearchCallItem = import_v415.z.object({
2331
- type: import_v415.z.literal("file_search_call"),
2332
- id: import_v415.z.string(),
2333
- queries: import_v415.z.array(import_v415.z.string()),
2334
- results: import_v415.z.array(
2335
- import_v415.z.object({
2336
- attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
2337
- file_id: import_v415.z.string(),
2338
- filename: import_v415.z.string(),
2339
- score: import_v415.z.number(),
2340
- text: import_v415.z.string()
2395
+ var fileSearchCallItem = import_v416.z.object({
2396
+ type: import_v416.z.literal("file_search_call"),
2397
+ id: import_v416.z.string(),
2398
+ queries: import_v416.z.array(import_v416.z.string()),
2399
+ results: import_v416.z.array(
2400
+ import_v416.z.object({
2401
+ attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
2402
+ file_id: import_v416.z.string(),
2403
+ filename: import_v416.z.string(),
2404
+ score: import_v416.z.number(),
2405
+ text: import_v416.z.string()
2341
2406
  })
2342
2407
  ).nullish()
2343
2408
  });
2344
- var codeInterpreterCallItem = import_v415.z.object({
2345
- type: import_v415.z.literal("code_interpreter_call"),
2346
- id: import_v415.z.string(),
2347
- code: import_v415.z.string().nullable(),
2348
- container_id: import_v415.z.string(),
2349
- outputs: import_v415.z.array(
2350
- import_v415.z.discriminatedUnion("type", [
2351
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
2352
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
2409
+ var codeInterpreterCallItem = import_v416.z.object({
2410
+ type: import_v416.z.literal("code_interpreter_call"),
2411
+ id: import_v416.z.string(),
2412
+ code: import_v416.z.string().nullable(),
2413
+ container_id: import_v416.z.string(),
2414
+ outputs: import_v416.z.array(
2415
+ import_v416.z.discriminatedUnion("type", [
2416
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2417
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2353
2418
  ])
2354
2419
  ).nullable()
2355
2420
  });
2356
- var imageGenerationCallItem = import_v415.z.object({
2357
- type: import_v415.z.literal("image_generation_call"),
2358
- id: import_v415.z.string(),
2359
- result: import_v415.z.string()
2421
+ var localShellCallItem = import_v416.z.object({
2422
+ type: import_v416.z.literal("local_shell_call"),
2423
+ id: import_v416.z.string(),
2424
+ call_id: import_v416.z.string(),
2425
+ action: import_v416.z.object({
2426
+ type: import_v416.z.literal("exec"),
2427
+ command: import_v416.z.array(import_v416.z.string()),
2428
+ timeout_ms: import_v416.z.number().optional(),
2429
+ user: import_v416.z.string().optional(),
2430
+ working_directory: import_v416.z.string().optional(),
2431
+ env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
2432
+ })
2433
+ });
2434
+ var imageGenerationCallItem = import_v416.z.object({
2435
+ type: import_v416.z.literal("image_generation_call"),
2436
+ id: import_v416.z.string(),
2437
+ result: import_v416.z.string()
2360
2438
  });
2361
2439
  var TOP_LOGPROBS_MAX = 20;
2362
- var LOGPROBS_SCHEMA = import_v415.z.array(
2363
- import_v415.z.object({
2364
- token: import_v415.z.string(),
2365
- logprob: import_v415.z.number(),
2366
- top_logprobs: import_v415.z.array(
2367
- import_v415.z.object({
2368
- token: import_v415.z.string(),
2369
- logprob: import_v415.z.number()
2440
+ var LOGPROBS_SCHEMA = import_v416.z.array(
2441
+ import_v416.z.object({
2442
+ token: import_v416.z.string(),
2443
+ logprob: import_v416.z.number(),
2444
+ top_logprobs: import_v416.z.array(
2445
+ import_v416.z.object({
2446
+ token: import_v416.z.string(),
2447
+ logprob: import_v416.z.number()
2370
2448
  })
2371
2449
  )
2372
2450
  })
@@ -2423,7 +2501,7 @@ var OpenAIResponsesLanguageModel = class {
2423
2501
  if (stopSequences != null) {
2424
2502
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2425
2503
  }
2426
- const openaiOptions = await (0, import_provider_utils13.parseProviderOptions)({
2504
+ const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
2427
2505
  provider: "openai",
2428
2506
  providerOptions,
2429
2507
  schema: openaiResponsesProviderOptionsSchema
@@ -2432,7 +2510,8 @@ var OpenAIResponsesLanguageModel = class {
2432
2510
  prompt,
2433
2511
  systemMessageMode: modelConfig.systemMessageMode,
2434
2512
  fileIdPrefixes: this.config.fileIdPrefixes,
2435
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2513
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
2514
+ hasLocalShellTool: hasOpenAITool("openai.local_shell")
2436
2515
  });
2437
2516
  warnings.push(...inputWarnings);
2438
2517
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -2591,51 +2670,51 @@ var OpenAIResponsesLanguageModel = class {
2591
2670
  responseHeaders,
2592
2671
  value: response,
2593
2672
  rawValue: rawResponse
2594
- } = await (0, import_provider_utils13.postJsonToApi)({
2673
+ } = await (0, import_provider_utils14.postJsonToApi)({
2595
2674
  url,
2596
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2675
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2597
2676
  body,
2598
2677
  failedResponseHandler: openaiFailedResponseHandler,
2599
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
2600
- import_v415.z.object({
2601
- id: import_v415.z.string(),
2602
- created_at: import_v415.z.number(),
2603
- error: import_v415.z.object({
2604
- code: import_v415.z.string(),
2605
- message: import_v415.z.string()
2678
+ successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
2679
+ import_v416.z.object({
2680
+ id: import_v416.z.string(),
2681
+ created_at: import_v416.z.number(),
2682
+ error: import_v416.z.object({
2683
+ code: import_v416.z.string(),
2684
+ message: import_v416.z.string()
2606
2685
  }).nullish(),
2607
- model: import_v415.z.string(),
2608
- output: import_v415.z.array(
2609
- import_v415.z.discriminatedUnion("type", [
2610
- import_v415.z.object({
2611
- type: import_v415.z.literal("message"),
2612
- role: import_v415.z.literal("assistant"),
2613
- id: import_v415.z.string(),
2614
- content: import_v415.z.array(
2615
- import_v415.z.object({
2616
- type: import_v415.z.literal("output_text"),
2617
- text: import_v415.z.string(),
2686
+ model: import_v416.z.string(),
2687
+ output: import_v416.z.array(
2688
+ import_v416.z.discriminatedUnion("type", [
2689
+ import_v416.z.object({
2690
+ type: import_v416.z.literal("message"),
2691
+ role: import_v416.z.literal("assistant"),
2692
+ id: import_v416.z.string(),
2693
+ content: import_v416.z.array(
2694
+ import_v416.z.object({
2695
+ type: import_v416.z.literal("output_text"),
2696
+ text: import_v416.z.string(),
2618
2697
  logprobs: LOGPROBS_SCHEMA.nullish(),
2619
- annotations: import_v415.z.array(
2620
- import_v415.z.discriminatedUnion("type", [
2621
- import_v415.z.object({
2622
- type: import_v415.z.literal("url_citation"),
2623
- start_index: import_v415.z.number(),
2624
- end_index: import_v415.z.number(),
2625
- url: import_v415.z.string(),
2626
- title: import_v415.z.string()
2698
+ annotations: import_v416.z.array(
2699
+ import_v416.z.discriminatedUnion("type", [
2700
+ import_v416.z.object({
2701
+ type: import_v416.z.literal("url_citation"),
2702
+ start_index: import_v416.z.number(),
2703
+ end_index: import_v416.z.number(),
2704
+ url: import_v416.z.string(),
2705
+ title: import_v416.z.string()
2627
2706
  }),
2628
- import_v415.z.object({
2629
- type: import_v415.z.literal("file_citation"),
2630
- file_id: import_v415.z.string(),
2631
- filename: import_v415.z.string().nullish(),
2632
- index: import_v415.z.number().nullish(),
2633
- start_index: import_v415.z.number().nullish(),
2634
- end_index: import_v415.z.number().nullish(),
2635
- quote: import_v415.z.string().nullish()
2707
+ import_v416.z.object({
2708
+ type: import_v416.z.literal("file_citation"),
2709
+ file_id: import_v416.z.string(),
2710
+ filename: import_v416.z.string().nullish(),
2711
+ index: import_v416.z.number().nullish(),
2712
+ start_index: import_v416.z.number().nullish(),
2713
+ end_index: import_v416.z.number().nullish(),
2714
+ quote: import_v416.z.string().nullish()
2636
2715
  }),
2637
- import_v415.z.object({
2638
- type: import_v415.z.literal("container_file_citation")
2716
+ import_v416.z.object({
2717
+ type: import_v416.z.literal("container_file_citation")
2639
2718
  })
2640
2719
  ])
2641
2720
  )
@@ -2646,33 +2725,34 @@ var OpenAIResponsesLanguageModel = class {
2646
2725
  fileSearchCallItem,
2647
2726
  codeInterpreterCallItem,
2648
2727
  imageGenerationCallItem,
2649
- import_v415.z.object({
2650
- type: import_v415.z.literal("function_call"),
2651
- call_id: import_v415.z.string(),
2652
- name: import_v415.z.string(),
2653
- arguments: import_v415.z.string(),
2654
- id: import_v415.z.string()
2728
+ localShellCallItem,
2729
+ import_v416.z.object({
2730
+ type: import_v416.z.literal("function_call"),
2731
+ call_id: import_v416.z.string(),
2732
+ name: import_v416.z.string(),
2733
+ arguments: import_v416.z.string(),
2734
+ id: import_v416.z.string()
2655
2735
  }),
2656
- import_v415.z.object({
2657
- type: import_v415.z.literal("computer_call"),
2658
- id: import_v415.z.string(),
2659
- status: import_v415.z.string().optional()
2736
+ import_v416.z.object({
2737
+ type: import_v416.z.literal("computer_call"),
2738
+ id: import_v416.z.string(),
2739
+ status: import_v416.z.string().optional()
2660
2740
  }),
2661
- import_v415.z.object({
2662
- type: import_v415.z.literal("reasoning"),
2663
- id: import_v415.z.string(),
2664
- encrypted_content: import_v415.z.string().nullish(),
2665
- summary: import_v415.z.array(
2666
- import_v415.z.object({
2667
- type: import_v415.z.literal("summary_text"),
2668
- text: import_v415.z.string()
2741
+ import_v416.z.object({
2742
+ type: import_v416.z.literal("reasoning"),
2743
+ id: import_v416.z.string(),
2744
+ encrypted_content: import_v416.z.string().nullish(),
2745
+ summary: import_v416.z.array(
2746
+ import_v416.z.object({
2747
+ type: import_v416.z.literal("summary_text"),
2748
+ text: import_v416.z.string()
2669
2749
  })
2670
2750
  )
2671
2751
  })
2672
2752
  ])
2673
2753
  ),
2674
- service_tier: import_v415.z.string().nullish(),
2675
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
2754
+ service_tier: import_v416.z.string().nullish(),
2755
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
2676
2756
  usage: usageSchema2
2677
2757
  })
2678
2758
  ),
@@ -2732,6 +2812,20 @@ var OpenAIResponsesLanguageModel = class {
2732
2812
  });
2733
2813
  break;
2734
2814
  }
2815
+ case "local_shell_call": {
2816
+ content.push({
2817
+ type: "tool-call",
2818
+ toolCallId: part.call_id,
2819
+ toolName: "local_shell",
2820
+ input: JSON.stringify({ action: part.action }),
2821
+ providerMetadata: {
2822
+ openai: {
2823
+ itemId: part.id
2824
+ }
2825
+ }
2826
+ });
2827
+ break;
2828
+ }
2735
2829
  case "message": {
2736
2830
  for (const contentPart of part.content) {
2737
2831
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -2751,7 +2845,7 @@ var OpenAIResponsesLanguageModel = class {
2751
2845
  content.push({
2752
2846
  type: "source",
2753
2847
  sourceType: "url",
2754
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils13.generateId)(),
2848
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils14.generateId)(),
2755
2849
  url: annotation.url,
2756
2850
  title: annotation.title
2757
2851
  });
@@ -2759,7 +2853,7 @@ var OpenAIResponsesLanguageModel = class {
2759
2853
  content.push({
2760
2854
  type: "source",
2761
2855
  sourceType: "document",
2762
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils13.generateId)(),
2856
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils14.generateId)(),
2763
2857
  mediaType: "text/plain",
2764
2858
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2765
2859
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2911,18 +3005,18 @@ var OpenAIResponsesLanguageModel = class {
2911
3005
  warnings,
2912
3006
  webSearchToolName
2913
3007
  } = await this.getArgs(options);
2914
- const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
3008
+ const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
2915
3009
  url: this.config.url({
2916
3010
  path: "/responses",
2917
3011
  modelId: this.modelId
2918
3012
  }),
2919
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
3013
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2920
3014
  body: {
2921
3015
  ...body,
2922
3016
  stream: true
2923
3017
  },
2924
3018
  failedResponseHandler: openaiFailedResponseHandler,
2925
- successfulResponseHandler: (0, import_provider_utils13.createEventSourceResponseHandler)(
3019
+ successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
2926
3020
  openaiResponsesChunkSchema
2927
3021
  ),
2928
3022
  abortSignal: options.abortSignal,
@@ -2989,6 +3083,24 @@ var OpenAIResponsesLanguageModel = class {
2989
3083
  id: value.item.id,
2990
3084
  toolName: "computer_use"
2991
3085
  });
3086
+ } else if (value.item.type === "code_interpreter_call") {
3087
+ ongoingToolCalls[value.output_index] = {
3088
+ toolName: "code_interpreter",
3089
+ toolCallId: value.item.id,
3090
+ codeInterpreter: {
3091
+ containerId: value.item.container_id
3092
+ }
3093
+ };
3094
+ controller.enqueue({
3095
+ type: "tool-input-start",
3096
+ id: value.item.id,
3097
+ toolName: "code_interpreter"
3098
+ });
3099
+ controller.enqueue({
3100
+ type: "tool-input-delta",
3101
+ id: value.item.id,
3102
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3103
+ });
2992
3104
  } else if (value.item.type === "file_search_call") {
2993
3105
  controller.enqueue({
2994
3106
  type: "tool-call",
@@ -3112,16 +3224,7 @@ var OpenAIResponsesLanguageModel = class {
3112
3224
  providerExecuted: true
3113
3225
  });
3114
3226
  } else if (value.item.type === "code_interpreter_call") {
3115
- controller.enqueue({
3116
- type: "tool-call",
3117
- toolCallId: value.item.id,
3118
- toolName: "code_interpreter",
3119
- input: JSON.stringify({
3120
- code: value.item.code,
3121
- containerId: value.item.container_id
3122
- }),
3123
- providerExecuted: true
3124
- });
3227
+ ongoingToolCalls[value.output_index] = void 0;
3125
3228
  controller.enqueue({
3126
3229
  type: "tool-result",
3127
3230
  toolCallId: value.item.id,
@@ -3141,6 +3244,26 @@ var OpenAIResponsesLanguageModel = class {
3141
3244
  },
3142
3245
  providerExecuted: true
3143
3246
  });
3247
+ } else if (value.item.type === "local_shell_call") {
3248
+ ongoingToolCalls[value.output_index] = void 0;
3249
+ controller.enqueue({
3250
+ type: "tool-call",
3251
+ toolCallId: value.item.call_id,
3252
+ toolName: "local_shell",
3253
+ input: JSON.stringify({
3254
+ action: {
3255
+ type: "exec",
3256
+ command: value.item.action.command,
3257
+ timeoutMs: value.item.action.timeout_ms,
3258
+ user: value.item.action.user,
3259
+ workingDirectory: value.item.action.working_directory,
3260
+ env: value.item.action.env
3261
+ }
3262
+ }),
3263
+ providerMetadata: {
3264
+ openai: { itemId: value.item.id }
3265
+ }
3266
+ });
3144
3267
  } else if (value.item.type === "message") {
3145
3268
  controller.enqueue({
3146
3269
  type: "text-end",
@@ -3171,6 +3294,40 @@ var OpenAIResponsesLanguageModel = class {
3171
3294
  delta: value.delta
3172
3295
  });
3173
3296
  }
3297
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3298
+ const toolCall = ongoingToolCalls[value.output_index];
3299
+ if (toolCall != null) {
3300
+ controller.enqueue({
3301
+ type: "tool-input-delta",
3302
+ id: toolCall.toolCallId,
3303
+ // The delta is code, which is embedding in a JSON string.
3304
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3305
+ delta: JSON.stringify(value.delta).slice(1, -1)
3306
+ });
3307
+ }
3308
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3309
+ const toolCall = ongoingToolCalls[value.output_index];
3310
+ if (toolCall != null) {
3311
+ controller.enqueue({
3312
+ type: "tool-input-delta",
3313
+ id: toolCall.toolCallId,
3314
+ delta: '"}'
3315
+ });
3316
+ controller.enqueue({
3317
+ type: "tool-input-end",
3318
+ id: toolCall.toolCallId
3319
+ });
3320
+ controller.enqueue({
3321
+ type: "tool-call",
3322
+ toolCallId: toolCall.toolCallId,
3323
+ toolName: "code_interpreter",
3324
+ input: JSON.stringify({
3325
+ code: value.code,
3326
+ containerId: toolCall.codeInterpreter.containerId
3327
+ }),
3328
+ providerExecuted: true
3329
+ });
3330
+ }
3174
3331
  } else if (isResponseCreatedChunk(value)) {
3175
3332
  responseId = value.response.id;
3176
3333
  controller.enqueue({
@@ -3233,7 +3390,7 @@ var OpenAIResponsesLanguageModel = class {
3233
3390
  controller.enqueue({
3234
3391
  type: "source",
3235
3392
  sourceType: "url",
3236
- id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils13.generateId)(),
3393
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils14.generateId)(),
3237
3394
  url: value.annotation.url,
3238
3395
  title: value.annotation.title
3239
3396
  });
@@ -3241,7 +3398,7 @@ var OpenAIResponsesLanguageModel = class {
3241
3398
  controller.enqueue({
3242
3399
  type: "source",
3243
3400
  sourceType: "document",
3244
- id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils13.generateId)(),
3401
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils14.generateId)(),
3245
3402
  mediaType: "text/plain",
3246
3403
  title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3247
3404
  filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
@@ -3277,166 +3434,194 @@ var OpenAIResponsesLanguageModel = class {
3277
3434
  };
3278
3435
  }
3279
3436
  };
3280
- var usageSchema2 = import_v415.z.object({
3281
- input_tokens: import_v415.z.number(),
3282
- input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
3283
- output_tokens: import_v415.z.number(),
3284
- output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
3437
+ var usageSchema2 = import_v416.z.object({
3438
+ input_tokens: import_v416.z.number(),
3439
+ input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3440
+ output_tokens: import_v416.z.number(),
3441
+ output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3285
3442
  });
3286
- var textDeltaChunkSchema = import_v415.z.object({
3287
- type: import_v415.z.literal("response.output_text.delta"),
3288
- item_id: import_v415.z.string(),
3289
- delta: import_v415.z.string(),
3443
+ var textDeltaChunkSchema = import_v416.z.object({
3444
+ type: import_v416.z.literal("response.output_text.delta"),
3445
+ item_id: import_v416.z.string(),
3446
+ delta: import_v416.z.string(),
3290
3447
  logprobs: LOGPROBS_SCHEMA.nullish()
3291
3448
  });
3292
- var errorChunkSchema = import_v415.z.object({
3293
- type: import_v415.z.literal("error"),
3294
- code: import_v415.z.string(),
3295
- message: import_v415.z.string(),
3296
- param: import_v415.z.string().nullish(),
3297
- sequence_number: import_v415.z.number()
3449
+ var errorChunkSchema = import_v416.z.object({
3450
+ type: import_v416.z.literal("error"),
3451
+ code: import_v416.z.string(),
3452
+ message: import_v416.z.string(),
3453
+ param: import_v416.z.string().nullish(),
3454
+ sequence_number: import_v416.z.number()
3298
3455
  });
3299
- var responseFinishedChunkSchema = import_v415.z.object({
3300
- type: import_v415.z.enum(["response.completed", "response.incomplete"]),
3301
- response: import_v415.z.object({
3302
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
3456
+ var responseFinishedChunkSchema = import_v416.z.object({
3457
+ type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3458
+ response: import_v416.z.object({
3459
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3303
3460
  usage: usageSchema2,
3304
- service_tier: import_v415.z.string().nullish()
3461
+ service_tier: import_v416.z.string().nullish()
3305
3462
  })
3306
3463
  });
3307
- var responseCreatedChunkSchema = import_v415.z.object({
3308
- type: import_v415.z.literal("response.created"),
3309
- response: import_v415.z.object({
3310
- id: import_v415.z.string(),
3311
- created_at: import_v415.z.number(),
3312
- model: import_v415.z.string(),
3313
- service_tier: import_v415.z.string().nullish()
3464
+ var responseCreatedChunkSchema = import_v416.z.object({
3465
+ type: import_v416.z.literal("response.created"),
3466
+ response: import_v416.z.object({
3467
+ id: import_v416.z.string(),
3468
+ created_at: import_v416.z.number(),
3469
+ model: import_v416.z.string(),
3470
+ service_tier: import_v416.z.string().nullish()
3314
3471
  })
3315
3472
  });
3316
- var responseOutputItemAddedSchema = import_v415.z.object({
3317
- type: import_v415.z.literal("response.output_item.added"),
3318
- output_index: import_v415.z.number(),
3319
- item: import_v415.z.discriminatedUnion("type", [
3320
- import_v415.z.object({
3321
- type: import_v415.z.literal("message"),
3322
- id: import_v415.z.string()
3473
+ var responseOutputItemAddedSchema = import_v416.z.object({
3474
+ type: import_v416.z.literal("response.output_item.added"),
3475
+ output_index: import_v416.z.number(),
3476
+ item: import_v416.z.discriminatedUnion("type", [
3477
+ import_v416.z.object({
3478
+ type: import_v416.z.literal("message"),
3479
+ id: import_v416.z.string()
3323
3480
  }),
3324
- import_v415.z.object({
3325
- type: import_v415.z.literal("reasoning"),
3326
- id: import_v415.z.string(),
3327
- encrypted_content: import_v415.z.string().nullish()
3481
+ import_v416.z.object({
3482
+ type: import_v416.z.literal("reasoning"),
3483
+ id: import_v416.z.string(),
3484
+ encrypted_content: import_v416.z.string().nullish()
3328
3485
  }),
3329
- import_v415.z.object({
3330
- type: import_v415.z.literal("function_call"),
3331
- id: import_v415.z.string(),
3332
- call_id: import_v415.z.string(),
3333
- name: import_v415.z.string(),
3334
- arguments: import_v415.z.string()
3486
+ import_v416.z.object({
3487
+ type: import_v416.z.literal("function_call"),
3488
+ id: import_v416.z.string(),
3489
+ call_id: import_v416.z.string(),
3490
+ name: import_v416.z.string(),
3491
+ arguments: import_v416.z.string()
3335
3492
  }),
3336
- import_v415.z.object({
3337
- type: import_v415.z.literal("web_search_call"),
3338
- id: import_v415.z.string(),
3339
- status: import_v415.z.string(),
3340
- action: import_v415.z.object({
3341
- type: import_v415.z.literal("search"),
3342
- query: import_v415.z.string().optional()
3493
+ import_v416.z.object({
3494
+ type: import_v416.z.literal("web_search_call"),
3495
+ id: import_v416.z.string(),
3496
+ status: import_v416.z.string(),
3497
+ action: import_v416.z.object({
3498
+ type: import_v416.z.literal("search"),
3499
+ query: import_v416.z.string().optional()
3343
3500
  }).nullish()
3344
3501
  }),
3345
- import_v415.z.object({
3346
- type: import_v415.z.literal("computer_call"),
3347
- id: import_v415.z.string(),
3348
- status: import_v415.z.string()
3502
+ import_v416.z.object({
3503
+ type: import_v416.z.literal("computer_call"),
3504
+ id: import_v416.z.string(),
3505
+ status: import_v416.z.string()
3506
+ }),
3507
+ import_v416.z.object({
3508
+ type: import_v416.z.literal("file_search_call"),
3509
+ id: import_v416.z.string()
3349
3510
  }),
3350
- import_v415.z.object({
3351
- type: import_v415.z.literal("file_search_call"),
3352
- id: import_v415.z.string()
3511
+ import_v416.z.object({
3512
+ type: import_v416.z.literal("image_generation_call"),
3513
+ id: import_v416.z.string()
3353
3514
  }),
3354
- import_v415.z.object({
3355
- type: import_v415.z.literal("image_generation_call"),
3356
- id: import_v415.z.string()
3515
+ import_v416.z.object({
3516
+ type: import_v416.z.literal("code_interpreter_call"),
3517
+ id: import_v416.z.string(),
3518
+ container_id: import_v416.z.string(),
3519
+ code: import_v416.z.string().nullable(),
3520
+ outputs: import_v416.z.array(
3521
+ import_v416.z.discriminatedUnion("type", [
3522
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3523
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3524
+ ])
3525
+ ).nullable(),
3526
+ status: import_v416.z.string()
3357
3527
  })
3358
3528
  ])
3359
3529
  });
3360
- var responseOutputItemDoneSchema = import_v415.z.object({
3361
- type: import_v415.z.literal("response.output_item.done"),
3362
- output_index: import_v415.z.number(),
3363
- item: import_v415.z.discriminatedUnion("type", [
3364
- import_v415.z.object({
3365
- type: import_v415.z.literal("message"),
3366
- id: import_v415.z.string()
3530
+ var responseOutputItemDoneSchema = import_v416.z.object({
3531
+ type: import_v416.z.literal("response.output_item.done"),
3532
+ output_index: import_v416.z.number(),
3533
+ item: import_v416.z.discriminatedUnion("type", [
3534
+ import_v416.z.object({
3535
+ type: import_v416.z.literal("message"),
3536
+ id: import_v416.z.string()
3367
3537
  }),
3368
- import_v415.z.object({
3369
- type: import_v415.z.literal("reasoning"),
3370
- id: import_v415.z.string(),
3371
- encrypted_content: import_v415.z.string().nullish()
3538
+ import_v416.z.object({
3539
+ type: import_v416.z.literal("reasoning"),
3540
+ id: import_v416.z.string(),
3541
+ encrypted_content: import_v416.z.string().nullish()
3372
3542
  }),
3373
- import_v415.z.object({
3374
- type: import_v415.z.literal("function_call"),
3375
- id: import_v415.z.string(),
3376
- call_id: import_v415.z.string(),
3377
- name: import_v415.z.string(),
3378
- arguments: import_v415.z.string(),
3379
- status: import_v415.z.literal("completed")
3543
+ import_v416.z.object({
3544
+ type: import_v416.z.literal("function_call"),
3545
+ id: import_v416.z.string(),
3546
+ call_id: import_v416.z.string(),
3547
+ name: import_v416.z.string(),
3548
+ arguments: import_v416.z.string(),
3549
+ status: import_v416.z.literal("completed")
3380
3550
  }),
3381
3551
  codeInterpreterCallItem,
3382
3552
  imageGenerationCallItem,
3383
3553
  webSearchCallItem,
3384
3554
  fileSearchCallItem,
3385
- import_v415.z.object({
3386
- type: import_v415.z.literal("computer_call"),
3387
- id: import_v415.z.string(),
3388
- status: import_v415.z.literal("completed")
3555
+ localShellCallItem,
3556
+ import_v416.z.object({
3557
+ type: import_v416.z.literal("computer_call"),
3558
+ id: import_v416.z.string(),
3559
+ status: import_v416.z.literal("completed")
3389
3560
  })
3390
3561
  ])
3391
3562
  });
3392
- var responseFunctionCallArgumentsDeltaSchema = import_v415.z.object({
3393
- type: import_v415.z.literal("response.function_call_arguments.delta"),
3394
- item_id: import_v415.z.string(),
3395
- output_index: import_v415.z.number(),
3396
- delta: import_v415.z.string()
3563
+ var responseFunctionCallArgumentsDeltaSchema = import_v416.z.object({
3564
+ type: import_v416.z.literal("response.function_call_arguments.delta"),
3565
+ item_id: import_v416.z.string(),
3566
+ output_index: import_v416.z.number(),
3567
+ delta: import_v416.z.string()
3397
3568
  });
3398
- var responseAnnotationAddedSchema = import_v415.z.object({
3399
- type: import_v415.z.literal("response.output_text.annotation.added"),
3400
- annotation: import_v415.z.discriminatedUnion("type", [
3401
- import_v415.z.object({
3402
- type: import_v415.z.literal("url_citation"),
3403
- url: import_v415.z.string(),
3404
- title: import_v415.z.string()
3569
+ var responseCodeInterpreterCallCodeDeltaSchema = import_v416.z.object({
3570
+ type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
3571
+ item_id: import_v416.z.string(),
3572
+ output_index: import_v416.z.number(),
3573
+ delta: import_v416.z.string()
3574
+ });
3575
+ var responseCodeInterpreterCallCodeDoneSchema = import_v416.z.object({
3576
+ type: import_v416.z.literal("response.code_interpreter_call_code.done"),
3577
+ item_id: import_v416.z.string(),
3578
+ output_index: import_v416.z.number(),
3579
+ code: import_v416.z.string()
3580
+ });
3581
+ var responseAnnotationAddedSchema = import_v416.z.object({
3582
+ type: import_v416.z.literal("response.output_text.annotation.added"),
3583
+ annotation: import_v416.z.discriminatedUnion("type", [
3584
+ import_v416.z.object({
3585
+ type: import_v416.z.literal("url_citation"),
3586
+ url: import_v416.z.string(),
3587
+ title: import_v416.z.string()
3405
3588
  }),
3406
- import_v415.z.object({
3407
- type: import_v415.z.literal("file_citation"),
3408
- file_id: import_v415.z.string(),
3409
- filename: import_v415.z.string().nullish(),
3410
- index: import_v415.z.number().nullish(),
3411
- start_index: import_v415.z.number().nullish(),
3412
- end_index: import_v415.z.number().nullish(),
3413
- quote: import_v415.z.string().nullish()
3589
+ import_v416.z.object({
3590
+ type: import_v416.z.literal("file_citation"),
3591
+ file_id: import_v416.z.string(),
3592
+ filename: import_v416.z.string().nullish(),
3593
+ index: import_v416.z.number().nullish(),
3594
+ start_index: import_v416.z.number().nullish(),
3595
+ end_index: import_v416.z.number().nullish(),
3596
+ quote: import_v416.z.string().nullish()
3414
3597
  })
3415
3598
  ])
3416
3599
  });
3417
- var responseReasoningSummaryPartAddedSchema = import_v415.z.object({
3418
- type: import_v415.z.literal("response.reasoning_summary_part.added"),
3419
- item_id: import_v415.z.string(),
3420
- summary_index: import_v415.z.number()
3600
+ var responseReasoningSummaryPartAddedSchema = import_v416.z.object({
3601
+ type: import_v416.z.literal("response.reasoning_summary_part.added"),
3602
+ item_id: import_v416.z.string(),
3603
+ summary_index: import_v416.z.number()
3421
3604
  });
3422
- var responseReasoningSummaryTextDeltaSchema = import_v415.z.object({
3423
- type: import_v415.z.literal("response.reasoning_summary_text.delta"),
3424
- item_id: import_v415.z.string(),
3425
- summary_index: import_v415.z.number(),
3426
- delta: import_v415.z.string()
3605
+ var responseReasoningSummaryTextDeltaSchema = import_v416.z.object({
3606
+ type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3607
+ item_id: import_v416.z.string(),
3608
+ summary_index: import_v416.z.number(),
3609
+ delta: import_v416.z.string()
3427
3610
  });
3428
- var openaiResponsesChunkSchema = import_v415.z.union([
3611
+ var openaiResponsesChunkSchema = import_v416.z.union([
3429
3612
  textDeltaChunkSchema,
3430
3613
  responseFinishedChunkSchema,
3431
3614
  responseCreatedChunkSchema,
3432
3615
  responseOutputItemAddedSchema,
3433
3616
  responseOutputItemDoneSchema,
3434
3617
  responseFunctionCallArgumentsDeltaSchema,
3618
+ responseCodeInterpreterCallCodeDeltaSchema,
3619
+ responseCodeInterpreterCallCodeDoneSchema,
3435
3620
  responseAnnotationAddedSchema,
3436
3621
  responseReasoningSummaryPartAddedSchema,
3437
3622
  responseReasoningSummaryTextDeltaSchema,
3438
3623
  errorChunkSchema,
3439
- import_v415.z.object({ type: import_v415.z.string() }).loose()
3624
+ import_v416.z.object({ type: import_v416.z.string() }).loose()
3440
3625
  // fallback for unknown chunks
3441
3626
  ]);
3442
3627
  function isTextDeltaChunk(chunk) {
@@ -3457,6 +3642,12 @@ function isResponseCreatedChunk(chunk) {
3457
3642
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3458
3643
  return chunk.type === "response.function_call_arguments.delta";
3459
3644
  }
3645
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3646
+ return chunk.type === "response.code_interpreter_call_code.delta";
3647
+ }
3648
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3649
+ return chunk.type === "response.code_interpreter_call_code.done";
3650
+ }
3460
3651
  function isResponseOutputItemAddedChunk(chunk) {
3461
3652
  return chunk.type === "response.output_item.added";
3462
3653
  }
@@ -3509,15 +3700,15 @@ function getResponsesModelConfig(modelId) {
3509
3700
  isReasoningModel: false
3510
3701
  };
3511
3702
  }
3512
- var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3513
- include: import_v415.z.array(
3514
- import_v415.z.enum([
3703
+ var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3704
+ include: import_v416.z.array(
3705
+ import_v416.z.enum([
3515
3706
  "reasoning.encrypted_content",
3516
3707
  "file_search_call.results",
3517
3708
  "message.output_text.logprobs"
3518
3709
  ])
3519
3710
  ).nullish(),
3520
- instructions: import_v415.z.string().nullish(),
3711
+ instructions: import_v416.z.string().nullish(),
3521
3712
  /**
3522
3713
  * Return the log probabilities of the tokens.
3523
3714
  *
@@ -3530,33 +3721,33 @@ var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3530
3721
  * @see https://platform.openai.com/docs/api-reference/responses/create
3531
3722
  * @see https://cookbook.openai.com/examples/using_logprobs
3532
3723
  */
3533
- logprobs: import_v415.z.union([import_v415.z.boolean(), import_v415.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3724
+ logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3534
3725
  /**
3535
3726
  * The maximum number of total calls to built-in tools that can be processed in a response.
3536
3727
  * This maximum number applies across all built-in tool calls, not per individual tool.
3537
3728
  * Any further attempts to call a tool by the model will be ignored.
3538
3729
  */
3539
- maxToolCalls: import_v415.z.number().nullish(),
3540
- metadata: import_v415.z.any().nullish(),
3541
- parallelToolCalls: import_v415.z.boolean().nullish(),
3542
- previousResponseId: import_v415.z.string().nullish(),
3543
- promptCacheKey: import_v415.z.string().nullish(),
3544
- reasoningEffort: import_v415.z.string().nullish(),
3545
- reasoningSummary: import_v415.z.string().nullish(),
3546
- safetyIdentifier: import_v415.z.string().nullish(),
3547
- serviceTier: import_v415.z.enum(["auto", "flex", "priority"]).nullish(),
3548
- store: import_v415.z.boolean().nullish(),
3549
- strictJsonSchema: import_v415.z.boolean().nullish(),
3550
- textVerbosity: import_v415.z.enum(["low", "medium", "high"]).nullish(),
3551
- user: import_v415.z.string().nullish()
3730
+ maxToolCalls: import_v416.z.number().nullish(),
3731
+ metadata: import_v416.z.any().nullish(),
3732
+ parallelToolCalls: import_v416.z.boolean().nullish(),
3733
+ previousResponseId: import_v416.z.string().nullish(),
3734
+ promptCacheKey: import_v416.z.string().nullish(),
3735
+ reasoningEffort: import_v416.z.string().nullish(),
3736
+ reasoningSummary: import_v416.z.string().nullish(),
3737
+ safetyIdentifier: import_v416.z.string().nullish(),
3738
+ serviceTier: import_v416.z.enum(["auto", "flex", "priority"]).nullish(),
3739
+ store: import_v416.z.boolean().nullish(),
3740
+ strictJsonSchema: import_v416.z.boolean().nullish(),
3741
+ textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
3742
+ user: import_v416.z.string().nullish()
3552
3743
  });
3553
3744
 
3554
3745
  // src/speech/openai-speech-model.ts
3555
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3556
- var import_v416 = require("zod/v4");
3557
- var OpenAIProviderOptionsSchema = import_v416.z.object({
3558
- instructions: import_v416.z.string().nullish(),
3559
- speed: import_v416.z.number().min(0.25).max(4).default(1).nullish()
3746
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3747
+ var import_v417 = require("zod/v4");
3748
+ var OpenAIProviderOptionsSchema = import_v417.z.object({
3749
+ instructions: import_v417.z.string().nullish(),
3750
+ speed: import_v417.z.number().min(0.25).max(4).default(1).nullish()
3560
3751
  });
3561
3752
  var OpenAISpeechModel = class {
3562
3753
  constructor(modelId, config) {
@@ -3577,7 +3768,7 @@ var OpenAISpeechModel = class {
3577
3768
  providerOptions
3578
3769
  }) {
3579
3770
  const warnings = [];
3580
- const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3771
+ const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3581
3772
  provider: "openai",
3582
3773
  providerOptions,
3583
3774
  schema: OpenAIProviderOptionsSchema
@@ -3630,15 +3821,15 @@ var OpenAISpeechModel = class {
3630
3821
  value: audio,
3631
3822
  responseHeaders,
3632
3823
  rawValue: rawResponse
3633
- } = await (0, import_provider_utils14.postJsonToApi)({
3824
+ } = await (0, import_provider_utils15.postJsonToApi)({
3634
3825
  url: this.config.url({
3635
3826
  path: "/audio/speech",
3636
3827
  modelId: this.modelId
3637
3828
  }),
3638
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3829
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3639
3830
  body: requestBody,
3640
3831
  failedResponseHandler: openaiFailedResponseHandler,
3641
- successfulResponseHandler: (0, import_provider_utils14.createBinaryResponseHandler)(),
3832
+ successfulResponseHandler: (0, import_provider_utils15.createBinaryResponseHandler)(),
3642
3833
  abortSignal: options.abortSignal,
3643
3834
  fetch: this.config.fetch
3644
3835
  });
@@ -3659,34 +3850,34 @@ var OpenAISpeechModel = class {
3659
3850
  };
3660
3851
 
3661
3852
  // src/transcription/openai-transcription-model.ts
3662
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3663
- var import_v418 = require("zod/v4");
3853
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3854
+ var import_v419 = require("zod/v4");
3664
3855
 
3665
3856
  // src/transcription/openai-transcription-options.ts
3666
- var import_v417 = require("zod/v4");
3667
- var openAITranscriptionProviderOptions = import_v417.z.object({
3857
+ var import_v418 = require("zod/v4");
3858
+ var openAITranscriptionProviderOptions = import_v418.z.object({
3668
3859
  /**
3669
3860
  * Additional information to include in the transcription response.
3670
3861
  */
3671
- include: import_v417.z.array(import_v417.z.string()).optional(),
3862
+ include: import_v418.z.array(import_v418.z.string()).optional(),
3672
3863
  /**
3673
3864
  * The language of the input audio in ISO-639-1 format.
3674
3865
  */
3675
- language: import_v417.z.string().optional(),
3866
+ language: import_v418.z.string().optional(),
3676
3867
  /**
3677
3868
  * An optional text to guide the model's style or continue a previous audio segment.
3678
3869
  */
3679
- prompt: import_v417.z.string().optional(),
3870
+ prompt: import_v418.z.string().optional(),
3680
3871
  /**
3681
3872
  * The sampling temperature, between 0 and 1.
3682
3873
  * @default 0
3683
3874
  */
3684
- temperature: import_v417.z.number().min(0).max(1).default(0).optional(),
3875
+ temperature: import_v418.z.number().min(0).max(1).default(0).optional(),
3685
3876
  /**
3686
3877
  * The timestamp granularities to populate for this transcription.
3687
3878
  * @default ['segment']
3688
3879
  */
3689
- timestampGranularities: import_v417.z.array(import_v417.z.enum(["word", "segment"])).default(["segment"]).optional()
3880
+ timestampGranularities: import_v418.z.array(import_v418.z.enum(["word", "segment"])).default(["segment"]).optional()
3690
3881
  });
3691
3882
 
3692
3883
  // src/transcription/openai-transcription-model.ts
@@ -3764,15 +3955,15 @@ var OpenAITranscriptionModel = class {
3764
3955
  providerOptions
3765
3956
  }) {
3766
3957
  const warnings = [];
3767
- const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3958
+ const openAIOptions = await (0, import_provider_utils16.parseProviderOptions)({
3768
3959
  provider: "openai",
3769
3960
  providerOptions,
3770
3961
  schema: openAITranscriptionProviderOptions
3771
3962
  });
3772
3963
  const formData = new FormData();
3773
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils15.convertBase64ToUint8Array)(audio)]);
3964
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(audio)]);
3774
3965
  formData.append("model", this.modelId);
3775
- const fileExtension = (0, import_provider_utils15.mediaTypeToExtension)(mediaType);
3966
+ const fileExtension = (0, import_provider_utils16.mediaTypeToExtension)(mediaType);
3776
3967
  formData.append(
3777
3968
  "file",
3778
3969
  new File([blob], "audio", { type: mediaType }),
@@ -3817,15 +4008,15 @@ var OpenAITranscriptionModel = class {
3817
4008
  value: response,
3818
4009
  responseHeaders,
3819
4010
  rawValue: rawResponse
3820
- } = await (0, import_provider_utils15.postFormDataToApi)({
4011
+ } = await (0, import_provider_utils16.postFormDataToApi)({
3821
4012
  url: this.config.url({
3822
4013
  path: "/audio/transcriptions",
3823
4014
  modelId: this.modelId
3824
4015
  }),
3825
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
4016
+ headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
3826
4017
  formData,
3827
4018
  failedResponseHandler: openaiFailedResponseHandler,
3828
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
4019
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3829
4020
  openaiTranscriptionResponseSchema
3830
4021
  ),
3831
4022
  abortSignal: options.abortSignal,
@@ -3855,44 +4046,44 @@ var OpenAITranscriptionModel = class {
3855
4046
  };
3856
4047
  }
3857
4048
  };
3858
- var openaiTranscriptionResponseSchema = import_v418.z.object({
3859
- text: import_v418.z.string(),
3860
- language: import_v418.z.string().nullish(),
3861
- duration: import_v418.z.number().nullish(),
3862
- words: import_v418.z.array(
3863
- import_v418.z.object({
3864
- word: import_v418.z.string(),
3865
- start: import_v418.z.number(),
3866
- end: import_v418.z.number()
4049
+ var openaiTranscriptionResponseSchema = import_v419.z.object({
4050
+ text: import_v419.z.string(),
4051
+ language: import_v419.z.string().nullish(),
4052
+ duration: import_v419.z.number().nullish(),
4053
+ words: import_v419.z.array(
4054
+ import_v419.z.object({
4055
+ word: import_v419.z.string(),
4056
+ start: import_v419.z.number(),
4057
+ end: import_v419.z.number()
3867
4058
  })
3868
4059
  ).nullish(),
3869
- segments: import_v418.z.array(
3870
- import_v418.z.object({
3871
- id: import_v418.z.number(),
3872
- seek: import_v418.z.number(),
3873
- start: import_v418.z.number(),
3874
- end: import_v418.z.number(),
3875
- text: import_v418.z.string(),
3876
- tokens: import_v418.z.array(import_v418.z.number()),
3877
- temperature: import_v418.z.number(),
3878
- avg_logprob: import_v418.z.number(),
3879
- compression_ratio: import_v418.z.number(),
3880
- no_speech_prob: import_v418.z.number()
4060
+ segments: import_v419.z.array(
4061
+ import_v419.z.object({
4062
+ id: import_v419.z.number(),
4063
+ seek: import_v419.z.number(),
4064
+ start: import_v419.z.number(),
4065
+ end: import_v419.z.number(),
4066
+ text: import_v419.z.string(),
4067
+ tokens: import_v419.z.array(import_v419.z.number()),
4068
+ temperature: import_v419.z.number(),
4069
+ avg_logprob: import_v419.z.number(),
4070
+ compression_ratio: import_v419.z.number(),
4071
+ no_speech_prob: import_v419.z.number()
3881
4072
  })
3882
4073
  ).nullish()
3883
4074
  });
3884
4075
 
3885
4076
  // src/version.ts
3886
- var VERSION = true ? "2.0.38" : "0.0.0-test";
4077
+ var VERSION = true ? "2.0.40" : "0.0.0-test";
3887
4078
 
3888
4079
  // src/openai-provider.ts
3889
4080
  function createOpenAI(options = {}) {
3890
4081
  var _a, _b;
3891
- const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
4082
+ const baseURL = (_a = (0, import_provider_utils17.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3892
4083
  const providerName = (_b = options.name) != null ? _b : "openai";
3893
- const getHeaders = () => (0, import_provider_utils16.withUserAgentSuffix)(
4084
+ const getHeaders = () => (0, import_provider_utils17.withUserAgentSuffix)(
3894
4085
  {
3895
- Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
4086
+ Authorization: `Bearer ${(0, import_provider_utils17.loadApiKey)({
3896
4087
  apiKey: options.apiKey,
3897
4088
  environmentVariableName: "OPENAI_API_KEY",
3898
4089
  description: "OpenAI"