@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/CHANGELOG.md +9 -0
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +1299 -1162
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1270 -1121
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +5 -5
- package/dist/internal/index.d.ts +5 -5
- package/dist/internal/index.js +32 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +39 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/chat/convert-to-openai-chat-messages.ts +21 -10
- package/src/files/openai-files-api.ts +17 -0
- package/src/files/openai-files-options.ts +18 -0
- package/src/files/openai-files.ts +102 -0
- package/src/index.ts +1 -0
- package/src/openai-config.ts +5 -5
- package/src/openai-provider.ts +18 -0
- package/src/responses/convert-to-openai-responses-input.ts +29 -2
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 {
|
|
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:
|
|
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/
|
|
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
|
-
|
|
1730
|
-
postFormDataToApi
|
|
1731
|
-
postJsonToApi as postJsonToApi4
|
|
1742
|
+
parseProviderOptions as parseProviderOptions4,
|
|
1743
|
+
postFormDataToApi
|
|
1732
1744
|
} from "@ai-sdk/provider-utils";
|
|
1733
1745
|
|
|
1734
|
-
// src/
|
|
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
|
|
1749
|
+
var openaiFilesResponseSchema = lazySchema7(
|
|
1738
1750
|
() => zodSchema7(
|
|
1739
1751
|
z8.object({
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
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:
|
|
1748
|
-
output_format:
|
|
1749
|
-
size:
|
|
1750
|
-
quality:
|
|
1751
|
-
usage:
|
|
1752
|
-
input_tokens:
|
|
1753
|
-
output_tokens:
|
|
1754
|
-
total_tokens:
|
|
1755
|
-
input_tokens_details:
|
|
1756
|
-
image_tokens:
|
|
1757
|
-
text_tokens:
|
|
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
|
|
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:
|
|
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([
|
|
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:
|
|
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:
|
|
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:
|
|
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 :
|
|
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
|
|
1982
|
-
zodSchema as
|
|
2103
|
+
lazySchema as lazySchema10,
|
|
2104
|
+
zodSchema as zodSchema10
|
|
1983
2105
|
} from "@ai-sdk/provider-utils";
|
|
1984
|
-
import { z as
|
|
1985
|
-
var applyPatchInputSchema =
|
|
1986
|
-
() =>
|
|
1987
|
-
|
|
1988
|
-
callId:
|
|
1989
|
-
operation:
|
|
1990
|
-
|
|
1991
|
-
type:
|
|
1992
|
-
path:
|
|
1993
|
-
diff:
|
|
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
|
-
|
|
1996
|
-
type:
|
|
1997
|
-
path:
|
|
2117
|
+
z11.object({
|
|
2118
|
+
type: z11.literal("delete_file"),
|
|
2119
|
+
path: z11.string()
|
|
1998
2120
|
}),
|
|
1999
|
-
|
|
2000
|
-
type:
|
|
2001
|
-
path:
|
|
2002
|
-
diff:
|
|
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 =
|
|
2009
|
-
() =>
|
|
2010
|
-
|
|
2011
|
-
status:
|
|
2012
|
-
output:
|
|
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 =
|
|
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
|
|
2028
|
-
zodSchema as
|
|
2149
|
+
lazySchema as lazySchema11,
|
|
2150
|
+
zodSchema as zodSchema11
|
|
2029
2151
|
} from "@ai-sdk/provider-utils";
|
|
2030
|
-
import { z as
|
|
2031
|
-
var codeInterpreterInputSchema =
|
|
2032
|
-
() =>
|
|
2033
|
-
|
|
2034
|
-
code:
|
|
2035
|
-
containerId:
|
|
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 =
|
|
2040
|
-
() =>
|
|
2041
|
-
|
|
2042
|
-
outputs:
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
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 =
|
|
2052
|
-
() =>
|
|
2053
|
-
|
|
2054
|
-
container:
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
fileIds:
|
|
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
|
|
2076
|
-
zodSchema as
|
|
2197
|
+
lazySchema as lazySchema12,
|
|
2198
|
+
zodSchema as zodSchema12
|
|
2077
2199
|
} from "@ai-sdk/provider-utils";
|
|
2078
|
-
import { z as
|
|
2079
|
-
var customArgsSchema =
|
|
2080
|
-
() =>
|
|
2081
|
-
|
|
2082
|
-
description:
|
|
2083
|
-
format:
|
|
2084
|
-
|
|
2085
|
-
type:
|
|
2086
|
-
syntax:
|
|
2087
|
-
definition:
|
|
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
|
-
|
|
2090
|
-
type:
|
|
2211
|
+
z13.object({
|
|
2212
|
+
type: z13.literal("text")
|
|
2091
2213
|
})
|
|
2092
2214
|
]).optional()
|
|
2093
2215
|
})
|
|
2094
2216
|
)
|
|
2095
2217
|
);
|
|
2096
|
-
var customInputSchema =
|
|
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
|
|
2107
|
-
zodSchema as
|
|
2228
|
+
lazySchema as lazySchema13,
|
|
2229
|
+
zodSchema as zodSchema13
|
|
2108
2230
|
} from "@ai-sdk/provider-utils";
|
|
2109
|
-
import { z as
|
|
2110
|
-
var comparisonFilterSchema =
|
|
2111
|
-
key:
|
|
2112
|
-
type:
|
|
2113
|
-
value:
|
|
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 =
|
|
2116
|
-
type:
|
|
2117
|
-
filters:
|
|
2118
|
-
|
|
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 =
|
|
2122
|
-
() =>
|
|
2123
|
-
|
|
2124
|
-
vectorStoreIds:
|
|
2125
|
-
maxNumResults:
|
|
2126
|
-
ranking:
|
|
2127
|
-
ranker:
|
|
2128
|
-
scoreThreshold:
|
|
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:
|
|
2252
|
+
filters: z14.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2131
2253
|
})
|
|
2132
2254
|
)
|
|
2133
2255
|
);
|
|
2134
|
-
var fileSearchOutputSchema =
|
|
2135
|
-
() =>
|
|
2136
|
-
|
|
2137
|
-
queries:
|
|
2138
|
-
results:
|
|
2139
|
-
|
|
2140
|
-
attributes:
|
|
2141
|
-
fileId:
|
|
2142
|
-
filename:
|
|
2143
|
-
score:
|
|
2144
|
-
text:
|
|
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:
|
|
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
|
|
2160
|
-
zodSchema as
|
|
2281
|
+
lazySchema as lazySchema14,
|
|
2282
|
+
zodSchema as zodSchema14
|
|
2161
2283
|
} from "@ai-sdk/provider-utils";
|
|
2162
|
-
import { z as
|
|
2163
|
-
var imageGenerationArgsSchema =
|
|
2164
|
-
() =>
|
|
2165
|
-
|
|
2166
|
-
background:
|
|
2167
|
-
inputFidelity:
|
|
2168
|
-
inputImageMask:
|
|
2169
|
-
fileId:
|
|
2170
|
-
imageUrl:
|
|
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:
|
|
2173
|
-
moderation:
|
|
2174
|
-
outputCompression:
|
|
2175
|
-
outputFormat:
|
|
2176
|
-
partialImages:
|
|
2177
|
-
quality:
|
|
2178
|
-
size:
|
|
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 =
|
|
2183
|
-
var imageGenerationOutputSchema =
|
|
2184
|
-
() =>
|
|
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
|
|
2199
|
-
zodSchema as
|
|
2320
|
+
lazySchema as lazySchema15,
|
|
2321
|
+
zodSchema as zodSchema15
|
|
2200
2322
|
} from "@ai-sdk/provider-utils";
|
|
2201
|
-
import { z as
|
|
2202
|
-
var localShellInputSchema =
|
|
2203
|
-
() =>
|
|
2204
|
-
|
|
2205
|
-
action:
|
|
2206
|
-
type:
|
|
2207
|
-
command:
|
|
2208
|
-
timeoutMs:
|
|
2209
|
-
user:
|
|
2210
|
-
workingDirectory:
|
|
2211
|
-
env:
|
|
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 =
|
|
2217
|
-
() =>
|
|
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
|
|
2229
|
-
zodSchema as
|
|
2350
|
+
lazySchema as lazySchema16,
|
|
2351
|
+
zodSchema as zodSchema16
|
|
2230
2352
|
} from "@ai-sdk/provider-utils";
|
|
2231
|
-
import { z as
|
|
2232
|
-
var shellInputSchema =
|
|
2233
|
-
() =>
|
|
2234
|
-
|
|
2235
|
-
action:
|
|
2236
|
-
commands:
|
|
2237
|
-
timeoutMs:
|
|
2238
|
-
maxOutputLength:
|
|
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 =
|
|
2244
|
-
() =>
|
|
2245
|
-
|
|
2246
|
-
output:
|
|
2247
|
-
|
|
2248
|
-
stdout:
|
|
2249
|
-
stderr:
|
|
2250
|
-
outcome:
|
|
2251
|
-
|
|
2252
|
-
|
|
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 =
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
type:
|
|
2263
|
-
skillId:
|
|
2264
|
-
version:
|
|
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
|
-
|
|
2267
|
-
type:
|
|
2268
|
-
name:
|
|
2269
|
-
description:
|
|
2270
|
-
source:
|
|
2271
|
-
type:
|
|
2272
|
-
mediaType:
|
|
2273
|
-
data:
|
|
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 =
|
|
2279
|
-
() =>
|
|
2280
|
-
|
|
2281
|
-
environment:
|
|
2282
|
-
|
|
2283
|
-
type:
|
|
2284
|
-
fileIds:
|
|
2285
|
-
memoryLimit:
|
|
2286
|
-
networkPolicy:
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
type:
|
|
2290
|
-
allowedDomains:
|
|
2291
|
-
domainSecrets:
|
|
2292
|
-
|
|
2293
|
-
domain:
|
|
2294
|
-
name:
|
|
2295
|
-
value:
|
|
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
|
-
|
|
2303
|
-
type:
|
|
2304
|
-
containerId:
|
|
2424
|
+
z17.object({
|
|
2425
|
+
type: z17.literal("containerReference"),
|
|
2426
|
+
containerId: z17.string()
|
|
2305
2427
|
}),
|
|
2306
|
-
|
|
2307
|
-
type:
|
|
2308
|
-
skills:
|
|
2309
|
-
|
|
2310
|
-
name:
|
|
2311
|
-
description:
|
|
2312
|
-
path:
|
|
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
|
|
2330
|
-
zodSchema as
|
|
2451
|
+
lazySchema as lazySchema17,
|
|
2452
|
+
zodSchema as zodSchema17
|
|
2331
2453
|
} from "@ai-sdk/provider-utils";
|
|
2332
|
-
import { z as
|
|
2333
|
-
var toolSearchArgsSchema =
|
|
2334
|
-
() =>
|
|
2335
|
-
|
|
2336
|
-
execution:
|
|
2337
|
-
description:
|
|
2338
|
-
parameters:
|
|
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 =
|
|
2343
|
-
() =>
|
|
2344
|
-
|
|
2345
|
-
arguments:
|
|
2346
|
-
call_id:
|
|
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 =
|
|
2351
|
-
() =>
|
|
2352
|
-
|
|
2353
|
-
tools:
|
|
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
|
|
2368
|
-
zodSchema as
|
|
2489
|
+
lazySchema as lazySchema18,
|
|
2490
|
+
zodSchema as zodSchema18
|
|
2369
2491
|
} from "@ai-sdk/provider-utils";
|
|
2370
|
-
import { z as
|
|
2371
|
-
var webSearchArgsSchema =
|
|
2372
|
-
() =>
|
|
2373
|
-
|
|
2374
|
-
externalWebAccess:
|
|
2375
|
-
filters:
|
|
2376
|
-
searchContextSize:
|
|
2377
|
-
userLocation:
|
|
2378
|
-
type:
|
|
2379
|
-
country:
|
|
2380
|
-
city:
|
|
2381
|
-
region:
|
|
2382
|
-
timezone:
|
|
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 =
|
|
2388
|
-
var webSearchOutputSchema =
|
|
2389
|
-
() =>
|
|
2390
|
-
|
|
2391
|
-
action:
|
|
2392
|
-
|
|
2393
|
-
type:
|
|
2394
|
-
query:
|
|
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
|
-
|
|
2397
|
-
type:
|
|
2398
|
-
url:
|
|
2518
|
+
z19.object({
|
|
2519
|
+
type: z19.literal("openPage"),
|
|
2520
|
+
url: z19.string().nullish()
|
|
2399
2521
|
}),
|
|
2400
|
-
|
|
2401
|
-
type:
|
|
2402
|
-
url:
|
|
2403
|
-
pattern:
|
|
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:
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
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
|
|
2426
|
-
zodSchema as
|
|
2547
|
+
lazySchema as lazySchema19,
|
|
2548
|
+
zodSchema as zodSchema19
|
|
2427
2549
|
} from "@ai-sdk/provider-utils";
|
|
2428
|
-
import { z as
|
|
2429
|
-
var webSearchPreviewArgsSchema =
|
|
2430
|
-
() =>
|
|
2431
|
-
|
|
2432
|
-
searchContextSize:
|
|
2433
|
-
userLocation:
|
|
2434
|
-
type:
|
|
2435
|
-
country:
|
|
2436
|
-
city:
|
|
2437
|
-
region:
|
|
2438
|
-
timezone:
|
|
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 =
|
|
2444
|
-
() =>
|
|
2565
|
+
var webSearchPreviewInputSchema = lazySchema19(
|
|
2566
|
+
() => zodSchema19(z20.object({}))
|
|
2445
2567
|
);
|
|
2446
|
-
var webSearchPreviewOutputSchema =
|
|
2447
|
-
() =>
|
|
2448
|
-
|
|
2449
|
-
action:
|
|
2450
|
-
|
|
2451
|
-
type:
|
|
2452
|
-
query:
|
|
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
|
-
|
|
2455
|
-
type:
|
|
2456
|
-
url:
|
|
2576
|
+
z20.object({
|
|
2577
|
+
type: z20.literal("openPage"),
|
|
2578
|
+
url: z20.string().nullish()
|
|
2457
2579
|
}),
|
|
2458
|
-
|
|
2459
|
-
type:
|
|
2460
|
-
url:
|
|
2461
|
-
pattern:
|
|
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
|
|
2477
|
-
zodSchema as
|
|
2598
|
+
lazySchema as lazySchema20,
|
|
2599
|
+
zodSchema as zodSchema20
|
|
2478
2600
|
} from "@ai-sdk/provider-utils";
|
|
2479
|
-
import { z as
|
|
2480
|
-
var jsonValueSchema =
|
|
2481
|
-
() =>
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
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 =
|
|
2491
|
-
() =>
|
|
2492
|
-
|
|
2493
|
-
serverLabel:
|
|
2494
|
-
allowedTools:
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
readOnly:
|
|
2498
|
-
toolNames:
|
|
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:
|
|
2502
|
-
connectorId:
|
|
2503
|
-
headers:
|
|
2504
|
-
requireApproval:
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
never:
|
|
2508
|
-
toolNames:
|
|
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:
|
|
2513
|
-
serverUrl:
|
|
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 =
|
|
2521
|
-
var mcpOutputSchema =
|
|
2522
|
-
() =>
|
|
2523
|
-
|
|
2524
|
-
type:
|
|
2525
|
-
serverLabel:
|
|
2526
|
-
name:
|
|
2527
|
-
arguments:
|
|
2528
|
-
output:
|
|
2529
|
-
error:
|
|
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
|
|
2784
|
+
combineHeaders as combineHeaders6,
|
|
2663
2785
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
2664
|
-
createJsonResponseHandler as
|
|
2786
|
+
createJsonResponseHandler as createJsonResponseHandler6,
|
|
2665
2787
|
createToolNameMapping,
|
|
2666
2788
|
generateId as generateId2,
|
|
2667
2789
|
isCustomReasoning as isCustomReasoning2,
|
|
2668
|
-
parseProviderOptions as
|
|
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
|
|
2842
|
+
parseProviderOptions as parseProviderOptions5,
|
|
2843
|
+
resolveProviderReference as resolveProviderReference2,
|
|
2720
2844
|
validateTypes
|
|
2721
2845
|
} from "@ai-sdk/provider-utils";
|
|
2722
|
-
import { z as
|
|
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: (
|
|
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: (
|
|
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
|
|
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 =
|
|
3346
|
-
itemId:
|
|
3347
|
-
reasoningEncryptedContent:
|
|
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
|
|
3370
|
-
import { z as
|
|
3371
|
-
var jsonValueSchema2 =
|
|
3372
|
-
() =>
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
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 =
|
|
3382
|
-
() =>
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
type:
|
|
3386
|
-
item_id:
|
|
3387
|
-
delta:
|
|
3388
|
-
logprobs:
|
|
3389
|
-
|
|
3390
|
-
token:
|
|
3391
|
-
logprob:
|
|
3392
|
-
top_logprobs:
|
|
3393
|
-
|
|
3394
|
-
token:
|
|
3395
|
-
logprob:
|
|
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
|
-
|
|
3402
|
-
type:
|
|
3403
|
-
response:
|
|
3404
|
-
incomplete_details:
|
|
3405
|
-
usage:
|
|
3406
|
-
input_tokens:
|
|
3407
|
-
input_tokens_details:
|
|
3408
|
-
output_tokens:
|
|
3409
|
-
output_tokens_details:
|
|
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:
|
|
3552
|
+
service_tier: z23.string().nullish()
|
|
3412
3553
|
})
|
|
3413
3554
|
}),
|
|
3414
|
-
|
|
3415
|
-
type:
|
|
3416
|
-
response:
|
|
3417
|
-
error:
|
|
3418
|
-
code:
|
|
3419
|
-
message:
|
|
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:
|
|
3422
|
-
usage:
|
|
3423
|
-
input_tokens:
|
|
3424
|
-
input_tokens_details:
|
|
3425
|
-
output_tokens:
|
|
3426
|
-
output_tokens_details:
|
|
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:
|
|
3569
|
+
service_tier: z23.string().nullish()
|
|
3429
3570
|
})
|
|
3430
3571
|
}),
|
|
3431
|
-
|
|
3432
|
-
type:
|
|
3433
|
-
response:
|
|
3434
|
-
id:
|
|
3435
|
-
created_at:
|
|
3436
|
-
model:
|
|
3437
|
-
service_tier:
|
|
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
|
-
|
|
3441
|
-
type:
|
|
3442
|
-
output_index:
|
|
3443
|
-
item:
|
|
3444
|
-
|
|
3445
|
-
type:
|
|
3446
|
-
id:
|
|
3447
|
-
phase:
|
|
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
|
-
|
|
3450
|
-
type:
|
|
3451
|
-
id:
|
|
3452
|
-
encrypted_content:
|
|
3590
|
+
z23.object({
|
|
3591
|
+
type: z23.literal("reasoning"),
|
|
3592
|
+
id: z23.string(),
|
|
3593
|
+
encrypted_content: z23.string().nullish()
|
|
3453
3594
|
}),
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
id:
|
|
3457
|
-
call_id:
|
|
3458
|
-
name:
|
|
3459
|
-
arguments:
|
|
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
|
-
|
|
3462
|
-
type:
|
|
3463
|
-
id:
|
|
3464
|
-
status:
|
|
3602
|
+
z23.object({
|
|
3603
|
+
type: z23.literal("web_search_call"),
|
|
3604
|
+
id: z23.string(),
|
|
3605
|
+
status: z23.string()
|
|
3465
3606
|
}),
|
|
3466
|
-
|
|
3467
|
-
type:
|
|
3468
|
-
id:
|
|
3469
|
-
status:
|
|
3607
|
+
z23.object({
|
|
3608
|
+
type: z23.literal("computer_call"),
|
|
3609
|
+
id: z23.string(),
|
|
3610
|
+
status: z23.string()
|
|
3470
3611
|
}),
|
|
3471
|
-
|
|
3472
|
-
type:
|
|
3473
|
-
id:
|
|
3612
|
+
z23.object({
|
|
3613
|
+
type: z23.literal("file_search_call"),
|
|
3614
|
+
id: z23.string()
|
|
3474
3615
|
}),
|
|
3475
|
-
|
|
3476
|
-
type:
|
|
3477
|
-
id:
|
|
3616
|
+
z23.object({
|
|
3617
|
+
type: z23.literal("image_generation_call"),
|
|
3618
|
+
id: z23.string()
|
|
3478
3619
|
}),
|
|
3479
|
-
|
|
3480
|
-
type:
|
|
3481
|
-
id:
|
|
3482
|
-
container_id:
|
|
3483
|
-
code:
|
|
3484
|
-
outputs:
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
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:
|
|
3631
|
+
status: z23.string()
|
|
3491
3632
|
}),
|
|
3492
|
-
|
|
3493
|
-
type:
|
|
3494
|
-
id:
|
|
3495
|
-
status:
|
|
3496
|
-
approval_request_id:
|
|
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
|
-
|
|
3499
|
-
type:
|
|
3500
|
-
id:
|
|
3639
|
+
z23.object({
|
|
3640
|
+
type: z23.literal("mcp_list_tools"),
|
|
3641
|
+
id: z23.string()
|
|
3501
3642
|
}),
|
|
3502
|
-
|
|
3503
|
-
type:
|
|
3504
|
-
id:
|
|
3643
|
+
z23.object({
|
|
3644
|
+
type: z23.literal("mcp_approval_request"),
|
|
3645
|
+
id: z23.string()
|
|
3505
3646
|
}),
|
|
3506
|
-
|
|
3507
|
-
type:
|
|
3508
|
-
id:
|
|
3509
|
-
call_id:
|
|
3510
|
-
status:
|
|
3511
|
-
operation:
|
|
3512
|
-
|
|
3513
|
-
type:
|
|
3514
|
-
path:
|
|
3515
|
-
diff:
|
|
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
|
-
|
|
3518
|
-
type:
|
|
3519
|
-
path:
|
|
3658
|
+
z23.object({
|
|
3659
|
+
type: z23.literal("delete_file"),
|
|
3660
|
+
path: z23.string()
|
|
3520
3661
|
}),
|
|
3521
|
-
|
|
3522
|
-
type:
|
|
3523
|
-
path:
|
|
3524
|
-
diff:
|
|
3662
|
+
z23.object({
|
|
3663
|
+
type: z23.literal("update_file"),
|
|
3664
|
+
path: z23.string(),
|
|
3665
|
+
diff: z23.string()
|
|
3525
3666
|
})
|
|
3526
3667
|
])
|
|
3527
3668
|
}),
|
|
3528
|
-
|
|
3529
|
-
type:
|
|
3530
|
-
id:
|
|
3531
|
-
call_id:
|
|
3532
|
-
name:
|
|
3533
|
-
input:
|
|
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
|
-
|
|
3536
|
-
type:
|
|
3537
|
-
id:
|
|
3538
|
-
call_id:
|
|
3539
|
-
status:
|
|
3540
|
-
action:
|
|
3541
|
-
commands:
|
|
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
|
-
|
|
3545
|
-
type:
|
|
3546
|
-
id:
|
|
3547
|
-
encrypted_content:
|
|
3685
|
+
z23.object({
|
|
3686
|
+
type: z23.literal("compaction"),
|
|
3687
|
+
id: z23.string(),
|
|
3688
|
+
encrypted_content: z23.string().nullish()
|
|
3548
3689
|
}),
|
|
3549
|
-
|
|
3550
|
-
type:
|
|
3551
|
-
id:
|
|
3552
|
-
call_id:
|
|
3553
|
-
status:
|
|
3554
|
-
output:
|
|
3555
|
-
|
|
3556
|
-
stdout:
|
|
3557
|
-
stderr:
|
|
3558
|
-
outcome:
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
type:
|
|
3562
|
-
exit_code:
|
|
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
|
-
|
|
3569
|
-
type:
|
|
3570
|
-
id:
|
|
3571
|
-
execution:
|
|
3572
|
-
call_id:
|
|
3573
|
-
status:
|
|
3574
|
-
arguments:
|
|
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
|
-
|
|
3577
|
-
type:
|
|
3578
|
-
id:
|
|
3579
|
-
execution:
|
|
3580
|
-
call_id:
|
|
3581
|
-
status:
|
|
3582
|
-
tools:
|
|
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
|
-
|
|
3587
|
-
type:
|
|
3588
|
-
output_index:
|
|
3589
|
-
item:
|
|
3590
|
-
|
|
3591
|
-
type:
|
|
3592
|
-
id:
|
|
3593
|
-
phase:
|
|
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
|
-
|
|
3596
|
-
type:
|
|
3597
|
-
id:
|
|
3598
|
-
encrypted_content:
|
|
3736
|
+
z23.object({
|
|
3737
|
+
type: z23.literal("reasoning"),
|
|
3738
|
+
id: z23.string(),
|
|
3739
|
+
encrypted_content: z23.string().nullish()
|
|
3599
3740
|
}),
|
|
3600
|
-
|
|
3601
|
-
type:
|
|
3602
|
-
id:
|
|
3603
|
-
call_id:
|
|
3604
|
-
name:
|
|
3605
|
-
arguments:
|
|
3606
|
-
status:
|
|
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
|
-
|
|
3609
|
-
type:
|
|
3610
|
-
id:
|
|
3611
|
-
call_id:
|
|
3612
|
-
name:
|
|
3613
|
-
input:
|
|
3614
|
-
status:
|
|
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
|
-
|
|
3617
|
-
type:
|
|
3618
|
-
id:
|
|
3619
|
-
code:
|
|
3620
|
-
container_id:
|
|
3621
|
-
outputs:
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
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
|
-
|
|
3629
|
-
type:
|
|
3630
|
-
id:
|
|
3631
|
-
result:
|
|
3769
|
+
z23.object({
|
|
3770
|
+
type: z23.literal("image_generation_call"),
|
|
3771
|
+
id: z23.string(),
|
|
3772
|
+
result: z23.string()
|
|
3632
3773
|
}),
|
|
3633
|
-
|
|
3634
|
-
type:
|
|
3635
|
-
id:
|
|
3636
|
-
status:
|
|
3637
|
-
action:
|
|
3638
|
-
|
|
3639
|
-
type:
|
|
3640
|
-
query:
|
|
3641
|
-
sources:
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
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
|
-
|
|
3649
|
-
type:
|
|
3650
|
-
url:
|
|
3789
|
+
z23.object({
|
|
3790
|
+
type: z23.literal("open_page"),
|
|
3791
|
+
url: z23.string().nullish()
|
|
3651
3792
|
}),
|
|
3652
|
-
|
|
3653
|
-
type:
|
|
3654
|
-
url:
|
|
3655
|
-
pattern:
|
|
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
|
-
|
|
3660
|
-
type:
|
|
3661
|
-
id:
|
|
3662
|
-
queries:
|
|
3663
|
-
results:
|
|
3664
|
-
|
|
3665
|
-
attributes:
|
|
3666
|
-
|
|
3667
|
-
|
|
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:
|
|
3670
|
-
filename:
|
|
3671
|
-
score:
|
|
3672
|
-
text:
|
|
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
|
-
|
|
3677
|
-
type:
|
|
3678
|
-
id:
|
|
3679
|
-
call_id:
|
|
3680
|
-
action:
|
|
3681
|
-
type:
|
|
3682
|
-
command:
|
|
3683
|
-
timeout_ms:
|
|
3684
|
-
user:
|
|
3685
|
-
working_directory:
|
|
3686
|
-
env:
|
|
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
|
-
|
|
3690
|
-
type:
|
|
3691
|
-
id:
|
|
3692
|
-
status:
|
|
3830
|
+
z23.object({
|
|
3831
|
+
type: z23.literal("computer_call"),
|
|
3832
|
+
id: z23.string(),
|
|
3833
|
+
status: z23.literal("completed")
|
|
3693
3834
|
}),
|
|
3694
|
-
|
|
3695
|
-
type:
|
|
3696
|
-
id:
|
|
3697
|
-
status:
|
|
3698
|
-
arguments:
|
|
3699
|
-
name:
|
|
3700
|
-
server_label:
|
|
3701
|
-
output:
|
|
3702
|
-
error:
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
type:
|
|
3706
|
-
code:
|
|
3707
|
-
message:
|
|
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:
|
|
3851
|
+
approval_request_id: z23.string().nullish()
|
|
3711
3852
|
}),
|
|
3712
|
-
|
|
3713
|
-
type:
|
|
3714
|
-
id:
|
|
3715
|
-
server_label:
|
|
3716
|
-
tools:
|
|
3717
|
-
|
|
3718
|
-
name:
|
|
3719
|
-
description:
|
|
3720
|
-
input_schema:
|
|
3721
|
-
annotations:
|
|
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:
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
code:
|
|
3729
|
-
message:
|
|
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
|
-
|
|
3734
|
-
type:
|
|
3735
|
-
id:
|
|
3736
|
-
server_label:
|
|
3737
|
-
name:
|
|
3738
|
-
arguments:
|
|
3739
|
-
approval_request_id:
|
|
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
|
-
|
|
3742
|
-
type:
|
|
3743
|
-
id:
|
|
3744
|
-
call_id:
|
|
3745
|
-
status:
|
|
3746
|
-
operation:
|
|
3747
|
-
|
|
3748
|
-
type:
|
|
3749
|
-
path:
|
|
3750
|
-
diff:
|
|
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
|
-
|
|
3753
|
-
type:
|
|
3754
|
-
path:
|
|
3893
|
+
z23.object({
|
|
3894
|
+
type: z23.literal("delete_file"),
|
|
3895
|
+
path: z23.string()
|
|
3755
3896
|
}),
|
|
3756
|
-
|
|
3757
|
-
type:
|
|
3758
|
-
path:
|
|
3759
|
-
diff:
|
|
3897
|
+
z23.object({
|
|
3898
|
+
type: z23.literal("update_file"),
|
|
3899
|
+
path: z23.string(),
|
|
3900
|
+
diff: z23.string()
|
|
3760
3901
|
})
|
|
3761
3902
|
])
|
|
3762
3903
|
}),
|
|
3763
|
-
|
|
3764
|
-
type:
|
|
3765
|
-
id:
|
|
3766
|
-
call_id:
|
|
3767
|
-
status:
|
|
3768
|
-
action:
|
|
3769
|
-
commands:
|
|
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
|
-
|
|
3773
|
-
type:
|
|
3774
|
-
id:
|
|
3775
|
-
encrypted_content:
|
|
3913
|
+
z23.object({
|
|
3914
|
+
type: z23.literal("compaction"),
|
|
3915
|
+
id: z23.string(),
|
|
3916
|
+
encrypted_content: z23.string()
|
|
3776
3917
|
}),
|
|
3777
|
-
|
|
3778
|
-
type:
|
|
3779
|
-
id:
|
|
3780
|
-
call_id:
|
|
3781
|
-
status:
|
|
3782
|
-
output:
|
|
3783
|
-
|
|
3784
|
-
stdout:
|
|
3785
|
-
stderr:
|
|
3786
|
-
outcome:
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
type:
|
|
3790
|
-
exit_code:
|
|
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
|
-
|
|
3797
|
-
type:
|
|
3798
|
-
id:
|
|
3799
|
-
execution:
|
|
3800
|
-
call_id:
|
|
3801
|
-
status:
|
|
3802
|
-
arguments:
|
|
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
|
-
|
|
3805
|
-
type:
|
|
3806
|
-
id:
|
|
3807
|
-
execution:
|
|
3808
|
-
call_id:
|
|
3809
|
-
status:
|
|
3810
|
-
tools:
|
|
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
|
-
|
|
3815
|
-
type:
|
|
3816
|
-
item_id:
|
|
3817
|
-
output_index:
|
|
3818
|
-
delta:
|
|
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
|
-
|
|
3821
|
-
type:
|
|
3822
|
-
item_id:
|
|
3823
|
-
output_index:
|
|
3824
|
-
delta:
|
|
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
|
-
|
|
3827
|
-
type:
|
|
3828
|
-
item_id:
|
|
3829
|
-
output_index:
|
|
3830
|
-
partial_image_b64:
|
|
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
|
-
|
|
3833
|
-
type:
|
|
3834
|
-
item_id:
|
|
3835
|
-
output_index:
|
|
3836
|
-
delta:
|
|
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
|
-
|
|
3839
|
-
type:
|
|
3840
|
-
item_id:
|
|
3841
|
-
output_index:
|
|
3842
|
-
code:
|
|
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
|
-
|
|
3845
|
-
type:
|
|
3846
|
-
annotation:
|
|
3847
|
-
|
|
3848
|
-
type:
|
|
3849
|
-
start_index:
|
|
3850
|
-
end_index:
|
|
3851
|
-
url:
|
|
3852
|
-
title:
|
|
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
|
-
|
|
3855
|
-
type:
|
|
3856
|
-
file_id:
|
|
3857
|
-
filename:
|
|
3858
|
-
index:
|
|
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
|
-
|
|
3861
|
-
type:
|
|
3862
|
-
container_id:
|
|
3863
|
-
file_id:
|
|
3864
|
-
filename:
|
|
3865
|
-
start_index:
|
|
3866
|
-
end_index:
|
|
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
|
-
|
|
3869
|
-
type:
|
|
3870
|
-
file_id:
|
|
3871
|
-
index:
|
|
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
|
-
|
|
3876
|
-
type:
|
|
3877
|
-
item_id:
|
|
3878
|
-
summary_index:
|
|
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
|
-
|
|
3881
|
-
type:
|
|
3882
|
-
item_id:
|
|
3883
|
-
summary_index:
|
|
3884
|
-
delta:
|
|
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
|
-
|
|
3887
|
-
type:
|
|
3888
|
-
item_id:
|
|
3889
|
-
summary_index:
|
|
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
|
-
|
|
3892
|
-
type:
|
|
3893
|
-
item_id:
|
|
3894
|
-
output_index:
|
|
3895
|
-
delta:
|
|
3896
|
-
obfuscation:
|
|
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
|
-
|
|
3899
|
-
type:
|
|
3900
|
-
item_id:
|
|
3901
|
-
output_index:
|
|
3902
|
-
diff:
|
|
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
|
-
|
|
3905
|
-
type:
|
|
3906
|
-
sequence_number:
|
|
3907
|
-
error:
|
|
3908
|
-
type:
|
|
3909
|
-
code:
|
|
3910
|
-
message:
|
|
3911
|
-
param:
|
|
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
|
-
|
|
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 =
|
|
3923
|
-
() =>
|
|
3924
|
-
|
|
3925
|
-
id:
|
|
3926
|
-
created_at:
|
|
3927
|
-
error:
|
|
3928
|
-
message:
|
|
3929
|
-
type:
|
|
3930
|
-
param:
|
|
3931
|
-
code:
|
|
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:
|
|
3934
|
-
output:
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
type:
|
|
3938
|
-
role:
|
|
3939
|
-
id:
|
|
3940
|
-
phase:
|
|
3941
|
-
content:
|
|
3942
|
-
|
|
3943
|
-
type:
|
|
3944
|
-
text:
|
|
3945
|
-
logprobs:
|
|
3946
|
-
|
|
3947
|
-
token:
|
|
3948
|
-
logprob:
|
|
3949
|
-
top_logprobs:
|
|
3950
|
-
|
|
3951
|
-
token:
|
|
3952
|
-
logprob:
|
|
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:
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
type:
|
|
3961
|
-
start_index:
|
|
3962
|
-
end_index:
|
|
3963
|
-
url:
|
|
3964
|
-
title:
|
|
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
|
-
|
|
3967
|
-
type:
|
|
3968
|
-
file_id:
|
|
3969
|
-
filename:
|
|
3970
|
-
index:
|
|
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
|
-
|
|
3973
|
-
type:
|
|
3974
|
-
container_id:
|
|
3975
|
-
file_id:
|
|
3976
|
-
filename:
|
|
3977
|
-
start_index:
|
|
3978
|
-
end_index:
|
|
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
|
-
|
|
3981
|
-
type:
|
|
3982
|
-
file_id:
|
|
3983
|
-
index:
|
|
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
|
-
|
|
3991
|
-
type:
|
|
3992
|
-
id:
|
|
3993
|
-
status:
|
|
3994
|
-
action:
|
|
3995
|
-
|
|
3996
|
-
type:
|
|
3997
|
-
query:
|
|
3998
|
-
sources:
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
type:
|
|
4003
|
-
name:
|
|
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
|
-
|
|
4009
|
-
type:
|
|
4010
|
-
url:
|
|
4149
|
+
z23.object({
|
|
4150
|
+
type: z23.literal("open_page"),
|
|
4151
|
+
url: z23.string().nullish()
|
|
4011
4152
|
}),
|
|
4012
|
-
|
|
4013
|
-
type:
|
|
4014
|
-
url:
|
|
4015
|
-
pattern:
|
|
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
|
-
|
|
4020
|
-
type:
|
|
4021
|
-
id:
|
|
4022
|
-
queries:
|
|
4023
|
-
results:
|
|
4024
|
-
|
|
4025
|
-
attributes:
|
|
4026
|
-
|
|
4027
|
-
|
|
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:
|
|
4030
|
-
filename:
|
|
4031
|
-
score:
|
|
4032
|
-
text:
|
|
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
|
-
|
|
4037
|
-
type:
|
|
4038
|
-
id:
|
|
4039
|
-
code:
|
|
4040
|
-
container_id:
|
|
4041
|
-
outputs:
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
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
|
-
|
|
4049
|
-
type:
|
|
4050
|
-
id:
|
|
4051
|
-
result:
|
|
4189
|
+
z23.object({
|
|
4190
|
+
type: z23.literal("image_generation_call"),
|
|
4191
|
+
id: z23.string(),
|
|
4192
|
+
result: z23.string()
|
|
4052
4193
|
}),
|
|
4053
|
-
|
|
4054
|
-
type:
|
|
4055
|
-
id:
|
|
4056
|
-
call_id:
|
|
4057
|
-
action:
|
|
4058
|
-
type:
|
|
4059
|
-
command:
|
|
4060
|
-
timeout_ms:
|
|
4061
|
-
user:
|
|
4062
|
-
working_directory:
|
|
4063
|
-
env:
|
|
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
|
-
|
|
4067
|
-
type:
|
|
4068
|
-
call_id:
|
|
4069
|
-
name:
|
|
4070
|
-
arguments:
|
|
4071
|
-
id:
|
|
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
|
-
|
|
4074
|
-
type:
|
|
4075
|
-
call_id:
|
|
4076
|
-
name:
|
|
4077
|
-
input:
|
|
4078
|
-
id:
|
|
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
|
-
|
|
4081
|
-
type:
|
|
4082
|
-
id:
|
|
4083
|
-
status:
|
|
4221
|
+
z23.object({
|
|
4222
|
+
type: z23.literal("computer_call"),
|
|
4223
|
+
id: z23.string(),
|
|
4224
|
+
status: z23.string().optional()
|
|
4084
4225
|
}),
|
|
4085
|
-
|
|
4086
|
-
type:
|
|
4087
|
-
id:
|
|
4088
|
-
encrypted_content:
|
|
4089
|
-
summary:
|
|
4090
|
-
|
|
4091
|
-
type:
|
|
4092
|
-
text:
|
|
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
|
-
|
|
4097
|
-
type:
|
|
4098
|
-
id:
|
|
4099
|
-
status:
|
|
4100
|
-
arguments:
|
|
4101
|
-
name:
|
|
4102
|
-
server_label:
|
|
4103
|
-
output:
|
|
4104
|
-
error:
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
type:
|
|
4108
|
-
code:
|
|
4109
|
-
message:
|
|
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:
|
|
4253
|
+
approval_request_id: z23.string().nullish()
|
|
4113
4254
|
}),
|
|
4114
|
-
|
|
4115
|
-
type:
|
|
4116
|
-
id:
|
|
4117
|
-
server_label:
|
|
4118
|
-
tools:
|
|
4119
|
-
|
|
4120
|
-
name:
|
|
4121
|
-
description:
|
|
4122
|
-
input_schema:
|
|
4123
|
-
annotations:
|
|
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:
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
type:
|
|
4130
|
-
code:
|
|
4131
|
-
message:
|
|
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
|
-
|
|
4136
|
-
type:
|
|
4137
|
-
id:
|
|
4138
|
-
server_label:
|
|
4139
|
-
name:
|
|
4140
|
-
arguments:
|
|
4141
|
-
approval_request_id:
|
|
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
|
-
|
|
4144
|
-
type:
|
|
4145
|
-
id:
|
|
4146
|
-
call_id:
|
|
4147
|
-
status:
|
|
4148
|
-
operation:
|
|
4149
|
-
|
|
4150
|
-
type:
|
|
4151
|
-
path:
|
|
4152
|
-
diff:
|
|
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
|
-
|
|
4155
|
-
type:
|
|
4156
|
-
path:
|
|
4295
|
+
z23.object({
|
|
4296
|
+
type: z23.literal("delete_file"),
|
|
4297
|
+
path: z23.string()
|
|
4157
4298
|
}),
|
|
4158
|
-
|
|
4159
|
-
type:
|
|
4160
|
-
path:
|
|
4161
|
-
diff:
|
|
4299
|
+
z23.object({
|
|
4300
|
+
type: z23.literal("update_file"),
|
|
4301
|
+
path: z23.string(),
|
|
4302
|
+
diff: z23.string()
|
|
4162
4303
|
})
|
|
4163
4304
|
])
|
|
4164
4305
|
}),
|
|
4165
|
-
|
|
4166
|
-
type:
|
|
4167
|
-
id:
|
|
4168
|
-
call_id:
|
|
4169
|
-
status:
|
|
4170
|
-
action:
|
|
4171
|
-
commands:
|
|
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
|
-
|
|
4175
|
-
type:
|
|
4176
|
-
id:
|
|
4177
|
-
encrypted_content:
|
|
4315
|
+
z23.object({
|
|
4316
|
+
type: z23.literal("compaction"),
|
|
4317
|
+
id: z23.string(),
|
|
4318
|
+
encrypted_content: z23.string()
|
|
4178
4319
|
}),
|
|
4179
|
-
|
|
4180
|
-
type:
|
|
4181
|
-
id:
|
|
4182
|
-
call_id:
|
|
4183
|
-
status:
|
|
4184
|
-
output:
|
|
4185
|
-
|
|
4186
|
-
stdout:
|
|
4187
|
-
stderr:
|
|
4188
|
-
outcome:
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
type:
|
|
4192
|
-
exit_code:
|
|
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
|
-
|
|
4199
|
-
type:
|
|
4200
|
-
id:
|
|
4201
|
-
execution:
|
|
4202
|
-
call_id:
|
|
4203
|
-
status:
|
|
4204
|
-
arguments:
|
|
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
|
-
|
|
4207
|
-
type:
|
|
4208
|
-
id:
|
|
4209
|
-
execution:
|
|
4210
|
-
call_id:
|
|
4211
|
-
status:
|
|
4212
|
-
tools:
|
|
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:
|
|
4217
|
-
incomplete_details:
|
|
4218
|
-
usage:
|
|
4219
|
-
input_tokens:
|
|
4220
|
-
input_tokens_details:
|
|
4221
|
-
output_tokens:
|
|
4222
|
-
output_tokens_details:
|
|
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
|
|
4230
|
-
import { z as
|
|
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 =
|
|
4296
|
-
() =>
|
|
4297
|
-
|
|
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:
|
|
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:
|
|
4311
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
4485
|
+
maxToolCalls: z24.number().nullish(),
|
|
4345
4486
|
/**
|
|
4346
4487
|
* Additional metadata to store with the generation.
|
|
4347
4488
|
*/
|
|
4348
|
-
metadata:
|
|
4489
|
+
metadata: z24.any().nullish(),
|
|
4349
4490
|
/**
|
|
4350
4491
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4351
4492
|
*/
|
|
4352
|
-
parallelToolCalls:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
4528
|
+
reasoningSummary: z24.string().nullish(),
|
|
4388
4529
|
/**
|
|
4389
4530
|
* The identifier for safety monitoring and tracking.
|
|
4390
4531
|
*/
|
|
4391
|
-
safetyIdentifier:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
4586
|
+
forceReasoning: z24.boolean().optional(),
|
|
4446
4587
|
/**
|
|
4447
4588
|
* Enable server-side context management (compaction).
|
|
4448
4589
|
*/
|
|
4449
|
-
contextManagement:
|
|
4450
|
-
|
|
4451
|
-
type:
|
|
4452
|
-
compactThreshold:
|
|
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
|
|
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
|
|
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:
|
|
5175
|
+
headers: combineHeaders6(this.config.headers(), options.headers),
|
|
5035
5176
|
body,
|
|
5036
5177
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5037
|
-
successfulResponseHandler:
|
|
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:
|
|
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
|
|
6601
|
+
combineHeaders as combineHeaders7,
|
|
6461
6602
|
createBinaryResponseHandler,
|
|
6462
|
-
parseProviderOptions as
|
|
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
|
|
6468
|
-
import { z as
|
|
6469
|
-
var openaiSpeechModelOptionsSchema =
|
|
6470
|
-
() =>
|
|
6471
|
-
|
|
6472
|
-
instructions:
|
|
6473
|
-
speed:
|
|
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
|
|
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:
|
|
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
|
|
6582
|
-
convertBase64ToUint8Array as
|
|
6583
|
-
createJsonResponseHandler as
|
|
6722
|
+
combineHeaders as combineHeaders8,
|
|
6723
|
+
convertBase64ToUint8Array as convertBase64ToUint8Array3,
|
|
6724
|
+
createJsonResponseHandler as createJsonResponseHandler7,
|
|
6584
6725
|
mediaTypeToExtension,
|
|
6585
|
-
parseProviderOptions as
|
|
6586
|
-
postFormDataToApi as
|
|
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
|
|
6591
|
-
import { z as
|
|
6592
|
-
var openaiTranscriptionResponseSchema =
|
|
6593
|
-
() =>
|
|
6594
|
-
|
|
6595
|
-
text:
|
|
6596
|
-
language:
|
|
6597
|
-
duration:
|
|
6598
|
-
words:
|
|
6599
|
-
|
|
6600
|
-
word:
|
|
6601
|
-
start:
|
|
6602
|
-
end:
|
|
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:
|
|
6606
|
-
|
|
6607
|
-
id:
|
|
6608
|
-
seek:
|
|
6609
|
-
start:
|
|
6610
|
-
end:
|
|
6611
|
-
text:
|
|
6612
|
-
tokens:
|
|
6613
|
-
temperature:
|
|
6614
|
-
avg_logprob:
|
|
6615
|
-
compression_ratio:
|
|
6616
|
-
no_speech_prob:
|
|
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
|
|
6625
|
-
import { z as
|
|
6626
|
-
var openAITranscriptionModelOptions =
|
|
6627
|
-
() =>
|
|
6628
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
6781
|
+
prompt: z27.string().optional(),
|
|
6641
6782
|
/**
|
|
6642
6783
|
* The sampling temperature, between 0 and 1.
|
|
6643
6784
|
* @default 0
|
|
6644
6785
|
*/
|
|
6645
|
-
temperature:
|
|
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:
|
|
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
|
|
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([
|
|
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
|
|
6924
|
+
} = await postFormDataToApi3({
|
|
6784
6925
|
url: this.config.url({
|
|
6785
6926
|
path: "/audio/transcriptions",
|
|
6786
6927
|
modelId: this.modelId
|
|
6787
6928
|
}),
|
|
6788
|
-
headers:
|
|
6929
|
+
headers: combineHeaders8(this.config.headers(), options.headers),
|
|
6789
6930
|
formData,
|
|
6790
6931
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6791
|
-
successfulResponseHandler:
|
|
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.
|
|
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
|
}
|