@ai-sdk/openai 4.0.0-beta.20 → 4.0.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -99,7 +99,11 @@ function convertOpenAIChatUsage(usage) {
99
99
  import {
100
100
  UnsupportedFunctionalityError
101
101
  } from "@ai-sdk/provider";
102
- import { convertToBase64 } from "@ai-sdk/provider-utils";
102
+ import {
103
+ convertToBase64,
104
+ isProviderReference,
105
+ resolveProviderReference
106
+ } from "@ai-sdk/provider-utils";
103
107
  function convertToOpenAIChatMessages({
104
108
  prompt,
105
109
  systemMessageMode = "system"
@@ -149,13 +153,23 @@ function convertToOpenAIChatMessages({
149
153
  return { type: "text", text: part.text };
150
154
  }
151
155
  case "file": {
156
+ if (isProviderReference(part.data)) {
157
+ return {
158
+ type: "file",
159
+ file: {
160
+ file_id: resolveProviderReference({
161
+ reference: part.data,
162
+ provider: "openai"
163
+ })
164
+ }
165
+ };
166
+ }
152
167
  if (part.mediaType.startsWith("image/")) {
153
168
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
154
169
  return {
155
170
  type: "image_url",
156
171
  image_url: {
157
172
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
158
- // OpenAI specific extension: image detail
159
173
  detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
160
174
  }
161
175
  };
@@ -199,7 +213,7 @@ function convertToOpenAIChatMessages({
199
213
  }
200
214
  return {
201
215
  type: "file",
202
- file: typeof part.data === "string" && part.data.startsWith("file-") ? { file_id: part.data } : {
216
+ file: {
203
217
  filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
204
218
  file_data: `data:application/pdf;base64,${convertToBase64(part.data)}`
205
219
  }
@@ -1720,41 +1734,149 @@ var OpenAIEmbeddingModel = class {
1720
1734
  }
1721
1735
  };
1722
1736
 
1723
- // src/image/openai-image-model.ts
1737
+ // src/files/openai-files.ts
1724
1738
  import {
1725
1739
  combineHeaders as combineHeaders4,
1726
1740
  convertBase64ToUint8Array,
1727
- convertToFormData,
1728
1741
  createJsonResponseHandler as createJsonResponseHandler4,
1729
- downloadBlob,
1730
- postFormDataToApi,
1731
- postJsonToApi as postJsonToApi4
1742
+ parseProviderOptions as parseProviderOptions4,
1743
+ postFormDataToApi
1732
1744
  } from "@ai-sdk/provider-utils";
1733
1745
 
1734
- // src/image/openai-image-api.ts
1746
+ // src/files/openai-files-api.ts
1735
1747
  import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1736
1748
  import { z as z8 } from "zod/v4";
1737
- var openaiImageResponseSchema = lazySchema7(
1749
+ var openaiFilesResponseSchema = lazySchema7(
1738
1750
  () => zodSchema7(
1739
1751
  z8.object({
1740
- created: z8.number().nullish(),
1741
- data: z8.array(
1742
- z8.object({
1743
- b64_json: z8.string(),
1744
- revised_prompt: z8.string().nullish()
1752
+ id: z8.string(),
1753
+ object: z8.string().nullish(),
1754
+ bytes: z8.number().nullish(),
1755
+ created_at: z8.number().nullish(),
1756
+ filename: z8.string().nullish(),
1757
+ purpose: z8.string().nullish(),
1758
+ status: z8.string().nullish(),
1759
+ expires_at: z8.number().nullish()
1760
+ })
1761
+ )
1762
+ );
1763
+
1764
+ // src/files/openai-files-options.ts
1765
+ import { lazySchema as lazySchema8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
1766
+ import { z as z9 } from "zod/v4";
1767
+ var openaiFilesOptionsSchema = lazySchema8(
1768
+ () => zodSchema8(
1769
+ z9.object({
1770
+ /*
1771
+ * Required by the OpenAI API, but optional here because
1772
+ * the SDK defaults to "assistants" — by far the most common
1773
+ * purpose when uploading files in this context.
1774
+ */
1775
+ purpose: z9.string().optional(),
1776
+ expiresAfter: z9.number().optional()
1777
+ })
1778
+ )
1779
+ );
1780
+
1781
+ // src/files/openai-files.ts
1782
+ var OpenAIFiles = class {
1783
+ constructor(config) {
1784
+ this.config = config;
1785
+ this.specificationVersion = "v4";
1786
+ }
1787
+ get provider() {
1788
+ return this.config.provider;
1789
+ }
1790
+ async uploadFile({
1791
+ data,
1792
+ mediaType,
1793
+ filename,
1794
+ providerOptions
1795
+ }) {
1796
+ var _a, _b, _c;
1797
+ const openaiOptions = await parseProviderOptions4({
1798
+ provider: "openai",
1799
+ providerOptions,
1800
+ schema: openaiFilesOptionsSchema
1801
+ });
1802
+ const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
1803
+ const blob = new Blob([fileBytes], {
1804
+ type: mediaType
1805
+ });
1806
+ const formData = new FormData();
1807
+ if (filename != null) {
1808
+ formData.append("file", blob, filename);
1809
+ } else {
1810
+ formData.append("file", blob);
1811
+ }
1812
+ formData.append("purpose", (_a = openaiOptions == null ? void 0 : openaiOptions.purpose) != null ? _a : "assistants");
1813
+ if ((openaiOptions == null ? void 0 : openaiOptions.expiresAfter) != null) {
1814
+ formData.append("expires_after", String(openaiOptions.expiresAfter));
1815
+ }
1816
+ const { value: response } = await postFormDataToApi({
1817
+ url: `${this.config.baseURL}/files`,
1818
+ headers: combineHeaders4(this.config.headers()),
1819
+ formData,
1820
+ failedResponseHandler: openaiFailedResponseHandler,
1821
+ successfulResponseHandler: createJsonResponseHandler4(
1822
+ openaiFilesResponseSchema
1823
+ ),
1824
+ fetch: this.config.fetch
1825
+ });
1826
+ return {
1827
+ warnings: [],
1828
+ providerReference: { openai: response.id },
1829
+ ...((_b = response.filename) != null ? _b : filename) ? { filename: (_c = response.filename) != null ? _c : filename } : {},
1830
+ ...mediaType != null ? { mediaType } : {},
1831
+ providerMetadata: {
1832
+ openai: {
1833
+ ...response.filename != null ? { filename: response.filename } : {},
1834
+ ...response.purpose != null ? { purpose: response.purpose } : {},
1835
+ ...response.bytes != null ? { bytes: response.bytes } : {},
1836
+ ...response.created_at != null ? { createdAt: response.created_at } : {},
1837
+ ...response.status != null ? { status: response.status } : {},
1838
+ ...response.expires_at != null ? { expiresAt: response.expires_at } : {}
1839
+ }
1840
+ }
1841
+ };
1842
+ }
1843
+ };
1844
+
1845
+ // src/image/openai-image-model.ts
1846
+ import {
1847
+ combineHeaders as combineHeaders5,
1848
+ convertBase64ToUint8Array as convertBase64ToUint8Array2,
1849
+ convertToFormData,
1850
+ createJsonResponseHandler as createJsonResponseHandler5,
1851
+ downloadBlob,
1852
+ postFormDataToApi as postFormDataToApi2,
1853
+ postJsonToApi as postJsonToApi4
1854
+ } from "@ai-sdk/provider-utils";
1855
+
1856
+ // src/image/openai-image-api.ts
1857
+ import { lazySchema as lazySchema9, zodSchema as zodSchema9 } from "@ai-sdk/provider-utils";
1858
+ import { z as z10 } from "zod/v4";
1859
+ var openaiImageResponseSchema = lazySchema9(
1860
+ () => zodSchema9(
1861
+ z10.object({
1862
+ created: z10.number().nullish(),
1863
+ data: z10.array(
1864
+ z10.object({
1865
+ b64_json: z10.string(),
1866
+ revised_prompt: z10.string().nullish()
1745
1867
  })
1746
1868
  ),
1747
- background: z8.string().nullish(),
1748
- output_format: z8.string().nullish(),
1749
- size: z8.string().nullish(),
1750
- quality: z8.string().nullish(),
1751
- usage: z8.object({
1752
- input_tokens: z8.number().nullish(),
1753
- output_tokens: z8.number().nullish(),
1754
- total_tokens: z8.number().nullish(),
1755
- input_tokens_details: z8.object({
1756
- image_tokens: z8.number().nullish(),
1757
- text_tokens: z8.number().nullish()
1869
+ background: z10.string().nullish(),
1870
+ output_format: z10.string().nullish(),
1871
+ size: z10.string().nullish(),
1872
+ quality: z10.string().nullish(),
1873
+ usage: z10.object({
1874
+ input_tokens: z10.number().nullish(),
1875
+ output_tokens: z10.number().nullish(),
1876
+ total_tokens: z10.number().nullish(),
1877
+ input_tokens_details: z10.object({
1878
+ image_tokens: z10.number().nullish(),
1879
+ text_tokens: z10.number().nullish()
1758
1880
  }).nullish()
1759
1881
  }).nullish()
1760
1882
  })
@@ -1822,12 +1944,12 @@ var OpenAIImageModel = class {
1822
1944
  }
1823
1945
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1824
1946
  if (files != null) {
1825
- const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi({
1947
+ const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi2({
1826
1948
  url: this.config.url({
1827
1949
  path: "/images/edits",
1828
1950
  modelId: this.modelId
1829
1951
  }),
1830
- headers: combineHeaders4(this.config.headers(), headers),
1952
+ headers: combineHeaders5(this.config.headers(), headers),
1831
1953
  formData: convertToFormData({
1832
1954
  model: this.modelId,
1833
1955
  prompt,
@@ -1837,7 +1959,7 @@ var OpenAIImageModel = class {
1837
1959
  [
1838
1960
  file.data instanceof Uint8Array ? new Blob([file.data], {
1839
1961
  type: file.mediaType
1840
- }) : new Blob([convertBase64ToUint8Array(file.data)], {
1962
+ }) : new Blob([convertBase64ToUint8Array2(file.data)], {
1841
1963
  type: file.mediaType
1842
1964
  })
1843
1965
  ],
@@ -1851,7 +1973,7 @@ var OpenAIImageModel = class {
1851
1973
  ...(_d = providerOptions.openai) != null ? _d : {}
1852
1974
  }),
1853
1975
  failedResponseHandler: openaiFailedResponseHandler,
1854
- successfulResponseHandler: createJsonResponseHandler4(
1976
+ successfulResponseHandler: createJsonResponseHandler5(
1855
1977
  openaiImageResponseSchema
1856
1978
  ),
1857
1979
  abortSignal,
@@ -1897,7 +2019,7 @@ var OpenAIImageModel = class {
1897
2019
  path: "/images/generations",
1898
2020
  modelId: this.modelId
1899
2021
  }),
1900
- headers: combineHeaders4(this.config.headers(), headers),
2022
+ headers: combineHeaders5(this.config.headers(), headers),
1901
2023
  body: {
1902
2024
  model: this.modelId,
1903
2025
  prompt,
@@ -1907,7 +2029,7 @@ var OpenAIImageModel = class {
1907
2029
  ...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
1908
2030
  },
1909
2031
  failedResponseHandler: openaiFailedResponseHandler,
1910
- successfulResponseHandler: createJsonResponseHandler4(
2032
+ successfulResponseHandler: createJsonResponseHandler5(
1911
2033
  openaiImageResponseSchema
1912
2034
  ),
1913
2035
  abortSignal,
@@ -1971,49 +2093,49 @@ async function fileToBlob(file) {
1971
2093
  if (file.type === "url") {
1972
2094
  return downloadBlob(file.url);
1973
2095
  }
1974
- const data = file.data instanceof Uint8Array ? file.data : convertBase64ToUint8Array(file.data);
2096
+ const data = file.data instanceof Uint8Array ? file.data : convertBase64ToUint8Array2(file.data);
1975
2097
  return new Blob([data], { type: file.mediaType });
1976
2098
  }
1977
2099
 
1978
2100
  // src/tool/apply-patch.ts
1979
2101
  import {
1980
2102
  createProviderToolFactoryWithOutputSchema,
1981
- lazySchema as lazySchema8,
1982
- zodSchema as zodSchema8
2103
+ lazySchema as lazySchema10,
2104
+ zodSchema as zodSchema10
1983
2105
  } from "@ai-sdk/provider-utils";
1984
- import { z as z9 } from "zod/v4";
1985
- var applyPatchInputSchema = lazySchema8(
1986
- () => zodSchema8(
1987
- z9.object({
1988
- callId: z9.string(),
1989
- operation: z9.discriminatedUnion("type", [
1990
- z9.object({
1991
- type: z9.literal("create_file"),
1992
- path: z9.string(),
1993
- diff: z9.string()
2106
+ import { z as z11 } from "zod/v4";
2107
+ var applyPatchInputSchema = lazySchema10(
2108
+ () => zodSchema10(
2109
+ z11.object({
2110
+ callId: z11.string(),
2111
+ operation: z11.discriminatedUnion("type", [
2112
+ z11.object({
2113
+ type: z11.literal("create_file"),
2114
+ path: z11.string(),
2115
+ diff: z11.string()
1994
2116
  }),
1995
- z9.object({
1996
- type: z9.literal("delete_file"),
1997
- path: z9.string()
2117
+ z11.object({
2118
+ type: z11.literal("delete_file"),
2119
+ path: z11.string()
1998
2120
  }),
1999
- z9.object({
2000
- type: z9.literal("update_file"),
2001
- path: z9.string(),
2002
- diff: z9.string()
2121
+ z11.object({
2122
+ type: z11.literal("update_file"),
2123
+ path: z11.string(),
2124
+ diff: z11.string()
2003
2125
  })
2004
2126
  ])
2005
2127
  })
2006
2128
  )
2007
2129
  );
2008
- var applyPatchOutputSchema = lazySchema8(
2009
- () => zodSchema8(
2010
- z9.object({
2011
- status: z9.enum(["completed", "failed"]),
2012
- output: z9.string().optional()
2130
+ var applyPatchOutputSchema = lazySchema10(
2131
+ () => zodSchema10(
2132
+ z11.object({
2133
+ status: z11.enum(["completed", "failed"]),
2134
+ output: z11.string().optional()
2013
2135
  })
2014
2136
  )
2015
2137
  );
2016
- var applyPatchArgsSchema = lazySchema8(() => zodSchema8(z9.object({})));
2138
+ var applyPatchArgsSchema = lazySchema10(() => zodSchema10(z11.object({})));
2017
2139
  var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2018
2140
  id: "openai.apply_patch",
2019
2141
  inputSchema: applyPatchInputSchema,
@@ -2024,37 +2146,37 @@ var applyPatch = applyPatchToolFactory;
2024
2146
  // src/tool/code-interpreter.ts
2025
2147
  import {
2026
2148
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2027
- lazySchema as lazySchema9,
2028
- zodSchema as zodSchema9
2149
+ lazySchema as lazySchema11,
2150
+ zodSchema as zodSchema11
2029
2151
  } from "@ai-sdk/provider-utils";
2030
- import { z as z10 } from "zod/v4";
2031
- var codeInterpreterInputSchema = lazySchema9(
2032
- () => zodSchema9(
2033
- z10.object({
2034
- code: z10.string().nullish(),
2035
- containerId: z10.string()
2152
+ import { z as z12 } from "zod/v4";
2153
+ var codeInterpreterInputSchema = lazySchema11(
2154
+ () => zodSchema11(
2155
+ z12.object({
2156
+ code: z12.string().nullish(),
2157
+ containerId: z12.string()
2036
2158
  })
2037
2159
  )
2038
2160
  );
2039
- var codeInterpreterOutputSchema = lazySchema9(
2040
- () => zodSchema9(
2041
- z10.object({
2042
- outputs: z10.array(
2043
- z10.discriminatedUnion("type", [
2044
- z10.object({ type: z10.literal("logs"), logs: z10.string() }),
2045
- z10.object({ type: z10.literal("image"), url: z10.string() })
2161
+ var codeInterpreterOutputSchema = lazySchema11(
2162
+ () => zodSchema11(
2163
+ z12.object({
2164
+ outputs: z12.array(
2165
+ z12.discriminatedUnion("type", [
2166
+ z12.object({ type: z12.literal("logs"), logs: z12.string() }),
2167
+ z12.object({ type: z12.literal("image"), url: z12.string() })
2046
2168
  ])
2047
2169
  ).nullish()
2048
2170
  })
2049
2171
  )
2050
2172
  );
2051
- var codeInterpreterArgsSchema = lazySchema9(
2052
- () => zodSchema9(
2053
- z10.object({
2054
- container: z10.union([
2055
- z10.string(),
2056
- z10.object({
2057
- fileIds: z10.array(z10.string()).optional()
2173
+ var codeInterpreterArgsSchema = lazySchema11(
2174
+ () => zodSchema11(
2175
+ z12.object({
2176
+ container: z12.union([
2177
+ z12.string(),
2178
+ z12.object({
2179
+ fileIds: z12.array(z12.string()).optional()
2058
2180
  })
2059
2181
  ]).optional()
2060
2182
  })
@@ -2072,28 +2194,28 @@ var codeInterpreter = (args = {}) => {
2072
2194
  // src/tool/custom.ts
2073
2195
  import {
2074
2196
  createProviderToolFactory,
2075
- lazySchema as lazySchema10,
2076
- zodSchema as zodSchema10
2197
+ lazySchema as lazySchema12,
2198
+ zodSchema as zodSchema12
2077
2199
  } from "@ai-sdk/provider-utils";
2078
- import { z as z11 } from "zod/v4";
2079
- var customArgsSchema = lazySchema10(
2080
- () => zodSchema10(
2081
- z11.object({
2082
- description: z11.string().optional(),
2083
- format: z11.union([
2084
- z11.object({
2085
- type: z11.literal("grammar"),
2086
- syntax: z11.enum(["regex", "lark"]),
2087
- definition: z11.string()
2200
+ import { z as z13 } from "zod/v4";
2201
+ var customArgsSchema = lazySchema12(
2202
+ () => zodSchema12(
2203
+ z13.object({
2204
+ description: z13.string().optional(),
2205
+ format: z13.union([
2206
+ z13.object({
2207
+ type: z13.literal("grammar"),
2208
+ syntax: z13.enum(["regex", "lark"]),
2209
+ definition: z13.string()
2088
2210
  }),
2089
- z11.object({
2090
- type: z11.literal("text")
2211
+ z13.object({
2212
+ type: z13.literal("text")
2091
2213
  })
2092
2214
  ]).optional()
2093
2215
  })
2094
2216
  )
2095
2217
  );
2096
- var customInputSchema = lazySchema10(() => zodSchema10(z11.string()));
2218
+ var customInputSchema = lazySchema12(() => zodSchema12(z13.string()));
2097
2219
  var customToolFactory = createProviderToolFactory({
2098
2220
  id: "openai.custom",
2099
2221
  inputSchema: customInputSchema
@@ -2103,45 +2225,45 @@ var customTool = (args) => customToolFactory(args);
2103
2225
  // src/tool/file-search.ts
2104
2226
  import {
2105
2227
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2106
- lazySchema as lazySchema11,
2107
- zodSchema as zodSchema11
2228
+ lazySchema as lazySchema13,
2229
+ zodSchema as zodSchema13
2108
2230
  } from "@ai-sdk/provider-utils";
2109
- import { z as z12 } from "zod/v4";
2110
- var comparisonFilterSchema = z12.object({
2111
- key: z12.string(),
2112
- type: z12.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2113
- value: z12.union([z12.string(), z12.number(), z12.boolean(), z12.array(z12.string())])
2231
+ import { z as z14 } from "zod/v4";
2232
+ var comparisonFilterSchema = z14.object({
2233
+ key: z14.string(),
2234
+ type: z14.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2235
+ value: z14.union([z14.string(), z14.number(), z14.boolean(), z14.array(z14.string())])
2114
2236
  });
2115
- var compoundFilterSchema = z12.object({
2116
- type: z12.enum(["and", "or"]),
2117
- filters: z12.array(
2118
- z12.union([comparisonFilterSchema, z12.lazy(() => compoundFilterSchema)])
2237
+ var compoundFilterSchema = z14.object({
2238
+ type: z14.enum(["and", "or"]),
2239
+ filters: z14.array(
2240
+ z14.union([comparisonFilterSchema, z14.lazy(() => compoundFilterSchema)])
2119
2241
  )
2120
2242
  });
2121
- var fileSearchArgsSchema = lazySchema11(
2122
- () => zodSchema11(
2123
- z12.object({
2124
- vectorStoreIds: z12.array(z12.string()),
2125
- maxNumResults: z12.number().optional(),
2126
- ranking: z12.object({
2127
- ranker: z12.string().optional(),
2128
- scoreThreshold: z12.number().optional()
2243
+ var fileSearchArgsSchema = lazySchema13(
2244
+ () => zodSchema13(
2245
+ z14.object({
2246
+ vectorStoreIds: z14.array(z14.string()),
2247
+ maxNumResults: z14.number().optional(),
2248
+ ranking: z14.object({
2249
+ ranker: z14.string().optional(),
2250
+ scoreThreshold: z14.number().optional()
2129
2251
  }).optional(),
2130
- filters: z12.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2252
+ filters: z14.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2131
2253
  })
2132
2254
  )
2133
2255
  );
2134
- var fileSearchOutputSchema = lazySchema11(
2135
- () => zodSchema11(
2136
- z12.object({
2137
- queries: z12.array(z12.string()),
2138
- results: z12.array(
2139
- z12.object({
2140
- attributes: z12.record(z12.string(), z12.unknown()),
2141
- fileId: z12.string(),
2142
- filename: z12.string(),
2143
- score: z12.number(),
2144
- text: z12.string()
2256
+ var fileSearchOutputSchema = lazySchema13(
2257
+ () => zodSchema13(
2258
+ z14.object({
2259
+ queries: z14.array(z14.string()),
2260
+ results: z14.array(
2261
+ z14.object({
2262
+ attributes: z14.record(z14.string(), z14.unknown()),
2263
+ fileId: z14.string(),
2264
+ filename: z14.string(),
2265
+ score: z14.number(),
2266
+ text: z14.string()
2145
2267
  })
2146
2268
  ).nullable()
2147
2269
  })
@@ -2149,39 +2271,39 @@ var fileSearchOutputSchema = lazySchema11(
2149
2271
  );
2150
2272
  var fileSearch = createProviderToolFactoryWithOutputSchema3({
2151
2273
  id: "openai.file_search",
2152
- inputSchema: z12.object({}),
2274
+ inputSchema: z14.object({}),
2153
2275
  outputSchema: fileSearchOutputSchema
2154
2276
  });
2155
2277
 
2156
2278
  // src/tool/image-generation.ts
2157
2279
  import {
2158
2280
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2159
- lazySchema as lazySchema12,
2160
- zodSchema as zodSchema12
2281
+ lazySchema as lazySchema14,
2282
+ zodSchema as zodSchema14
2161
2283
  } from "@ai-sdk/provider-utils";
2162
- import { z as z13 } from "zod/v4";
2163
- var imageGenerationArgsSchema = lazySchema12(
2164
- () => zodSchema12(
2165
- z13.object({
2166
- background: z13.enum(["auto", "opaque", "transparent"]).optional(),
2167
- inputFidelity: z13.enum(["low", "high"]).optional(),
2168
- inputImageMask: z13.object({
2169
- fileId: z13.string().optional(),
2170
- imageUrl: z13.string().optional()
2284
+ import { z as z15 } from "zod/v4";
2285
+ var imageGenerationArgsSchema = lazySchema14(
2286
+ () => zodSchema14(
2287
+ z15.object({
2288
+ background: z15.enum(["auto", "opaque", "transparent"]).optional(),
2289
+ inputFidelity: z15.enum(["low", "high"]).optional(),
2290
+ inputImageMask: z15.object({
2291
+ fileId: z15.string().optional(),
2292
+ imageUrl: z15.string().optional()
2171
2293
  }).optional(),
2172
- model: z13.string().optional(),
2173
- moderation: z13.enum(["auto"]).optional(),
2174
- outputCompression: z13.number().int().min(0).max(100).optional(),
2175
- outputFormat: z13.enum(["png", "jpeg", "webp"]).optional(),
2176
- partialImages: z13.number().int().min(0).max(3).optional(),
2177
- quality: z13.enum(["auto", "low", "medium", "high"]).optional(),
2178
- size: z13.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2294
+ model: z15.string().optional(),
2295
+ moderation: z15.enum(["auto"]).optional(),
2296
+ outputCompression: z15.number().int().min(0).max(100).optional(),
2297
+ outputFormat: z15.enum(["png", "jpeg", "webp"]).optional(),
2298
+ partialImages: z15.number().int().min(0).max(3).optional(),
2299
+ quality: z15.enum(["auto", "low", "medium", "high"]).optional(),
2300
+ size: z15.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2179
2301
  }).strict()
2180
2302
  )
2181
2303
  );
2182
- var imageGenerationInputSchema = lazySchema12(() => zodSchema12(z13.object({})));
2183
- var imageGenerationOutputSchema = lazySchema12(
2184
- () => zodSchema12(z13.object({ result: z13.string() }))
2304
+ var imageGenerationInputSchema = lazySchema14(() => zodSchema14(z15.object({})));
2305
+ var imageGenerationOutputSchema = lazySchema14(
2306
+ () => zodSchema14(z15.object({ result: z15.string() }))
2185
2307
  );
2186
2308
  var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
2187
2309
  id: "openai.image_generation",
@@ -2195,26 +2317,26 @@ var imageGeneration = (args = {}) => {
2195
2317
  // src/tool/local-shell.ts
2196
2318
  import {
2197
2319
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
2198
- lazySchema as lazySchema13,
2199
- zodSchema as zodSchema13
2320
+ lazySchema as lazySchema15,
2321
+ zodSchema as zodSchema15
2200
2322
  } from "@ai-sdk/provider-utils";
2201
- import { z as z14 } from "zod/v4";
2202
- var localShellInputSchema = lazySchema13(
2203
- () => zodSchema13(
2204
- z14.object({
2205
- action: z14.object({
2206
- type: z14.literal("exec"),
2207
- command: z14.array(z14.string()),
2208
- timeoutMs: z14.number().optional(),
2209
- user: z14.string().optional(),
2210
- workingDirectory: z14.string().optional(),
2211
- env: z14.record(z14.string(), z14.string()).optional()
2323
+ import { z as z16 } from "zod/v4";
2324
+ var localShellInputSchema = lazySchema15(
2325
+ () => zodSchema15(
2326
+ z16.object({
2327
+ action: z16.object({
2328
+ type: z16.literal("exec"),
2329
+ command: z16.array(z16.string()),
2330
+ timeoutMs: z16.number().optional(),
2331
+ user: z16.string().optional(),
2332
+ workingDirectory: z16.string().optional(),
2333
+ env: z16.record(z16.string(), z16.string()).optional()
2212
2334
  })
2213
2335
  })
2214
2336
  )
2215
2337
  );
2216
- var localShellOutputSchema = lazySchema13(
2217
- () => zodSchema13(z14.object({ output: z14.string() }))
2338
+ var localShellOutputSchema = lazySchema15(
2339
+ () => zodSchema15(z16.object({ output: z16.string() }))
2218
2340
  );
2219
2341
  var localShell = createProviderToolFactoryWithOutputSchema5({
2220
2342
  id: "openai.local_shell",
@@ -2225,91 +2347,91 @@ var localShell = createProviderToolFactoryWithOutputSchema5({
2225
2347
  // src/tool/shell.ts
2226
2348
  import {
2227
2349
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
2228
- lazySchema as lazySchema14,
2229
- zodSchema as zodSchema14
2350
+ lazySchema as lazySchema16,
2351
+ zodSchema as zodSchema16
2230
2352
  } from "@ai-sdk/provider-utils";
2231
- import { z as z15 } from "zod/v4";
2232
- var shellInputSchema = lazySchema14(
2233
- () => zodSchema14(
2234
- z15.object({
2235
- action: z15.object({
2236
- commands: z15.array(z15.string()),
2237
- timeoutMs: z15.number().optional(),
2238
- maxOutputLength: z15.number().optional()
2353
+ import { z as z17 } from "zod/v4";
2354
+ var shellInputSchema = lazySchema16(
2355
+ () => zodSchema16(
2356
+ z17.object({
2357
+ action: z17.object({
2358
+ commands: z17.array(z17.string()),
2359
+ timeoutMs: z17.number().optional(),
2360
+ maxOutputLength: z17.number().optional()
2239
2361
  })
2240
2362
  })
2241
2363
  )
2242
2364
  );
2243
- var shellOutputSchema = lazySchema14(
2244
- () => zodSchema14(
2245
- z15.object({
2246
- output: z15.array(
2247
- z15.object({
2248
- stdout: z15.string(),
2249
- stderr: z15.string(),
2250
- outcome: z15.discriminatedUnion("type", [
2251
- z15.object({ type: z15.literal("timeout") }),
2252
- z15.object({ type: z15.literal("exit"), exitCode: z15.number() })
2365
+ var shellOutputSchema = lazySchema16(
2366
+ () => zodSchema16(
2367
+ z17.object({
2368
+ output: z17.array(
2369
+ z17.object({
2370
+ stdout: z17.string(),
2371
+ stderr: z17.string(),
2372
+ outcome: z17.discriminatedUnion("type", [
2373
+ z17.object({ type: z17.literal("timeout") }),
2374
+ z17.object({ type: z17.literal("exit"), exitCode: z17.number() })
2253
2375
  ])
2254
2376
  })
2255
2377
  )
2256
2378
  })
2257
2379
  )
2258
2380
  );
2259
- var shellSkillsSchema = z15.array(
2260
- z15.discriminatedUnion("type", [
2261
- z15.object({
2262
- type: z15.literal("skillReference"),
2263
- skillId: z15.string(),
2264
- version: z15.string().optional()
2381
+ var shellSkillsSchema = z17.array(
2382
+ z17.discriminatedUnion("type", [
2383
+ z17.object({
2384
+ type: z17.literal("skillReference"),
2385
+ skillId: z17.string(),
2386
+ version: z17.string().optional()
2265
2387
  }),
2266
- z15.object({
2267
- type: z15.literal("inline"),
2268
- name: z15.string(),
2269
- description: z15.string(),
2270
- source: z15.object({
2271
- type: z15.literal("base64"),
2272
- mediaType: z15.literal("application/zip"),
2273
- data: z15.string()
2388
+ z17.object({
2389
+ type: z17.literal("inline"),
2390
+ name: z17.string(),
2391
+ description: z17.string(),
2392
+ source: z17.object({
2393
+ type: z17.literal("base64"),
2394
+ mediaType: z17.literal("application/zip"),
2395
+ data: z17.string()
2274
2396
  })
2275
2397
  })
2276
2398
  ])
2277
2399
  ).optional();
2278
- var shellArgsSchema = lazySchema14(
2279
- () => zodSchema14(
2280
- z15.object({
2281
- environment: z15.union([
2282
- z15.object({
2283
- type: z15.literal("containerAuto"),
2284
- fileIds: z15.array(z15.string()).optional(),
2285
- memoryLimit: z15.enum(["1g", "4g", "16g", "64g"]).optional(),
2286
- networkPolicy: z15.discriminatedUnion("type", [
2287
- z15.object({ type: z15.literal("disabled") }),
2288
- z15.object({
2289
- type: z15.literal("allowlist"),
2290
- allowedDomains: z15.array(z15.string()),
2291
- domainSecrets: z15.array(
2292
- z15.object({
2293
- domain: z15.string(),
2294
- name: z15.string(),
2295
- value: z15.string()
2400
+ var shellArgsSchema = lazySchema16(
2401
+ () => zodSchema16(
2402
+ z17.object({
2403
+ environment: z17.union([
2404
+ z17.object({
2405
+ type: z17.literal("containerAuto"),
2406
+ fileIds: z17.array(z17.string()).optional(),
2407
+ memoryLimit: z17.enum(["1g", "4g", "16g", "64g"]).optional(),
2408
+ networkPolicy: z17.discriminatedUnion("type", [
2409
+ z17.object({ type: z17.literal("disabled") }),
2410
+ z17.object({
2411
+ type: z17.literal("allowlist"),
2412
+ allowedDomains: z17.array(z17.string()),
2413
+ domainSecrets: z17.array(
2414
+ z17.object({
2415
+ domain: z17.string(),
2416
+ name: z17.string(),
2417
+ value: z17.string()
2296
2418
  })
2297
2419
  ).optional()
2298
2420
  })
2299
2421
  ]).optional(),
2300
2422
  skills: shellSkillsSchema
2301
2423
  }),
2302
- z15.object({
2303
- type: z15.literal("containerReference"),
2304
- containerId: z15.string()
2424
+ z17.object({
2425
+ type: z17.literal("containerReference"),
2426
+ containerId: z17.string()
2305
2427
  }),
2306
- z15.object({
2307
- type: z15.literal("local").optional(),
2308
- skills: z15.array(
2309
- z15.object({
2310
- name: z15.string(),
2311
- description: z15.string(),
2312
- path: z15.string()
2428
+ z17.object({
2429
+ type: z17.literal("local").optional(),
2430
+ skills: z17.array(
2431
+ z17.object({
2432
+ name: z17.string(),
2433
+ description: z17.string(),
2434
+ path: z17.string()
2313
2435
  })
2314
2436
  ).optional()
2315
2437
  })
@@ -2326,31 +2448,31 @@ var shell = createProviderToolFactoryWithOutputSchema6({
2326
2448
  // src/tool/tool-search.ts
2327
2449
  import {
2328
2450
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2329
- lazySchema as lazySchema15,
2330
- zodSchema as zodSchema15
2451
+ lazySchema as lazySchema17,
2452
+ zodSchema as zodSchema17
2331
2453
  } from "@ai-sdk/provider-utils";
2332
- import { z as z16 } from "zod/v4";
2333
- var toolSearchArgsSchema = lazySchema15(
2334
- () => zodSchema15(
2335
- z16.object({
2336
- execution: z16.enum(["server", "client"]).optional(),
2337
- description: z16.string().optional(),
2338
- parameters: z16.record(z16.string(), z16.unknown()).optional()
2454
+ import { z as z18 } from "zod/v4";
2455
+ var toolSearchArgsSchema = lazySchema17(
2456
+ () => zodSchema17(
2457
+ z18.object({
2458
+ execution: z18.enum(["server", "client"]).optional(),
2459
+ description: z18.string().optional(),
2460
+ parameters: z18.record(z18.string(), z18.unknown()).optional()
2339
2461
  })
2340
2462
  )
2341
2463
  );
2342
- var toolSearchInputSchema = lazySchema15(
2343
- () => zodSchema15(
2344
- z16.object({
2345
- arguments: z16.unknown().optional(),
2346
- call_id: z16.string().nullish()
2464
+ var toolSearchInputSchema = lazySchema17(
2465
+ () => zodSchema17(
2466
+ z18.object({
2467
+ arguments: z18.unknown().optional(),
2468
+ call_id: z18.string().nullish()
2347
2469
  })
2348
2470
  )
2349
2471
  );
2350
- var toolSearchOutputSchema = lazySchema15(
2351
- () => zodSchema15(
2352
- z16.object({
2353
- tools: z16.array(z16.record(z16.string(), z16.unknown()))
2472
+ var toolSearchOutputSchema = lazySchema17(
2473
+ () => zodSchema17(
2474
+ z18.object({
2475
+ tools: z18.array(z18.record(z18.string(), z18.unknown()))
2354
2476
  })
2355
2477
  )
2356
2478
  );
@@ -2364,49 +2486,49 @@ var toolSearch = (args = {}) => toolSearchToolFactory(args);
2364
2486
  // src/tool/web-search.ts
2365
2487
  import {
2366
2488
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2367
- lazySchema as lazySchema16,
2368
- zodSchema as zodSchema16
2489
+ lazySchema as lazySchema18,
2490
+ zodSchema as zodSchema18
2369
2491
  } from "@ai-sdk/provider-utils";
2370
- import { z as z17 } from "zod/v4";
2371
- var webSearchArgsSchema = lazySchema16(
2372
- () => zodSchema16(
2373
- z17.object({
2374
- externalWebAccess: z17.boolean().optional(),
2375
- filters: z17.object({ allowedDomains: z17.array(z17.string()).optional() }).optional(),
2376
- searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
2377
- userLocation: z17.object({
2378
- type: z17.literal("approximate"),
2379
- country: z17.string().optional(),
2380
- city: z17.string().optional(),
2381
- region: z17.string().optional(),
2382
- timezone: z17.string().optional()
2492
+ import { z as z19 } from "zod/v4";
2493
+ var webSearchArgsSchema = lazySchema18(
2494
+ () => zodSchema18(
2495
+ z19.object({
2496
+ externalWebAccess: z19.boolean().optional(),
2497
+ filters: z19.object({ allowedDomains: z19.array(z19.string()).optional() }).optional(),
2498
+ searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
2499
+ userLocation: z19.object({
2500
+ type: z19.literal("approximate"),
2501
+ country: z19.string().optional(),
2502
+ city: z19.string().optional(),
2503
+ region: z19.string().optional(),
2504
+ timezone: z19.string().optional()
2383
2505
  }).optional()
2384
2506
  })
2385
2507
  )
2386
2508
  );
2387
- var webSearchInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
2388
- var webSearchOutputSchema = lazySchema16(
2389
- () => zodSchema16(
2390
- z17.object({
2391
- action: z17.discriminatedUnion("type", [
2392
- z17.object({
2393
- type: z17.literal("search"),
2394
- query: z17.string().optional()
2509
+ var webSearchInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
2510
+ var webSearchOutputSchema = lazySchema18(
2511
+ () => zodSchema18(
2512
+ z19.object({
2513
+ action: z19.discriminatedUnion("type", [
2514
+ z19.object({
2515
+ type: z19.literal("search"),
2516
+ query: z19.string().optional()
2395
2517
  }),
2396
- z17.object({
2397
- type: z17.literal("openPage"),
2398
- url: z17.string().nullish()
2518
+ z19.object({
2519
+ type: z19.literal("openPage"),
2520
+ url: z19.string().nullish()
2399
2521
  }),
2400
- z17.object({
2401
- type: z17.literal("findInPage"),
2402
- url: z17.string().nullish(),
2403
- pattern: z17.string().nullish()
2522
+ z19.object({
2523
+ type: z19.literal("findInPage"),
2524
+ url: z19.string().nullish(),
2525
+ pattern: z19.string().nullish()
2404
2526
  })
2405
2527
  ]).optional(),
2406
- sources: z17.array(
2407
- z17.discriminatedUnion("type", [
2408
- z17.object({ type: z17.literal("url"), url: z17.string() }),
2409
- z17.object({ type: z17.literal("api"), name: z17.string() })
2528
+ sources: z19.array(
2529
+ z19.discriminatedUnion("type", [
2530
+ z19.object({ type: z19.literal("url"), url: z19.string() }),
2531
+ z19.object({ type: z19.literal("api"), name: z19.string() })
2410
2532
  ])
2411
2533
  ).optional()
2412
2534
  })
@@ -2422,43 +2544,43 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
2422
2544
  // src/tool/web-search-preview.ts
2423
2545
  import {
2424
2546
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2425
- lazySchema as lazySchema17,
2426
- zodSchema as zodSchema17
2547
+ lazySchema as lazySchema19,
2548
+ zodSchema as zodSchema19
2427
2549
  } from "@ai-sdk/provider-utils";
2428
- import { z as z18 } from "zod/v4";
2429
- var webSearchPreviewArgsSchema = lazySchema17(
2430
- () => zodSchema17(
2431
- z18.object({
2432
- searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
2433
- userLocation: z18.object({
2434
- type: z18.literal("approximate"),
2435
- country: z18.string().optional(),
2436
- city: z18.string().optional(),
2437
- region: z18.string().optional(),
2438
- timezone: z18.string().optional()
2550
+ import { z as z20 } from "zod/v4";
2551
+ var webSearchPreviewArgsSchema = lazySchema19(
2552
+ () => zodSchema19(
2553
+ z20.object({
2554
+ searchContextSize: z20.enum(["low", "medium", "high"]).optional(),
2555
+ userLocation: z20.object({
2556
+ type: z20.literal("approximate"),
2557
+ country: z20.string().optional(),
2558
+ city: z20.string().optional(),
2559
+ region: z20.string().optional(),
2560
+ timezone: z20.string().optional()
2439
2561
  }).optional()
2440
2562
  })
2441
2563
  )
2442
2564
  );
2443
- var webSearchPreviewInputSchema = lazySchema17(
2444
- () => zodSchema17(z18.object({}))
2565
+ var webSearchPreviewInputSchema = lazySchema19(
2566
+ () => zodSchema19(z20.object({}))
2445
2567
  );
2446
- var webSearchPreviewOutputSchema = lazySchema17(
2447
- () => zodSchema17(
2448
- z18.object({
2449
- action: z18.discriminatedUnion("type", [
2450
- z18.object({
2451
- type: z18.literal("search"),
2452
- query: z18.string().optional()
2568
+ var webSearchPreviewOutputSchema = lazySchema19(
2569
+ () => zodSchema19(
2570
+ z20.object({
2571
+ action: z20.discriminatedUnion("type", [
2572
+ z20.object({
2573
+ type: z20.literal("search"),
2574
+ query: z20.string().optional()
2453
2575
  }),
2454
- z18.object({
2455
- type: z18.literal("openPage"),
2456
- url: z18.string().nullish()
2576
+ z20.object({
2577
+ type: z20.literal("openPage"),
2578
+ url: z20.string().nullish()
2457
2579
  }),
2458
- z18.object({
2459
- type: z18.literal("findInPage"),
2460
- url: z18.string().nullish(),
2461
- pattern: z18.string().nullish()
2580
+ z20.object({
2581
+ type: z20.literal("findInPage"),
2582
+ url: z20.string().nullish(),
2583
+ pattern: z20.string().nullish()
2462
2584
  })
2463
2585
  ]).optional()
2464
2586
  })
@@ -2473,60 +2595,60 @@ var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
2473
2595
  // src/tool/mcp.ts
2474
2596
  import {
2475
2597
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
2476
- lazySchema as lazySchema18,
2477
- zodSchema as zodSchema18
2598
+ lazySchema as lazySchema20,
2599
+ zodSchema as zodSchema20
2478
2600
  } from "@ai-sdk/provider-utils";
2479
- import { z as z19 } from "zod/v4";
2480
- var jsonValueSchema = z19.lazy(
2481
- () => z19.union([
2482
- z19.string(),
2483
- z19.number(),
2484
- z19.boolean(),
2485
- z19.null(),
2486
- z19.array(jsonValueSchema),
2487
- z19.record(z19.string(), jsonValueSchema)
2601
+ import { z as z21 } from "zod/v4";
2602
+ var jsonValueSchema = z21.lazy(
2603
+ () => z21.union([
2604
+ z21.string(),
2605
+ z21.number(),
2606
+ z21.boolean(),
2607
+ z21.null(),
2608
+ z21.array(jsonValueSchema),
2609
+ z21.record(z21.string(), jsonValueSchema)
2488
2610
  ])
2489
2611
  );
2490
- var mcpArgsSchema = lazySchema18(
2491
- () => zodSchema18(
2492
- z19.object({
2493
- serverLabel: z19.string(),
2494
- allowedTools: z19.union([
2495
- z19.array(z19.string()),
2496
- z19.object({
2497
- readOnly: z19.boolean().optional(),
2498
- toolNames: z19.array(z19.string()).optional()
2612
+ var mcpArgsSchema = lazySchema20(
2613
+ () => zodSchema20(
2614
+ z21.object({
2615
+ serverLabel: z21.string(),
2616
+ allowedTools: z21.union([
2617
+ z21.array(z21.string()),
2618
+ z21.object({
2619
+ readOnly: z21.boolean().optional(),
2620
+ toolNames: z21.array(z21.string()).optional()
2499
2621
  })
2500
2622
  ]).optional(),
2501
- authorization: z19.string().optional(),
2502
- connectorId: z19.string().optional(),
2503
- headers: z19.record(z19.string(), z19.string()).optional(),
2504
- requireApproval: z19.union([
2505
- z19.enum(["always", "never"]),
2506
- z19.object({
2507
- never: z19.object({
2508
- toolNames: z19.array(z19.string()).optional()
2623
+ authorization: z21.string().optional(),
2624
+ connectorId: z21.string().optional(),
2625
+ headers: z21.record(z21.string(), z21.string()).optional(),
2626
+ requireApproval: z21.union([
2627
+ z21.enum(["always", "never"]),
2628
+ z21.object({
2629
+ never: z21.object({
2630
+ toolNames: z21.array(z21.string()).optional()
2509
2631
  }).optional()
2510
2632
  })
2511
2633
  ]).optional(),
2512
- serverDescription: z19.string().optional(),
2513
- serverUrl: z19.string().optional()
2634
+ serverDescription: z21.string().optional(),
2635
+ serverUrl: z21.string().optional()
2514
2636
  }).refine(
2515
2637
  (v) => v.serverUrl != null || v.connectorId != null,
2516
2638
  "One of serverUrl or connectorId must be provided."
2517
2639
  )
2518
2640
  )
2519
2641
  );
2520
- var mcpInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
2521
- var mcpOutputSchema = lazySchema18(
2522
- () => zodSchema18(
2523
- z19.object({
2524
- type: z19.literal("call"),
2525
- serverLabel: z19.string(),
2526
- name: z19.string(),
2527
- arguments: z19.string(),
2528
- output: z19.string().nullish(),
2529
- error: z19.union([z19.string(), jsonValueSchema]).optional()
2642
+ var mcpInputSchema = lazySchema20(() => zodSchema20(z21.object({})));
2643
+ var mcpOutputSchema = lazySchema20(
2644
+ () => zodSchema20(
2645
+ z21.object({
2646
+ type: z21.literal("call"),
2647
+ serverLabel: z21.string(),
2648
+ name: z21.string(),
2649
+ arguments: z21.string(),
2650
+ output: z21.string().nullish(),
2651
+ error: z21.union([z21.string(), jsonValueSchema]).optional()
2530
2652
  })
2531
2653
  )
2532
2654
  );
@@ -2659,13 +2781,13 @@ import {
2659
2781
  APICallError
2660
2782
  } from "@ai-sdk/provider";
2661
2783
  import {
2662
- combineHeaders as combineHeaders5,
2784
+ combineHeaders as combineHeaders6,
2663
2785
  createEventSourceResponseHandler as createEventSourceResponseHandler3,
2664
- createJsonResponseHandler as createJsonResponseHandler5,
2786
+ createJsonResponseHandler as createJsonResponseHandler6,
2665
2787
  createToolNameMapping,
2666
2788
  generateId as generateId2,
2667
2789
  isCustomReasoning as isCustomReasoning2,
2668
- parseProviderOptions as parseProviderOptions5,
2790
+ parseProviderOptions as parseProviderOptions6,
2669
2791
  postJsonToApi as postJsonToApi5
2670
2792
  } from "@ai-sdk/provider-utils";
2671
2793
 
@@ -2715,11 +2837,13 @@ import {
2715
2837
  import {
2716
2838
  convertToBase64 as convertToBase642,
2717
2839
  isNonNullable,
2840
+ isProviderReference as isProviderReference2,
2718
2841
  parseJSON,
2719
- parseProviderOptions as parseProviderOptions4,
2842
+ parseProviderOptions as parseProviderOptions5,
2843
+ resolveProviderReference as resolveProviderReference2,
2720
2844
  validateTypes
2721
2845
  } from "@ai-sdk/provider-utils";
2722
- import { z as z20 } from "zod/v4";
2846
+ import { z as z22 } from "zod/v4";
2723
2847
  function isFileId(data, prefixes) {
2724
2848
  if (!prefixes) return false;
2725
2849
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2773,12 +2897,29 @@ async function convertToOpenAIResponsesInput({
2773
2897
  input.push({
2774
2898
  role: "user",
2775
2899
  content: content.map((part, index) => {
2776
- var _a2, _b2, _c2;
2900
+ var _a2, _b2, _c2, _d2, _e2;
2777
2901
  switch (part.type) {
2778
2902
  case "text": {
2779
2903
  return { type: "input_text", text: part.text };
2780
2904
  }
2781
2905
  case "file": {
2906
+ if (isProviderReference2(part.data)) {
2907
+ const fileId = resolveProviderReference2({
2908
+ reference: part.data,
2909
+ provider: providerOptionsName
2910
+ });
2911
+ if (part.mediaType.startsWith("image/")) {
2912
+ return {
2913
+ type: "input_image",
2914
+ file_id: fileId,
2915
+ detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
2916
+ };
2917
+ }
2918
+ return {
2919
+ type: "input_file",
2920
+ file_id: fileId
2921
+ };
2922
+ }
2782
2923
  if (part.mediaType.startsWith("image/")) {
2783
2924
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
2784
2925
  return {
@@ -2786,7 +2927,7 @@ async function convertToOpenAIResponsesInput({
2786
2927
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2787
2928
  image_url: `data:${mediaType};base64,${convertToBase642(part.data)}`
2788
2929
  },
2789
- detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
2930
+ detail: (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2[providerOptionsName]) == null ? void 0 : _d2.imageDetail
2790
2931
  };
2791
2932
  } else if (part.mediaType === "application/pdf") {
2792
2933
  if (part.data instanceof URL) {
@@ -2798,7 +2939,7 @@ async function convertToOpenAIResponsesInput({
2798
2939
  return {
2799
2940
  type: "input_file",
2800
2941
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2801
- filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2942
+ filename: (_e2 = part.filename) != null ? _e2 : `part-${index}.pdf`,
2802
2943
  file_data: `data:application/pdf;base64,${convertToBase642(part.data)}`
2803
2944
  }
2804
2945
  };
@@ -3012,7 +3153,7 @@ async function convertToOpenAIResponsesInput({
3012
3153
  break;
3013
3154
  }
3014
3155
  case "reasoning": {
3015
- const providerOptions = await parseProviderOptions4({
3156
+ const providerOptions = await parseProviderOptions5({
3016
3157
  provider: providerOptionsName,
3017
3158
  providerOptions: part.providerOptions,
3018
3159
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -3342,9 +3483,9 @@ async function convertToOpenAIResponsesInput({
3342
3483
  }
3343
3484
  return { input, warnings };
3344
3485
  }
3345
- var openaiResponsesReasoningProviderOptionsSchema = z20.object({
3346
- itemId: z20.string().nullish(),
3347
- reasoningEncryptedContent: z20.string().nullish()
3486
+ var openaiResponsesReasoningProviderOptionsSchema = z22.object({
3487
+ itemId: z22.string().nullish(),
3488
+ reasoningEncryptedContent: z22.string().nullish()
3348
3489
  });
3349
3490
 
3350
3491
  // src/responses/map-openai-responses-finish-reason.ts
@@ -3366,552 +3507,552 @@ function mapOpenAIResponseFinishReason({
3366
3507
  }
3367
3508
 
3368
3509
  // src/responses/openai-responses-api.ts
3369
- import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
3370
- import { z as z21 } from "zod/v4";
3371
- var jsonValueSchema2 = z21.lazy(
3372
- () => z21.union([
3373
- z21.string(),
3374
- z21.number(),
3375
- z21.boolean(),
3376
- z21.null(),
3377
- z21.array(jsonValueSchema2),
3378
- z21.record(z21.string(), jsonValueSchema2.optional())
3510
+ import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
3511
+ import { z as z23 } from "zod/v4";
3512
+ var jsonValueSchema2 = z23.lazy(
3513
+ () => z23.union([
3514
+ z23.string(),
3515
+ z23.number(),
3516
+ z23.boolean(),
3517
+ z23.null(),
3518
+ z23.array(jsonValueSchema2),
3519
+ z23.record(z23.string(), jsonValueSchema2.optional())
3379
3520
  ])
3380
3521
  );
3381
- var openaiResponsesChunkSchema = lazySchema19(
3382
- () => zodSchema19(
3383
- z21.union([
3384
- z21.object({
3385
- type: z21.literal("response.output_text.delta"),
3386
- item_id: z21.string(),
3387
- delta: z21.string(),
3388
- logprobs: z21.array(
3389
- z21.object({
3390
- token: z21.string(),
3391
- logprob: z21.number(),
3392
- top_logprobs: z21.array(
3393
- z21.object({
3394
- token: z21.string(),
3395
- logprob: z21.number()
3522
+ var openaiResponsesChunkSchema = lazySchema21(
3523
+ () => zodSchema21(
3524
+ z23.union([
3525
+ z23.object({
3526
+ type: z23.literal("response.output_text.delta"),
3527
+ item_id: z23.string(),
3528
+ delta: z23.string(),
3529
+ logprobs: z23.array(
3530
+ z23.object({
3531
+ token: z23.string(),
3532
+ logprob: z23.number(),
3533
+ top_logprobs: z23.array(
3534
+ z23.object({
3535
+ token: z23.string(),
3536
+ logprob: z23.number()
3396
3537
  })
3397
3538
  )
3398
3539
  })
3399
3540
  ).nullish()
3400
3541
  }),
3401
- z21.object({
3402
- type: z21.enum(["response.completed", "response.incomplete"]),
3403
- response: z21.object({
3404
- incomplete_details: z21.object({ reason: z21.string() }).nullish(),
3405
- usage: z21.object({
3406
- input_tokens: z21.number(),
3407
- input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
3408
- output_tokens: z21.number(),
3409
- output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3542
+ z23.object({
3543
+ type: z23.enum(["response.completed", "response.incomplete"]),
3544
+ response: z23.object({
3545
+ incomplete_details: z23.object({ reason: z23.string() }).nullish(),
3546
+ usage: z23.object({
3547
+ input_tokens: z23.number(),
3548
+ input_tokens_details: z23.object({ cached_tokens: z23.number().nullish() }).nullish(),
3549
+ output_tokens: z23.number(),
3550
+ output_tokens_details: z23.object({ reasoning_tokens: z23.number().nullish() }).nullish()
3410
3551
  }),
3411
- service_tier: z21.string().nullish()
3552
+ service_tier: z23.string().nullish()
3412
3553
  })
3413
3554
  }),
3414
- z21.object({
3415
- type: z21.literal("response.failed"),
3416
- response: z21.object({
3417
- error: z21.object({
3418
- code: z21.string().nullish(),
3419
- message: z21.string()
3555
+ z23.object({
3556
+ type: z23.literal("response.failed"),
3557
+ response: z23.object({
3558
+ error: z23.object({
3559
+ code: z23.string().nullish(),
3560
+ message: z23.string()
3420
3561
  }).nullish(),
3421
- incomplete_details: z21.object({ reason: z21.string() }).nullish(),
3422
- usage: z21.object({
3423
- input_tokens: z21.number(),
3424
- input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
3425
- output_tokens: z21.number(),
3426
- output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
3562
+ incomplete_details: z23.object({ reason: z23.string() }).nullish(),
3563
+ usage: z23.object({
3564
+ input_tokens: z23.number(),
3565
+ input_tokens_details: z23.object({ cached_tokens: z23.number().nullish() }).nullish(),
3566
+ output_tokens: z23.number(),
3567
+ output_tokens_details: z23.object({ reasoning_tokens: z23.number().nullish() }).nullish()
3427
3568
  }).nullish(),
3428
- service_tier: z21.string().nullish()
3569
+ service_tier: z23.string().nullish()
3429
3570
  })
3430
3571
  }),
3431
- z21.object({
3432
- type: z21.literal("response.created"),
3433
- response: z21.object({
3434
- id: z21.string(),
3435
- created_at: z21.number(),
3436
- model: z21.string(),
3437
- service_tier: z21.string().nullish()
3572
+ z23.object({
3573
+ type: z23.literal("response.created"),
3574
+ response: z23.object({
3575
+ id: z23.string(),
3576
+ created_at: z23.number(),
3577
+ model: z23.string(),
3578
+ service_tier: z23.string().nullish()
3438
3579
  })
3439
3580
  }),
3440
- z21.object({
3441
- type: z21.literal("response.output_item.added"),
3442
- output_index: z21.number(),
3443
- item: z21.discriminatedUnion("type", [
3444
- z21.object({
3445
- type: z21.literal("message"),
3446
- id: z21.string(),
3447
- phase: z21.enum(["commentary", "final_answer"]).nullish()
3581
+ z23.object({
3582
+ type: z23.literal("response.output_item.added"),
3583
+ output_index: z23.number(),
3584
+ item: z23.discriminatedUnion("type", [
3585
+ z23.object({
3586
+ type: z23.literal("message"),
3587
+ id: z23.string(),
3588
+ phase: z23.enum(["commentary", "final_answer"]).nullish()
3448
3589
  }),
3449
- z21.object({
3450
- type: z21.literal("reasoning"),
3451
- id: z21.string(),
3452
- encrypted_content: z21.string().nullish()
3590
+ z23.object({
3591
+ type: z23.literal("reasoning"),
3592
+ id: z23.string(),
3593
+ encrypted_content: z23.string().nullish()
3453
3594
  }),
3454
- z21.object({
3455
- type: z21.literal("function_call"),
3456
- id: z21.string(),
3457
- call_id: z21.string(),
3458
- name: z21.string(),
3459
- arguments: z21.string()
3595
+ z23.object({
3596
+ type: z23.literal("function_call"),
3597
+ id: z23.string(),
3598
+ call_id: z23.string(),
3599
+ name: z23.string(),
3600
+ arguments: z23.string()
3460
3601
  }),
3461
- z21.object({
3462
- type: z21.literal("web_search_call"),
3463
- id: z21.string(),
3464
- status: z21.string()
3602
+ z23.object({
3603
+ type: z23.literal("web_search_call"),
3604
+ id: z23.string(),
3605
+ status: z23.string()
3465
3606
  }),
3466
- z21.object({
3467
- type: z21.literal("computer_call"),
3468
- id: z21.string(),
3469
- status: z21.string()
3607
+ z23.object({
3608
+ type: z23.literal("computer_call"),
3609
+ id: z23.string(),
3610
+ status: z23.string()
3470
3611
  }),
3471
- z21.object({
3472
- type: z21.literal("file_search_call"),
3473
- id: z21.string()
3612
+ z23.object({
3613
+ type: z23.literal("file_search_call"),
3614
+ id: z23.string()
3474
3615
  }),
3475
- z21.object({
3476
- type: z21.literal("image_generation_call"),
3477
- id: z21.string()
3616
+ z23.object({
3617
+ type: z23.literal("image_generation_call"),
3618
+ id: z23.string()
3478
3619
  }),
3479
- z21.object({
3480
- type: z21.literal("code_interpreter_call"),
3481
- id: z21.string(),
3482
- container_id: z21.string(),
3483
- code: z21.string().nullable(),
3484
- outputs: z21.array(
3485
- z21.discriminatedUnion("type", [
3486
- z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3487
- z21.object({ type: z21.literal("image"), url: z21.string() })
3620
+ z23.object({
3621
+ type: z23.literal("code_interpreter_call"),
3622
+ id: z23.string(),
3623
+ container_id: z23.string(),
3624
+ code: z23.string().nullable(),
3625
+ outputs: z23.array(
3626
+ z23.discriminatedUnion("type", [
3627
+ z23.object({ type: z23.literal("logs"), logs: z23.string() }),
3628
+ z23.object({ type: z23.literal("image"), url: z23.string() })
3488
3629
  ])
3489
3630
  ).nullable(),
3490
- status: z21.string()
3631
+ status: z23.string()
3491
3632
  }),
3492
- z21.object({
3493
- type: z21.literal("mcp_call"),
3494
- id: z21.string(),
3495
- status: z21.string(),
3496
- approval_request_id: z21.string().nullish()
3633
+ z23.object({
3634
+ type: z23.literal("mcp_call"),
3635
+ id: z23.string(),
3636
+ status: z23.string(),
3637
+ approval_request_id: z23.string().nullish()
3497
3638
  }),
3498
- z21.object({
3499
- type: z21.literal("mcp_list_tools"),
3500
- id: z21.string()
3639
+ z23.object({
3640
+ type: z23.literal("mcp_list_tools"),
3641
+ id: z23.string()
3501
3642
  }),
3502
- z21.object({
3503
- type: z21.literal("mcp_approval_request"),
3504
- id: z21.string()
3643
+ z23.object({
3644
+ type: z23.literal("mcp_approval_request"),
3645
+ id: z23.string()
3505
3646
  }),
3506
- z21.object({
3507
- type: z21.literal("apply_patch_call"),
3508
- id: z21.string(),
3509
- call_id: z21.string(),
3510
- status: z21.enum(["in_progress", "completed"]),
3511
- operation: z21.discriminatedUnion("type", [
3512
- z21.object({
3513
- type: z21.literal("create_file"),
3514
- path: z21.string(),
3515
- diff: z21.string()
3647
+ z23.object({
3648
+ type: z23.literal("apply_patch_call"),
3649
+ id: z23.string(),
3650
+ call_id: z23.string(),
3651
+ status: z23.enum(["in_progress", "completed"]),
3652
+ operation: z23.discriminatedUnion("type", [
3653
+ z23.object({
3654
+ type: z23.literal("create_file"),
3655
+ path: z23.string(),
3656
+ diff: z23.string()
3516
3657
  }),
3517
- z21.object({
3518
- type: z21.literal("delete_file"),
3519
- path: z21.string()
3658
+ z23.object({
3659
+ type: z23.literal("delete_file"),
3660
+ path: z23.string()
3520
3661
  }),
3521
- z21.object({
3522
- type: z21.literal("update_file"),
3523
- path: z21.string(),
3524
- diff: z21.string()
3662
+ z23.object({
3663
+ type: z23.literal("update_file"),
3664
+ path: z23.string(),
3665
+ diff: z23.string()
3525
3666
  })
3526
3667
  ])
3527
3668
  }),
3528
- z21.object({
3529
- type: z21.literal("custom_tool_call"),
3530
- id: z21.string(),
3531
- call_id: z21.string(),
3532
- name: z21.string(),
3533
- input: z21.string()
3669
+ z23.object({
3670
+ type: z23.literal("custom_tool_call"),
3671
+ id: z23.string(),
3672
+ call_id: z23.string(),
3673
+ name: z23.string(),
3674
+ input: z23.string()
3534
3675
  }),
3535
- z21.object({
3536
- type: z21.literal("shell_call"),
3537
- id: z21.string(),
3538
- call_id: z21.string(),
3539
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3540
- action: z21.object({
3541
- commands: z21.array(z21.string())
3676
+ z23.object({
3677
+ type: z23.literal("shell_call"),
3678
+ id: z23.string(),
3679
+ call_id: z23.string(),
3680
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3681
+ action: z23.object({
3682
+ commands: z23.array(z23.string())
3542
3683
  })
3543
3684
  }),
3544
- z21.object({
3545
- type: z21.literal("compaction"),
3546
- id: z21.string(),
3547
- encrypted_content: z21.string().nullish()
3685
+ z23.object({
3686
+ type: z23.literal("compaction"),
3687
+ id: z23.string(),
3688
+ encrypted_content: z23.string().nullish()
3548
3689
  }),
3549
- z21.object({
3550
- type: z21.literal("shell_call_output"),
3551
- id: z21.string(),
3552
- call_id: z21.string(),
3553
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3554
- output: z21.array(
3555
- z21.object({
3556
- stdout: z21.string(),
3557
- stderr: z21.string(),
3558
- outcome: z21.discriminatedUnion("type", [
3559
- z21.object({ type: z21.literal("timeout") }),
3560
- z21.object({
3561
- type: z21.literal("exit"),
3562
- exit_code: z21.number()
3690
+ z23.object({
3691
+ type: z23.literal("shell_call_output"),
3692
+ id: z23.string(),
3693
+ call_id: z23.string(),
3694
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3695
+ output: z23.array(
3696
+ z23.object({
3697
+ stdout: z23.string(),
3698
+ stderr: z23.string(),
3699
+ outcome: z23.discriminatedUnion("type", [
3700
+ z23.object({ type: z23.literal("timeout") }),
3701
+ z23.object({
3702
+ type: z23.literal("exit"),
3703
+ exit_code: z23.number()
3563
3704
  })
3564
3705
  ])
3565
3706
  })
3566
3707
  )
3567
3708
  }),
3568
- z21.object({
3569
- type: z21.literal("tool_search_call"),
3570
- id: z21.string(),
3571
- execution: z21.enum(["server", "client"]),
3572
- call_id: z21.string().nullable(),
3573
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3574
- arguments: z21.unknown()
3709
+ z23.object({
3710
+ type: z23.literal("tool_search_call"),
3711
+ id: z23.string(),
3712
+ execution: z23.enum(["server", "client"]),
3713
+ call_id: z23.string().nullable(),
3714
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3715
+ arguments: z23.unknown()
3575
3716
  }),
3576
- z21.object({
3577
- type: z21.literal("tool_search_output"),
3578
- id: z21.string(),
3579
- execution: z21.enum(["server", "client"]),
3580
- call_id: z21.string().nullable(),
3581
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3582
- tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3717
+ z23.object({
3718
+ type: z23.literal("tool_search_output"),
3719
+ id: z23.string(),
3720
+ execution: z23.enum(["server", "client"]),
3721
+ call_id: z23.string().nullable(),
3722
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3723
+ tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
3583
3724
  })
3584
3725
  ])
3585
3726
  }),
3586
- z21.object({
3587
- type: z21.literal("response.output_item.done"),
3588
- output_index: z21.number(),
3589
- item: z21.discriminatedUnion("type", [
3590
- z21.object({
3591
- type: z21.literal("message"),
3592
- id: z21.string(),
3593
- phase: z21.enum(["commentary", "final_answer"]).nullish()
3727
+ z23.object({
3728
+ type: z23.literal("response.output_item.done"),
3729
+ output_index: z23.number(),
3730
+ item: z23.discriminatedUnion("type", [
3731
+ z23.object({
3732
+ type: z23.literal("message"),
3733
+ id: z23.string(),
3734
+ phase: z23.enum(["commentary", "final_answer"]).nullish()
3594
3735
  }),
3595
- z21.object({
3596
- type: z21.literal("reasoning"),
3597
- id: z21.string(),
3598
- encrypted_content: z21.string().nullish()
3736
+ z23.object({
3737
+ type: z23.literal("reasoning"),
3738
+ id: z23.string(),
3739
+ encrypted_content: z23.string().nullish()
3599
3740
  }),
3600
- z21.object({
3601
- type: z21.literal("function_call"),
3602
- id: z21.string(),
3603
- call_id: z21.string(),
3604
- name: z21.string(),
3605
- arguments: z21.string(),
3606
- status: z21.literal("completed")
3741
+ z23.object({
3742
+ type: z23.literal("function_call"),
3743
+ id: z23.string(),
3744
+ call_id: z23.string(),
3745
+ name: z23.string(),
3746
+ arguments: z23.string(),
3747
+ status: z23.literal("completed")
3607
3748
  }),
3608
- z21.object({
3609
- type: z21.literal("custom_tool_call"),
3610
- id: z21.string(),
3611
- call_id: z21.string(),
3612
- name: z21.string(),
3613
- input: z21.string(),
3614
- status: z21.literal("completed")
3749
+ z23.object({
3750
+ type: z23.literal("custom_tool_call"),
3751
+ id: z23.string(),
3752
+ call_id: z23.string(),
3753
+ name: z23.string(),
3754
+ input: z23.string(),
3755
+ status: z23.literal("completed")
3615
3756
  }),
3616
- z21.object({
3617
- type: z21.literal("code_interpreter_call"),
3618
- id: z21.string(),
3619
- code: z21.string().nullable(),
3620
- container_id: z21.string(),
3621
- outputs: z21.array(
3622
- z21.discriminatedUnion("type", [
3623
- z21.object({ type: z21.literal("logs"), logs: z21.string() }),
3624
- z21.object({ type: z21.literal("image"), url: z21.string() })
3757
+ z23.object({
3758
+ type: z23.literal("code_interpreter_call"),
3759
+ id: z23.string(),
3760
+ code: z23.string().nullable(),
3761
+ container_id: z23.string(),
3762
+ outputs: z23.array(
3763
+ z23.discriminatedUnion("type", [
3764
+ z23.object({ type: z23.literal("logs"), logs: z23.string() }),
3765
+ z23.object({ type: z23.literal("image"), url: z23.string() })
3625
3766
  ])
3626
3767
  ).nullable()
3627
3768
  }),
3628
- z21.object({
3629
- type: z21.literal("image_generation_call"),
3630
- id: z21.string(),
3631
- result: z21.string()
3769
+ z23.object({
3770
+ type: z23.literal("image_generation_call"),
3771
+ id: z23.string(),
3772
+ result: z23.string()
3632
3773
  }),
3633
- z21.object({
3634
- type: z21.literal("web_search_call"),
3635
- id: z21.string(),
3636
- status: z21.string(),
3637
- action: z21.discriminatedUnion("type", [
3638
- z21.object({
3639
- type: z21.literal("search"),
3640
- query: z21.string().nullish(),
3641
- sources: z21.array(
3642
- z21.discriminatedUnion("type", [
3643
- z21.object({ type: z21.literal("url"), url: z21.string() }),
3644
- z21.object({ type: z21.literal("api"), name: z21.string() })
3774
+ z23.object({
3775
+ type: z23.literal("web_search_call"),
3776
+ id: z23.string(),
3777
+ status: z23.string(),
3778
+ action: z23.discriminatedUnion("type", [
3779
+ z23.object({
3780
+ type: z23.literal("search"),
3781
+ query: z23.string().nullish(),
3782
+ sources: z23.array(
3783
+ z23.discriminatedUnion("type", [
3784
+ z23.object({ type: z23.literal("url"), url: z23.string() }),
3785
+ z23.object({ type: z23.literal("api"), name: z23.string() })
3645
3786
  ])
3646
3787
  ).nullish()
3647
3788
  }),
3648
- z21.object({
3649
- type: z21.literal("open_page"),
3650
- url: z21.string().nullish()
3789
+ z23.object({
3790
+ type: z23.literal("open_page"),
3791
+ url: z23.string().nullish()
3651
3792
  }),
3652
- z21.object({
3653
- type: z21.literal("find_in_page"),
3654
- url: z21.string().nullish(),
3655
- pattern: z21.string().nullish()
3793
+ z23.object({
3794
+ type: z23.literal("find_in_page"),
3795
+ url: z23.string().nullish(),
3796
+ pattern: z23.string().nullish()
3656
3797
  })
3657
3798
  ]).nullish()
3658
3799
  }),
3659
- z21.object({
3660
- type: z21.literal("file_search_call"),
3661
- id: z21.string(),
3662
- queries: z21.array(z21.string()),
3663
- results: z21.array(
3664
- z21.object({
3665
- attributes: z21.record(
3666
- z21.string(),
3667
- z21.union([z21.string(), z21.number(), z21.boolean()])
3800
+ z23.object({
3801
+ type: z23.literal("file_search_call"),
3802
+ id: z23.string(),
3803
+ queries: z23.array(z23.string()),
3804
+ results: z23.array(
3805
+ z23.object({
3806
+ attributes: z23.record(
3807
+ z23.string(),
3808
+ z23.union([z23.string(), z23.number(), z23.boolean()])
3668
3809
  ),
3669
- file_id: z21.string(),
3670
- filename: z21.string(),
3671
- score: z21.number(),
3672
- text: z21.string()
3810
+ file_id: z23.string(),
3811
+ filename: z23.string(),
3812
+ score: z23.number(),
3813
+ text: z23.string()
3673
3814
  })
3674
3815
  ).nullish()
3675
3816
  }),
3676
- z21.object({
3677
- type: z21.literal("local_shell_call"),
3678
- id: z21.string(),
3679
- call_id: z21.string(),
3680
- action: z21.object({
3681
- type: z21.literal("exec"),
3682
- command: z21.array(z21.string()),
3683
- timeout_ms: z21.number().optional(),
3684
- user: z21.string().optional(),
3685
- working_directory: z21.string().optional(),
3686
- env: z21.record(z21.string(), z21.string()).optional()
3817
+ z23.object({
3818
+ type: z23.literal("local_shell_call"),
3819
+ id: z23.string(),
3820
+ call_id: z23.string(),
3821
+ action: z23.object({
3822
+ type: z23.literal("exec"),
3823
+ command: z23.array(z23.string()),
3824
+ timeout_ms: z23.number().optional(),
3825
+ user: z23.string().optional(),
3826
+ working_directory: z23.string().optional(),
3827
+ env: z23.record(z23.string(), z23.string()).optional()
3687
3828
  })
3688
3829
  }),
3689
- z21.object({
3690
- type: z21.literal("computer_call"),
3691
- id: z21.string(),
3692
- status: z21.literal("completed")
3830
+ z23.object({
3831
+ type: z23.literal("computer_call"),
3832
+ id: z23.string(),
3833
+ status: z23.literal("completed")
3693
3834
  }),
3694
- z21.object({
3695
- type: z21.literal("mcp_call"),
3696
- id: z21.string(),
3697
- status: z21.string(),
3698
- arguments: z21.string(),
3699
- name: z21.string(),
3700
- server_label: z21.string(),
3701
- output: z21.string().nullish(),
3702
- error: z21.union([
3703
- z21.string(),
3704
- z21.object({
3705
- type: z21.string().optional(),
3706
- code: z21.union([z21.number(), z21.string()]).optional(),
3707
- message: z21.string().optional()
3835
+ z23.object({
3836
+ type: z23.literal("mcp_call"),
3837
+ id: z23.string(),
3838
+ status: z23.string(),
3839
+ arguments: z23.string(),
3840
+ name: z23.string(),
3841
+ server_label: z23.string(),
3842
+ output: z23.string().nullish(),
3843
+ error: z23.union([
3844
+ z23.string(),
3845
+ z23.object({
3846
+ type: z23.string().optional(),
3847
+ code: z23.union([z23.number(), z23.string()]).optional(),
3848
+ message: z23.string().optional()
3708
3849
  }).loose()
3709
3850
  ]).nullish(),
3710
- approval_request_id: z21.string().nullish()
3851
+ approval_request_id: z23.string().nullish()
3711
3852
  }),
3712
- z21.object({
3713
- type: z21.literal("mcp_list_tools"),
3714
- id: z21.string(),
3715
- server_label: z21.string(),
3716
- tools: z21.array(
3717
- z21.object({
3718
- name: z21.string(),
3719
- description: z21.string().optional(),
3720
- input_schema: z21.any(),
3721
- annotations: z21.record(z21.string(), z21.unknown()).optional()
3853
+ z23.object({
3854
+ type: z23.literal("mcp_list_tools"),
3855
+ id: z23.string(),
3856
+ server_label: z23.string(),
3857
+ tools: z23.array(
3858
+ z23.object({
3859
+ name: z23.string(),
3860
+ description: z23.string().optional(),
3861
+ input_schema: z23.any(),
3862
+ annotations: z23.record(z23.string(), z23.unknown()).optional()
3722
3863
  })
3723
3864
  ),
3724
- error: z21.union([
3725
- z21.string(),
3726
- z21.object({
3727
- type: z21.string().optional(),
3728
- code: z21.union([z21.number(), z21.string()]).optional(),
3729
- message: z21.string().optional()
3865
+ error: z23.union([
3866
+ z23.string(),
3867
+ z23.object({
3868
+ type: z23.string().optional(),
3869
+ code: z23.union([z23.number(), z23.string()]).optional(),
3870
+ message: z23.string().optional()
3730
3871
  }).loose()
3731
3872
  ]).optional()
3732
3873
  }),
3733
- z21.object({
3734
- type: z21.literal("mcp_approval_request"),
3735
- id: z21.string(),
3736
- server_label: z21.string(),
3737
- name: z21.string(),
3738
- arguments: z21.string(),
3739
- approval_request_id: z21.string().optional()
3874
+ z23.object({
3875
+ type: z23.literal("mcp_approval_request"),
3876
+ id: z23.string(),
3877
+ server_label: z23.string(),
3878
+ name: z23.string(),
3879
+ arguments: z23.string(),
3880
+ approval_request_id: z23.string().optional()
3740
3881
  }),
3741
- z21.object({
3742
- type: z21.literal("apply_patch_call"),
3743
- id: z21.string(),
3744
- call_id: z21.string(),
3745
- status: z21.enum(["in_progress", "completed"]),
3746
- operation: z21.discriminatedUnion("type", [
3747
- z21.object({
3748
- type: z21.literal("create_file"),
3749
- path: z21.string(),
3750
- diff: z21.string()
3882
+ z23.object({
3883
+ type: z23.literal("apply_patch_call"),
3884
+ id: z23.string(),
3885
+ call_id: z23.string(),
3886
+ status: z23.enum(["in_progress", "completed"]),
3887
+ operation: z23.discriminatedUnion("type", [
3888
+ z23.object({
3889
+ type: z23.literal("create_file"),
3890
+ path: z23.string(),
3891
+ diff: z23.string()
3751
3892
  }),
3752
- z21.object({
3753
- type: z21.literal("delete_file"),
3754
- path: z21.string()
3893
+ z23.object({
3894
+ type: z23.literal("delete_file"),
3895
+ path: z23.string()
3755
3896
  }),
3756
- z21.object({
3757
- type: z21.literal("update_file"),
3758
- path: z21.string(),
3759
- diff: z21.string()
3897
+ z23.object({
3898
+ type: z23.literal("update_file"),
3899
+ path: z23.string(),
3900
+ diff: z23.string()
3760
3901
  })
3761
3902
  ])
3762
3903
  }),
3763
- z21.object({
3764
- type: z21.literal("shell_call"),
3765
- id: z21.string(),
3766
- call_id: z21.string(),
3767
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3768
- action: z21.object({
3769
- commands: z21.array(z21.string())
3904
+ z23.object({
3905
+ type: z23.literal("shell_call"),
3906
+ id: z23.string(),
3907
+ call_id: z23.string(),
3908
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3909
+ action: z23.object({
3910
+ commands: z23.array(z23.string())
3770
3911
  })
3771
3912
  }),
3772
- z21.object({
3773
- type: z21.literal("compaction"),
3774
- id: z21.string(),
3775
- encrypted_content: z21.string()
3913
+ z23.object({
3914
+ type: z23.literal("compaction"),
3915
+ id: z23.string(),
3916
+ encrypted_content: z23.string()
3776
3917
  }),
3777
- z21.object({
3778
- type: z21.literal("shell_call_output"),
3779
- id: z21.string(),
3780
- call_id: z21.string(),
3781
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3782
- output: z21.array(
3783
- z21.object({
3784
- stdout: z21.string(),
3785
- stderr: z21.string(),
3786
- outcome: z21.discriminatedUnion("type", [
3787
- z21.object({ type: z21.literal("timeout") }),
3788
- z21.object({
3789
- type: z21.literal("exit"),
3790
- exit_code: z21.number()
3918
+ z23.object({
3919
+ type: z23.literal("shell_call_output"),
3920
+ id: z23.string(),
3921
+ call_id: z23.string(),
3922
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3923
+ output: z23.array(
3924
+ z23.object({
3925
+ stdout: z23.string(),
3926
+ stderr: z23.string(),
3927
+ outcome: z23.discriminatedUnion("type", [
3928
+ z23.object({ type: z23.literal("timeout") }),
3929
+ z23.object({
3930
+ type: z23.literal("exit"),
3931
+ exit_code: z23.number()
3791
3932
  })
3792
3933
  ])
3793
3934
  })
3794
3935
  )
3795
3936
  }),
3796
- z21.object({
3797
- type: z21.literal("tool_search_call"),
3798
- id: z21.string(),
3799
- execution: z21.enum(["server", "client"]),
3800
- call_id: z21.string().nullable(),
3801
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3802
- arguments: z21.unknown()
3937
+ z23.object({
3938
+ type: z23.literal("tool_search_call"),
3939
+ id: z23.string(),
3940
+ execution: z23.enum(["server", "client"]),
3941
+ call_id: z23.string().nullable(),
3942
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3943
+ arguments: z23.unknown()
3803
3944
  }),
3804
- z21.object({
3805
- type: z21.literal("tool_search_output"),
3806
- id: z21.string(),
3807
- execution: z21.enum(["server", "client"]),
3808
- call_id: z21.string().nullable(),
3809
- status: z21.enum(["in_progress", "completed", "incomplete"]),
3810
- tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
3945
+ z23.object({
3946
+ type: z23.literal("tool_search_output"),
3947
+ id: z23.string(),
3948
+ execution: z23.enum(["server", "client"]),
3949
+ call_id: z23.string().nullable(),
3950
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
3951
+ tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
3811
3952
  })
3812
3953
  ])
3813
3954
  }),
3814
- z21.object({
3815
- type: z21.literal("response.function_call_arguments.delta"),
3816
- item_id: z21.string(),
3817
- output_index: z21.number(),
3818
- delta: z21.string()
3955
+ z23.object({
3956
+ type: z23.literal("response.function_call_arguments.delta"),
3957
+ item_id: z23.string(),
3958
+ output_index: z23.number(),
3959
+ delta: z23.string()
3819
3960
  }),
3820
- z21.object({
3821
- type: z21.literal("response.custom_tool_call_input.delta"),
3822
- item_id: z21.string(),
3823
- output_index: z21.number(),
3824
- delta: z21.string()
3961
+ z23.object({
3962
+ type: z23.literal("response.custom_tool_call_input.delta"),
3963
+ item_id: z23.string(),
3964
+ output_index: z23.number(),
3965
+ delta: z23.string()
3825
3966
  }),
3826
- z21.object({
3827
- type: z21.literal("response.image_generation_call.partial_image"),
3828
- item_id: z21.string(),
3829
- output_index: z21.number(),
3830
- partial_image_b64: z21.string()
3967
+ z23.object({
3968
+ type: z23.literal("response.image_generation_call.partial_image"),
3969
+ item_id: z23.string(),
3970
+ output_index: z23.number(),
3971
+ partial_image_b64: z23.string()
3831
3972
  }),
3832
- z21.object({
3833
- type: z21.literal("response.code_interpreter_call_code.delta"),
3834
- item_id: z21.string(),
3835
- output_index: z21.number(),
3836
- delta: z21.string()
3973
+ z23.object({
3974
+ type: z23.literal("response.code_interpreter_call_code.delta"),
3975
+ item_id: z23.string(),
3976
+ output_index: z23.number(),
3977
+ delta: z23.string()
3837
3978
  }),
3838
- z21.object({
3839
- type: z21.literal("response.code_interpreter_call_code.done"),
3840
- item_id: z21.string(),
3841
- output_index: z21.number(),
3842
- code: z21.string()
3979
+ z23.object({
3980
+ type: z23.literal("response.code_interpreter_call_code.done"),
3981
+ item_id: z23.string(),
3982
+ output_index: z23.number(),
3983
+ code: z23.string()
3843
3984
  }),
3844
- z21.object({
3845
- type: z21.literal("response.output_text.annotation.added"),
3846
- annotation: z21.discriminatedUnion("type", [
3847
- z21.object({
3848
- type: z21.literal("url_citation"),
3849
- start_index: z21.number(),
3850
- end_index: z21.number(),
3851
- url: z21.string(),
3852
- title: z21.string()
3985
+ z23.object({
3986
+ type: z23.literal("response.output_text.annotation.added"),
3987
+ annotation: z23.discriminatedUnion("type", [
3988
+ z23.object({
3989
+ type: z23.literal("url_citation"),
3990
+ start_index: z23.number(),
3991
+ end_index: z23.number(),
3992
+ url: z23.string(),
3993
+ title: z23.string()
3853
3994
  }),
3854
- z21.object({
3855
- type: z21.literal("file_citation"),
3856
- file_id: z21.string(),
3857
- filename: z21.string(),
3858
- index: z21.number()
3995
+ z23.object({
3996
+ type: z23.literal("file_citation"),
3997
+ file_id: z23.string(),
3998
+ filename: z23.string(),
3999
+ index: z23.number()
3859
4000
  }),
3860
- z21.object({
3861
- type: z21.literal("container_file_citation"),
3862
- container_id: z21.string(),
3863
- file_id: z21.string(),
3864
- filename: z21.string(),
3865
- start_index: z21.number(),
3866
- end_index: z21.number()
4001
+ z23.object({
4002
+ type: z23.literal("container_file_citation"),
4003
+ container_id: z23.string(),
4004
+ file_id: z23.string(),
4005
+ filename: z23.string(),
4006
+ start_index: z23.number(),
4007
+ end_index: z23.number()
3867
4008
  }),
3868
- z21.object({
3869
- type: z21.literal("file_path"),
3870
- file_id: z21.string(),
3871
- index: z21.number()
4009
+ z23.object({
4010
+ type: z23.literal("file_path"),
4011
+ file_id: z23.string(),
4012
+ index: z23.number()
3872
4013
  })
3873
4014
  ])
3874
4015
  }),
3875
- z21.object({
3876
- type: z21.literal("response.reasoning_summary_part.added"),
3877
- item_id: z21.string(),
3878
- summary_index: z21.number()
4016
+ z23.object({
4017
+ type: z23.literal("response.reasoning_summary_part.added"),
4018
+ item_id: z23.string(),
4019
+ summary_index: z23.number()
3879
4020
  }),
3880
- z21.object({
3881
- type: z21.literal("response.reasoning_summary_text.delta"),
3882
- item_id: z21.string(),
3883
- summary_index: z21.number(),
3884
- delta: z21.string()
4021
+ z23.object({
4022
+ type: z23.literal("response.reasoning_summary_text.delta"),
4023
+ item_id: z23.string(),
4024
+ summary_index: z23.number(),
4025
+ delta: z23.string()
3885
4026
  }),
3886
- z21.object({
3887
- type: z21.literal("response.reasoning_summary_part.done"),
3888
- item_id: z21.string(),
3889
- summary_index: z21.number()
4027
+ z23.object({
4028
+ type: z23.literal("response.reasoning_summary_part.done"),
4029
+ item_id: z23.string(),
4030
+ summary_index: z23.number()
3890
4031
  }),
3891
- z21.object({
3892
- type: z21.literal("response.apply_patch_call_operation_diff.delta"),
3893
- item_id: z21.string(),
3894
- output_index: z21.number(),
3895
- delta: z21.string(),
3896
- obfuscation: z21.string().nullish()
4032
+ z23.object({
4033
+ type: z23.literal("response.apply_patch_call_operation_diff.delta"),
4034
+ item_id: z23.string(),
4035
+ output_index: z23.number(),
4036
+ delta: z23.string(),
4037
+ obfuscation: z23.string().nullish()
3897
4038
  }),
3898
- z21.object({
3899
- type: z21.literal("response.apply_patch_call_operation_diff.done"),
3900
- item_id: z21.string(),
3901
- output_index: z21.number(),
3902
- diff: z21.string()
4039
+ z23.object({
4040
+ type: z23.literal("response.apply_patch_call_operation_diff.done"),
4041
+ item_id: z23.string(),
4042
+ output_index: z23.number(),
4043
+ diff: z23.string()
3903
4044
  }),
3904
- z21.object({
3905
- type: z21.literal("error"),
3906
- sequence_number: z21.number(),
3907
- error: z21.object({
3908
- type: z21.string(),
3909
- code: z21.string(),
3910
- message: z21.string(),
3911
- param: z21.string().nullish()
4045
+ z23.object({
4046
+ type: z23.literal("error"),
4047
+ sequence_number: z23.number(),
4048
+ error: z23.object({
4049
+ type: z23.string(),
4050
+ code: z23.string(),
4051
+ message: z23.string(),
4052
+ param: z23.string().nullish()
3912
4053
  })
3913
4054
  }),
3914
- z21.object({ type: z21.string() }).loose().transform((value) => ({
4055
+ z23.object({ type: z23.string() }).loose().transform((value) => ({
3915
4056
  type: "unknown_chunk",
3916
4057
  message: value.type
3917
4058
  }))
@@ -3919,315 +4060,315 @@ var openaiResponsesChunkSchema = lazySchema19(
3919
4060
  ])
3920
4061
  )
3921
4062
  );
3922
- var openaiResponsesResponseSchema = lazySchema19(
3923
- () => zodSchema19(
3924
- z21.object({
3925
- id: z21.string().optional(),
3926
- created_at: z21.number().optional(),
3927
- error: z21.object({
3928
- message: z21.string(),
3929
- type: z21.string(),
3930
- param: z21.string().nullish(),
3931
- code: z21.string()
4063
+ var openaiResponsesResponseSchema = lazySchema21(
4064
+ () => zodSchema21(
4065
+ z23.object({
4066
+ id: z23.string().optional(),
4067
+ created_at: z23.number().optional(),
4068
+ error: z23.object({
4069
+ message: z23.string(),
4070
+ type: z23.string(),
4071
+ param: z23.string().nullish(),
4072
+ code: z23.string()
3932
4073
  }).nullish(),
3933
- model: z21.string().optional(),
3934
- output: z21.array(
3935
- z21.discriminatedUnion("type", [
3936
- z21.object({
3937
- type: z21.literal("message"),
3938
- role: z21.literal("assistant"),
3939
- id: z21.string(),
3940
- phase: z21.enum(["commentary", "final_answer"]).nullish(),
3941
- content: z21.array(
3942
- z21.object({
3943
- type: z21.literal("output_text"),
3944
- text: z21.string(),
3945
- logprobs: z21.array(
3946
- z21.object({
3947
- token: z21.string(),
3948
- logprob: z21.number(),
3949
- top_logprobs: z21.array(
3950
- z21.object({
3951
- token: z21.string(),
3952
- logprob: z21.number()
4074
+ model: z23.string().optional(),
4075
+ output: z23.array(
4076
+ z23.discriminatedUnion("type", [
4077
+ z23.object({
4078
+ type: z23.literal("message"),
4079
+ role: z23.literal("assistant"),
4080
+ id: z23.string(),
4081
+ phase: z23.enum(["commentary", "final_answer"]).nullish(),
4082
+ content: z23.array(
4083
+ z23.object({
4084
+ type: z23.literal("output_text"),
4085
+ text: z23.string(),
4086
+ logprobs: z23.array(
4087
+ z23.object({
4088
+ token: z23.string(),
4089
+ logprob: z23.number(),
4090
+ top_logprobs: z23.array(
4091
+ z23.object({
4092
+ token: z23.string(),
4093
+ logprob: z23.number()
3953
4094
  })
3954
4095
  )
3955
4096
  })
3956
4097
  ).nullish(),
3957
- annotations: z21.array(
3958
- z21.discriminatedUnion("type", [
3959
- z21.object({
3960
- type: z21.literal("url_citation"),
3961
- start_index: z21.number(),
3962
- end_index: z21.number(),
3963
- url: z21.string(),
3964
- title: z21.string()
4098
+ annotations: z23.array(
4099
+ z23.discriminatedUnion("type", [
4100
+ z23.object({
4101
+ type: z23.literal("url_citation"),
4102
+ start_index: z23.number(),
4103
+ end_index: z23.number(),
4104
+ url: z23.string(),
4105
+ title: z23.string()
3965
4106
  }),
3966
- z21.object({
3967
- type: z21.literal("file_citation"),
3968
- file_id: z21.string(),
3969
- filename: z21.string(),
3970
- index: z21.number()
4107
+ z23.object({
4108
+ type: z23.literal("file_citation"),
4109
+ file_id: z23.string(),
4110
+ filename: z23.string(),
4111
+ index: z23.number()
3971
4112
  }),
3972
- z21.object({
3973
- type: z21.literal("container_file_citation"),
3974
- container_id: z21.string(),
3975
- file_id: z21.string(),
3976
- filename: z21.string(),
3977
- start_index: z21.number(),
3978
- end_index: z21.number()
4113
+ z23.object({
4114
+ type: z23.literal("container_file_citation"),
4115
+ container_id: z23.string(),
4116
+ file_id: z23.string(),
4117
+ filename: z23.string(),
4118
+ start_index: z23.number(),
4119
+ end_index: z23.number()
3979
4120
  }),
3980
- z21.object({
3981
- type: z21.literal("file_path"),
3982
- file_id: z21.string(),
3983
- index: z21.number()
4121
+ z23.object({
4122
+ type: z23.literal("file_path"),
4123
+ file_id: z23.string(),
4124
+ index: z23.number()
3984
4125
  })
3985
4126
  ])
3986
4127
  )
3987
4128
  })
3988
4129
  )
3989
4130
  }),
3990
- z21.object({
3991
- type: z21.literal("web_search_call"),
3992
- id: z21.string(),
3993
- status: z21.string(),
3994
- action: z21.discriminatedUnion("type", [
3995
- z21.object({
3996
- type: z21.literal("search"),
3997
- query: z21.string().nullish(),
3998
- sources: z21.array(
3999
- z21.discriminatedUnion("type", [
4000
- z21.object({ type: z21.literal("url"), url: z21.string() }),
4001
- z21.object({
4002
- type: z21.literal("api"),
4003
- name: z21.string()
4131
+ z23.object({
4132
+ type: z23.literal("web_search_call"),
4133
+ id: z23.string(),
4134
+ status: z23.string(),
4135
+ action: z23.discriminatedUnion("type", [
4136
+ z23.object({
4137
+ type: z23.literal("search"),
4138
+ query: z23.string().nullish(),
4139
+ sources: z23.array(
4140
+ z23.discriminatedUnion("type", [
4141
+ z23.object({ type: z23.literal("url"), url: z23.string() }),
4142
+ z23.object({
4143
+ type: z23.literal("api"),
4144
+ name: z23.string()
4004
4145
  })
4005
4146
  ])
4006
4147
  ).nullish()
4007
4148
  }),
4008
- z21.object({
4009
- type: z21.literal("open_page"),
4010
- url: z21.string().nullish()
4149
+ z23.object({
4150
+ type: z23.literal("open_page"),
4151
+ url: z23.string().nullish()
4011
4152
  }),
4012
- z21.object({
4013
- type: z21.literal("find_in_page"),
4014
- url: z21.string().nullish(),
4015
- pattern: z21.string().nullish()
4153
+ z23.object({
4154
+ type: z23.literal("find_in_page"),
4155
+ url: z23.string().nullish(),
4156
+ pattern: z23.string().nullish()
4016
4157
  })
4017
4158
  ]).nullish()
4018
4159
  }),
4019
- z21.object({
4020
- type: z21.literal("file_search_call"),
4021
- id: z21.string(),
4022
- queries: z21.array(z21.string()),
4023
- results: z21.array(
4024
- z21.object({
4025
- attributes: z21.record(
4026
- z21.string(),
4027
- z21.union([z21.string(), z21.number(), z21.boolean()])
4160
+ z23.object({
4161
+ type: z23.literal("file_search_call"),
4162
+ id: z23.string(),
4163
+ queries: z23.array(z23.string()),
4164
+ results: z23.array(
4165
+ z23.object({
4166
+ attributes: z23.record(
4167
+ z23.string(),
4168
+ z23.union([z23.string(), z23.number(), z23.boolean()])
4028
4169
  ),
4029
- file_id: z21.string(),
4030
- filename: z21.string(),
4031
- score: z21.number(),
4032
- text: z21.string()
4170
+ file_id: z23.string(),
4171
+ filename: z23.string(),
4172
+ score: z23.number(),
4173
+ text: z23.string()
4033
4174
  })
4034
4175
  ).nullish()
4035
4176
  }),
4036
- z21.object({
4037
- type: z21.literal("code_interpreter_call"),
4038
- id: z21.string(),
4039
- code: z21.string().nullable(),
4040
- container_id: z21.string(),
4041
- outputs: z21.array(
4042
- z21.discriminatedUnion("type", [
4043
- z21.object({ type: z21.literal("logs"), logs: z21.string() }),
4044
- z21.object({ type: z21.literal("image"), url: z21.string() })
4177
+ z23.object({
4178
+ type: z23.literal("code_interpreter_call"),
4179
+ id: z23.string(),
4180
+ code: z23.string().nullable(),
4181
+ container_id: z23.string(),
4182
+ outputs: z23.array(
4183
+ z23.discriminatedUnion("type", [
4184
+ z23.object({ type: z23.literal("logs"), logs: z23.string() }),
4185
+ z23.object({ type: z23.literal("image"), url: z23.string() })
4045
4186
  ])
4046
4187
  ).nullable()
4047
4188
  }),
4048
- z21.object({
4049
- type: z21.literal("image_generation_call"),
4050
- id: z21.string(),
4051
- result: z21.string()
4189
+ z23.object({
4190
+ type: z23.literal("image_generation_call"),
4191
+ id: z23.string(),
4192
+ result: z23.string()
4052
4193
  }),
4053
- z21.object({
4054
- type: z21.literal("local_shell_call"),
4055
- id: z21.string(),
4056
- call_id: z21.string(),
4057
- action: z21.object({
4058
- type: z21.literal("exec"),
4059
- command: z21.array(z21.string()),
4060
- timeout_ms: z21.number().optional(),
4061
- user: z21.string().optional(),
4062
- working_directory: z21.string().optional(),
4063
- env: z21.record(z21.string(), z21.string()).optional()
4194
+ z23.object({
4195
+ type: z23.literal("local_shell_call"),
4196
+ id: z23.string(),
4197
+ call_id: z23.string(),
4198
+ action: z23.object({
4199
+ type: z23.literal("exec"),
4200
+ command: z23.array(z23.string()),
4201
+ timeout_ms: z23.number().optional(),
4202
+ user: z23.string().optional(),
4203
+ working_directory: z23.string().optional(),
4204
+ env: z23.record(z23.string(), z23.string()).optional()
4064
4205
  })
4065
4206
  }),
4066
- z21.object({
4067
- type: z21.literal("function_call"),
4068
- call_id: z21.string(),
4069
- name: z21.string(),
4070
- arguments: z21.string(),
4071
- id: z21.string()
4207
+ z23.object({
4208
+ type: z23.literal("function_call"),
4209
+ call_id: z23.string(),
4210
+ name: z23.string(),
4211
+ arguments: z23.string(),
4212
+ id: z23.string()
4072
4213
  }),
4073
- z21.object({
4074
- type: z21.literal("custom_tool_call"),
4075
- call_id: z21.string(),
4076
- name: z21.string(),
4077
- input: z21.string(),
4078
- id: z21.string()
4214
+ z23.object({
4215
+ type: z23.literal("custom_tool_call"),
4216
+ call_id: z23.string(),
4217
+ name: z23.string(),
4218
+ input: z23.string(),
4219
+ id: z23.string()
4079
4220
  }),
4080
- z21.object({
4081
- type: z21.literal("computer_call"),
4082
- id: z21.string(),
4083
- status: z21.string().optional()
4221
+ z23.object({
4222
+ type: z23.literal("computer_call"),
4223
+ id: z23.string(),
4224
+ status: z23.string().optional()
4084
4225
  }),
4085
- z21.object({
4086
- type: z21.literal("reasoning"),
4087
- id: z21.string(),
4088
- encrypted_content: z21.string().nullish(),
4089
- summary: z21.array(
4090
- z21.object({
4091
- type: z21.literal("summary_text"),
4092
- text: z21.string()
4226
+ z23.object({
4227
+ type: z23.literal("reasoning"),
4228
+ id: z23.string(),
4229
+ encrypted_content: z23.string().nullish(),
4230
+ summary: z23.array(
4231
+ z23.object({
4232
+ type: z23.literal("summary_text"),
4233
+ text: z23.string()
4093
4234
  })
4094
4235
  )
4095
4236
  }),
4096
- z21.object({
4097
- type: z21.literal("mcp_call"),
4098
- id: z21.string(),
4099
- status: z21.string(),
4100
- arguments: z21.string(),
4101
- name: z21.string(),
4102
- server_label: z21.string(),
4103
- output: z21.string().nullish(),
4104
- error: z21.union([
4105
- z21.string(),
4106
- z21.object({
4107
- type: z21.string().optional(),
4108
- code: z21.union([z21.number(), z21.string()]).optional(),
4109
- message: z21.string().optional()
4237
+ z23.object({
4238
+ type: z23.literal("mcp_call"),
4239
+ id: z23.string(),
4240
+ status: z23.string(),
4241
+ arguments: z23.string(),
4242
+ name: z23.string(),
4243
+ server_label: z23.string(),
4244
+ output: z23.string().nullish(),
4245
+ error: z23.union([
4246
+ z23.string(),
4247
+ z23.object({
4248
+ type: z23.string().optional(),
4249
+ code: z23.union([z23.number(), z23.string()]).optional(),
4250
+ message: z23.string().optional()
4110
4251
  }).loose()
4111
4252
  ]).nullish(),
4112
- approval_request_id: z21.string().nullish()
4253
+ approval_request_id: z23.string().nullish()
4113
4254
  }),
4114
- z21.object({
4115
- type: z21.literal("mcp_list_tools"),
4116
- id: z21.string(),
4117
- server_label: z21.string(),
4118
- tools: z21.array(
4119
- z21.object({
4120
- name: z21.string(),
4121
- description: z21.string().optional(),
4122
- input_schema: z21.any(),
4123
- annotations: z21.record(z21.string(), z21.unknown()).optional()
4255
+ z23.object({
4256
+ type: z23.literal("mcp_list_tools"),
4257
+ id: z23.string(),
4258
+ server_label: z23.string(),
4259
+ tools: z23.array(
4260
+ z23.object({
4261
+ name: z23.string(),
4262
+ description: z23.string().optional(),
4263
+ input_schema: z23.any(),
4264
+ annotations: z23.record(z23.string(), z23.unknown()).optional()
4124
4265
  })
4125
4266
  ),
4126
- error: z21.union([
4127
- z21.string(),
4128
- z21.object({
4129
- type: z21.string().optional(),
4130
- code: z21.union([z21.number(), z21.string()]).optional(),
4131
- message: z21.string().optional()
4267
+ error: z23.union([
4268
+ z23.string(),
4269
+ z23.object({
4270
+ type: z23.string().optional(),
4271
+ code: z23.union([z23.number(), z23.string()]).optional(),
4272
+ message: z23.string().optional()
4132
4273
  }).loose()
4133
4274
  ]).optional()
4134
4275
  }),
4135
- z21.object({
4136
- type: z21.literal("mcp_approval_request"),
4137
- id: z21.string(),
4138
- server_label: z21.string(),
4139
- name: z21.string(),
4140
- arguments: z21.string(),
4141
- approval_request_id: z21.string().optional()
4276
+ z23.object({
4277
+ type: z23.literal("mcp_approval_request"),
4278
+ id: z23.string(),
4279
+ server_label: z23.string(),
4280
+ name: z23.string(),
4281
+ arguments: z23.string(),
4282
+ approval_request_id: z23.string().optional()
4142
4283
  }),
4143
- z21.object({
4144
- type: z21.literal("apply_patch_call"),
4145
- id: z21.string(),
4146
- call_id: z21.string(),
4147
- status: z21.enum(["in_progress", "completed"]),
4148
- operation: z21.discriminatedUnion("type", [
4149
- z21.object({
4150
- type: z21.literal("create_file"),
4151
- path: z21.string(),
4152
- diff: z21.string()
4284
+ z23.object({
4285
+ type: z23.literal("apply_patch_call"),
4286
+ id: z23.string(),
4287
+ call_id: z23.string(),
4288
+ status: z23.enum(["in_progress", "completed"]),
4289
+ operation: z23.discriminatedUnion("type", [
4290
+ z23.object({
4291
+ type: z23.literal("create_file"),
4292
+ path: z23.string(),
4293
+ diff: z23.string()
4153
4294
  }),
4154
- z21.object({
4155
- type: z21.literal("delete_file"),
4156
- path: z21.string()
4295
+ z23.object({
4296
+ type: z23.literal("delete_file"),
4297
+ path: z23.string()
4157
4298
  }),
4158
- z21.object({
4159
- type: z21.literal("update_file"),
4160
- path: z21.string(),
4161
- diff: z21.string()
4299
+ z23.object({
4300
+ type: z23.literal("update_file"),
4301
+ path: z23.string(),
4302
+ diff: z23.string()
4162
4303
  })
4163
4304
  ])
4164
4305
  }),
4165
- z21.object({
4166
- type: z21.literal("shell_call"),
4167
- id: z21.string(),
4168
- call_id: z21.string(),
4169
- status: z21.enum(["in_progress", "completed", "incomplete"]),
4170
- action: z21.object({
4171
- commands: z21.array(z21.string())
4306
+ z23.object({
4307
+ type: z23.literal("shell_call"),
4308
+ id: z23.string(),
4309
+ call_id: z23.string(),
4310
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
4311
+ action: z23.object({
4312
+ commands: z23.array(z23.string())
4172
4313
  })
4173
4314
  }),
4174
- z21.object({
4175
- type: z21.literal("compaction"),
4176
- id: z21.string(),
4177
- encrypted_content: z21.string()
4315
+ z23.object({
4316
+ type: z23.literal("compaction"),
4317
+ id: z23.string(),
4318
+ encrypted_content: z23.string()
4178
4319
  }),
4179
- z21.object({
4180
- type: z21.literal("shell_call_output"),
4181
- id: z21.string(),
4182
- call_id: z21.string(),
4183
- status: z21.enum(["in_progress", "completed", "incomplete"]),
4184
- output: z21.array(
4185
- z21.object({
4186
- stdout: z21.string(),
4187
- stderr: z21.string(),
4188
- outcome: z21.discriminatedUnion("type", [
4189
- z21.object({ type: z21.literal("timeout") }),
4190
- z21.object({
4191
- type: z21.literal("exit"),
4192
- exit_code: z21.number()
4320
+ z23.object({
4321
+ type: z23.literal("shell_call_output"),
4322
+ id: z23.string(),
4323
+ call_id: z23.string(),
4324
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
4325
+ output: z23.array(
4326
+ z23.object({
4327
+ stdout: z23.string(),
4328
+ stderr: z23.string(),
4329
+ outcome: z23.discriminatedUnion("type", [
4330
+ z23.object({ type: z23.literal("timeout") }),
4331
+ z23.object({
4332
+ type: z23.literal("exit"),
4333
+ exit_code: z23.number()
4193
4334
  })
4194
4335
  ])
4195
4336
  })
4196
4337
  )
4197
4338
  }),
4198
- z21.object({
4199
- type: z21.literal("tool_search_call"),
4200
- id: z21.string(),
4201
- execution: z21.enum(["server", "client"]),
4202
- call_id: z21.string().nullable(),
4203
- status: z21.enum(["in_progress", "completed", "incomplete"]),
4204
- arguments: z21.unknown()
4339
+ z23.object({
4340
+ type: z23.literal("tool_search_call"),
4341
+ id: z23.string(),
4342
+ execution: z23.enum(["server", "client"]),
4343
+ call_id: z23.string().nullable(),
4344
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
4345
+ arguments: z23.unknown()
4205
4346
  }),
4206
- z21.object({
4207
- type: z21.literal("tool_search_output"),
4208
- id: z21.string(),
4209
- execution: z21.enum(["server", "client"]),
4210
- call_id: z21.string().nullable(),
4211
- status: z21.enum(["in_progress", "completed", "incomplete"]),
4212
- tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
4347
+ z23.object({
4348
+ type: z23.literal("tool_search_output"),
4349
+ id: z23.string(),
4350
+ execution: z23.enum(["server", "client"]),
4351
+ call_id: z23.string().nullable(),
4352
+ status: z23.enum(["in_progress", "completed", "incomplete"]),
4353
+ tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
4213
4354
  })
4214
4355
  ])
4215
4356
  ).optional(),
4216
- service_tier: z21.string().nullish(),
4217
- incomplete_details: z21.object({ reason: z21.string() }).nullish(),
4218
- usage: z21.object({
4219
- input_tokens: z21.number(),
4220
- input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
4221
- output_tokens: z21.number(),
4222
- output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
4357
+ service_tier: z23.string().nullish(),
4358
+ incomplete_details: z23.object({ reason: z23.string() }).nullish(),
4359
+ usage: z23.object({
4360
+ input_tokens: z23.number(),
4361
+ input_tokens_details: z23.object({ cached_tokens: z23.number().nullish() }).nullish(),
4362
+ output_tokens: z23.number(),
4363
+ output_tokens_details: z23.object({ reasoning_tokens: z23.number().nullish() }).nullish()
4223
4364
  }).optional()
4224
4365
  })
4225
4366
  )
4226
4367
  );
4227
4368
 
4228
4369
  // src/responses/openai-responses-options.ts
4229
- import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
4230
- import { z as z22 } from "zod/v4";
4370
+ import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
4371
+ import { z as z24 } from "zod/v4";
4231
4372
  var TOP_LOGPROBS_MAX = 20;
4232
4373
  var openaiResponsesReasoningModelIds = [
4233
4374
  "o1",
@@ -4292,9 +4433,9 @@ var openaiResponsesModelIds = [
4292
4433
  "gpt-5-chat-latest",
4293
4434
  ...openaiResponsesReasoningModelIds
4294
4435
  ];
4295
- var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4296
- () => zodSchema20(
4297
- z22.object({
4436
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema22(
4437
+ () => zodSchema22(
4438
+ z24.object({
4298
4439
  /**
4299
4440
  * The ID of the OpenAI Conversation to continue.
4300
4441
  * You must create a conversation first via the OpenAI API.
@@ -4302,13 +4443,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4302
4443
  * Defaults to `undefined`.
4303
4444
  * @see https://platform.openai.com/docs/api-reference/conversations/create
4304
4445
  */
4305
- conversation: z22.string().nullish(),
4446
+ conversation: z24.string().nullish(),
4306
4447
  /**
4307
4448
  * The set of extra fields to include in the response (advanced, usually not needed).
4308
4449
  * Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
4309
4450
  */
4310
- include: z22.array(
4311
- z22.enum([
4451
+ include: z24.array(
4452
+ z24.enum([
4312
4453
  "reasoning.encrypted_content",
4313
4454
  // handled internally by default, only needed for unknown reasoning models
4314
4455
  "file_search_call.results",
@@ -4320,7 +4461,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4320
4461
  * They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
4321
4462
  * Defaults to `undefined`.
4322
4463
  */
4323
- instructions: z22.string().nullish(),
4464
+ instructions: z24.string().nullish(),
4324
4465
  /**
4325
4466
  * Return the log probabilities of the tokens. Including logprobs will increase
4326
4467
  * the response size and can slow down response times. However, it can
@@ -4335,30 +4476,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4335
4476
  * @see https://platform.openai.com/docs/api-reference/responses/create
4336
4477
  * @see https://cookbook.openai.com/examples/using_logprobs
4337
4478
  */
4338
- logprobs: z22.union([z22.boolean(), z22.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4479
+ logprobs: z24.union([z24.boolean(), z24.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
4339
4480
  /**
4340
4481
  * The maximum number of total calls to built-in tools that can be processed in a response.
4341
4482
  * This maximum number applies across all built-in tool calls, not per individual tool.
4342
4483
  * Any further attempts to call a tool by the model will be ignored.
4343
4484
  */
4344
- maxToolCalls: z22.number().nullish(),
4485
+ maxToolCalls: z24.number().nullish(),
4345
4486
  /**
4346
4487
  * Additional metadata to store with the generation.
4347
4488
  */
4348
- metadata: z22.any().nullish(),
4489
+ metadata: z24.any().nullish(),
4349
4490
  /**
4350
4491
  * Whether to use parallel tool calls. Defaults to `true`.
4351
4492
  */
4352
- parallelToolCalls: z22.boolean().nullish(),
4493
+ parallelToolCalls: z24.boolean().nullish(),
4353
4494
  /**
4354
4495
  * The ID of the previous response. You can use it to continue a conversation.
4355
4496
  * Defaults to `undefined`.
4356
4497
  */
4357
- previousResponseId: z22.string().nullish(),
4498
+ previousResponseId: z24.string().nullish(),
4358
4499
  /**
4359
4500
  * Sets a cache key to tie this prompt to cached prefixes for better caching performance.
4360
4501
  */
4361
- promptCacheKey: z22.string().nullish(),
4502
+ promptCacheKey: z24.string().nullish(),
4362
4503
  /**
4363
4504
  * The retention policy for the prompt cache.
4364
4505
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -4367,7 +4508,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4367
4508
  *
4368
4509
  * @default 'in_memory'
4369
4510
  */
4370
- promptCacheRetention: z22.enum(["in_memory", "24h"]).nullish(),
4511
+ promptCacheRetention: z24.enum(["in_memory", "24h"]).nullish(),
4371
4512
  /**
4372
4513
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
4373
4514
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
@@ -4378,17 +4519,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4378
4519
  * OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
4379
4520
  * an error.
4380
4521
  */
4381
- reasoningEffort: z22.string().nullish(),
4522
+ reasoningEffort: z24.string().nullish(),
4382
4523
  /**
4383
4524
  * Controls reasoning summary output from the model.
4384
4525
  * Set to "auto" to automatically receive the richest level available,
4385
4526
  * or "detailed" for comprehensive summaries.
4386
4527
  */
4387
- reasoningSummary: z22.string().nullish(),
4528
+ reasoningSummary: z24.string().nullish(),
4388
4529
  /**
4389
4530
  * The identifier for safety monitoring and tracking.
4390
4531
  */
4391
- safetyIdentifier: z22.string().nullish(),
4532
+ safetyIdentifier: z24.string().nullish(),
4392
4533
  /**
4393
4534
  * Service tier for the request.
4394
4535
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
@@ -4396,34 +4537,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4396
4537
  *
4397
4538
  * Defaults to 'auto'.
4398
4539
  */
4399
- serviceTier: z22.enum(["auto", "flex", "priority", "default"]).nullish(),
4540
+ serviceTier: z24.enum(["auto", "flex", "priority", "default"]).nullish(),
4400
4541
  /**
4401
4542
  * Whether to store the generation. Defaults to `true`.
4402
4543
  */
4403
- store: z22.boolean().nullish(),
4544
+ store: z24.boolean().nullish(),
4404
4545
  /**
4405
4546
  * Whether to use strict JSON schema validation.
4406
4547
  * Defaults to `true`.
4407
4548
  */
4408
- strictJsonSchema: z22.boolean().nullish(),
4549
+ strictJsonSchema: z24.boolean().nullish(),
4409
4550
  /**
4410
4551
  * Controls the verbosity of the model's responses. Lower values ('low') will result
4411
4552
  * in more concise responses, while higher values ('high') will result in more verbose responses.
4412
4553
  * Valid values: 'low', 'medium', 'high'.
4413
4554
  */
4414
- textVerbosity: z22.enum(["low", "medium", "high"]).nullish(),
4555
+ textVerbosity: z24.enum(["low", "medium", "high"]).nullish(),
4415
4556
  /**
4416
4557
  * Controls output truncation. 'auto' (default) performs truncation automatically;
4417
4558
  * 'disabled' turns truncation off.
4418
4559
  */
4419
- truncation: z22.enum(["auto", "disabled"]).nullish(),
4560
+ truncation: z24.enum(["auto", "disabled"]).nullish(),
4420
4561
  /**
4421
4562
  * A unique identifier representing your end-user, which can help OpenAI to
4422
4563
  * monitor and detect abuse.
4423
4564
  * Defaults to `undefined`.
4424
4565
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
4425
4566
  */
4426
- user: z22.string().nullish(),
4567
+ user: z24.string().nullish(),
4427
4568
  /**
4428
4569
  * Override the system message mode for this model.
4429
4570
  * - 'system': Use the 'system' role for system messages (default for most models)
@@ -4432,7 +4573,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4432
4573
  *
4433
4574
  * If not specified, the mode is automatically determined based on the model.
4434
4575
  */
4435
- systemMessageMode: z22.enum(["system", "developer", "remove"]).optional(),
4576
+ systemMessageMode: z24.enum(["system", "developer", "remove"]).optional(),
4436
4577
  /**
4437
4578
  * Force treating this model as a reasoning model.
4438
4579
  *
@@ -4442,14 +4583,14 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
4442
4583
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
4443
4584
  * and defaults `systemMessageMode` to `developer` unless overridden.
4444
4585
  */
4445
- forceReasoning: z22.boolean().optional(),
4586
+ forceReasoning: z24.boolean().optional(),
4446
4587
  /**
4447
4588
  * Enable server-side context management (compaction).
4448
4589
  */
4449
- contextManagement: z22.array(
4450
- z22.object({
4451
- type: z22.literal("compaction"),
4452
- compactThreshold: z22.number()
4590
+ contextManagement: z24.array(
4591
+ z24.object({
4592
+ type: z24.literal("compaction"),
4593
+ compactThreshold: z24.number()
4453
4594
  })
4454
4595
  ).nullish()
4455
4596
  })
@@ -4794,13 +4935,13 @@ var OpenAIResponsesLanguageModel = class {
4794
4935
  warnings.push({ type: "unsupported", feature: "stopSequences" });
4795
4936
  }
4796
4937
  const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
4797
- let openaiOptions = await parseProviderOptions5({
4938
+ let openaiOptions = await parseProviderOptions6({
4798
4939
  provider: providerOptionsName,
4799
4940
  providerOptions,
4800
4941
  schema: openaiLanguageModelResponsesOptionsSchema
4801
4942
  });
4802
4943
  if (openaiOptions == null && providerOptionsName !== "openai") {
4803
- openaiOptions = await parseProviderOptions5({
4944
+ openaiOptions = await parseProviderOptions6({
4804
4945
  provider: "openai",
4805
4946
  providerOptions,
4806
4947
  schema: openaiLanguageModelResponsesOptionsSchema
@@ -5031,10 +5172,10 @@ var OpenAIResponsesLanguageModel = class {
5031
5172
  rawValue: rawResponse
5032
5173
  } = await postJsonToApi5({
5033
5174
  url,
5034
- headers: combineHeaders5(this.config.headers(), options.headers),
5175
+ headers: combineHeaders6(this.config.headers(), options.headers),
5035
5176
  body,
5036
5177
  failedResponseHandler: openaiFailedResponseHandler,
5037
- successfulResponseHandler: createJsonResponseHandler5(
5178
+ successfulResponseHandler: createJsonResponseHandler6(
5038
5179
  openaiResponsesResponseSchema
5039
5180
  ),
5040
5181
  abortSignal: options.abortSignal,
@@ -5514,7 +5655,7 @@ var OpenAIResponsesLanguageModel = class {
5514
5655
  path: "/responses",
5515
5656
  modelId: this.modelId
5516
5657
  }),
5517
- headers: combineHeaders5(this.config.headers(), options.headers),
5658
+ headers: combineHeaders6(this.config.headers(), options.headers),
5518
5659
  body: {
5519
5660
  ...body,
5520
5661
  stream: true
@@ -6457,20 +6598,20 @@ function escapeJSONDelta(delta) {
6457
6598
 
6458
6599
  // src/speech/openai-speech-model.ts
6459
6600
  import {
6460
- combineHeaders as combineHeaders6,
6601
+ combineHeaders as combineHeaders7,
6461
6602
  createBinaryResponseHandler,
6462
- parseProviderOptions as parseProviderOptions6,
6603
+ parseProviderOptions as parseProviderOptions7,
6463
6604
  postJsonToApi as postJsonToApi6
6464
6605
  } from "@ai-sdk/provider-utils";
6465
6606
 
6466
6607
  // src/speech/openai-speech-options.ts
6467
- import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
6468
- import { z as z23 } from "zod/v4";
6469
- var openaiSpeechModelOptionsSchema = lazySchema21(
6470
- () => zodSchema21(
6471
- z23.object({
6472
- instructions: z23.string().nullish(),
6473
- speed: z23.number().min(0.25).max(4).default(1).nullish()
6608
+ import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
6609
+ import { z as z25 } from "zod/v4";
6610
+ var openaiSpeechModelOptionsSchema = lazySchema23(
6611
+ () => zodSchema23(
6612
+ z25.object({
6613
+ instructions: z25.string().nullish(),
6614
+ speed: z25.number().min(0.25).max(4).default(1).nullish()
6474
6615
  })
6475
6616
  )
6476
6617
  );
@@ -6495,7 +6636,7 @@ var OpenAISpeechModel = class {
6495
6636
  providerOptions
6496
6637
  }) {
6497
6638
  const warnings = [];
6498
- const openAIOptions = await parseProviderOptions6({
6639
+ const openAIOptions = await parseProviderOptions7({
6499
6640
  provider: "openai",
6500
6641
  providerOptions,
6501
6642
  schema: openaiSpeechModelOptionsSchema
@@ -6553,7 +6694,7 @@ var OpenAISpeechModel = class {
6553
6694
  path: "/audio/speech",
6554
6695
  modelId: this.modelId
6555
6696
  }),
6556
- headers: combineHeaders6(this.config.headers(), options.headers),
6697
+ headers: combineHeaders7(this.config.headers(), options.headers),
6557
6698
  body: requestBody,
6558
6699
  failedResponseHandler: openaiFailedResponseHandler,
6559
6700
  successfulResponseHandler: createBinaryResponseHandler(),
@@ -6578,42 +6719,42 @@ var OpenAISpeechModel = class {
6578
6719
 
6579
6720
  // src/transcription/openai-transcription-model.ts
6580
6721
  import {
6581
- combineHeaders as combineHeaders7,
6582
- convertBase64ToUint8Array as convertBase64ToUint8Array2,
6583
- createJsonResponseHandler as createJsonResponseHandler6,
6722
+ combineHeaders as combineHeaders8,
6723
+ convertBase64ToUint8Array as convertBase64ToUint8Array3,
6724
+ createJsonResponseHandler as createJsonResponseHandler7,
6584
6725
  mediaTypeToExtension,
6585
- parseProviderOptions as parseProviderOptions7,
6586
- postFormDataToApi as postFormDataToApi2
6726
+ parseProviderOptions as parseProviderOptions8,
6727
+ postFormDataToApi as postFormDataToApi3
6587
6728
  } from "@ai-sdk/provider-utils";
6588
6729
 
6589
6730
  // src/transcription/openai-transcription-api.ts
6590
- import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
6591
- import { z as z24 } from "zod/v4";
6592
- var openaiTranscriptionResponseSchema = lazySchema22(
6593
- () => zodSchema22(
6594
- z24.object({
6595
- text: z24.string(),
6596
- language: z24.string().nullish(),
6597
- duration: z24.number().nullish(),
6598
- words: z24.array(
6599
- z24.object({
6600
- word: z24.string(),
6601
- start: z24.number(),
6602
- end: z24.number()
6731
+ import { lazySchema as lazySchema24, zodSchema as zodSchema24 } from "@ai-sdk/provider-utils";
6732
+ import { z as z26 } from "zod/v4";
6733
+ var openaiTranscriptionResponseSchema = lazySchema24(
6734
+ () => zodSchema24(
6735
+ z26.object({
6736
+ text: z26.string(),
6737
+ language: z26.string().nullish(),
6738
+ duration: z26.number().nullish(),
6739
+ words: z26.array(
6740
+ z26.object({
6741
+ word: z26.string(),
6742
+ start: z26.number(),
6743
+ end: z26.number()
6603
6744
  })
6604
6745
  ).nullish(),
6605
- segments: z24.array(
6606
- z24.object({
6607
- id: z24.number(),
6608
- seek: z24.number(),
6609
- start: z24.number(),
6610
- end: z24.number(),
6611
- text: z24.string(),
6612
- tokens: z24.array(z24.number()),
6613
- temperature: z24.number(),
6614
- avg_logprob: z24.number(),
6615
- compression_ratio: z24.number(),
6616
- no_speech_prob: z24.number()
6746
+ segments: z26.array(
6747
+ z26.object({
6748
+ id: z26.number(),
6749
+ seek: z26.number(),
6750
+ start: z26.number(),
6751
+ end: z26.number(),
6752
+ text: z26.string(),
6753
+ tokens: z26.array(z26.number()),
6754
+ temperature: z26.number(),
6755
+ avg_logprob: z26.number(),
6756
+ compression_ratio: z26.number(),
6757
+ no_speech_prob: z26.number()
6617
6758
  })
6618
6759
  ).nullish()
6619
6760
  })
@@ -6621,33 +6762,33 @@ var openaiTranscriptionResponseSchema = lazySchema22(
6621
6762
  );
6622
6763
 
6623
6764
  // src/transcription/openai-transcription-options.ts
6624
- import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
6625
- import { z as z25 } from "zod/v4";
6626
- var openAITranscriptionModelOptions = lazySchema23(
6627
- () => zodSchema23(
6628
- z25.object({
6765
+ import { lazySchema as lazySchema25, zodSchema as zodSchema25 } from "@ai-sdk/provider-utils";
6766
+ import { z as z27 } from "zod/v4";
6767
+ var openAITranscriptionModelOptions = lazySchema25(
6768
+ () => zodSchema25(
6769
+ z27.object({
6629
6770
  /**
6630
6771
  * Additional information to include in the transcription response.
6631
6772
  */
6632
- include: z25.array(z25.string()).optional(),
6773
+ include: z27.array(z27.string()).optional(),
6633
6774
  /**
6634
6775
  * The language of the input audio in ISO-639-1 format.
6635
6776
  */
6636
- language: z25.string().optional(),
6777
+ language: z27.string().optional(),
6637
6778
  /**
6638
6779
  * An optional text to guide the model's style or continue a previous audio segment.
6639
6780
  */
6640
- prompt: z25.string().optional(),
6781
+ prompt: z27.string().optional(),
6641
6782
  /**
6642
6783
  * The sampling temperature, between 0 and 1.
6643
6784
  * @default 0
6644
6785
  */
6645
- temperature: z25.number().min(0).max(1).default(0).optional(),
6786
+ temperature: z27.number().min(0).max(1).default(0).optional(),
6646
6787
  /**
6647
6788
  * The timestamp granularities to populate for this transcription.
6648
6789
  * @default ['segment']
6649
6790
  */
6650
- timestampGranularities: z25.array(z25.enum(["word", "segment"])).default(["segment"]).optional()
6791
+ timestampGranularities: z27.array(z27.enum(["word", "segment"])).default(["segment"]).optional()
6651
6792
  })
6652
6793
  )
6653
6794
  );
@@ -6727,13 +6868,13 @@ var OpenAITranscriptionModel = class {
6727
6868
  providerOptions
6728
6869
  }) {
6729
6870
  const warnings = [];
6730
- const openAIOptions = await parseProviderOptions7({
6871
+ const openAIOptions = await parseProviderOptions8({
6731
6872
  provider: "openai",
6732
6873
  providerOptions,
6733
6874
  schema: openAITranscriptionModelOptions
6734
6875
  });
6735
6876
  const formData = new FormData();
6736
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array2(audio)]);
6877
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array3(audio)]);
6737
6878
  formData.append("model", this.modelId);
6738
6879
  const fileExtension = mediaTypeToExtension(mediaType);
6739
6880
  formData.append(
@@ -6780,15 +6921,15 @@ var OpenAITranscriptionModel = class {
6780
6921
  value: response,
6781
6922
  responseHeaders,
6782
6923
  rawValue: rawResponse
6783
- } = await postFormDataToApi2({
6924
+ } = await postFormDataToApi3({
6784
6925
  url: this.config.url({
6785
6926
  path: "/audio/transcriptions",
6786
6927
  modelId: this.modelId
6787
6928
  }),
6788
- headers: combineHeaders7(this.config.headers(), options.headers),
6929
+ headers: combineHeaders8(this.config.headers(), options.headers),
6789
6930
  formData,
6790
6931
  failedResponseHandler: openaiFailedResponseHandler,
6791
- successfulResponseHandler: createJsonResponseHandler6(
6932
+ successfulResponseHandler: createJsonResponseHandler7(
6792
6933
  openaiTranscriptionResponseSchema
6793
6934
  ),
6794
6935
  abortSignal: options.abortSignal,
@@ -6820,7 +6961,7 @@ var OpenAITranscriptionModel = class {
6820
6961
  };
6821
6962
 
6822
6963
  // src/version.ts
6823
- var VERSION = true ? "4.0.0-beta.20" : "0.0.0-test";
6964
+ var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
6824
6965
 
6825
6966
  // src/openai-provider.ts
6826
6967
  function createOpenAI(options = {}) {
@@ -6881,6 +7022,12 @@ function createOpenAI(options = {}) {
6881
7022
  headers: getHeaders,
6882
7023
  fetch: options.fetch
6883
7024
  });
7025
+ const createFiles = () => new OpenAIFiles({
7026
+ provider: `${providerName}.files`,
7027
+ baseURL,
7028
+ headers: getHeaders,
7029
+ fetch: options.fetch
7030
+ });
6884
7031
  const createLanguageModel = (modelId) => {
6885
7032
  if (new.target) {
6886
7033
  throw new Error(
@@ -6895,6 +7042,7 @@ function createOpenAI(options = {}) {
6895
7042
  url: ({ path }) => `${baseURL}${path}`,
6896
7043
  headers: getHeaders,
6897
7044
  fetch: options.fetch,
7045
+ // Soft-deprecated. TODO: remove in v8
6898
7046
  fileIdPrefixes: ["file-"]
6899
7047
  });
6900
7048
  };
@@ -6916,6 +7064,7 @@ function createOpenAI(options = {}) {
6916
7064
  provider.transcriptionModel = createTranscriptionModel;
6917
7065
  provider.speech = createSpeechModel;
6918
7066
  provider.speechModel = createSpeechModel;
7067
+ provider.files = createFiles;
6919
7068
  provider.tools = openaiTools;
6920
7069
  return provider;
6921
7070
  }