@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.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils38 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -159,13 +159,23 @@ function convertToOpenAIChatMessages({
|
|
|
159
159
|
return { type: "text", text: part.text };
|
|
160
160
|
}
|
|
161
161
|
case "file": {
|
|
162
|
+
if ((0, import_provider_utils2.isProviderReference)(part.data)) {
|
|
163
|
+
return {
|
|
164
|
+
type: "file",
|
|
165
|
+
file: {
|
|
166
|
+
file_id: (0, import_provider_utils2.resolveProviderReference)({
|
|
167
|
+
reference: part.data,
|
|
168
|
+
provider: "openai"
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
162
173
|
if (part.mediaType.startsWith("image/")) {
|
|
163
174
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
164
175
|
return {
|
|
165
176
|
type: "image_url",
|
|
166
177
|
image_url: {
|
|
167
178
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
|
|
168
|
-
// OpenAI specific extension: image detail
|
|
169
179
|
detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
|
|
170
180
|
}
|
|
171
181
|
};
|
|
@@ -209,7 +219,7 @@ function convertToOpenAIChatMessages({
|
|
|
209
219
|
}
|
|
210
220
|
return {
|
|
211
221
|
type: "file",
|
|
212
|
-
file:
|
|
222
|
+
file: {
|
|
213
223
|
filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
|
|
214
224
|
file_data: `data:application/pdf;base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`
|
|
215
225
|
}
|
|
@@ -1712,33 +1722,135 @@ var OpenAIEmbeddingModel = class {
|
|
|
1712
1722
|
}
|
|
1713
1723
|
};
|
|
1714
1724
|
|
|
1715
|
-
// src/
|
|
1716
|
-
var
|
|
1725
|
+
// src/files/openai-files.ts
|
|
1726
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1717
1727
|
|
|
1718
|
-
// src/
|
|
1728
|
+
// src/files/openai-files-api.ts
|
|
1719
1729
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1720
1730
|
var import_v48 = require("zod/v4");
|
|
1721
|
-
var
|
|
1731
|
+
var openaiFilesResponseSchema = (0, import_provider_utils12.lazySchema)(
|
|
1722
1732
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1723
1733
|
import_v48.z.object({
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1734
|
+
id: import_v48.z.string(),
|
|
1735
|
+
object: import_v48.z.string().nullish(),
|
|
1736
|
+
bytes: import_v48.z.number().nullish(),
|
|
1737
|
+
created_at: import_v48.z.number().nullish(),
|
|
1738
|
+
filename: import_v48.z.string().nullish(),
|
|
1739
|
+
purpose: import_v48.z.string().nullish(),
|
|
1740
|
+
status: import_v48.z.string().nullish(),
|
|
1741
|
+
expires_at: import_v48.z.number().nullish()
|
|
1742
|
+
})
|
|
1743
|
+
)
|
|
1744
|
+
);
|
|
1745
|
+
|
|
1746
|
+
// src/files/openai-files-options.ts
|
|
1747
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1748
|
+
var import_v49 = require("zod/v4");
|
|
1749
|
+
var openaiFilesOptionsSchema = (0, import_provider_utils13.lazySchema)(
|
|
1750
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1751
|
+
import_v49.z.object({
|
|
1752
|
+
/*
|
|
1753
|
+
* Required by the OpenAI API, but optional here because
|
|
1754
|
+
* the SDK defaults to "assistants" — by far the most common
|
|
1755
|
+
* purpose when uploading files in this context.
|
|
1756
|
+
*/
|
|
1757
|
+
purpose: import_v49.z.string().optional(),
|
|
1758
|
+
expiresAfter: import_v49.z.number().optional()
|
|
1759
|
+
})
|
|
1760
|
+
)
|
|
1761
|
+
);
|
|
1762
|
+
|
|
1763
|
+
// src/files/openai-files.ts
|
|
1764
|
+
var OpenAIFiles = class {
|
|
1765
|
+
constructor(config) {
|
|
1766
|
+
this.config = config;
|
|
1767
|
+
this.specificationVersion = "v4";
|
|
1768
|
+
}
|
|
1769
|
+
get provider() {
|
|
1770
|
+
return this.config.provider;
|
|
1771
|
+
}
|
|
1772
|
+
async uploadFile({
|
|
1773
|
+
data,
|
|
1774
|
+
mediaType,
|
|
1775
|
+
filename,
|
|
1776
|
+
providerOptions
|
|
1777
|
+
}) {
|
|
1778
|
+
var _a, _b, _c;
|
|
1779
|
+
const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1780
|
+
provider: "openai",
|
|
1781
|
+
providerOptions,
|
|
1782
|
+
schema: openaiFilesOptionsSchema
|
|
1783
|
+
});
|
|
1784
|
+
const fileBytes = data instanceof Uint8Array ? data : (0, import_provider_utils14.convertBase64ToUint8Array)(data);
|
|
1785
|
+
const blob = new Blob([fileBytes], {
|
|
1786
|
+
type: mediaType
|
|
1787
|
+
});
|
|
1788
|
+
const formData = new FormData();
|
|
1789
|
+
if (filename != null) {
|
|
1790
|
+
formData.append("file", blob, filename);
|
|
1791
|
+
} else {
|
|
1792
|
+
formData.append("file", blob);
|
|
1793
|
+
}
|
|
1794
|
+
formData.append("purpose", (_a = openaiOptions == null ? void 0 : openaiOptions.purpose) != null ? _a : "assistants");
|
|
1795
|
+
if ((openaiOptions == null ? void 0 : openaiOptions.expiresAfter) != null) {
|
|
1796
|
+
formData.append("expires_after", String(openaiOptions.expiresAfter));
|
|
1797
|
+
}
|
|
1798
|
+
const { value: response } = await (0, import_provider_utils14.postFormDataToApi)({
|
|
1799
|
+
url: `${this.config.baseURL}/files`,
|
|
1800
|
+
headers: (0, import_provider_utils14.combineHeaders)(this.config.headers()),
|
|
1801
|
+
formData,
|
|
1802
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
1803
|
+
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
1804
|
+
openaiFilesResponseSchema
|
|
1805
|
+
),
|
|
1806
|
+
fetch: this.config.fetch
|
|
1807
|
+
});
|
|
1808
|
+
return {
|
|
1809
|
+
warnings: [],
|
|
1810
|
+
providerReference: { openai: response.id },
|
|
1811
|
+
...((_b = response.filename) != null ? _b : filename) ? { filename: (_c = response.filename) != null ? _c : filename } : {},
|
|
1812
|
+
...mediaType != null ? { mediaType } : {},
|
|
1813
|
+
providerMetadata: {
|
|
1814
|
+
openai: {
|
|
1815
|
+
...response.filename != null ? { filename: response.filename } : {},
|
|
1816
|
+
...response.purpose != null ? { purpose: response.purpose } : {},
|
|
1817
|
+
...response.bytes != null ? { bytes: response.bytes } : {},
|
|
1818
|
+
...response.created_at != null ? { createdAt: response.created_at } : {},
|
|
1819
|
+
...response.status != null ? { status: response.status } : {},
|
|
1820
|
+
...response.expires_at != null ? { expiresAt: response.expires_at } : {}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
// src/image/openai-image-model.ts
|
|
1828
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1829
|
+
|
|
1830
|
+
// src/image/openai-image-api.ts
|
|
1831
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1832
|
+
var import_v410 = require("zod/v4");
|
|
1833
|
+
var openaiImageResponseSchema = (0, import_provider_utils15.lazySchema)(
|
|
1834
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1835
|
+
import_v410.z.object({
|
|
1836
|
+
created: import_v410.z.number().nullish(),
|
|
1837
|
+
data: import_v410.z.array(
|
|
1838
|
+
import_v410.z.object({
|
|
1839
|
+
b64_json: import_v410.z.string(),
|
|
1840
|
+
revised_prompt: import_v410.z.string().nullish()
|
|
1729
1841
|
})
|
|
1730
1842
|
),
|
|
1731
|
-
background:
|
|
1732
|
-
output_format:
|
|
1733
|
-
size:
|
|
1734
|
-
quality:
|
|
1735
|
-
usage:
|
|
1736
|
-
input_tokens:
|
|
1737
|
-
output_tokens:
|
|
1738
|
-
total_tokens:
|
|
1739
|
-
input_tokens_details:
|
|
1740
|
-
image_tokens:
|
|
1741
|
-
text_tokens:
|
|
1843
|
+
background: import_v410.z.string().nullish(),
|
|
1844
|
+
output_format: import_v410.z.string().nullish(),
|
|
1845
|
+
size: import_v410.z.string().nullish(),
|
|
1846
|
+
quality: import_v410.z.string().nullish(),
|
|
1847
|
+
usage: import_v410.z.object({
|
|
1848
|
+
input_tokens: import_v410.z.number().nullish(),
|
|
1849
|
+
output_tokens: import_v410.z.number().nullish(),
|
|
1850
|
+
total_tokens: import_v410.z.number().nullish(),
|
|
1851
|
+
input_tokens_details: import_v410.z.object({
|
|
1852
|
+
image_tokens: import_v410.z.number().nullish(),
|
|
1853
|
+
text_tokens: import_v410.z.number().nullish()
|
|
1742
1854
|
}).nullish()
|
|
1743
1855
|
}).nullish()
|
|
1744
1856
|
})
|
|
@@ -1806,13 +1918,13 @@ var OpenAIImageModel = class {
|
|
|
1806
1918
|
}
|
|
1807
1919
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1808
1920
|
if (files != null) {
|
|
1809
|
-
const { value: response2, responseHeaders: responseHeaders2 } = await (0,
|
|
1921
|
+
const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils16.postFormDataToApi)({
|
|
1810
1922
|
url: this.config.url({
|
|
1811
1923
|
path: "/images/edits",
|
|
1812
1924
|
modelId: this.modelId
|
|
1813
1925
|
}),
|
|
1814
|
-
headers: (0,
|
|
1815
|
-
formData: (0,
|
|
1926
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), headers),
|
|
1927
|
+
formData: (0, import_provider_utils16.convertToFormData)({
|
|
1816
1928
|
model: this.modelId,
|
|
1817
1929
|
prompt,
|
|
1818
1930
|
image: await Promise.all(
|
|
@@ -1821,12 +1933,12 @@ var OpenAIImageModel = class {
|
|
|
1821
1933
|
[
|
|
1822
1934
|
file.data instanceof Uint8Array ? new Blob([file.data], {
|
|
1823
1935
|
type: file.mediaType
|
|
1824
|
-
}) : new Blob([(0,
|
|
1936
|
+
}) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(file.data)], {
|
|
1825
1937
|
type: file.mediaType
|
|
1826
1938
|
})
|
|
1827
1939
|
],
|
|
1828
1940
|
{ type: file.mediaType }
|
|
1829
|
-
) : (0,
|
|
1941
|
+
) : (0, import_provider_utils16.downloadBlob)(file.url)
|
|
1830
1942
|
)
|
|
1831
1943
|
),
|
|
1832
1944
|
mask: mask != null ? await fileToBlob(mask) : void 0,
|
|
@@ -1835,7 +1947,7 @@ var OpenAIImageModel = class {
|
|
|
1835
1947
|
...(_d = providerOptions.openai) != null ? _d : {}
|
|
1836
1948
|
}),
|
|
1837
1949
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1838
|
-
successfulResponseHandler: (0,
|
|
1950
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
1839
1951
|
openaiImageResponseSchema
|
|
1840
1952
|
),
|
|
1841
1953
|
abortSignal,
|
|
@@ -1876,12 +1988,12 @@ var OpenAIImageModel = class {
|
|
|
1876
1988
|
}
|
|
1877
1989
|
};
|
|
1878
1990
|
}
|
|
1879
|
-
const { value: response, responseHeaders } = await (0,
|
|
1991
|
+
const { value: response, responseHeaders } = await (0, import_provider_utils16.postJsonToApi)({
|
|
1880
1992
|
url: this.config.url({
|
|
1881
1993
|
path: "/images/generations",
|
|
1882
1994
|
modelId: this.modelId
|
|
1883
1995
|
}),
|
|
1884
|
-
headers: (0,
|
|
1996
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), headers),
|
|
1885
1997
|
body: {
|
|
1886
1998
|
model: this.modelId,
|
|
1887
1999
|
prompt,
|
|
@@ -1891,7 +2003,7 @@ var OpenAIImageModel = class {
|
|
|
1891
2003
|
...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
|
|
1892
2004
|
},
|
|
1893
2005
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1894
|
-
successfulResponseHandler: (0,
|
|
2006
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
1895
2007
|
openaiImageResponseSchema
|
|
1896
2008
|
),
|
|
1897
2009
|
abortSignal,
|
|
@@ -1953,48 +2065,48 @@ function distributeTokenDetails(details, index, total) {
|
|
|
1953
2065
|
async function fileToBlob(file) {
|
|
1954
2066
|
if (!file) return void 0;
|
|
1955
2067
|
if (file.type === "url") {
|
|
1956
|
-
return (0,
|
|
2068
|
+
return (0, import_provider_utils16.downloadBlob)(file.url);
|
|
1957
2069
|
}
|
|
1958
|
-
const data = file.data instanceof Uint8Array ? file.data : (0,
|
|
2070
|
+
const data = file.data instanceof Uint8Array ? file.data : (0, import_provider_utils16.convertBase64ToUint8Array)(file.data);
|
|
1959
2071
|
return new Blob([data], { type: file.mediaType });
|
|
1960
2072
|
}
|
|
1961
2073
|
|
|
1962
2074
|
// src/tool/apply-patch.ts
|
|
1963
|
-
var
|
|
1964
|
-
var
|
|
1965
|
-
var applyPatchInputSchema = (0,
|
|
1966
|
-
() => (0,
|
|
1967
|
-
|
|
1968
|
-
callId:
|
|
1969
|
-
operation:
|
|
1970
|
-
|
|
1971
|
-
type:
|
|
1972
|
-
path:
|
|
1973
|
-
diff:
|
|
2075
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2076
|
+
var import_v411 = require("zod/v4");
|
|
2077
|
+
var applyPatchInputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2078
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2079
|
+
import_v411.z.object({
|
|
2080
|
+
callId: import_v411.z.string(),
|
|
2081
|
+
operation: import_v411.z.discriminatedUnion("type", [
|
|
2082
|
+
import_v411.z.object({
|
|
2083
|
+
type: import_v411.z.literal("create_file"),
|
|
2084
|
+
path: import_v411.z.string(),
|
|
2085
|
+
diff: import_v411.z.string()
|
|
1974
2086
|
}),
|
|
1975
|
-
|
|
1976
|
-
type:
|
|
1977
|
-
path:
|
|
2087
|
+
import_v411.z.object({
|
|
2088
|
+
type: import_v411.z.literal("delete_file"),
|
|
2089
|
+
path: import_v411.z.string()
|
|
1978
2090
|
}),
|
|
1979
|
-
|
|
1980
|
-
type:
|
|
1981
|
-
path:
|
|
1982
|
-
diff:
|
|
2091
|
+
import_v411.z.object({
|
|
2092
|
+
type: import_v411.z.literal("update_file"),
|
|
2093
|
+
path: import_v411.z.string(),
|
|
2094
|
+
diff: import_v411.z.string()
|
|
1983
2095
|
})
|
|
1984
2096
|
])
|
|
1985
2097
|
})
|
|
1986
2098
|
)
|
|
1987
2099
|
);
|
|
1988
|
-
var applyPatchOutputSchema = (0,
|
|
1989
|
-
() => (0,
|
|
1990
|
-
|
|
1991
|
-
status:
|
|
1992
|
-
output:
|
|
2100
|
+
var applyPatchOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2101
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2102
|
+
import_v411.z.object({
|
|
2103
|
+
status: import_v411.z.enum(["completed", "failed"]),
|
|
2104
|
+
output: import_v411.z.string().optional()
|
|
1993
2105
|
})
|
|
1994
2106
|
)
|
|
1995
2107
|
);
|
|
1996
|
-
var applyPatchArgsSchema = (0,
|
|
1997
|
-
var applyPatchToolFactory = (0,
|
|
2108
|
+
var applyPatchArgsSchema = (0, import_provider_utils17.lazySchema)(() => (0, import_provider_utils17.zodSchema)(import_v411.z.object({})));
|
|
2109
|
+
var applyPatchToolFactory = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
1998
2110
|
id: "openai.apply_patch",
|
|
1999
2111
|
inputSchema: applyPatchInputSchema,
|
|
2000
2112
|
outputSchema: applyPatchOutputSchema
|
|
@@ -2002,41 +2114,41 @@ var applyPatchToolFactory = (0, import_provider_utils14.createProviderToolFactor
|
|
|
2002
2114
|
var applyPatch = applyPatchToolFactory;
|
|
2003
2115
|
|
|
2004
2116
|
// src/tool/code-interpreter.ts
|
|
2005
|
-
var
|
|
2006
|
-
var
|
|
2007
|
-
var codeInterpreterInputSchema = (0,
|
|
2008
|
-
() => (0,
|
|
2009
|
-
|
|
2010
|
-
code:
|
|
2011
|
-
containerId:
|
|
2117
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2118
|
+
var import_v412 = require("zod/v4");
|
|
2119
|
+
var codeInterpreterInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2120
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2121
|
+
import_v412.z.object({
|
|
2122
|
+
code: import_v412.z.string().nullish(),
|
|
2123
|
+
containerId: import_v412.z.string()
|
|
2012
2124
|
})
|
|
2013
2125
|
)
|
|
2014
2126
|
);
|
|
2015
|
-
var codeInterpreterOutputSchema = (0,
|
|
2016
|
-
() => (0,
|
|
2017
|
-
|
|
2018
|
-
outputs:
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2127
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2128
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2129
|
+
import_v412.z.object({
|
|
2130
|
+
outputs: import_v412.z.array(
|
|
2131
|
+
import_v412.z.discriminatedUnion("type", [
|
|
2132
|
+
import_v412.z.object({ type: import_v412.z.literal("logs"), logs: import_v412.z.string() }),
|
|
2133
|
+
import_v412.z.object({ type: import_v412.z.literal("image"), url: import_v412.z.string() })
|
|
2022
2134
|
])
|
|
2023
2135
|
).nullish()
|
|
2024
2136
|
})
|
|
2025
2137
|
)
|
|
2026
2138
|
);
|
|
2027
|
-
var codeInterpreterArgsSchema = (0,
|
|
2028
|
-
() => (0,
|
|
2029
|
-
|
|
2030
|
-
container:
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
fileIds:
|
|
2139
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
2140
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2141
|
+
import_v412.z.object({
|
|
2142
|
+
container: import_v412.z.union([
|
|
2143
|
+
import_v412.z.string(),
|
|
2144
|
+
import_v412.z.object({
|
|
2145
|
+
fileIds: import_v412.z.array(import_v412.z.string()).optional()
|
|
2034
2146
|
})
|
|
2035
2147
|
]).optional()
|
|
2036
2148
|
})
|
|
2037
2149
|
)
|
|
2038
2150
|
);
|
|
2039
|
-
var codeInterpreterToolFactory = (0,
|
|
2151
|
+
var codeInterpreterToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
2040
2152
|
id: "openai.code_interpreter",
|
|
2041
2153
|
inputSchema: codeInterpreterInputSchema,
|
|
2042
2154
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -2046,108 +2158,108 @@ var codeInterpreter = (args = {}) => {
|
|
|
2046
2158
|
};
|
|
2047
2159
|
|
|
2048
2160
|
// src/tool/custom.ts
|
|
2049
|
-
var
|
|
2050
|
-
var
|
|
2051
|
-
var customArgsSchema = (0,
|
|
2052
|
-
() => (0,
|
|
2053
|
-
|
|
2054
|
-
description:
|
|
2055
|
-
format:
|
|
2056
|
-
|
|
2057
|
-
type:
|
|
2058
|
-
syntax:
|
|
2059
|
-
definition:
|
|
2161
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2162
|
+
var import_v413 = require("zod/v4");
|
|
2163
|
+
var customArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
2164
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2165
|
+
import_v413.z.object({
|
|
2166
|
+
description: import_v413.z.string().optional(),
|
|
2167
|
+
format: import_v413.z.union([
|
|
2168
|
+
import_v413.z.object({
|
|
2169
|
+
type: import_v413.z.literal("grammar"),
|
|
2170
|
+
syntax: import_v413.z.enum(["regex", "lark"]),
|
|
2171
|
+
definition: import_v413.z.string()
|
|
2060
2172
|
}),
|
|
2061
|
-
|
|
2062
|
-
type:
|
|
2173
|
+
import_v413.z.object({
|
|
2174
|
+
type: import_v413.z.literal("text")
|
|
2063
2175
|
})
|
|
2064
2176
|
]).optional()
|
|
2065
2177
|
})
|
|
2066
2178
|
)
|
|
2067
2179
|
);
|
|
2068
|
-
var customInputSchema = (0,
|
|
2069
|
-
var customToolFactory = (0,
|
|
2180
|
+
var customInputSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v413.z.string()));
|
|
2181
|
+
var customToolFactory = (0, import_provider_utils19.createProviderToolFactory)({
|
|
2070
2182
|
id: "openai.custom",
|
|
2071
2183
|
inputSchema: customInputSchema
|
|
2072
2184
|
});
|
|
2073
2185
|
var customTool = (args) => customToolFactory(args);
|
|
2074
2186
|
|
|
2075
2187
|
// src/tool/file-search.ts
|
|
2076
|
-
var
|
|
2077
|
-
var
|
|
2078
|
-
var comparisonFilterSchema =
|
|
2079
|
-
key:
|
|
2080
|
-
type:
|
|
2081
|
-
value:
|
|
2188
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2189
|
+
var import_v414 = require("zod/v4");
|
|
2190
|
+
var comparisonFilterSchema = import_v414.z.object({
|
|
2191
|
+
key: import_v414.z.string(),
|
|
2192
|
+
type: import_v414.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
2193
|
+
value: import_v414.z.union([import_v414.z.string(), import_v414.z.number(), import_v414.z.boolean(), import_v414.z.array(import_v414.z.string())])
|
|
2082
2194
|
});
|
|
2083
|
-
var compoundFilterSchema =
|
|
2084
|
-
type:
|
|
2085
|
-
filters:
|
|
2086
|
-
|
|
2195
|
+
var compoundFilterSchema = import_v414.z.object({
|
|
2196
|
+
type: import_v414.z.enum(["and", "or"]),
|
|
2197
|
+
filters: import_v414.z.array(
|
|
2198
|
+
import_v414.z.union([comparisonFilterSchema, import_v414.z.lazy(() => compoundFilterSchema)])
|
|
2087
2199
|
)
|
|
2088
2200
|
});
|
|
2089
|
-
var fileSearchArgsSchema = (0,
|
|
2090
|
-
() => (0,
|
|
2091
|
-
|
|
2092
|
-
vectorStoreIds:
|
|
2093
|
-
maxNumResults:
|
|
2094
|
-
ranking:
|
|
2095
|
-
ranker:
|
|
2096
|
-
scoreThreshold:
|
|
2201
|
+
var fileSearchArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2202
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2203
|
+
import_v414.z.object({
|
|
2204
|
+
vectorStoreIds: import_v414.z.array(import_v414.z.string()),
|
|
2205
|
+
maxNumResults: import_v414.z.number().optional(),
|
|
2206
|
+
ranking: import_v414.z.object({
|
|
2207
|
+
ranker: import_v414.z.string().optional(),
|
|
2208
|
+
scoreThreshold: import_v414.z.number().optional()
|
|
2097
2209
|
}).optional(),
|
|
2098
|
-
filters:
|
|
2210
|
+
filters: import_v414.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2099
2211
|
})
|
|
2100
2212
|
)
|
|
2101
2213
|
);
|
|
2102
|
-
var fileSearchOutputSchema = (0,
|
|
2103
|
-
() => (0,
|
|
2104
|
-
|
|
2105
|
-
queries:
|
|
2106
|
-
results:
|
|
2107
|
-
|
|
2108
|
-
attributes:
|
|
2109
|
-
fileId:
|
|
2110
|
-
filename:
|
|
2111
|
-
score:
|
|
2112
|
-
text:
|
|
2214
|
+
var fileSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2215
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2216
|
+
import_v414.z.object({
|
|
2217
|
+
queries: import_v414.z.array(import_v414.z.string()),
|
|
2218
|
+
results: import_v414.z.array(
|
|
2219
|
+
import_v414.z.object({
|
|
2220
|
+
attributes: import_v414.z.record(import_v414.z.string(), import_v414.z.unknown()),
|
|
2221
|
+
fileId: import_v414.z.string(),
|
|
2222
|
+
filename: import_v414.z.string(),
|
|
2223
|
+
score: import_v414.z.number(),
|
|
2224
|
+
text: import_v414.z.string()
|
|
2113
2225
|
})
|
|
2114
2226
|
).nullable()
|
|
2115
2227
|
})
|
|
2116
2228
|
)
|
|
2117
2229
|
);
|
|
2118
|
-
var fileSearch = (0,
|
|
2230
|
+
var fileSearch = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2119
2231
|
id: "openai.file_search",
|
|
2120
|
-
inputSchema:
|
|
2232
|
+
inputSchema: import_v414.z.object({}),
|
|
2121
2233
|
outputSchema: fileSearchOutputSchema
|
|
2122
2234
|
});
|
|
2123
2235
|
|
|
2124
2236
|
// src/tool/image-generation.ts
|
|
2125
|
-
var
|
|
2126
|
-
var
|
|
2127
|
-
var imageGenerationArgsSchema = (0,
|
|
2128
|
-
() => (0,
|
|
2129
|
-
|
|
2130
|
-
background:
|
|
2131
|
-
inputFidelity:
|
|
2132
|
-
inputImageMask:
|
|
2133
|
-
fileId:
|
|
2134
|
-
imageUrl:
|
|
2237
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2238
|
+
var import_v415 = require("zod/v4");
|
|
2239
|
+
var imageGenerationArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2240
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2241
|
+
import_v415.z.object({
|
|
2242
|
+
background: import_v415.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2243
|
+
inputFidelity: import_v415.z.enum(["low", "high"]).optional(),
|
|
2244
|
+
inputImageMask: import_v415.z.object({
|
|
2245
|
+
fileId: import_v415.z.string().optional(),
|
|
2246
|
+
imageUrl: import_v415.z.string().optional()
|
|
2135
2247
|
}).optional(),
|
|
2136
|
-
model:
|
|
2137
|
-
moderation:
|
|
2138
|
-
outputCompression:
|
|
2139
|
-
outputFormat:
|
|
2140
|
-
partialImages:
|
|
2141
|
-
quality:
|
|
2142
|
-
size:
|
|
2248
|
+
model: import_v415.z.string().optional(),
|
|
2249
|
+
moderation: import_v415.z.enum(["auto"]).optional(),
|
|
2250
|
+
outputCompression: import_v415.z.number().int().min(0).max(100).optional(),
|
|
2251
|
+
outputFormat: import_v415.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2252
|
+
partialImages: import_v415.z.number().int().min(0).max(3).optional(),
|
|
2253
|
+
quality: import_v415.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2254
|
+
size: import_v415.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2143
2255
|
}).strict()
|
|
2144
2256
|
)
|
|
2145
2257
|
);
|
|
2146
|
-
var imageGenerationInputSchema = (0,
|
|
2147
|
-
var imageGenerationOutputSchema = (0,
|
|
2148
|
-
() => (0,
|
|
2258
|
+
var imageGenerationInputSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v415.z.object({})));
|
|
2259
|
+
var imageGenerationOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2260
|
+
() => (0, import_provider_utils21.zodSchema)(import_v415.z.object({ result: import_v415.z.string() }))
|
|
2149
2261
|
);
|
|
2150
|
-
var imageGenerationToolFactory = (0,
|
|
2262
|
+
var imageGenerationToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2151
2263
|
id: "openai.image_generation",
|
|
2152
2264
|
inputSchema: imageGenerationInputSchema,
|
|
2153
2265
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -2157,115 +2269,115 @@ var imageGeneration = (args = {}) => {
|
|
|
2157
2269
|
};
|
|
2158
2270
|
|
|
2159
2271
|
// src/tool/local-shell.ts
|
|
2160
|
-
var
|
|
2161
|
-
var
|
|
2162
|
-
var localShellInputSchema = (0,
|
|
2163
|
-
() => (0,
|
|
2164
|
-
|
|
2165
|
-
action:
|
|
2166
|
-
type:
|
|
2167
|
-
command:
|
|
2168
|
-
timeoutMs:
|
|
2169
|
-
user:
|
|
2170
|
-
workingDirectory:
|
|
2171
|
-
env:
|
|
2272
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2273
|
+
var import_v416 = require("zod/v4");
|
|
2274
|
+
var localShellInputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2275
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2276
|
+
import_v416.z.object({
|
|
2277
|
+
action: import_v416.z.object({
|
|
2278
|
+
type: import_v416.z.literal("exec"),
|
|
2279
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
2280
|
+
timeoutMs: import_v416.z.number().optional(),
|
|
2281
|
+
user: import_v416.z.string().optional(),
|
|
2282
|
+
workingDirectory: import_v416.z.string().optional(),
|
|
2283
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
2172
2284
|
})
|
|
2173
2285
|
})
|
|
2174
2286
|
)
|
|
2175
2287
|
);
|
|
2176
|
-
var localShellOutputSchema = (0,
|
|
2177
|
-
() => (0,
|
|
2288
|
+
var localShellOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2289
|
+
() => (0, import_provider_utils22.zodSchema)(import_v416.z.object({ output: import_v416.z.string() }))
|
|
2178
2290
|
);
|
|
2179
|
-
var localShell = (0,
|
|
2291
|
+
var localShell = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2180
2292
|
id: "openai.local_shell",
|
|
2181
2293
|
inputSchema: localShellInputSchema,
|
|
2182
2294
|
outputSchema: localShellOutputSchema
|
|
2183
2295
|
});
|
|
2184
2296
|
|
|
2185
2297
|
// src/tool/shell.ts
|
|
2186
|
-
var
|
|
2187
|
-
var
|
|
2188
|
-
var shellInputSchema = (0,
|
|
2189
|
-
() => (0,
|
|
2190
|
-
|
|
2191
|
-
action:
|
|
2192
|
-
commands:
|
|
2193
|
-
timeoutMs:
|
|
2194
|
-
maxOutputLength:
|
|
2298
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2299
|
+
var import_v417 = require("zod/v4");
|
|
2300
|
+
var shellInputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2301
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2302
|
+
import_v417.z.object({
|
|
2303
|
+
action: import_v417.z.object({
|
|
2304
|
+
commands: import_v417.z.array(import_v417.z.string()),
|
|
2305
|
+
timeoutMs: import_v417.z.number().optional(),
|
|
2306
|
+
maxOutputLength: import_v417.z.number().optional()
|
|
2195
2307
|
})
|
|
2196
2308
|
})
|
|
2197
2309
|
)
|
|
2198
2310
|
);
|
|
2199
|
-
var shellOutputSchema = (0,
|
|
2200
|
-
() => (0,
|
|
2201
|
-
|
|
2202
|
-
output:
|
|
2203
|
-
|
|
2204
|
-
stdout:
|
|
2205
|
-
stderr:
|
|
2206
|
-
outcome:
|
|
2207
|
-
|
|
2208
|
-
|
|
2311
|
+
var shellOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2312
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2313
|
+
import_v417.z.object({
|
|
2314
|
+
output: import_v417.z.array(
|
|
2315
|
+
import_v417.z.object({
|
|
2316
|
+
stdout: import_v417.z.string(),
|
|
2317
|
+
stderr: import_v417.z.string(),
|
|
2318
|
+
outcome: import_v417.z.discriminatedUnion("type", [
|
|
2319
|
+
import_v417.z.object({ type: import_v417.z.literal("timeout") }),
|
|
2320
|
+
import_v417.z.object({ type: import_v417.z.literal("exit"), exitCode: import_v417.z.number() })
|
|
2209
2321
|
])
|
|
2210
2322
|
})
|
|
2211
2323
|
)
|
|
2212
2324
|
})
|
|
2213
2325
|
)
|
|
2214
2326
|
);
|
|
2215
|
-
var shellSkillsSchema =
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
type:
|
|
2219
|
-
skillId:
|
|
2220
|
-
version:
|
|
2327
|
+
var shellSkillsSchema = import_v417.z.array(
|
|
2328
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2329
|
+
import_v417.z.object({
|
|
2330
|
+
type: import_v417.z.literal("skillReference"),
|
|
2331
|
+
skillId: import_v417.z.string(),
|
|
2332
|
+
version: import_v417.z.string().optional()
|
|
2221
2333
|
}),
|
|
2222
|
-
|
|
2223
|
-
type:
|
|
2224
|
-
name:
|
|
2225
|
-
description:
|
|
2226
|
-
source:
|
|
2227
|
-
type:
|
|
2228
|
-
mediaType:
|
|
2229
|
-
data:
|
|
2334
|
+
import_v417.z.object({
|
|
2335
|
+
type: import_v417.z.literal("inline"),
|
|
2336
|
+
name: import_v417.z.string(),
|
|
2337
|
+
description: import_v417.z.string(),
|
|
2338
|
+
source: import_v417.z.object({
|
|
2339
|
+
type: import_v417.z.literal("base64"),
|
|
2340
|
+
mediaType: import_v417.z.literal("application/zip"),
|
|
2341
|
+
data: import_v417.z.string()
|
|
2230
2342
|
})
|
|
2231
2343
|
})
|
|
2232
2344
|
])
|
|
2233
2345
|
).optional();
|
|
2234
|
-
var shellArgsSchema = (0,
|
|
2235
|
-
() => (0,
|
|
2236
|
-
|
|
2237
|
-
environment:
|
|
2238
|
-
|
|
2239
|
-
type:
|
|
2240
|
-
fileIds:
|
|
2241
|
-
memoryLimit:
|
|
2242
|
-
networkPolicy:
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
type:
|
|
2246
|
-
allowedDomains:
|
|
2247
|
-
domainSecrets:
|
|
2248
|
-
|
|
2249
|
-
domain:
|
|
2250
|
-
name:
|
|
2251
|
-
value:
|
|
2346
|
+
var shellArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
2347
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2348
|
+
import_v417.z.object({
|
|
2349
|
+
environment: import_v417.z.union([
|
|
2350
|
+
import_v417.z.object({
|
|
2351
|
+
type: import_v417.z.literal("containerAuto"),
|
|
2352
|
+
fileIds: import_v417.z.array(import_v417.z.string()).optional(),
|
|
2353
|
+
memoryLimit: import_v417.z.enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
2354
|
+
networkPolicy: import_v417.z.discriminatedUnion("type", [
|
|
2355
|
+
import_v417.z.object({ type: import_v417.z.literal("disabled") }),
|
|
2356
|
+
import_v417.z.object({
|
|
2357
|
+
type: import_v417.z.literal("allowlist"),
|
|
2358
|
+
allowedDomains: import_v417.z.array(import_v417.z.string()),
|
|
2359
|
+
domainSecrets: import_v417.z.array(
|
|
2360
|
+
import_v417.z.object({
|
|
2361
|
+
domain: import_v417.z.string(),
|
|
2362
|
+
name: import_v417.z.string(),
|
|
2363
|
+
value: import_v417.z.string()
|
|
2252
2364
|
})
|
|
2253
2365
|
).optional()
|
|
2254
2366
|
})
|
|
2255
2367
|
]).optional(),
|
|
2256
2368
|
skills: shellSkillsSchema
|
|
2257
2369
|
}),
|
|
2258
|
-
|
|
2259
|
-
type:
|
|
2260
|
-
containerId:
|
|
2370
|
+
import_v417.z.object({
|
|
2371
|
+
type: import_v417.z.literal("containerReference"),
|
|
2372
|
+
containerId: import_v417.z.string()
|
|
2261
2373
|
}),
|
|
2262
|
-
|
|
2263
|
-
type:
|
|
2264
|
-
skills:
|
|
2265
|
-
|
|
2266
|
-
name:
|
|
2267
|
-
description:
|
|
2268
|
-
path:
|
|
2374
|
+
import_v417.z.object({
|
|
2375
|
+
type: import_v417.z.literal("local").optional(),
|
|
2376
|
+
skills: import_v417.z.array(
|
|
2377
|
+
import_v417.z.object({
|
|
2378
|
+
name: import_v417.z.string(),
|
|
2379
|
+
description: import_v417.z.string(),
|
|
2380
|
+
path: import_v417.z.string()
|
|
2269
2381
|
})
|
|
2270
2382
|
).optional()
|
|
2271
2383
|
})
|
|
@@ -2273,40 +2385,40 @@ var shellArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2273
2385
|
})
|
|
2274
2386
|
)
|
|
2275
2387
|
);
|
|
2276
|
-
var shell = (0,
|
|
2388
|
+
var shell = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2277
2389
|
id: "openai.shell",
|
|
2278
2390
|
inputSchema: shellInputSchema,
|
|
2279
2391
|
outputSchema: shellOutputSchema
|
|
2280
2392
|
});
|
|
2281
2393
|
|
|
2282
2394
|
// src/tool/tool-search.ts
|
|
2283
|
-
var
|
|
2284
|
-
var
|
|
2285
|
-
var toolSearchArgsSchema = (0,
|
|
2286
|
-
() => (0,
|
|
2287
|
-
|
|
2288
|
-
execution:
|
|
2289
|
-
description:
|
|
2290
|
-
parameters:
|
|
2395
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2396
|
+
var import_v418 = require("zod/v4");
|
|
2397
|
+
var toolSearchArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
2398
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2399
|
+
import_v418.z.object({
|
|
2400
|
+
execution: import_v418.z.enum(["server", "client"]).optional(),
|
|
2401
|
+
description: import_v418.z.string().optional(),
|
|
2402
|
+
parameters: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
2291
2403
|
})
|
|
2292
2404
|
)
|
|
2293
2405
|
);
|
|
2294
|
-
var toolSearchInputSchema = (0,
|
|
2295
|
-
() => (0,
|
|
2296
|
-
|
|
2297
|
-
arguments:
|
|
2298
|
-
call_id:
|
|
2406
|
+
var toolSearchInputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2407
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2408
|
+
import_v418.z.object({
|
|
2409
|
+
arguments: import_v418.z.unknown().optional(),
|
|
2410
|
+
call_id: import_v418.z.string().nullish()
|
|
2299
2411
|
})
|
|
2300
2412
|
)
|
|
2301
2413
|
);
|
|
2302
|
-
var toolSearchOutputSchema = (0,
|
|
2303
|
-
() => (0,
|
|
2304
|
-
|
|
2305
|
-
tools:
|
|
2414
|
+
var toolSearchOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2415
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2416
|
+
import_v418.z.object({
|
|
2417
|
+
tools: import_v418.z.array(import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()))
|
|
2306
2418
|
})
|
|
2307
2419
|
)
|
|
2308
2420
|
);
|
|
2309
|
-
var toolSearchToolFactory = (0,
|
|
2421
|
+
var toolSearchToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
2310
2422
|
id: "openai.tool_search",
|
|
2311
2423
|
inputSchema: toolSearchInputSchema,
|
|
2312
2424
|
outputSchema: toolSearchOutputSchema
|
|
@@ -2314,53 +2426,53 @@ var toolSearchToolFactory = (0, import_provider_utils21.createProviderToolFactor
|
|
|
2314
2426
|
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2315
2427
|
|
|
2316
2428
|
// src/tool/web-search.ts
|
|
2317
|
-
var
|
|
2318
|
-
var
|
|
2319
|
-
var webSearchArgsSchema = (0,
|
|
2320
|
-
() => (0,
|
|
2321
|
-
|
|
2322
|
-
externalWebAccess:
|
|
2323
|
-
filters:
|
|
2324
|
-
searchContextSize:
|
|
2325
|
-
userLocation:
|
|
2326
|
-
type:
|
|
2327
|
-
country:
|
|
2328
|
-
city:
|
|
2329
|
-
region:
|
|
2330
|
-
timezone:
|
|
2429
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2430
|
+
var import_v419 = require("zod/v4");
|
|
2431
|
+
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
2432
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
2433
|
+
import_v419.z.object({
|
|
2434
|
+
externalWebAccess: import_v419.z.boolean().optional(),
|
|
2435
|
+
filters: import_v419.z.object({ allowedDomains: import_v419.z.array(import_v419.z.string()).optional() }).optional(),
|
|
2436
|
+
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
2437
|
+
userLocation: import_v419.z.object({
|
|
2438
|
+
type: import_v419.z.literal("approximate"),
|
|
2439
|
+
country: import_v419.z.string().optional(),
|
|
2440
|
+
city: import_v419.z.string().optional(),
|
|
2441
|
+
region: import_v419.z.string().optional(),
|
|
2442
|
+
timezone: import_v419.z.string().optional()
|
|
2331
2443
|
}).optional()
|
|
2332
2444
|
})
|
|
2333
2445
|
)
|
|
2334
2446
|
);
|
|
2335
|
-
var webSearchInputSchema = (0,
|
|
2336
|
-
var webSearchOutputSchema = (0,
|
|
2337
|
-
() => (0,
|
|
2338
|
-
|
|
2339
|
-
action:
|
|
2340
|
-
|
|
2341
|
-
type:
|
|
2342
|
-
query:
|
|
2447
|
+
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v419.z.object({})));
|
|
2448
|
+
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
2449
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
2450
|
+
import_v419.z.object({
|
|
2451
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2452
|
+
import_v419.z.object({
|
|
2453
|
+
type: import_v419.z.literal("search"),
|
|
2454
|
+
query: import_v419.z.string().optional()
|
|
2343
2455
|
}),
|
|
2344
|
-
|
|
2345
|
-
type:
|
|
2346
|
-
url:
|
|
2456
|
+
import_v419.z.object({
|
|
2457
|
+
type: import_v419.z.literal("openPage"),
|
|
2458
|
+
url: import_v419.z.string().nullish()
|
|
2347
2459
|
}),
|
|
2348
|
-
|
|
2349
|
-
type:
|
|
2350
|
-
url:
|
|
2351
|
-
pattern:
|
|
2460
|
+
import_v419.z.object({
|
|
2461
|
+
type: import_v419.z.literal("findInPage"),
|
|
2462
|
+
url: import_v419.z.string().nullish(),
|
|
2463
|
+
pattern: import_v419.z.string().nullish()
|
|
2352
2464
|
})
|
|
2353
2465
|
]).optional(),
|
|
2354
|
-
sources:
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2466
|
+
sources: import_v419.z.array(
|
|
2467
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2468
|
+
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
2469
|
+
import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
|
|
2358
2470
|
])
|
|
2359
2471
|
).optional()
|
|
2360
2472
|
})
|
|
2361
2473
|
)
|
|
2362
2474
|
);
|
|
2363
|
-
var webSearchToolFactory = (0,
|
|
2475
|
+
var webSearchToolFactory = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
2364
2476
|
id: "openai.web_search",
|
|
2365
2477
|
inputSchema: webSearchInputSchema,
|
|
2366
2478
|
outputSchema: webSearchOutputSchema
|
|
@@ -2368,109 +2480,109 @@ var webSearchToolFactory = (0, import_provider_utils22.createProviderToolFactory
|
|
|
2368
2480
|
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2369
2481
|
|
|
2370
2482
|
// src/tool/web-search-preview.ts
|
|
2371
|
-
var
|
|
2372
|
-
var
|
|
2373
|
-
var webSearchPreviewArgsSchema = (0,
|
|
2374
|
-
() => (0,
|
|
2375
|
-
|
|
2376
|
-
searchContextSize:
|
|
2377
|
-
userLocation:
|
|
2378
|
-
type:
|
|
2379
|
-
country:
|
|
2380
|
-
city:
|
|
2381
|
-
region:
|
|
2382
|
-
timezone:
|
|
2483
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
2484
|
+
var import_v420 = require("zod/v4");
|
|
2485
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
2486
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
2487
|
+
import_v420.z.object({
|
|
2488
|
+
searchContextSize: import_v420.z.enum(["low", "medium", "high"]).optional(),
|
|
2489
|
+
userLocation: import_v420.z.object({
|
|
2490
|
+
type: import_v420.z.literal("approximate"),
|
|
2491
|
+
country: import_v420.z.string().optional(),
|
|
2492
|
+
city: import_v420.z.string().optional(),
|
|
2493
|
+
region: import_v420.z.string().optional(),
|
|
2494
|
+
timezone: import_v420.z.string().optional()
|
|
2383
2495
|
}).optional()
|
|
2384
2496
|
})
|
|
2385
2497
|
)
|
|
2386
2498
|
);
|
|
2387
|
-
var webSearchPreviewInputSchema = (0,
|
|
2388
|
-
() => (0,
|
|
2499
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
2500
|
+
() => (0, import_provider_utils26.zodSchema)(import_v420.z.object({}))
|
|
2389
2501
|
);
|
|
2390
|
-
var webSearchPreviewOutputSchema = (0,
|
|
2391
|
-
() => (0,
|
|
2392
|
-
|
|
2393
|
-
action:
|
|
2394
|
-
|
|
2395
|
-
type:
|
|
2396
|
-
query:
|
|
2502
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
2503
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
2504
|
+
import_v420.z.object({
|
|
2505
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
2506
|
+
import_v420.z.object({
|
|
2507
|
+
type: import_v420.z.literal("search"),
|
|
2508
|
+
query: import_v420.z.string().optional()
|
|
2397
2509
|
}),
|
|
2398
|
-
|
|
2399
|
-
type:
|
|
2400
|
-
url:
|
|
2510
|
+
import_v420.z.object({
|
|
2511
|
+
type: import_v420.z.literal("openPage"),
|
|
2512
|
+
url: import_v420.z.string().nullish()
|
|
2401
2513
|
}),
|
|
2402
|
-
|
|
2403
|
-
type:
|
|
2404
|
-
url:
|
|
2405
|
-
pattern:
|
|
2514
|
+
import_v420.z.object({
|
|
2515
|
+
type: import_v420.z.literal("findInPage"),
|
|
2516
|
+
url: import_v420.z.string().nullish(),
|
|
2517
|
+
pattern: import_v420.z.string().nullish()
|
|
2406
2518
|
})
|
|
2407
2519
|
]).optional()
|
|
2408
2520
|
})
|
|
2409
2521
|
)
|
|
2410
2522
|
);
|
|
2411
|
-
var webSearchPreview = (0,
|
|
2523
|
+
var webSearchPreview = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
2412
2524
|
id: "openai.web_search_preview",
|
|
2413
2525
|
inputSchema: webSearchPreviewInputSchema,
|
|
2414
2526
|
outputSchema: webSearchPreviewOutputSchema
|
|
2415
2527
|
});
|
|
2416
2528
|
|
|
2417
2529
|
// src/tool/mcp.ts
|
|
2418
|
-
var
|
|
2419
|
-
var
|
|
2420
|
-
var jsonValueSchema =
|
|
2421
|
-
() =>
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2530
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
2531
|
+
var import_v421 = require("zod/v4");
|
|
2532
|
+
var jsonValueSchema = import_v421.z.lazy(
|
|
2533
|
+
() => import_v421.z.union([
|
|
2534
|
+
import_v421.z.string(),
|
|
2535
|
+
import_v421.z.number(),
|
|
2536
|
+
import_v421.z.boolean(),
|
|
2537
|
+
import_v421.z.null(),
|
|
2538
|
+
import_v421.z.array(jsonValueSchema),
|
|
2539
|
+
import_v421.z.record(import_v421.z.string(), jsonValueSchema)
|
|
2428
2540
|
])
|
|
2429
2541
|
);
|
|
2430
|
-
var mcpArgsSchema = (0,
|
|
2431
|
-
() => (0,
|
|
2432
|
-
|
|
2433
|
-
serverLabel:
|
|
2434
|
-
allowedTools:
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
readOnly:
|
|
2438
|
-
toolNames:
|
|
2542
|
+
var mcpArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
2543
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
2544
|
+
import_v421.z.object({
|
|
2545
|
+
serverLabel: import_v421.z.string(),
|
|
2546
|
+
allowedTools: import_v421.z.union([
|
|
2547
|
+
import_v421.z.array(import_v421.z.string()),
|
|
2548
|
+
import_v421.z.object({
|
|
2549
|
+
readOnly: import_v421.z.boolean().optional(),
|
|
2550
|
+
toolNames: import_v421.z.array(import_v421.z.string()).optional()
|
|
2439
2551
|
})
|
|
2440
2552
|
]).optional(),
|
|
2441
|
-
authorization:
|
|
2442
|
-
connectorId:
|
|
2443
|
-
headers:
|
|
2444
|
-
requireApproval:
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
never:
|
|
2448
|
-
toolNames:
|
|
2553
|
+
authorization: import_v421.z.string().optional(),
|
|
2554
|
+
connectorId: import_v421.z.string().optional(),
|
|
2555
|
+
headers: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional(),
|
|
2556
|
+
requireApproval: import_v421.z.union([
|
|
2557
|
+
import_v421.z.enum(["always", "never"]),
|
|
2558
|
+
import_v421.z.object({
|
|
2559
|
+
never: import_v421.z.object({
|
|
2560
|
+
toolNames: import_v421.z.array(import_v421.z.string()).optional()
|
|
2449
2561
|
}).optional()
|
|
2450
2562
|
})
|
|
2451
2563
|
]).optional(),
|
|
2452
|
-
serverDescription:
|
|
2453
|
-
serverUrl:
|
|
2564
|
+
serverDescription: import_v421.z.string().optional(),
|
|
2565
|
+
serverUrl: import_v421.z.string().optional()
|
|
2454
2566
|
}).refine(
|
|
2455
2567
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2456
2568
|
"One of serverUrl or connectorId must be provided."
|
|
2457
2569
|
)
|
|
2458
2570
|
)
|
|
2459
2571
|
);
|
|
2460
|
-
var mcpInputSchema = (0,
|
|
2461
|
-
var mcpOutputSchema = (0,
|
|
2462
|
-
() => (0,
|
|
2463
|
-
|
|
2464
|
-
type:
|
|
2465
|
-
serverLabel:
|
|
2466
|
-
name:
|
|
2467
|
-
arguments:
|
|
2468
|
-
output:
|
|
2469
|
-
error:
|
|
2572
|
+
var mcpInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v421.z.object({})));
|
|
2573
|
+
var mcpOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
2574
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
2575
|
+
import_v421.z.object({
|
|
2576
|
+
type: import_v421.z.literal("call"),
|
|
2577
|
+
serverLabel: import_v421.z.string(),
|
|
2578
|
+
name: import_v421.z.string(),
|
|
2579
|
+
arguments: import_v421.z.string(),
|
|
2580
|
+
output: import_v421.z.string().nullish(),
|
|
2581
|
+
error: import_v421.z.union([import_v421.z.string(), jsonValueSchema]).optional()
|
|
2470
2582
|
})
|
|
2471
2583
|
)
|
|
2472
2584
|
);
|
|
2473
|
-
var mcpToolFactory = (0,
|
|
2585
|
+
var mcpToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
2474
2586
|
id: "openai.mcp",
|
|
2475
2587
|
inputSchema: mcpInputSchema,
|
|
2476
2588
|
outputSchema: mcpOutputSchema
|
|
@@ -2596,7 +2708,7 @@ var openaiTools = {
|
|
|
2596
2708
|
|
|
2597
2709
|
// src/responses/openai-responses-language-model.ts
|
|
2598
2710
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2599
|
-
var
|
|
2711
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
2600
2712
|
|
|
2601
2713
|
// src/responses/convert-openai-responses-usage.ts
|
|
2602
2714
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2639,8 +2751,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2639
2751
|
|
|
2640
2752
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2641
2753
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2642
|
-
var
|
|
2643
|
-
var
|
|
2754
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
2755
|
+
var import_v422 = require("zod/v4");
|
|
2644
2756
|
function isFileId(data, prefixes) {
|
|
2645
2757
|
if (!prefixes) return false;
|
|
2646
2758
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2694,20 +2806,37 @@ async function convertToOpenAIResponsesInput({
|
|
|
2694
2806
|
input.push({
|
|
2695
2807
|
role: "user",
|
|
2696
2808
|
content: content.map((part, index) => {
|
|
2697
|
-
var _a2, _b2, _c2;
|
|
2809
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
2698
2810
|
switch (part.type) {
|
|
2699
2811
|
case "text": {
|
|
2700
2812
|
return { type: "input_text", text: part.text };
|
|
2701
2813
|
}
|
|
2702
2814
|
case "file": {
|
|
2815
|
+
if ((0, import_provider_utils28.isProviderReference)(part.data)) {
|
|
2816
|
+
const fileId = (0, import_provider_utils28.resolveProviderReference)({
|
|
2817
|
+
reference: part.data,
|
|
2818
|
+
provider: providerOptionsName
|
|
2819
|
+
});
|
|
2820
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2821
|
+
return {
|
|
2822
|
+
type: "input_image",
|
|
2823
|
+
file_id: fileId,
|
|
2824
|
+
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
return {
|
|
2828
|
+
type: "input_file",
|
|
2829
|
+
file_id: fileId
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2703
2832
|
if (part.mediaType.startsWith("image/")) {
|
|
2704
2833
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
2705
2834
|
return {
|
|
2706
2835
|
type: "input_image",
|
|
2707
2836
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2708
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2837
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
|
|
2709
2838
|
},
|
|
2710
|
-
detail: (
|
|
2839
|
+
detail: (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2[providerOptionsName]) == null ? void 0 : _d2.imageDetail
|
|
2711
2840
|
};
|
|
2712
2841
|
} else if (part.mediaType === "application/pdf") {
|
|
2713
2842
|
if (part.data instanceof URL) {
|
|
@@ -2719,8 +2848,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2719
2848
|
return {
|
|
2720
2849
|
type: "input_file",
|
|
2721
2850
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2722
|
-
filename: (
|
|
2723
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2851
|
+
filename: (_e2 = part.filename) != null ? _e2 : `part-${index}.pdf`,
|
|
2852
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
|
|
2724
2853
|
}
|
|
2725
2854
|
};
|
|
2726
2855
|
} else {
|
|
@@ -2770,10 +2899,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2770
2899
|
input.push({ type: "item_reference", id });
|
|
2771
2900
|
break;
|
|
2772
2901
|
}
|
|
2773
|
-
const parsedInput = typeof part.input === "string" ? await (0,
|
|
2902
|
+
const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils28.parseJSON)({
|
|
2774
2903
|
text: part.input,
|
|
2775
2904
|
schema: toolSearchInputSchema
|
|
2776
|
-
}) : await (0,
|
|
2905
|
+
}) : await (0, import_provider_utils28.validateTypes)({
|
|
2777
2906
|
value: part.input,
|
|
2778
2907
|
schema: toolSearchInputSchema
|
|
2779
2908
|
});
|
|
@@ -2799,7 +2928,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2799
2928
|
break;
|
|
2800
2929
|
}
|
|
2801
2930
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2802
|
-
const parsedInput = await (0,
|
|
2931
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2803
2932
|
value: part.input,
|
|
2804
2933
|
schema: localShellInputSchema
|
|
2805
2934
|
});
|
|
@@ -2819,7 +2948,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2819
2948
|
break;
|
|
2820
2949
|
}
|
|
2821
2950
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2822
|
-
const parsedInput = await (0,
|
|
2951
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2823
2952
|
value: part.input,
|
|
2824
2953
|
schema: shellInputSchema
|
|
2825
2954
|
});
|
|
@@ -2837,7 +2966,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2837
2966
|
break;
|
|
2838
2967
|
}
|
|
2839
2968
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2840
|
-
const parsedInput = await (0,
|
|
2969
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2841
2970
|
value: part.input,
|
|
2842
2971
|
schema: applyPatchInputSchema
|
|
2843
2972
|
});
|
|
@@ -2885,7 +3014,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2885
3014
|
if (store) {
|
|
2886
3015
|
input.push({ type: "item_reference", id: itemId });
|
|
2887
3016
|
} else if (part.output.type === "json") {
|
|
2888
|
-
const parsedOutput = await (0,
|
|
3017
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2889
3018
|
value: part.output.value,
|
|
2890
3019
|
schema: toolSearchOutputSchema
|
|
2891
3020
|
});
|
|
@@ -2902,7 +3031,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2902
3031
|
}
|
|
2903
3032
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2904
3033
|
if (part.output.type === "json") {
|
|
2905
|
-
const parsedOutput = await (0,
|
|
3034
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2906
3035
|
value: part.output.value,
|
|
2907
3036
|
schema: shellOutputSchema
|
|
2908
3037
|
});
|
|
@@ -2933,7 +3062,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2933
3062
|
break;
|
|
2934
3063
|
}
|
|
2935
3064
|
case "reasoning": {
|
|
2936
|
-
const providerOptions = await (0,
|
|
3065
|
+
const providerOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
2937
3066
|
provider: providerOptionsName,
|
|
2938
3067
|
providerOptions: part.providerOptions,
|
|
2939
3068
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -3063,7 +3192,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3063
3192
|
part.toolName
|
|
3064
3193
|
);
|
|
3065
3194
|
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3066
|
-
const parsedOutput = await (0,
|
|
3195
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3067
3196
|
value: output.value,
|
|
3068
3197
|
schema: toolSearchOutputSchema
|
|
3069
3198
|
});
|
|
@@ -3077,7 +3206,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3077
3206
|
continue;
|
|
3078
3207
|
}
|
|
3079
3208
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
3080
|
-
const parsedOutput = await (0,
|
|
3209
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3081
3210
|
value: output.value,
|
|
3082
3211
|
schema: localShellOutputSchema
|
|
3083
3212
|
});
|
|
@@ -3089,7 +3218,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3089
3218
|
continue;
|
|
3090
3219
|
}
|
|
3091
3220
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
3092
|
-
const parsedOutput = await (0,
|
|
3221
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3093
3222
|
value: output.value,
|
|
3094
3223
|
schema: shellOutputSchema
|
|
3095
3224
|
});
|
|
@@ -3108,7 +3237,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3108
3237
|
continue;
|
|
3109
3238
|
}
|
|
3110
3239
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
3111
|
-
const parsedOutput = await (0,
|
|
3240
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3112
3241
|
value: output.value,
|
|
3113
3242
|
schema: applyPatchOutputSchema
|
|
3114
3243
|
});
|
|
@@ -3168,7 +3297,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3168
3297
|
});
|
|
3169
3298
|
return void 0;
|
|
3170
3299
|
}
|
|
3171
|
-
}).filter(
|
|
3300
|
+
}).filter(import_provider_utils28.isNonNullable);
|
|
3172
3301
|
break;
|
|
3173
3302
|
default:
|
|
3174
3303
|
outputValue = "";
|
|
@@ -3233,7 +3362,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3233
3362
|
return void 0;
|
|
3234
3363
|
}
|
|
3235
3364
|
}
|
|
3236
|
-
}).filter(
|
|
3365
|
+
}).filter(import_provider_utils28.isNonNullable);
|
|
3237
3366
|
break;
|
|
3238
3367
|
}
|
|
3239
3368
|
input.push({
|
|
@@ -3263,9 +3392,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3263
3392
|
}
|
|
3264
3393
|
return { input, warnings };
|
|
3265
3394
|
}
|
|
3266
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3267
|
-
itemId:
|
|
3268
|
-
reasoningEncryptedContent:
|
|
3395
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v422.z.object({
|
|
3396
|
+
itemId: import_v422.z.string().nullish(),
|
|
3397
|
+
reasoningEncryptedContent: import_v422.z.string().nullish()
|
|
3269
3398
|
});
|
|
3270
3399
|
|
|
3271
3400
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3287,552 +3416,552 @@ function mapOpenAIResponseFinishReason({
|
|
|
3287
3416
|
}
|
|
3288
3417
|
|
|
3289
3418
|
// src/responses/openai-responses-api.ts
|
|
3290
|
-
var
|
|
3291
|
-
var
|
|
3292
|
-
var jsonValueSchema2 =
|
|
3293
|
-
() =>
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3419
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3420
|
+
var import_v423 = require("zod/v4");
|
|
3421
|
+
var jsonValueSchema2 = import_v423.z.lazy(
|
|
3422
|
+
() => import_v423.z.union([
|
|
3423
|
+
import_v423.z.string(),
|
|
3424
|
+
import_v423.z.number(),
|
|
3425
|
+
import_v423.z.boolean(),
|
|
3426
|
+
import_v423.z.null(),
|
|
3427
|
+
import_v423.z.array(jsonValueSchema2),
|
|
3428
|
+
import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional())
|
|
3300
3429
|
])
|
|
3301
3430
|
);
|
|
3302
|
-
var openaiResponsesChunkSchema = (0,
|
|
3303
|
-
() => (0,
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
type:
|
|
3307
|
-
item_id:
|
|
3308
|
-
delta:
|
|
3309
|
-
logprobs:
|
|
3310
|
-
|
|
3311
|
-
token:
|
|
3312
|
-
logprob:
|
|
3313
|
-
top_logprobs:
|
|
3314
|
-
|
|
3315
|
-
token:
|
|
3316
|
-
logprob:
|
|
3431
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils29.lazySchema)(
|
|
3432
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3433
|
+
import_v423.z.union([
|
|
3434
|
+
import_v423.z.object({
|
|
3435
|
+
type: import_v423.z.literal("response.output_text.delta"),
|
|
3436
|
+
item_id: import_v423.z.string(),
|
|
3437
|
+
delta: import_v423.z.string(),
|
|
3438
|
+
logprobs: import_v423.z.array(
|
|
3439
|
+
import_v423.z.object({
|
|
3440
|
+
token: import_v423.z.string(),
|
|
3441
|
+
logprob: import_v423.z.number(),
|
|
3442
|
+
top_logprobs: import_v423.z.array(
|
|
3443
|
+
import_v423.z.object({
|
|
3444
|
+
token: import_v423.z.string(),
|
|
3445
|
+
logprob: import_v423.z.number()
|
|
3317
3446
|
})
|
|
3318
3447
|
)
|
|
3319
3448
|
})
|
|
3320
3449
|
).nullish()
|
|
3321
3450
|
}),
|
|
3322
|
-
|
|
3323
|
-
type:
|
|
3324
|
-
response:
|
|
3325
|
-
incomplete_details:
|
|
3326
|
-
usage:
|
|
3327
|
-
input_tokens:
|
|
3328
|
-
input_tokens_details:
|
|
3329
|
-
output_tokens:
|
|
3330
|
-
output_tokens_details:
|
|
3451
|
+
import_v423.z.object({
|
|
3452
|
+
type: import_v423.z.enum(["response.completed", "response.incomplete"]),
|
|
3453
|
+
response: import_v423.z.object({
|
|
3454
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
3455
|
+
usage: import_v423.z.object({
|
|
3456
|
+
input_tokens: import_v423.z.number(),
|
|
3457
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
3458
|
+
output_tokens: import_v423.z.number(),
|
|
3459
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
3331
3460
|
}),
|
|
3332
|
-
service_tier:
|
|
3461
|
+
service_tier: import_v423.z.string().nullish()
|
|
3333
3462
|
})
|
|
3334
3463
|
}),
|
|
3335
|
-
|
|
3336
|
-
type:
|
|
3337
|
-
response:
|
|
3338
|
-
error:
|
|
3339
|
-
code:
|
|
3340
|
-
message:
|
|
3464
|
+
import_v423.z.object({
|
|
3465
|
+
type: import_v423.z.literal("response.failed"),
|
|
3466
|
+
response: import_v423.z.object({
|
|
3467
|
+
error: import_v423.z.object({
|
|
3468
|
+
code: import_v423.z.string().nullish(),
|
|
3469
|
+
message: import_v423.z.string()
|
|
3341
3470
|
}).nullish(),
|
|
3342
|
-
incomplete_details:
|
|
3343
|
-
usage:
|
|
3344
|
-
input_tokens:
|
|
3345
|
-
input_tokens_details:
|
|
3346
|
-
output_tokens:
|
|
3347
|
-
output_tokens_details:
|
|
3471
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
3472
|
+
usage: import_v423.z.object({
|
|
3473
|
+
input_tokens: import_v423.z.number(),
|
|
3474
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
3475
|
+
output_tokens: import_v423.z.number(),
|
|
3476
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
3348
3477
|
}).nullish(),
|
|
3349
|
-
service_tier:
|
|
3478
|
+
service_tier: import_v423.z.string().nullish()
|
|
3350
3479
|
})
|
|
3351
3480
|
}),
|
|
3352
|
-
|
|
3353
|
-
type:
|
|
3354
|
-
response:
|
|
3355
|
-
id:
|
|
3356
|
-
created_at:
|
|
3357
|
-
model:
|
|
3358
|
-
service_tier:
|
|
3481
|
+
import_v423.z.object({
|
|
3482
|
+
type: import_v423.z.literal("response.created"),
|
|
3483
|
+
response: import_v423.z.object({
|
|
3484
|
+
id: import_v423.z.string(),
|
|
3485
|
+
created_at: import_v423.z.number(),
|
|
3486
|
+
model: import_v423.z.string(),
|
|
3487
|
+
service_tier: import_v423.z.string().nullish()
|
|
3359
3488
|
})
|
|
3360
3489
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
output_index:
|
|
3364
|
-
item:
|
|
3365
|
-
|
|
3366
|
-
type:
|
|
3367
|
-
id:
|
|
3368
|
-
phase:
|
|
3490
|
+
import_v423.z.object({
|
|
3491
|
+
type: import_v423.z.literal("response.output_item.added"),
|
|
3492
|
+
output_index: import_v423.z.number(),
|
|
3493
|
+
item: import_v423.z.discriminatedUnion("type", [
|
|
3494
|
+
import_v423.z.object({
|
|
3495
|
+
type: import_v423.z.literal("message"),
|
|
3496
|
+
id: import_v423.z.string(),
|
|
3497
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
|
|
3369
3498
|
}),
|
|
3370
|
-
|
|
3371
|
-
type:
|
|
3372
|
-
id:
|
|
3373
|
-
encrypted_content:
|
|
3499
|
+
import_v423.z.object({
|
|
3500
|
+
type: import_v423.z.literal("reasoning"),
|
|
3501
|
+
id: import_v423.z.string(),
|
|
3502
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3374
3503
|
}),
|
|
3375
|
-
|
|
3376
|
-
type:
|
|
3377
|
-
id:
|
|
3378
|
-
call_id:
|
|
3379
|
-
name:
|
|
3380
|
-
arguments:
|
|
3504
|
+
import_v423.z.object({
|
|
3505
|
+
type: import_v423.z.literal("function_call"),
|
|
3506
|
+
id: import_v423.z.string(),
|
|
3507
|
+
call_id: import_v423.z.string(),
|
|
3508
|
+
name: import_v423.z.string(),
|
|
3509
|
+
arguments: import_v423.z.string()
|
|
3381
3510
|
}),
|
|
3382
|
-
|
|
3383
|
-
type:
|
|
3384
|
-
id:
|
|
3385
|
-
status:
|
|
3511
|
+
import_v423.z.object({
|
|
3512
|
+
type: import_v423.z.literal("web_search_call"),
|
|
3513
|
+
id: import_v423.z.string(),
|
|
3514
|
+
status: import_v423.z.string()
|
|
3386
3515
|
}),
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
id:
|
|
3390
|
-
status:
|
|
3516
|
+
import_v423.z.object({
|
|
3517
|
+
type: import_v423.z.literal("computer_call"),
|
|
3518
|
+
id: import_v423.z.string(),
|
|
3519
|
+
status: import_v423.z.string()
|
|
3391
3520
|
}),
|
|
3392
|
-
|
|
3393
|
-
type:
|
|
3394
|
-
id:
|
|
3521
|
+
import_v423.z.object({
|
|
3522
|
+
type: import_v423.z.literal("file_search_call"),
|
|
3523
|
+
id: import_v423.z.string()
|
|
3395
3524
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
id:
|
|
3525
|
+
import_v423.z.object({
|
|
3526
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
3527
|
+
id: import_v423.z.string()
|
|
3399
3528
|
}),
|
|
3400
|
-
|
|
3401
|
-
type:
|
|
3402
|
-
id:
|
|
3403
|
-
container_id:
|
|
3404
|
-
code:
|
|
3405
|
-
outputs:
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3529
|
+
import_v423.z.object({
|
|
3530
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
3531
|
+
id: import_v423.z.string(),
|
|
3532
|
+
container_id: import_v423.z.string(),
|
|
3533
|
+
code: import_v423.z.string().nullable(),
|
|
3534
|
+
outputs: import_v423.z.array(
|
|
3535
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3536
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
3537
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3409
3538
|
])
|
|
3410
3539
|
).nullable(),
|
|
3411
|
-
status:
|
|
3540
|
+
status: import_v423.z.string()
|
|
3412
3541
|
}),
|
|
3413
|
-
|
|
3414
|
-
type:
|
|
3415
|
-
id:
|
|
3416
|
-
status:
|
|
3417
|
-
approval_request_id:
|
|
3542
|
+
import_v423.z.object({
|
|
3543
|
+
type: import_v423.z.literal("mcp_call"),
|
|
3544
|
+
id: import_v423.z.string(),
|
|
3545
|
+
status: import_v423.z.string(),
|
|
3546
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
3418
3547
|
}),
|
|
3419
|
-
|
|
3420
|
-
type:
|
|
3421
|
-
id:
|
|
3548
|
+
import_v423.z.object({
|
|
3549
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
3550
|
+
id: import_v423.z.string()
|
|
3422
3551
|
}),
|
|
3423
|
-
|
|
3424
|
-
type:
|
|
3425
|
-
id:
|
|
3552
|
+
import_v423.z.object({
|
|
3553
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
3554
|
+
id: import_v423.z.string()
|
|
3426
3555
|
}),
|
|
3427
|
-
|
|
3428
|
-
type:
|
|
3429
|
-
id:
|
|
3430
|
-
call_id:
|
|
3431
|
-
status:
|
|
3432
|
-
operation:
|
|
3433
|
-
|
|
3434
|
-
type:
|
|
3435
|
-
path:
|
|
3436
|
-
diff:
|
|
3556
|
+
import_v423.z.object({
|
|
3557
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
3558
|
+
id: import_v423.z.string(),
|
|
3559
|
+
call_id: import_v423.z.string(),
|
|
3560
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
3561
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
3562
|
+
import_v423.z.object({
|
|
3563
|
+
type: import_v423.z.literal("create_file"),
|
|
3564
|
+
path: import_v423.z.string(),
|
|
3565
|
+
diff: import_v423.z.string()
|
|
3437
3566
|
}),
|
|
3438
|
-
|
|
3439
|
-
type:
|
|
3440
|
-
path:
|
|
3567
|
+
import_v423.z.object({
|
|
3568
|
+
type: import_v423.z.literal("delete_file"),
|
|
3569
|
+
path: import_v423.z.string()
|
|
3441
3570
|
}),
|
|
3442
|
-
|
|
3443
|
-
type:
|
|
3444
|
-
path:
|
|
3445
|
-
diff:
|
|
3571
|
+
import_v423.z.object({
|
|
3572
|
+
type: import_v423.z.literal("update_file"),
|
|
3573
|
+
path: import_v423.z.string(),
|
|
3574
|
+
diff: import_v423.z.string()
|
|
3446
3575
|
})
|
|
3447
3576
|
])
|
|
3448
3577
|
}),
|
|
3449
|
-
|
|
3450
|
-
type:
|
|
3451
|
-
id:
|
|
3452
|
-
call_id:
|
|
3453
|
-
name:
|
|
3454
|
-
input:
|
|
3578
|
+
import_v423.z.object({
|
|
3579
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
3580
|
+
id: import_v423.z.string(),
|
|
3581
|
+
call_id: import_v423.z.string(),
|
|
3582
|
+
name: import_v423.z.string(),
|
|
3583
|
+
input: import_v423.z.string()
|
|
3455
3584
|
}),
|
|
3456
|
-
|
|
3457
|
-
type:
|
|
3458
|
-
id:
|
|
3459
|
-
call_id:
|
|
3460
|
-
status:
|
|
3461
|
-
action:
|
|
3462
|
-
commands:
|
|
3585
|
+
import_v423.z.object({
|
|
3586
|
+
type: import_v423.z.literal("shell_call"),
|
|
3587
|
+
id: import_v423.z.string(),
|
|
3588
|
+
call_id: import_v423.z.string(),
|
|
3589
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3590
|
+
action: import_v423.z.object({
|
|
3591
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
3463
3592
|
})
|
|
3464
3593
|
}),
|
|
3465
|
-
|
|
3466
|
-
type:
|
|
3467
|
-
id:
|
|
3468
|
-
encrypted_content:
|
|
3594
|
+
import_v423.z.object({
|
|
3595
|
+
type: import_v423.z.literal("compaction"),
|
|
3596
|
+
id: import_v423.z.string(),
|
|
3597
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3469
3598
|
}),
|
|
3470
|
-
|
|
3471
|
-
type:
|
|
3472
|
-
id:
|
|
3473
|
-
call_id:
|
|
3474
|
-
status:
|
|
3475
|
-
output:
|
|
3476
|
-
|
|
3477
|
-
stdout:
|
|
3478
|
-
stderr:
|
|
3479
|
-
outcome:
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
type:
|
|
3483
|
-
exit_code:
|
|
3599
|
+
import_v423.z.object({
|
|
3600
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
3601
|
+
id: import_v423.z.string(),
|
|
3602
|
+
call_id: import_v423.z.string(),
|
|
3603
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3604
|
+
output: import_v423.z.array(
|
|
3605
|
+
import_v423.z.object({
|
|
3606
|
+
stdout: import_v423.z.string(),
|
|
3607
|
+
stderr: import_v423.z.string(),
|
|
3608
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
3609
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
3610
|
+
import_v423.z.object({
|
|
3611
|
+
type: import_v423.z.literal("exit"),
|
|
3612
|
+
exit_code: import_v423.z.number()
|
|
3484
3613
|
})
|
|
3485
3614
|
])
|
|
3486
3615
|
})
|
|
3487
3616
|
)
|
|
3488
3617
|
}),
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
id:
|
|
3492
|
-
execution:
|
|
3493
|
-
call_id:
|
|
3494
|
-
status:
|
|
3495
|
-
arguments:
|
|
3618
|
+
import_v423.z.object({
|
|
3619
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
3620
|
+
id: import_v423.z.string(),
|
|
3621
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3622
|
+
call_id: import_v423.z.string().nullable(),
|
|
3623
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3624
|
+
arguments: import_v423.z.unknown()
|
|
3496
3625
|
}),
|
|
3497
|
-
|
|
3498
|
-
type:
|
|
3499
|
-
id:
|
|
3500
|
-
execution:
|
|
3501
|
-
call_id:
|
|
3502
|
-
status:
|
|
3503
|
-
tools:
|
|
3626
|
+
import_v423.z.object({
|
|
3627
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
3628
|
+
id: import_v423.z.string(),
|
|
3629
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3630
|
+
call_id: import_v423.z.string().nullable(),
|
|
3631
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3632
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
3504
3633
|
})
|
|
3505
3634
|
])
|
|
3506
3635
|
}),
|
|
3507
|
-
|
|
3508
|
-
type:
|
|
3509
|
-
output_index:
|
|
3510
|
-
item:
|
|
3511
|
-
|
|
3512
|
-
type:
|
|
3513
|
-
id:
|
|
3514
|
-
phase:
|
|
3636
|
+
import_v423.z.object({
|
|
3637
|
+
type: import_v423.z.literal("response.output_item.done"),
|
|
3638
|
+
output_index: import_v423.z.number(),
|
|
3639
|
+
item: import_v423.z.discriminatedUnion("type", [
|
|
3640
|
+
import_v423.z.object({
|
|
3641
|
+
type: import_v423.z.literal("message"),
|
|
3642
|
+
id: import_v423.z.string(),
|
|
3643
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
|
|
3515
3644
|
}),
|
|
3516
|
-
|
|
3517
|
-
type:
|
|
3518
|
-
id:
|
|
3519
|
-
encrypted_content:
|
|
3645
|
+
import_v423.z.object({
|
|
3646
|
+
type: import_v423.z.literal("reasoning"),
|
|
3647
|
+
id: import_v423.z.string(),
|
|
3648
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3520
3649
|
}),
|
|
3521
|
-
|
|
3522
|
-
type:
|
|
3523
|
-
id:
|
|
3524
|
-
call_id:
|
|
3525
|
-
name:
|
|
3526
|
-
arguments:
|
|
3527
|
-
status:
|
|
3650
|
+
import_v423.z.object({
|
|
3651
|
+
type: import_v423.z.literal("function_call"),
|
|
3652
|
+
id: import_v423.z.string(),
|
|
3653
|
+
call_id: import_v423.z.string(),
|
|
3654
|
+
name: import_v423.z.string(),
|
|
3655
|
+
arguments: import_v423.z.string(),
|
|
3656
|
+
status: import_v423.z.literal("completed")
|
|
3528
3657
|
}),
|
|
3529
|
-
|
|
3530
|
-
type:
|
|
3531
|
-
id:
|
|
3532
|
-
call_id:
|
|
3533
|
-
name:
|
|
3534
|
-
input:
|
|
3535
|
-
status:
|
|
3658
|
+
import_v423.z.object({
|
|
3659
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
3660
|
+
id: import_v423.z.string(),
|
|
3661
|
+
call_id: import_v423.z.string(),
|
|
3662
|
+
name: import_v423.z.string(),
|
|
3663
|
+
input: import_v423.z.string(),
|
|
3664
|
+
status: import_v423.z.literal("completed")
|
|
3536
3665
|
}),
|
|
3537
|
-
|
|
3538
|
-
type:
|
|
3539
|
-
id:
|
|
3540
|
-
code:
|
|
3541
|
-
container_id:
|
|
3542
|
-
outputs:
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3666
|
+
import_v423.z.object({
|
|
3667
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
3668
|
+
id: import_v423.z.string(),
|
|
3669
|
+
code: import_v423.z.string().nullable(),
|
|
3670
|
+
container_id: import_v423.z.string(),
|
|
3671
|
+
outputs: import_v423.z.array(
|
|
3672
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3673
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
3674
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3546
3675
|
])
|
|
3547
3676
|
).nullable()
|
|
3548
3677
|
}),
|
|
3549
|
-
|
|
3550
|
-
type:
|
|
3551
|
-
id:
|
|
3552
|
-
result:
|
|
3678
|
+
import_v423.z.object({
|
|
3679
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
3680
|
+
id: import_v423.z.string(),
|
|
3681
|
+
result: import_v423.z.string()
|
|
3553
3682
|
}),
|
|
3554
|
-
|
|
3555
|
-
type:
|
|
3556
|
-
id:
|
|
3557
|
-
status:
|
|
3558
|
-
action:
|
|
3559
|
-
|
|
3560
|
-
type:
|
|
3561
|
-
query:
|
|
3562
|
-
sources:
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3683
|
+
import_v423.z.object({
|
|
3684
|
+
type: import_v423.z.literal("web_search_call"),
|
|
3685
|
+
id: import_v423.z.string(),
|
|
3686
|
+
status: import_v423.z.string(),
|
|
3687
|
+
action: import_v423.z.discriminatedUnion("type", [
|
|
3688
|
+
import_v423.z.object({
|
|
3689
|
+
type: import_v423.z.literal("search"),
|
|
3690
|
+
query: import_v423.z.string().nullish(),
|
|
3691
|
+
sources: import_v423.z.array(
|
|
3692
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3693
|
+
import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
|
|
3694
|
+
import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
|
|
3566
3695
|
])
|
|
3567
3696
|
).nullish()
|
|
3568
3697
|
}),
|
|
3569
|
-
|
|
3570
|
-
type:
|
|
3571
|
-
url:
|
|
3698
|
+
import_v423.z.object({
|
|
3699
|
+
type: import_v423.z.literal("open_page"),
|
|
3700
|
+
url: import_v423.z.string().nullish()
|
|
3572
3701
|
}),
|
|
3573
|
-
|
|
3574
|
-
type:
|
|
3575
|
-
url:
|
|
3576
|
-
pattern:
|
|
3702
|
+
import_v423.z.object({
|
|
3703
|
+
type: import_v423.z.literal("find_in_page"),
|
|
3704
|
+
url: import_v423.z.string().nullish(),
|
|
3705
|
+
pattern: import_v423.z.string().nullish()
|
|
3577
3706
|
})
|
|
3578
3707
|
]).nullish()
|
|
3579
3708
|
}),
|
|
3580
|
-
|
|
3581
|
-
type:
|
|
3582
|
-
id:
|
|
3583
|
-
queries:
|
|
3584
|
-
results:
|
|
3585
|
-
|
|
3586
|
-
attributes:
|
|
3587
|
-
|
|
3588
|
-
|
|
3709
|
+
import_v423.z.object({
|
|
3710
|
+
type: import_v423.z.literal("file_search_call"),
|
|
3711
|
+
id: import_v423.z.string(),
|
|
3712
|
+
queries: import_v423.z.array(import_v423.z.string()),
|
|
3713
|
+
results: import_v423.z.array(
|
|
3714
|
+
import_v423.z.object({
|
|
3715
|
+
attributes: import_v423.z.record(
|
|
3716
|
+
import_v423.z.string(),
|
|
3717
|
+
import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
|
|
3589
3718
|
),
|
|
3590
|
-
file_id:
|
|
3591
|
-
filename:
|
|
3592
|
-
score:
|
|
3593
|
-
text:
|
|
3719
|
+
file_id: import_v423.z.string(),
|
|
3720
|
+
filename: import_v423.z.string(),
|
|
3721
|
+
score: import_v423.z.number(),
|
|
3722
|
+
text: import_v423.z.string()
|
|
3594
3723
|
})
|
|
3595
3724
|
).nullish()
|
|
3596
3725
|
}),
|
|
3597
|
-
|
|
3598
|
-
type:
|
|
3599
|
-
id:
|
|
3600
|
-
call_id:
|
|
3601
|
-
action:
|
|
3602
|
-
type:
|
|
3603
|
-
command:
|
|
3604
|
-
timeout_ms:
|
|
3605
|
-
user:
|
|
3606
|
-
working_directory:
|
|
3607
|
-
env:
|
|
3726
|
+
import_v423.z.object({
|
|
3727
|
+
type: import_v423.z.literal("local_shell_call"),
|
|
3728
|
+
id: import_v423.z.string(),
|
|
3729
|
+
call_id: import_v423.z.string(),
|
|
3730
|
+
action: import_v423.z.object({
|
|
3731
|
+
type: import_v423.z.literal("exec"),
|
|
3732
|
+
command: import_v423.z.array(import_v423.z.string()),
|
|
3733
|
+
timeout_ms: import_v423.z.number().optional(),
|
|
3734
|
+
user: import_v423.z.string().optional(),
|
|
3735
|
+
working_directory: import_v423.z.string().optional(),
|
|
3736
|
+
env: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional()
|
|
3608
3737
|
})
|
|
3609
3738
|
}),
|
|
3610
|
-
|
|
3611
|
-
type:
|
|
3612
|
-
id:
|
|
3613
|
-
status:
|
|
3739
|
+
import_v423.z.object({
|
|
3740
|
+
type: import_v423.z.literal("computer_call"),
|
|
3741
|
+
id: import_v423.z.string(),
|
|
3742
|
+
status: import_v423.z.literal("completed")
|
|
3614
3743
|
}),
|
|
3615
|
-
|
|
3616
|
-
type:
|
|
3617
|
-
id:
|
|
3618
|
-
status:
|
|
3619
|
-
arguments:
|
|
3620
|
-
name:
|
|
3621
|
-
server_label:
|
|
3622
|
-
output:
|
|
3623
|
-
error:
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
type:
|
|
3627
|
-
code:
|
|
3628
|
-
message:
|
|
3744
|
+
import_v423.z.object({
|
|
3745
|
+
type: import_v423.z.literal("mcp_call"),
|
|
3746
|
+
id: import_v423.z.string(),
|
|
3747
|
+
status: import_v423.z.string(),
|
|
3748
|
+
arguments: import_v423.z.string(),
|
|
3749
|
+
name: import_v423.z.string(),
|
|
3750
|
+
server_label: import_v423.z.string(),
|
|
3751
|
+
output: import_v423.z.string().nullish(),
|
|
3752
|
+
error: import_v423.z.union([
|
|
3753
|
+
import_v423.z.string(),
|
|
3754
|
+
import_v423.z.object({
|
|
3755
|
+
type: import_v423.z.string().optional(),
|
|
3756
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
3757
|
+
message: import_v423.z.string().optional()
|
|
3629
3758
|
}).loose()
|
|
3630
3759
|
]).nullish(),
|
|
3631
|
-
approval_request_id:
|
|
3760
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
3632
3761
|
}),
|
|
3633
|
-
|
|
3634
|
-
type:
|
|
3635
|
-
id:
|
|
3636
|
-
server_label:
|
|
3637
|
-
tools:
|
|
3638
|
-
|
|
3639
|
-
name:
|
|
3640
|
-
description:
|
|
3641
|
-
input_schema:
|
|
3642
|
-
annotations:
|
|
3762
|
+
import_v423.z.object({
|
|
3763
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
3764
|
+
id: import_v423.z.string(),
|
|
3765
|
+
server_label: import_v423.z.string(),
|
|
3766
|
+
tools: import_v423.z.array(
|
|
3767
|
+
import_v423.z.object({
|
|
3768
|
+
name: import_v423.z.string(),
|
|
3769
|
+
description: import_v423.z.string().optional(),
|
|
3770
|
+
input_schema: import_v423.z.any(),
|
|
3771
|
+
annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
|
|
3643
3772
|
})
|
|
3644
3773
|
),
|
|
3645
|
-
error:
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
type:
|
|
3649
|
-
code:
|
|
3650
|
-
message:
|
|
3774
|
+
error: import_v423.z.union([
|
|
3775
|
+
import_v423.z.string(),
|
|
3776
|
+
import_v423.z.object({
|
|
3777
|
+
type: import_v423.z.string().optional(),
|
|
3778
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
3779
|
+
message: import_v423.z.string().optional()
|
|
3651
3780
|
}).loose()
|
|
3652
3781
|
]).optional()
|
|
3653
3782
|
}),
|
|
3654
|
-
|
|
3655
|
-
type:
|
|
3656
|
-
id:
|
|
3657
|
-
server_label:
|
|
3658
|
-
name:
|
|
3659
|
-
arguments:
|
|
3660
|
-
approval_request_id:
|
|
3783
|
+
import_v423.z.object({
|
|
3784
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
3785
|
+
id: import_v423.z.string(),
|
|
3786
|
+
server_label: import_v423.z.string(),
|
|
3787
|
+
name: import_v423.z.string(),
|
|
3788
|
+
arguments: import_v423.z.string(),
|
|
3789
|
+
approval_request_id: import_v423.z.string().optional()
|
|
3661
3790
|
}),
|
|
3662
|
-
|
|
3663
|
-
type:
|
|
3664
|
-
id:
|
|
3665
|
-
call_id:
|
|
3666
|
-
status:
|
|
3667
|
-
operation:
|
|
3668
|
-
|
|
3669
|
-
type:
|
|
3670
|
-
path:
|
|
3671
|
-
diff:
|
|
3791
|
+
import_v423.z.object({
|
|
3792
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
3793
|
+
id: import_v423.z.string(),
|
|
3794
|
+
call_id: import_v423.z.string(),
|
|
3795
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
3796
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
3797
|
+
import_v423.z.object({
|
|
3798
|
+
type: import_v423.z.literal("create_file"),
|
|
3799
|
+
path: import_v423.z.string(),
|
|
3800
|
+
diff: import_v423.z.string()
|
|
3672
3801
|
}),
|
|
3673
|
-
|
|
3674
|
-
type:
|
|
3675
|
-
path:
|
|
3802
|
+
import_v423.z.object({
|
|
3803
|
+
type: import_v423.z.literal("delete_file"),
|
|
3804
|
+
path: import_v423.z.string()
|
|
3676
3805
|
}),
|
|
3677
|
-
|
|
3678
|
-
type:
|
|
3679
|
-
path:
|
|
3680
|
-
diff:
|
|
3806
|
+
import_v423.z.object({
|
|
3807
|
+
type: import_v423.z.literal("update_file"),
|
|
3808
|
+
path: import_v423.z.string(),
|
|
3809
|
+
diff: import_v423.z.string()
|
|
3681
3810
|
})
|
|
3682
3811
|
])
|
|
3683
3812
|
}),
|
|
3684
|
-
|
|
3685
|
-
type:
|
|
3686
|
-
id:
|
|
3687
|
-
call_id:
|
|
3688
|
-
status:
|
|
3689
|
-
action:
|
|
3690
|
-
commands:
|
|
3813
|
+
import_v423.z.object({
|
|
3814
|
+
type: import_v423.z.literal("shell_call"),
|
|
3815
|
+
id: import_v423.z.string(),
|
|
3816
|
+
call_id: import_v423.z.string(),
|
|
3817
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3818
|
+
action: import_v423.z.object({
|
|
3819
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
3691
3820
|
})
|
|
3692
3821
|
}),
|
|
3693
|
-
|
|
3694
|
-
type:
|
|
3695
|
-
id:
|
|
3696
|
-
encrypted_content:
|
|
3822
|
+
import_v423.z.object({
|
|
3823
|
+
type: import_v423.z.literal("compaction"),
|
|
3824
|
+
id: import_v423.z.string(),
|
|
3825
|
+
encrypted_content: import_v423.z.string()
|
|
3697
3826
|
}),
|
|
3698
|
-
|
|
3699
|
-
type:
|
|
3700
|
-
id:
|
|
3701
|
-
call_id:
|
|
3702
|
-
status:
|
|
3703
|
-
output:
|
|
3704
|
-
|
|
3705
|
-
stdout:
|
|
3706
|
-
stderr:
|
|
3707
|
-
outcome:
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
type:
|
|
3711
|
-
exit_code:
|
|
3827
|
+
import_v423.z.object({
|
|
3828
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
3829
|
+
id: import_v423.z.string(),
|
|
3830
|
+
call_id: import_v423.z.string(),
|
|
3831
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3832
|
+
output: import_v423.z.array(
|
|
3833
|
+
import_v423.z.object({
|
|
3834
|
+
stdout: import_v423.z.string(),
|
|
3835
|
+
stderr: import_v423.z.string(),
|
|
3836
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
3837
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
3838
|
+
import_v423.z.object({
|
|
3839
|
+
type: import_v423.z.literal("exit"),
|
|
3840
|
+
exit_code: import_v423.z.number()
|
|
3712
3841
|
})
|
|
3713
3842
|
])
|
|
3714
3843
|
})
|
|
3715
3844
|
)
|
|
3716
3845
|
}),
|
|
3717
|
-
|
|
3718
|
-
type:
|
|
3719
|
-
id:
|
|
3720
|
-
execution:
|
|
3721
|
-
call_id:
|
|
3722
|
-
status:
|
|
3723
|
-
arguments:
|
|
3846
|
+
import_v423.z.object({
|
|
3847
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
3848
|
+
id: import_v423.z.string(),
|
|
3849
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3850
|
+
call_id: import_v423.z.string().nullable(),
|
|
3851
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3852
|
+
arguments: import_v423.z.unknown()
|
|
3724
3853
|
}),
|
|
3725
|
-
|
|
3726
|
-
type:
|
|
3727
|
-
id:
|
|
3728
|
-
execution:
|
|
3729
|
-
call_id:
|
|
3730
|
-
status:
|
|
3731
|
-
tools:
|
|
3854
|
+
import_v423.z.object({
|
|
3855
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
3856
|
+
id: import_v423.z.string(),
|
|
3857
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3858
|
+
call_id: import_v423.z.string().nullable(),
|
|
3859
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3860
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
3732
3861
|
})
|
|
3733
3862
|
])
|
|
3734
3863
|
}),
|
|
3735
|
-
|
|
3736
|
-
type:
|
|
3737
|
-
item_id:
|
|
3738
|
-
output_index:
|
|
3739
|
-
delta:
|
|
3864
|
+
import_v423.z.object({
|
|
3865
|
+
type: import_v423.z.literal("response.function_call_arguments.delta"),
|
|
3866
|
+
item_id: import_v423.z.string(),
|
|
3867
|
+
output_index: import_v423.z.number(),
|
|
3868
|
+
delta: import_v423.z.string()
|
|
3740
3869
|
}),
|
|
3741
|
-
|
|
3742
|
-
type:
|
|
3743
|
-
item_id:
|
|
3744
|
-
output_index:
|
|
3745
|
-
delta:
|
|
3870
|
+
import_v423.z.object({
|
|
3871
|
+
type: import_v423.z.literal("response.custom_tool_call_input.delta"),
|
|
3872
|
+
item_id: import_v423.z.string(),
|
|
3873
|
+
output_index: import_v423.z.number(),
|
|
3874
|
+
delta: import_v423.z.string()
|
|
3746
3875
|
}),
|
|
3747
|
-
|
|
3748
|
-
type:
|
|
3749
|
-
item_id:
|
|
3750
|
-
output_index:
|
|
3751
|
-
partial_image_b64:
|
|
3876
|
+
import_v423.z.object({
|
|
3877
|
+
type: import_v423.z.literal("response.image_generation_call.partial_image"),
|
|
3878
|
+
item_id: import_v423.z.string(),
|
|
3879
|
+
output_index: import_v423.z.number(),
|
|
3880
|
+
partial_image_b64: import_v423.z.string()
|
|
3752
3881
|
}),
|
|
3753
|
-
|
|
3754
|
-
type:
|
|
3755
|
-
item_id:
|
|
3756
|
-
output_index:
|
|
3757
|
-
delta:
|
|
3882
|
+
import_v423.z.object({
|
|
3883
|
+
type: import_v423.z.literal("response.code_interpreter_call_code.delta"),
|
|
3884
|
+
item_id: import_v423.z.string(),
|
|
3885
|
+
output_index: import_v423.z.number(),
|
|
3886
|
+
delta: import_v423.z.string()
|
|
3758
3887
|
}),
|
|
3759
|
-
|
|
3760
|
-
type:
|
|
3761
|
-
item_id:
|
|
3762
|
-
output_index:
|
|
3763
|
-
code:
|
|
3888
|
+
import_v423.z.object({
|
|
3889
|
+
type: import_v423.z.literal("response.code_interpreter_call_code.done"),
|
|
3890
|
+
item_id: import_v423.z.string(),
|
|
3891
|
+
output_index: import_v423.z.number(),
|
|
3892
|
+
code: import_v423.z.string()
|
|
3764
3893
|
}),
|
|
3765
|
-
|
|
3766
|
-
type:
|
|
3767
|
-
annotation:
|
|
3768
|
-
|
|
3769
|
-
type:
|
|
3770
|
-
start_index:
|
|
3771
|
-
end_index:
|
|
3772
|
-
url:
|
|
3773
|
-
title:
|
|
3894
|
+
import_v423.z.object({
|
|
3895
|
+
type: import_v423.z.literal("response.output_text.annotation.added"),
|
|
3896
|
+
annotation: import_v423.z.discriminatedUnion("type", [
|
|
3897
|
+
import_v423.z.object({
|
|
3898
|
+
type: import_v423.z.literal("url_citation"),
|
|
3899
|
+
start_index: import_v423.z.number(),
|
|
3900
|
+
end_index: import_v423.z.number(),
|
|
3901
|
+
url: import_v423.z.string(),
|
|
3902
|
+
title: import_v423.z.string()
|
|
3774
3903
|
}),
|
|
3775
|
-
|
|
3776
|
-
type:
|
|
3777
|
-
file_id:
|
|
3778
|
-
filename:
|
|
3779
|
-
index:
|
|
3904
|
+
import_v423.z.object({
|
|
3905
|
+
type: import_v423.z.literal("file_citation"),
|
|
3906
|
+
file_id: import_v423.z.string(),
|
|
3907
|
+
filename: import_v423.z.string(),
|
|
3908
|
+
index: import_v423.z.number()
|
|
3780
3909
|
}),
|
|
3781
|
-
|
|
3782
|
-
type:
|
|
3783
|
-
container_id:
|
|
3784
|
-
file_id:
|
|
3785
|
-
filename:
|
|
3786
|
-
start_index:
|
|
3787
|
-
end_index:
|
|
3910
|
+
import_v423.z.object({
|
|
3911
|
+
type: import_v423.z.literal("container_file_citation"),
|
|
3912
|
+
container_id: import_v423.z.string(),
|
|
3913
|
+
file_id: import_v423.z.string(),
|
|
3914
|
+
filename: import_v423.z.string(),
|
|
3915
|
+
start_index: import_v423.z.number(),
|
|
3916
|
+
end_index: import_v423.z.number()
|
|
3788
3917
|
}),
|
|
3789
|
-
|
|
3790
|
-
type:
|
|
3791
|
-
file_id:
|
|
3792
|
-
index:
|
|
3918
|
+
import_v423.z.object({
|
|
3919
|
+
type: import_v423.z.literal("file_path"),
|
|
3920
|
+
file_id: import_v423.z.string(),
|
|
3921
|
+
index: import_v423.z.number()
|
|
3793
3922
|
})
|
|
3794
3923
|
])
|
|
3795
3924
|
}),
|
|
3796
|
-
|
|
3797
|
-
type:
|
|
3798
|
-
item_id:
|
|
3799
|
-
summary_index:
|
|
3925
|
+
import_v423.z.object({
|
|
3926
|
+
type: import_v423.z.literal("response.reasoning_summary_part.added"),
|
|
3927
|
+
item_id: import_v423.z.string(),
|
|
3928
|
+
summary_index: import_v423.z.number()
|
|
3800
3929
|
}),
|
|
3801
|
-
|
|
3802
|
-
type:
|
|
3803
|
-
item_id:
|
|
3804
|
-
summary_index:
|
|
3805
|
-
delta:
|
|
3930
|
+
import_v423.z.object({
|
|
3931
|
+
type: import_v423.z.literal("response.reasoning_summary_text.delta"),
|
|
3932
|
+
item_id: import_v423.z.string(),
|
|
3933
|
+
summary_index: import_v423.z.number(),
|
|
3934
|
+
delta: import_v423.z.string()
|
|
3806
3935
|
}),
|
|
3807
|
-
|
|
3808
|
-
type:
|
|
3809
|
-
item_id:
|
|
3810
|
-
summary_index:
|
|
3936
|
+
import_v423.z.object({
|
|
3937
|
+
type: import_v423.z.literal("response.reasoning_summary_part.done"),
|
|
3938
|
+
item_id: import_v423.z.string(),
|
|
3939
|
+
summary_index: import_v423.z.number()
|
|
3811
3940
|
}),
|
|
3812
|
-
|
|
3813
|
-
type:
|
|
3814
|
-
item_id:
|
|
3815
|
-
output_index:
|
|
3816
|
-
delta:
|
|
3817
|
-
obfuscation:
|
|
3941
|
+
import_v423.z.object({
|
|
3942
|
+
type: import_v423.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3943
|
+
item_id: import_v423.z.string(),
|
|
3944
|
+
output_index: import_v423.z.number(),
|
|
3945
|
+
delta: import_v423.z.string(),
|
|
3946
|
+
obfuscation: import_v423.z.string().nullish()
|
|
3818
3947
|
}),
|
|
3819
|
-
|
|
3820
|
-
type:
|
|
3821
|
-
item_id:
|
|
3822
|
-
output_index:
|
|
3823
|
-
diff:
|
|
3948
|
+
import_v423.z.object({
|
|
3949
|
+
type: import_v423.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3950
|
+
item_id: import_v423.z.string(),
|
|
3951
|
+
output_index: import_v423.z.number(),
|
|
3952
|
+
diff: import_v423.z.string()
|
|
3824
3953
|
}),
|
|
3825
|
-
|
|
3826
|
-
type:
|
|
3827
|
-
sequence_number:
|
|
3828
|
-
error:
|
|
3829
|
-
type:
|
|
3830
|
-
code:
|
|
3831
|
-
message:
|
|
3832
|
-
param:
|
|
3954
|
+
import_v423.z.object({
|
|
3955
|
+
type: import_v423.z.literal("error"),
|
|
3956
|
+
sequence_number: import_v423.z.number(),
|
|
3957
|
+
error: import_v423.z.object({
|
|
3958
|
+
type: import_v423.z.string(),
|
|
3959
|
+
code: import_v423.z.string(),
|
|
3960
|
+
message: import_v423.z.string(),
|
|
3961
|
+
param: import_v423.z.string().nullish()
|
|
3833
3962
|
})
|
|
3834
3963
|
}),
|
|
3835
|
-
|
|
3964
|
+
import_v423.z.object({ type: import_v423.z.string() }).loose().transform((value) => ({
|
|
3836
3965
|
type: "unknown_chunk",
|
|
3837
3966
|
message: value.type
|
|
3838
3967
|
}))
|
|
@@ -3840,315 +3969,315 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3840
3969
|
])
|
|
3841
3970
|
)
|
|
3842
3971
|
);
|
|
3843
|
-
var openaiResponsesResponseSchema = (0,
|
|
3844
|
-
() => (0,
|
|
3845
|
-
|
|
3846
|
-
id:
|
|
3847
|
-
created_at:
|
|
3848
|
-
error:
|
|
3849
|
-
message:
|
|
3850
|
-
type:
|
|
3851
|
-
param:
|
|
3852
|
-
code:
|
|
3972
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
3973
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3974
|
+
import_v423.z.object({
|
|
3975
|
+
id: import_v423.z.string().optional(),
|
|
3976
|
+
created_at: import_v423.z.number().optional(),
|
|
3977
|
+
error: import_v423.z.object({
|
|
3978
|
+
message: import_v423.z.string(),
|
|
3979
|
+
type: import_v423.z.string(),
|
|
3980
|
+
param: import_v423.z.string().nullish(),
|
|
3981
|
+
code: import_v423.z.string()
|
|
3853
3982
|
}).nullish(),
|
|
3854
|
-
model:
|
|
3855
|
-
output:
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
type:
|
|
3859
|
-
role:
|
|
3860
|
-
id:
|
|
3861
|
-
phase:
|
|
3862
|
-
content:
|
|
3863
|
-
|
|
3864
|
-
type:
|
|
3865
|
-
text:
|
|
3866
|
-
logprobs:
|
|
3867
|
-
|
|
3868
|
-
token:
|
|
3869
|
-
logprob:
|
|
3870
|
-
top_logprobs:
|
|
3871
|
-
|
|
3872
|
-
token:
|
|
3873
|
-
logprob:
|
|
3983
|
+
model: import_v423.z.string().optional(),
|
|
3984
|
+
output: import_v423.z.array(
|
|
3985
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3986
|
+
import_v423.z.object({
|
|
3987
|
+
type: import_v423.z.literal("message"),
|
|
3988
|
+
role: import_v423.z.literal("assistant"),
|
|
3989
|
+
id: import_v423.z.string(),
|
|
3990
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3991
|
+
content: import_v423.z.array(
|
|
3992
|
+
import_v423.z.object({
|
|
3993
|
+
type: import_v423.z.literal("output_text"),
|
|
3994
|
+
text: import_v423.z.string(),
|
|
3995
|
+
logprobs: import_v423.z.array(
|
|
3996
|
+
import_v423.z.object({
|
|
3997
|
+
token: import_v423.z.string(),
|
|
3998
|
+
logprob: import_v423.z.number(),
|
|
3999
|
+
top_logprobs: import_v423.z.array(
|
|
4000
|
+
import_v423.z.object({
|
|
4001
|
+
token: import_v423.z.string(),
|
|
4002
|
+
logprob: import_v423.z.number()
|
|
3874
4003
|
})
|
|
3875
4004
|
)
|
|
3876
4005
|
})
|
|
3877
4006
|
).nullish(),
|
|
3878
|
-
annotations:
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
type:
|
|
3882
|
-
start_index:
|
|
3883
|
-
end_index:
|
|
3884
|
-
url:
|
|
3885
|
-
title:
|
|
4007
|
+
annotations: import_v423.z.array(
|
|
4008
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4009
|
+
import_v423.z.object({
|
|
4010
|
+
type: import_v423.z.literal("url_citation"),
|
|
4011
|
+
start_index: import_v423.z.number(),
|
|
4012
|
+
end_index: import_v423.z.number(),
|
|
4013
|
+
url: import_v423.z.string(),
|
|
4014
|
+
title: import_v423.z.string()
|
|
3886
4015
|
}),
|
|
3887
|
-
|
|
3888
|
-
type:
|
|
3889
|
-
file_id:
|
|
3890
|
-
filename:
|
|
3891
|
-
index:
|
|
4016
|
+
import_v423.z.object({
|
|
4017
|
+
type: import_v423.z.literal("file_citation"),
|
|
4018
|
+
file_id: import_v423.z.string(),
|
|
4019
|
+
filename: import_v423.z.string(),
|
|
4020
|
+
index: import_v423.z.number()
|
|
3892
4021
|
}),
|
|
3893
|
-
|
|
3894
|
-
type:
|
|
3895
|
-
container_id:
|
|
3896
|
-
file_id:
|
|
3897
|
-
filename:
|
|
3898
|
-
start_index:
|
|
3899
|
-
end_index:
|
|
4022
|
+
import_v423.z.object({
|
|
4023
|
+
type: import_v423.z.literal("container_file_citation"),
|
|
4024
|
+
container_id: import_v423.z.string(),
|
|
4025
|
+
file_id: import_v423.z.string(),
|
|
4026
|
+
filename: import_v423.z.string(),
|
|
4027
|
+
start_index: import_v423.z.number(),
|
|
4028
|
+
end_index: import_v423.z.number()
|
|
3900
4029
|
}),
|
|
3901
|
-
|
|
3902
|
-
type:
|
|
3903
|
-
file_id:
|
|
3904
|
-
index:
|
|
4030
|
+
import_v423.z.object({
|
|
4031
|
+
type: import_v423.z.literal("file_path"),
|
|
4032
|
+
file_id: import_v423.z.string(),
|
|
4033
|
+
index: import_v423.z.number()
|
|
3905
4034
|
})
|
|
3906
4035
|
])
|
|
3907
4036
|
)
|
|
3908
4037
|
})
|
|
3909
4038
|
)
|
|
3910
4039
|
}),
|
|
3911
|
-
|
|
3912
|
-
type:
|
|
3913
|
-
id:
|
|
3914
|
-
status:
|
|
3915
|
-
action:
|
|
3916
|
-
|
|
3917
|
-
type:
|
|
3918
|
-
query:
|
|
3919
|
-
sources:
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
type:
|
|
3924
|
-
name:
|
|
4040
|
+
import_v423.z.object({
|
|
4041
|
+
type: import_v423.z.literal("web_search_call"),
|
|
4042
|
+
id: import_v423.z.string(),
|
|
4043
|
+
status: import_v423.z.string(),
|
|
4044
|
+
action: import_v423.z.discriminatedUnion("type", [
|
|
4045
|
+
import_v423.z.object({
|
|
4046
|
+
type: import_v423.z.literal("search"),
|
|
4047
|
+
query: import_v423.z.string().nullish(),
|
|
4048
|
+
sources: import_v423.z.array(
|
|
4049
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4050
|
+
import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
|
|
4051
|
+
import_v423.z.object({
|
|
4052
|
+
type: import_v423.z.literal("api"),
|
|
4053
|
+
name: import_v423.z.string()
|
|
3925
4054
|
})
|
|
3926
4055
|
])
|
|
3927
4056
|
).nullish()
|
|
3928
4057
|
}),
|
|
3929
|
-
|
|
3930
|
-
type:
|
|
3931
|
-
url:
|
|
4058
|
+
import_v423.z.object({
|
|
4059
|
+
type: import_v423.z.literal("open_page"),
|
|
4060
|
+
url: import_v423.z.string().nullish()
|
|
3932
4061
|
}),
|
|
3933
|
-
|
|
3934
|
-
type:
|
|
3935
|
-
url:
|
|
3936
|
-
pattern:
|
|
4062
|
+
import_v423.z.object({
|
|
4063
|
+
type: import_v423.z.literal("find_in_page"),
|
|
4064
|
+
url: import_v423.z.string().nullish(),
|
|
4065
|
+
pattern: import_v423.z.string().nullish()
|
|
3937
4066
|
})
|
|
3938
4067
|
]).nullish()
|
|
3939
4068
|
}),
|
|
3940
|
-
|
|
3941
|
-
type:
|
|
3942
|
-
id:
|
|
3943
|
-
queries:
|
|
3944
|
-
results:
|
|
3945
|
-
|
|
3946
|
-
attributes:
|
|
3947
|
-
|
|
3948
|
-
|
|
4069
|
+
import_v423.z.object({
|
|
4070
|
+
type: import_v423.z.literal("file_search_call"),
|
|
4071
|
+
id: import_v423.z.string(),
|
|
4072
|
+
queries: import_v423.z.array(import_v423.z.string()),
|
|
4073
|
+
results: import_v423.z.array(
|
|
4074
|
+
import_v423.z.object({
|
|
4075
|
+
attributes: import_v423.z.record(
|
|
4076
|
+
import_v423.z.string(),
|
|
4077
|
+
import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
|
|
3949
4078
|
),
|
|
3950
|
-
file_id:
|
|
3951
|
-
filename:
|
|
3952
|
-
score:
|
|
3953
|
-
text:
|
|
4079
|
+
file_id: import_v423.z.string(),
|
|
4080
|
+
filename: import_v423.z.string(),
|
|
4081
|
+
score: import_v423.z.number(),
|
|
4082
|
+
text: import_v423.z.string()
|
|
3954
4083
|
})
|
|
3955
4084
|
).nullish()
|
|
3956
4085
|
}),
|
|
3957
|
-
|
|
3958
|
-
type:
|
|
3959
|
-
id:
|
|
3960
|
-
code:
|
|
3961
|
-
container_id:
|
|
3962
|
-
outputs:
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4086
|
+
import_v423.z.object({
|
|
4087
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
4088
|
+
id: import_v423.z.string(),
|
|
4089
|
+
code: import_v423.z.string().nullable(),
|
|
4090
|
+
container_id: import_v423.z.string(),
|
|
4091
|
+
outputs: import_v423.z.array(
|
|
4092
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4093
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
4094
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3966
4095
|
])
|
|
3967
4096
|
).nullable()
|
|
3968
4097
|
}),
|
|
3969
|
-
|
|
3970
|
-
type:
|
|
3971
|
-
id:
|
|
3972
|
-
result:
|
|
4098
|
+
import_v423.z.object({
|
|
4099
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
4100
|
+
id: import_v423.z.string(),
|
|
4101
|
+
result: import_v423.z.string()
|
|
3973
4102
|
}),
|
|
3974
|
-
|
|
3975
|
-
type:
|
|
3976
|
-
id:
|
|
3977
|
-
call_id:
|
|
3978
|
-
action:
|
|
3979
|
-
type:
|
|
3980
|
-
command:
|
|
3981
|
-
timeout_ms:
|
|
3982
|
-
user:
|
|
3983
|
-
working_directory:
|
|
3984
|
-
env:
|
|
4103
|
+
import_v423.z.object({
|
|
4104
|
+
type: import_v423.z.literal("local_shell_call"),
|
|
4105
|
+
id: import_v423.z.string(),
|
|
4106
|
+
call_id: import_v423.z.string(),
|
|
4107
|
+
action: import_v423.z.object({
|
|
4108
|
+
type: import_v423.z.literal("exec"),
|
|
4109
|
+
command: import_v423.z.array(import_v423.z.string()),
|
|
4110
|
+
timeout_ms: import_v423.z.number().optional(),
|
|
4111
|
+
user: import_v423.z.string().optional(),
|
|
4112
|
+
working_directory: import_v423.z.string().optional(),
|
|
4113
|
+
env: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional()
|
|
3985
4114
|
})
|
|
3986
4115
|
}),
|
|
3987
|
-
|
|
3988
|
-
type:
|
|
3989
|
-
call_id:
|
|
3990
|
-
name:
|
|
3991
|
-
arguments:
|
|
3992
|
-
id:
|
|
4116
|
+
import_v423.z.object({
|
|
4117
|
+
type: import_v423.z.literal("function_call"),
|
|
4118
|
+
call_id: import_v423.z.string(),
|
|
4119
|
+
name: import_v423.z.string(),
|
|
4120
|
+
arguments: import_v423.z.string(),
|
|
4121
|
+
id: import_v423.z.string()
|
|
3993
4122
|
}),
|
|
3994
|
-
|
|
3995
|
-
type:
|
|
3996
|
-
call_id:
|
|
3997
|
-
name:
|
|
3998
|
-
input:
|
|
3999
|
-
id:
|
|
4123
|
+
import_v423.z.object({
|
|
4124
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
4125
|
+
call_id: import_v423.z.string(),
|
|
4126
|
+
name: import_v423.z.string(),
|
|
4127
|
+
input: import_v423.z.string(),
|
|
4128
|
+
id: import_v423.z.string()
|
|
4000
4129
|
}),
|
|
4001
|
-
|
|
4002
|
-
type:
|
|
4003
|
-
id:
|
|
4004
|
-
status:
|
|
4130
|
+
import_v423.z.object({
|
|
4131
|
+
type: import_v423.z.literal("computer_call"),
|
|
4132
|
+
id: import_v423.z.string(),
|
|
4133
|
+
status: import_v423.z.string().optional()
|
|
4005
4134
|
}),
|
|
4006
|
-
|
|
4007
|
-
type:
|
|
4008
|
-
id:
|
|
4009
|
-
encrypted_content:
|
|
4010
|
-
summary:
|
|
4011
|
-
|
|
4012
|
-
type:
|
|
4013
|
-
text:
|
|
4135
|
+
import_v423.z.object({
|
|
4136
|
+
type: import_v423.z.literal("reasoning"),
|
|
4137
|
+
id: import_v423.z.string(),
|
|
4138
|
+
encrypted_content: import_v423.z.string().nullish(),
|
|
4139
|
+
summary: import_v423.z.array(
|
|
4140
|
+
import_v423.z.object({
|
|
4141
|
+
type: import_v423.z.literal("summary_text"),
|
|
4142
|
+
text: import_v423.z.string()
|
|
4014
4143
|
})
|
|
4015
4144
|
)
|
|
4016
4145
|
}),
|
|
4017
|
-
|
|
4018
|
-
type:
|
|
4019
|
-
id:
|
|
4020
|
-
status:
|
|
4021
|
-
arguments:
|
|
4022
|
-
name:
|
|
4023
|
-
server_label:
|
|
4024
|
-
output:
|
|
4025
|
-
error:
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
type:
|
|
4029
|
-
code:
|
|
4030
|
-
message:
|
|
4146
|
+
import_v423.z.object({
|
|
4147
|
+
type: import_v423.z.literal("mcp_call"),
|
|
4148
|
+
id: import_v423.z.string(),
|
|
4149
|
+
status: import_v423.z.string(),
|
|
4150
|
+
arguments: import_v423.z.string(),
|
|
4151
|
+
name: import_v423.z.string(),
|
|
4152
|
+
server_label: import_v423.z.string(),
|
|
4153
|
+
output: import_v423.z.string().nullish(),
|
|
4154
|
+
error: import_v423.z.union([
|
|
4155
|
+
import_v423.z.string(),
|
|
4156
|
+
import_v423.z.object({
|
|
4157
|
+
type: import_v423.z.string().optional(),
|
|
4158
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
4159
|
+
message: import_v423.z.string().optional()
|
|
4031
4160
|
}).loose()
|
|
4032
4161
|
]).nullish(),
|
|
4033
|
-
approval_request_id:
|
|
4162
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
4034
4163
|
}),
|
|
4035
|
-
|
|
4036
|
-
type:
|
|
4037
|
-
id:
|
|
4038
|
-
server_label:
|
|
4039
|
-
tools:
|
|
4040
|
-
|
|
4041
|
-
name:
|
|
4042
|
-
description:
|
|
4043
|
-
input_schema:
|
|
4044
|
-
annotations:
|
|
4164
|
+
import_v423.z.object({
|
|
4165
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
4166
|
+
id: import_v423.z.string(),
|
|
4167
|
+
server_label: import_v423.z.string(),
|
|
4168
|
+
tools: import_v423.z.array(
|
|
4169
|
+
import_v423.z.object({
|
|
4170
|
+
name: import_v423.z.string(),
|
|
4171
|
+
description: import_v423.z.string().optional(),
|
|
4172
|
+
input_schema: import_v423.z.any(),
|
|
4173
|
+
annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
|
|
4045
4174
|
})
|
|
4046
4175
|
),
|
|
4047
|
-
error:
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
type:
|
|
4051
|
-
code:
|
|
4052
|
-
message:
|
|
4176
|
+
error: import_v423.z.union([
|
|
4177
|
+
import_v423.z.string(),
|
|
4178
|
+
import_v423.z.object({
|
|
4179
|
+
type: import_v423.z.string().optional(),
|
|
4180
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
4181
|
+
message: import_v423.z.string().optional()
|
|
4053
4182
|
}).loose()
|
|
4054
4183
|
]).optional()
|
|
4055
4184
|
}),
|
|
4056
|
-
|
|
4057
|
-
type:
|
|
4058
|
-
id:
|
|
4059
|
-
server_label:
|
|
4060
|
-
name:
|
|
4061
|
-
arguments:
|
|
4062
|
-
approval_request_id:
|
|
4185
|
+
import_v423.z.object({
|
|
4186
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
4187
|
+
id: import_v423.z.string(),
|
|
4188
|
+
server_label: import_v423.z.string(),
|
|
4189
|
+
name: import_v423.z.string(),
|
|
4190
|
+
arguments: import_v423.z.string(),
|
|
4191
|
+
approval_request_id: import_v423.z.string().optional()
|
|
4063
4192
|
}),
|
|
4064
|
-
|
|
4065
|
-
type:
|
|
4066
|
-
id:
|
|
4067
|
-
call_id:
|
|
4068
|
-
status:
|
|
4069
|
-
operation:
|
|
4070
|
-
|
|
4071
|
-
type:
|
|
4072
|
-
path:
|
|
4073
|
-
diff:
|
|
4193
|
+
import_v423.z.object({
|
|
4194
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
4195
|
+
id: import_v423.z.string(),
|
|
4196
|
+
call_id: import_v423.z.string(),
|
|
4197
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
4198
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
4199
|
+
import_v423.z.object({
|
|
4200
|
+
type: import_v423.z.literal("create_file"),
|
|
4201
|
+
path: import_v423.z.string(),
|
|
4202
|
+
diff: import_v423.z.string()
|
|
4074
4203
|
}),
|
|
4075
|
-
|
|
4076
|
-
type:
|
|
4077
|
-
path:
|
|
4204
|
+
import_v423.z.object({
|
|
4205
|
+
type: import_v423.z.literal("delete_file"),
|
|
4206
|
+
path: import_v423.z.string()
|
|
4078
4207
|
}),
|
|
4079
|
-
|
|
4080
|
-
type:
|
|
4081
|
-
path:
|
|
4082
|
-
diff:
|
|
4208
|
+
import_v423.z.object({
|
|
4209
|
+
type: import_v423.z.literal("update_file"),
|
|
4210
|
+
path: import_v423.z.string(),
|
|
4211
|
+
diff: import_v423.z.string()
|
|
4083
4212
|
})
|
|
4084
4213
|
])
|
|
4085
4214
|
}),
|
|
4086
|
-
|
|
4087
|
-
type:
|
|
4088
|
-
id:
|
|
4089
|
-
call_id:
|
|
4090
|
-
status:
|
|
4091
|
-
action:
|
|
4092
|
-
commands:
|
|
4215
|
+
import_v423.z.object({
|
|
4216
|
+
type: import_v423.z.literal("shell_call"),
|
|
4217
|
+
id: import_v423.z.string(),
|
|
4218
|
+
call_id: import_v423.z.string(),
|
|
4219
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4220
|
+
action: import_v423.z.object({
|
|
4221
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
4093
4222
|
})
|
|
4094
4223
|
}),
|
|
4095
|
-
|
|
4096
|
-
type:
|
|
4097
|
-
id:
|
|
4098
|
-
encrypted_content:
|
|
4224
|
+
import_v423.z.object({
|
|
4225
|
+
type: import_v423.z.literal("compaction"),
|
|
4226
|
+
id: import_v423.z.string(),
|
|
4227
|
+
encrypted_content: import_v423.z.string()
|
|
4099
4228
|
}),
|
|
4100
|
-
|
|
4101
|
-
type:
|
|
4102
|
-
id:
|
|
4103
|
-
call_id:
|
|
4104
|
-
status:
|
|
4105
|
-
output:
|
|
4106
|
-
|
|
4107
|
-
stdout:
|
|
4108
|
-
stderr:
|
|
4109
|
-
outcome:
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
type:
|
|
4113
|
-
exit_code:
|
|
4229
|
+
import_v423.z.object({
|
|
4230
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
4231
|
+
id: import_v423.z.string(),
|
|
4232
|
+
call_id: import_v423.z.string(),
|
|
4233
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4234
|
+
output: import_v423.z.array(
|
|
4235
|
+
import_v423.z.object({
|
|
4236
|
+
stdout: import_v423.z.string(),
|
|
4237
|
+
stderr: import_v423.z.string(),
|
|
4238
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
4239
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
4240
|
+
import_v423.z.object({
|
|
4241
|
+
type: import_v423.z.literal("exit"),
|
|
4242
|
+
exit_code: import_v423.z.number()
|
|
4114
4243
|
})
|
|
4115
4244
|
])
|
|
4116
4245
|
})
|
|
4117
4246
|
)
|
|
4118
4247
|
}),
|
|
4119
|
-
|
|
4120
|
-
type:
|
|
4121
|
-
id:
|
|
4122
|
-
execution:
|
|
4123
|
-
call_id:
|
|
4124
|
-
status:
|
|
4125
|
-
arguments:
|
|
4248
|
+
import_v423.z.object({
|
|
4249
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
4250
|
+
id: import_v423.z.string(),
|
|
4251
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
4252
|
+
call_id: import_v423.z.string().nullable(),
|
|
4253
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4254
|
+
arguments: import_v423.z.unknown()
|
|
4126
4255
|
}),
|
|
4127
|
-
|
|
4128
|
-
type:
|
|
4129
|
-
id:
|
|
4130
|
-
execution:
|
|
4131
|
-
call_id:
|
|
4132
|
-
status:
|
|
4133
|
-
tools:
|
|
4256
|
+
import_v423.z.object({
|
|
4257
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
4258
|
+
id: import_v423.z.string(),
|
|
4259
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
4260
|
+
call_id: import_v423.z.string().nullable(),
|
|
4261
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4262
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
4134
4263
|
})
|
|
4135
4264
|
])
|
|
4136
4265
|
).optional(),
|
|
4137
|
-
service_tier:
|
|
4138
|
-
incomplete_details:
|
|
4139
|
-
usage:
|
|
4140
|
-
input_tokens:
|
|
4141
|
-
input_tokens_details:
|
|
4142
|
-
output_tokens:
|
|
4143
|
-
output_tokens_details:
|
|
4266
|
+
service_tier: import_v423.z.string().nullish(),
|
|
4267
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
4268
|
+
usage: import_v423.z.object({
|
|
4269
|
+
input_tokens: import_v423.z.number(),
|
|
4270
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
4271
|
+
output_tokens: import_v423.z.number(),
|
|
4272
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
4144
4273
|
}).optional()
|
|
4145
4274
|
})
|
|
4146
4275
|
)
|
|
4147
4276
|
);
|
|
4148
4277
|
|
|
4149
4278
|
// src/responses/openai-responses-options.ts
|
|
4150
|
-
var
|
|
4151
|
-
var
|
|
4279
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4280
|
+
var import_v424 = require("zod/v4");
|
|
4152
4281
|
var TOP_LOGPROBS_MAX = 20;
|
|
4153
4282
|
var openaiResponsesReasoningModelIds = [
|
|
4154
4283
|
"o1",
|
|
@@ -4213,9 +4342,9 @@ var openaiResponsesModelIds = [
|
|
|
4213
4342
|
"gpt-5-chat-latest",
|
|
4214
4343
|
...openaiResponsesReasoningModelIds
|
|
4215
4344
|
];
|
|
4216
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
4217
|
-
() => (0,
|
|
4218
|
-
|
|
4345
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils30.lazySchema)(
|
|
4346
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4347
|
+
import_v424.z.object({
|
|
4219
4348
|
/**
|
|
4220
4349
|
* The ID of the OpenAI Conversation to continue.
|
|
4221
4350
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -4223,13 +4352,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4223
4352
|
* Defaults to `undefined`.
|
|
4224
4353
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
4225
4354
|
*/
|
|
4226
|
-
conversation:
|
|
4355
|
+
conversation: import_v424.z.string().nullish(),
|
|
4227
4356
|
/**
|
|
4228
4357
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
4229
4358
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
4230
4359
|
*/
|
|
4231
|
-
include:
|
|
4232
|
-
|
|
4360
|
+
include: import_v424.z.array(
|
|
4361
|
+
import_v424.z.enum([
|
|
4233
4362
|
"reasoning.encrypted_content",
|
|
4234
4363
|
// handled internally by default, only needed for unknown reasoning models
|
|
4235
4364
|
"file_search_call.results",
|
|
@@ -4241,7 +4370,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4241
4370
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4242
4371
|
* Defaults to `undefined`.
|
|
4243
4372
|
*/
|
|
4244
|
-
instructions:
|
|
4373
|
+
instructions: import_v424.z.string().nullish(),
|
|
4245
4374
|
/**
|
|
4246
4375
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4247
4376
|
* the response size and can slow down response times. However, it can
|
|
@@ -4256,30 +4385,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4256
4385
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4257
4386
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4258
4387
|
*/
|
|
4259
|
-
logprobs:
|
|
4388
|
+
logprobs: import_v424.z.union([import_v424.z.boolean(), import_v424.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4260
4389
|
/**
|
|
4261
4390
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4262
4391
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4263
4392
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4264
4393
|
*/
|
|
4265
|
-
maxToolCalls:
|
|
4394
|
+
maxToolCalls: import_v424.z.number().nullish(),
|
|
4266
4395
|
/**
|
|
4267
4396
|
* Additional metadata to store with the generation.
|
|
4268
4397
|
*/
|
|
4269
|
-
metadata:
|
|
4398
|
+
metadata: import_v424.z.any().nullish(),
|
|
4270
4399
|
/**
|
|
4271
4400
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4272
4401
|
*/
|
|
4273
|
-
parallelToolCalls:
|
|
4402
|
+
parallelToolCalls: import_v424.z.boolean().nullish(),
|
|
4274
4403
|
/**
|
|
4275
4404
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4276
4405
|
* Defaults to `undefined`.
|
|
4277
4406
|
*/
|
|
4278
|
-
previousResponseId:
|
|
4407
|
+
previousResponseId: import_v424.z.string().nullish(),
|
|
4279
4408
|
/**
|
|
4280
4409
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4281
4410
|
*/
|
|
4282
|
-
promptCacheKey:
|
|
4411
|
+
promptCacheKey: import_v424.z.string().nullish(),
|
|
4283
4412
|
/**
|
|
4284
4413
|
* The retention policy for the prompt cache.
|
|
4285
4414
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4288,7 +4417,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4288
4417
|
*
|
|
4289
4418
|
* @default 'in_memory'
|
|
4290
4419
|
*/
|
|
4291
|
-
promptCacheRetention:
|
|
4420
|
+
promptCacheRetention: import_v424.z.enum(["in_memory", "24h"]).nullish(),
|
|
4292
4421
|
/**
|
|
4293
4422
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4294
4423
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4299,17 +4428,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4299
4428
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4300
4429
|
* an error.
|
|
4301
4430
|
*/
|
|
4302
|
-
reasoningEffort:
|
|
4431
|
+
reasoningEffort: import_v424.z.string().nullish(),
|
|
4303
4432
|
/**
|
|
4304
4433
|
* Controls reasoning summary output from the model.
|
|
4305
4434
|
* Set to "auto" to automatically receive the richest level available,
|
|
4306
4435
|
* or "detailed" for comprehensive summaries.
|
|
4307
4436
|
*/
|
|
4308
|
-
reasoningSummary:
|
|
4437
|
+
reasoningSummary: import_v424.z.string().nullish(),
|
|
4309
4438
|
/**
|
|
4310
4439
|
* The identifier for safety monitoring and tracking.
|
|
4311
4440
|
*/
|
|
4312
|
-
safetyIdentifier:
|
|
4441
|
+
safetyIdentifier: import_v424.z.string().nullish(),
|
|
4313
4442
|
/**
|
|
4314
4443
|
* Service tier for the request.
|
|
4315
4444
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4317,34 +4446,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4317
4446
|
*
|
|
4318
4447
|
* Defaults to 'auto'.
|
|
4319
4448
|
*/
|
|
4320
|
-
serviceTier:
|
|
4449
|
+
serviceTier: import_v424.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4321
4450
|
/**
|
|
4322
4451
|
* Whether to store the generation. Defaults to `true`.
|
|
4323
4452
|
*/
|
|
4324
|
-
store:
|
|
4453
|
+
store: import_v424.z.boolean().nullish(),
|
|
4325
4454
|
/**
|
|
4326
4455
|
* Whether to use strict JSON schema validation.
|
|
4327
4456
|
* Defaults to `true`.
|
|
4328
4457
|
*/
|
|
4329
|
-
strictJsonSchema:
|
|
4458
|
+
strictJsonSchema: import_v424.z.boolean().nullish(),
|
|
4330
4459
|
/**
|
|
4331
4460
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4332
4461
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4333
4462
|
* Valid values: 'low', 'medium', 'high'.
|
|
4334
4463
|
*/
|
|
4335
|
-
textVerbosity:
|
|
4464
|
+
textVerbosity: import_v424.z.enum(["low", "medium", "high"]).nullish(),
|
|
4336
4465
|
/**
|
|
4337
4466
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4338
4467
|
* 'disabled' turns truncation off.
|
|
4339
4468
|
*/
|
|
4340
|
-
truncation:
|
|
4469
|
+
truncation: import_v424.z.enum(["auto", "disabled"]).nullish(),
|
|
4341
4470
|
/**
|
|
4342
4471
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4343
4472
|
* monitor and detect abuse.
|
|
4344
4473
|
* Defaults to `undefined`.
|
|
4345
4474
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4346
4475
|
*/
|
|
4347
|
-
user:
|
|
4476
|
+
user: import_v424.z.string().nullish(),
|
|
4348
4477
|
/**
|
|
4349
4478
|
* Override the system message mode for this model.
|
|
4350
4479
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4353,7 +4482,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4353
4482
|
*
|
|
4354
4483
|
* If not specified, the mode is automatically determined based on the model.
|
|
4355
4484
|
*/
|
|
4356
|
-
systemMessageMode:
|
|
4485
|
+
systemMessageMode: import_v424.z.enum(["system", "developer", "remove"]).optional(),
|
|
4357
4486
|
/**
|
|
4358
4487
|
* Force treating this model as a reasoning model.
|
|
4359
4488
|
*
|
|
@@ -4363,14 +4492,14 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4363
4492
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4364
4493
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4365
4494
|
*/
|
|
4366
|
-
forceReasoning:
|
|
4495
|
+
forceReasoning: import_v424.z.boolean().optional(),
|
|
4367
4496
|
/**
|
|
4368
4497
|
* Enable server-side context management (compaction).
|
|
4369
4498
|
*/
|
|
4370
|
-
contextManagement:
|
|
4371
|
-
|
|
4372
|
-
type:
|
|
4373
|
-
compactThreshold:
|
|
4499
|
+
contextManagement: import_v424.z.array(
|
|
4500
|
+
import_v424.z.object({
|
|
4501
|
+
type: import_v424.z.literal("compaction"),
|
|
4502
|
+
compactThreshold: import_v424.z.number()
|
|
4374
4503
|
})
|
|
4375
4504
|
).nullish()
|
|
4376
4505
|
})
|
|
@@ -4379,7 +4508,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
4379
4508
|
|
|
4380
4509
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4381
4510
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4382
|
-
var
|
|
4511
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
4383
4512
|
async function prepareResponsesTools({
|
|
4384
4513
|
tools,
|
|
4385
4514
|
toolChoice,
|
|
@@ -4412,7 +4541,7 @@ async function prepareResponsesTools({
|
|
|
4412
4541
|
case "provider": {
|
|
4413
4542
|
switch (tool.id) {
|
|
4414
4543
|
case "openai.file_search": {
|
|
4415
|
-
const args = await (0,
|
|
4544
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4416
4545
|
value: tool.args,
|
|
4417
4546
|
schema: fileSearchArgsSchema
|
|
4418
4547
|
});
|
|
@@ -4435,7 +4564,7 @@ async function prepareResponsesTools({
|
|
|
4435
4564
|
break;
|
|
4436
4565
|
}
|
|
4437
4566
|
case "openai.shell": {
|
|
4438
|
-
const args = await (0,
|
|
4567
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4439
4568
|
value: tool.args,
|
|
4440
4569
|
schema: shellArgsSchema
|
|
4441
4570
|
});
|
|
@@ -4454,7 +4583,7 @@ async function prepareResponsesTools({
|
|
|
4454
4583
|
break;
|
|
4455
4584
|
}
|
|
4456
4585
|
case "openai.web_search_preview": {
|
|
4457
|
-
const args = await (0,
|
|
4586
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4458
4587
|
value: tool.args,
|
|
4459
4588
|
schema: webSearchPreviewArgsSchema
|
|
4460
4589
|
});
|
|
@@ -4466,7 +4595,7 @@ async function prepareResponsesTools({
|
|
|
4466
4595
|
break;
|
|
4467
4596
|
}
|
|
4468
4597
|
case "openai.web_search": {
|
|
4469
|
-
const args = await (0,
|
|
4598
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4470
4599
|
value: tool.args,
|
|
4471
4600
|
schema: webSearchArgsSchema
|
|
4472
4601
|
});
|
|
@@ -4480,7 +4609,7 @@ async function prepareResponsesTools({
|
|
|
4480
4609
|
break;
|
|
4481
4610
|
}
|
|
4482
4611
|
case "openai.code_interpreter": {
|
|
4483
|
-
const args = await (0,
|
|
4612
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4484
4613
|
value: tool.args,
|
|
4485
4614
|
schema: codeInterpreterArgsSchema
|
|
4486
4615
|
});
|
|
@@ -4491,7 +4620,7 @@ async function prepareResponsesTools({
|
|
|
4491
4620
|
break;
|
|
4492
4621
|
}
|
|
4493
4622
|
case "openai.image_generation": {
|
|
4494
|
-
const args = await (0,
|
|
4623
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4495
4624
|
value: tool.args,
|
|
4496
4625
|
schema: imageGenerationArgsSchema
|
|
4497
4626
|
});
|
|
@@ -4514,7 +4643,7 @@ async function prepareResponsesTools({
|
|
|
4514
4643
|
break;
|
|
4515
4644
|
}
|
|
4516
4645
|
case "openai.mcp": {
|
|
4517
|
-
const args = await (0,
|
|
4646
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4518
4647
|
value: tool.args,
|
|
4519
4648
|
schema: mcpArgsSchema
|
|
4520
4649
|
});
|
|
@@ -4540,7 +4669,7 @@ async function prepareResponsesTools({
|
|
|
4540
4669
|
break;
|
|
4541
4670
|
}
|
|
4542
4671
|
case "openai.custom": {
|
|
4543
|
-
const args = await (0,
|
|
4672
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4544
4673
|
value: tool.args,
|
|
4545
4674
|
schema: customArgsSchema
|
|
4546
4675
|
});
|
|
@@ -4554,7 +4683,7 @@ async function prepareResponsesTools({
|
|
|
4554
4683
|
break;
|
|
4555
4684
|
}
|
|
4556
4685
|
case "openai.tool_search": {
|
|
4557
|
-
const args = await (0,
|
|
4686
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4558
4687
|
value: tool.args,
|
|
4559
4688
|
schema: toolSearchArgsSchema
|
|
4560
4689
|
});
|
|
@@ -4713,19 +4842,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4713
4842
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4714
4843
|
}
|
|
4715
4844
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4716
|
-
let openaiOptions = await (0,
|
|
4845
|
+
let openaiOptions = await (0, import_provider_utils32.parseProviderOptions)({
|
|
4717
4846
|
provider: providerOptionsName,
|
|
4718
4847
|
providerOptions,
|
|
4719
4848
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4720
4849
|
});
|
|
4721
4850
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4722
|
-
openaiOptions = await (0,
|
|
4851
|
+
openaiOptions = await (0, import_provider_utils32.parseProviderOptions)({
|
|
4723
4852
|
provider: "openai",
|
|
4724
4853
|
providerOptions,
|
|
4725
4854
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4726
4855
|
});
|
|
4727
4856
|
}
|
|
4728
|
-
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : (0,
|
|
4857
|
+
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : (0, import_provider_utils32.isCustomReasoning)(reasoning) ? reasoning : void 0;
|
|
4729
4858
|
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
4730
4859
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
4731
4860
|
warnings.push({
|
|
@@ -4734,7 +4863,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4734
4863
|
details: "conversation and previousResponseId cannot be used together"
|
|
4735
4864
|
});
|
|
4736
4865
|
}
|
|
4737
|
-
const toolNameMapping = (0,
|
|
4866
|
+
const toolNameMapping = (0, import_provider_utils32.createToolNameMapping)({
|
|
4738
4867
|
tools,
|
|
4739
4868
|
providerToolNames: {
|
|
4740
4869
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4948,12 +5077,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4948
5077
|
responseHeaders,
|
|
4949
5078
|
value: response,
|
|
4950
5079
|
rawValue: rawResponse
|
|
4951
|
-
} = await (0,
|
|
5080
|
+
} = await (0, import_provider_utils32.postJsonToApi)({
|
|
4952
5081
|
url,
|
|
4953
|
-
headers: (0,
|
|
5082
|
+
headers: (0, import_provider_utils32.combineHeaders)(this.config.headers(), options.headers),
|
|
4954
5083
|
body,
|
|
4955
5084
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4956
|
-
successfulResponseHandler: (0,
|
|
5085
|
+
successfulResponseHandler: (0, import_provider_utils32.createJsonResponseHandler)(
|
|
4957
5086
|
openaiResponsesResponseSchema
|
|
4958
5087
|
),
|
|
4959
5088
|
abortSignal: options.abortSignal,
|
|
@@ -5129,7 +5258,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5129
5258
|
content.push({
|
|
5130
5259
|
type: "source",
|
|
5131
5260
|
sourceType: "url",
|
|
5132
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
5261
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils32.generateId)(),
|
|
5133
5262
|
url: annotation.url,
|
|
5134
5263
|
title: annotation.title
|
|
5135
5264
|
});
|
|
@@ -5137,7 +5266,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5137
5266
|
content.push({
|
|
5138
5267
|
type: "source",
|
|
5139
5268
|
sourceType: "document",
|
|
5140
|
-
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0,
|
|
5269
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils32.generateId)(),
|
|
5141
5270
|
mediaType: "text/plain",
|
|
5142
5271
|
title: annotation.filename,
|
|
5143
5272
|
filename: annotation.filename,
|
|
@@ -5153,7 +5282,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5153
5282
|
content.push({
|
|
5154
5283
|
type: "source",
|
|
5155
5284
|
sourceType: "document",
|
|
5156
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
5285
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)(),
|
|
5157
5286
|
mediaType: "text/plain",
|
|
5158
5287
|
title: annotation.filename,
|
|
5159
5288
|
filename: annotation.filename,
|
|
@@ -5169,7 +5298,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5169
5298
|
content.push({
|
|
5170
5299
|
type: "source",
|
|
5171
5300
|
sourceType: "document",
|
|
5172
|
-
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0,
|
|
5301
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils32.generateId)(),
|
|
5173
5302
|
mediaType: "application/octet-stream",
|
|
5174
5303
|
title: annotation.file_id,
|
|
5175
5304
|
filename: annotation.file_id,
|
|
@@ -5273,7 +5402,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5273
5402
|
}
|
|
5274
5403
|
case "mcp_approval_request": {
|
|
5275
5404
|
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5276
|
-
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0,
|
|
5405
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils32.generateId)();
|
|
5277
5406
|
const toolName = `mcp.${part.name}`;
|
|
5278
5407
|
content.push({
|
|
5279
5408
|
type: "tool-call",
|
|
@@ -5428,18 +5557,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5428
5557
|
providerOptionsName,
|
|
5429
5558
|
isShellProviderExecuted
|
|
5430
5559
|
} = await this.getArgs(options);
|
|
5431
|
-
const { responseHeaders, value: response } = await (0,
|
|
5560
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils32.postJsonToApi)({
|
|
5432
5561
|
url: this.config.url({
|
|
5433
5562
|
path: "/responses",
|
|
5434
5563
|
modelId: this.modelId
|
|
5435
5564
|
}),
|
|
5436
|
-
headers: (0,
|
|
5565
|
+
headers: (0, import_provider_utils32.combineHeaders)(this.config.headers(), options.headers),
|
|
5437
5566
|
body: {
|
|
5438
5567
|
...body,
|
|
5439
5568
|
stream: true
|
|
5440
5569
|
},
|
|
5441
5570
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5442
|
-
successfulResponseHandler: (0,
|
|
5571
|
+
successfulResponseHandler: (0, import_provider_utils32.createEventSourceResponseHandler)(
|
|
5443
5572
|
openaiResponsesChunkSchema
|
|
5444
5573
|
),
|
|
5445
5574
|
abortSignal: options.abortSignal,
|
|
@@ -5919,7 +6048,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5919
6048
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5920
6049
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5921
6050
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5922
|
-
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
6051
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)();
|
|
5923
6052
|
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5924
6053
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5925
6054
|
approvalRequestId,
|
|
@@ -6222,7 +6351,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6222
6351
|
controller.enqueue({
|
|
6223
6352
|
type: "source",
|
|
6224
6353
|
sourceType: "url",
|
|
6225
|
-
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0,
|
|
6354
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils32.generateId)(),
|
|
6226
6355
|
url: value.annotation.url,
|
|
6227
6356
|
title: value.annotation.title
|
|
6228
6357
|
});
|
|
@@ -6230,7 +6359,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6230
6359
|
controller.enqueue({
|
|
6231
6360
|
type: "source",
|
|
6232
6361
|
sourceType: "document",
|
|
6233
|
-
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0,
|
|
6362
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils32.generateId)(),
|
|
6234
6363
|
mediaType: "text/plain",
|
|
6235
6364
|
title: value.annotation.filename,
|
|
6236
6365
|
filename: value.annotation.filename,
|
|
@@ -6246,7 +6375,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6246
6375
|
controller.enqueue({
|
|
6247
6376
|
type: "source",
|
|
6248
6377
|
sourceType: "document",
|
|
6249
|
-
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0,
|
|
6378
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils32.generateId)(),
|
|
6250
6379
|
mediaType: "text/plain",
|
|
6251
6380
|
title: value.annotation.filename,
|
|
6252
6381
|
filename: value.annotation.filename,
|
|
@@ -6262,7 +6391,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6262
6391
|
controller.enqueue({
|
|
6263
6392
|
type: "source",
|
|
6264
6393
|
sourceType: "document",
|
|
6265
|
-
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0,
|
|
6394
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils32.generateId)(),
|
|
6266
6395
|
mediaType: "application/octet-stream",
|
|
6267
6396
|
title: value.annotation.file_id,
|
|
6268
6397
|
filename: value.annotation.file_id,
|
|
@@ -6375,16 +6504,16 @@ function escapeJSONDelta(delta) {
|
|
|
6375
6504
|
}
|
|
6376
6505
|
|
|
6377
6506
|
// src/speech/openai-speech-model.ts
|
|
6378
|
-
var
|
|
6507
|
+
var import_provider_utils34 = require("@ai-sdk/provider-utils");
|
|
6379
6508
|
|
|
6380
6509
|
// src/speech/openai-speech-options.ts
|
|
6381
|
-
var
|
|
6382
|
-
var
|
|
6383
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
6384
|
-
() => (0,
|
|
6385
|
-
|
|
6386
|
-
instructions:
|
|
6387
|
-
speed:
|
|
6510
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
6511
|
+
var import_v425 = require("zod/v4");
|
|
6512
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils33.lazySchema)(
|
|
6513
|
+
() => (0, import_provider_utils33.zodSchema)(
|
|
6514
|
+
import_v425.z.object({
|
|
6515
|
+
instructions: import_v425.z.string().nullish(),
|
|
6516
|
+
speed: import_v425.z.number().min(0.25).max(4).default(1).nullish()
|
|
6388
6517
|
})
|
|
6389
6518
|
)
|
|
6390
6519
|
);
|
|
@@ -6409,7 +6538,7 @@ var OpenAISpeechModel = class {
|
|
|
6409
6538
|
providerOptions
|
|
6410
6539
|
}) {
|
|
6411
6540
|
const warnings = [];
|
|
6412
|
-
const openAIOptions = await (0,
|
|
6541
|
+
const openAIOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
6413
6542
|
provider: "openai",
|
|
6414
6543
|
providerOptions,
|
|
6415
6544
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -6462,15 +6591,15 @@ var OpenAISpeechModel = class {
|
|
|
6462
6591
|
value: audio,
|
|
6463
6592
|
responseHeaders,
|
|
6464
6593
|
rawValue: rawResponse
|
|
6465
|
-
} = await (0,
|
|
6594
|
+
} = await (0, import_provider_utils34.postJsonToApi)({
|
|
6466
6595
|
url: this.config.url({
|
|
6467
6596
|
path: "/audio/speech",
|
|
6468
6597
|
modelId: this.modelId
|
|
6469
6598
|
}),
|
|
6470
|
-
headers: (0,
|
|
6599
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
6471
6600
|
body: requestBody,
|
|
6472
6601
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6473
|
-
successfulResponseHandler: (0,
|
|
6602
|
+
successfulResponseHandler: (0, import_provider_utils34.createBinaryResponseHandler)(),
|
|
6474
6603
|
abortSignal: options.abortSignal,
|
|
6475
6604
|
fetch: this.config.fetch
|
|
6476
6605
|
});
|
|
@@ -6491,36 +6620,36 @@ var OpenAISpeechModel = class {
|
|
|
6491
6620
|
};
|
|
6492
6621
|
|
|
6493
6622
|
// src/transcription/openai-transcription-model.ts
|
|
6494
|
-
var
|
|
6623
|
+
var import_provider_utils37 = require("@ai-sdk/provider-utils");
|
|
6495
6624
|
|
|
6496
6625
|
// src/transcription/openai-transcription-api.ts
|
|
6497
|
-
var
|
|
6498
|
-
var
|
|
6499
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
6500
|
-
() => (0,
|
|
6501
|
-
|
|
6502
|
-
text:
|
|
6503
|
-
language:
|
|
6504
|
-
duration:
|
|
6505
|
-
words:
|
|
6506
|
-
|
|
6507
|
-
word:
|
|
6508
|
-
start:
|
|
6509
|
-
end:
|
|
6626
|
+
var import_provider_utils35 = require("@ai-sdk/provider-utils");
|
|
6627
|
+
var import_v426 = require("zod/v4");
|
|
6628
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils35.lazySchema)(
|
|
6629
|
+
() => (0, import_provider_utils35.zodSchema)(
|
|
6630
|
+
import_v426.z.object({
|
|
6631
|
+
text: import_v426.z.string(),
|
|
6632
|
+
language: import_v426.z.string().nullish(),
|
|
6633
|
+
duration: import_v426.z.number().nullish(),
|
|
6634
|
+
words: import_v426.z.array(
|
|
6635
|
+
import_v426.z.object({
|
|
6636
|
+
word: import_v426.z.string(),
|
|
6637
|
+
start: import_v426.z.number(),
|
|
6638
|
+
end: import_v426.z.number()
|
|
6510
6639
|
})
|
|
6511
6640
|
).nullish(),
|
|
6512
|
-
segments:
|
|
6513
|
-
|
|
6514
|
-
id:
|
|
6515
|
-
seek:
|
|
6516
|
-
start:
|
|
6517
|
-
end:
|
|
6518
|
-
text:
|
|
6519
|
-
tokens:
|
|
6520
|
-
temperature:
|
|
6521
|
-
avg_logprob:
|
|
6522
|
-
compression_ratio:
|
|
6523
|
-
no_speech_prob:
|
|
6641
|
+
segments: import_v426.z.array(
|
|
6642
|
+
import_v426.z.object({
|
|
6643
|
+
id: import_v426.z.number(),
|
|
6644
|
+
seek: import_v426.z.number(),
|
|
6645
|
+
start: import_v426.z.number(),
|
|
6646
|
+
end: import_v426.z.number(),
|
|
6647
|
+
text: import_v426.z.string(),
|
|
6648
|
+
tokens: import_v426.z.array(import_v426.z.number()),
|
|
6649
|
+
temperature: import_v426.z.number(),
|
|
6650
|
+
avg_logprob: import_v426.z.number(),
|
|
6651
|
+
compression_ratio: import_v426.z.number(),
|
|
6652
|
+
no_speech_prob: import_v426.z.number()
|
|
6524
6653
|
})
|
|
6525
6654
|
).nullish()
|
|
6526
6655
|
})
|
|
@@ -6528,33 +6657,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils32.lazySchema)(
|
|
|
6528
6657
|
);
|
|
6529
6658
|
|
|
6530
6659
|
// src/transcription/openai-transcription-options.ts
|
|
6531
|
-
var
|
|
6532
|
-
var
|
|
6533
|
-
var openAITranscriptionModelOptions = (0,
|
|
6534
|
-
() => (0,
|
|
6535
|
-
|
|
6660
|
+
var import_provider_utils36 = require("@ai-sdk/provider-utils");
|
|
6661
|
+
var import_v427 = require("zod/v4");
|
|
6662
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils36.lazySchema)(
|
|
6663
|
+
() => (0, import_provider_utils36.zodSchema)(
|
|
6664
|
+
import_v427.z.object({
|
|
6536
6665
|
/**
|
|
6537
6666
|
* Additional information to include in the transcription response.
|
|
6538
6667
|
*/
|
|
6539
|
-
include:
|
|
6668
|
+
include: import_v427.z.array(import_v427.z.string()).optional(),
|
|
6540
6669
|
/**
|
|
6541
6670
|
* The language of the input audio in ISO-639-1 format.
|
|
6542
6671
|
*/
|
|
6543
|
-
language:
|
|
6672
|
+
language: import_v427.z.string().optional(),
|
|
6544
6673
|
/**
|
|
6545
6674
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6546
6675
|
*/
|
|
6547
|
-
prompt:
|
|
6676
|
+
prompt: import_v427.z.string().optional(),
|
|
6548
6677
|
/**
|
|
6549
6678
|
* The sampling temperature, between 0 and 1.
|
|
6550
6679
|
* @default 0
|
|
6551
6680
|
*/
|
|
6552
|
-
temperature:
|
|
6681
|
+
temperature: import_v427.z.number().min(0).max(1).default(0).optional(),
|
|
6553
6682
|
/**
|
|
6554
6683
|
* The timestamp granularities to populate for this transcription.
|
|
6555
6684
|
* @default ['segment']
|
|
6556
6685
|
*/
|
|
6557
|
-
timestampGranularities:
|
|
6686
|
+
timestampGranularities: import_v427.z.array(import_v427.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6558
6687
|
})
|
|
6559
6688
|
)
|
|
6560
6689
|
);
|
|
@@ -6634,15 +6763,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6634
6763
|
providerOptions
|
|
6635
6764
|
}) {
|
|
6636
6765
|
const warnings = [];
|
|
6637
|
-
const openAIOptions = await (0,
|
|
6766
|
+
const openAIOptions = await (0, import_provider_utils37.parseProviderOptions)({
|
|
6638
6767
|
provider: "openai",
|
|
6639
6768
|
providerOptions,
|
|
6640
6769
|
schema: openAITranscriptionModelOptions
|
|
6641
6770
|
});
|
|
6642
6771
|
const formData = new FormData();
|
|
6643
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6772
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils37.convertBase64ToUint8Array)(audio)]);
|
|
6644
6773
|
formData.append("model", this.modelId);
|
|
6645
|
-
const fileExtension = (0,
|
|
6774
|
+
const fileExtension = (0, import_provider_utils37.mediaTypeToExtension)(mediaType);
|
|
6646
6775
|
formData.append(
|
|
6647
6776
|
"file",
|
|
6648
6777
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6687,15 +6816,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6687
6816
|
value: response,
|
|
6688
6817
|
responseHeaders,
|
|
6689
6818
|
rawValue: rawResponse
|
|
6690
|
-
} = await (0,
|
|
6819
|
+
} = await (0, import_provider_utils37.postFormDataToApi)({
|
|
6691
6820
|
url: this.config.url({
|
|
6692
6821
|
path: "/audio/transcriptions",
|
|
6693
6822
|
modelId: this.modelId
|
|
6694
6823
|
}),
|
|
6695
|
-
headers: (0,
|
|
6824
|
+
headers: (0, import_provider_utils37.combineHeaders)(this.config.headers(), options.headers),
|
|
6696
6825
|
formData,
|
|
6697
6826
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6698
|
-
successfulResponseHandler: (0,
|
|
6827
|
+
successfulResponseHandler: (0, import_provider_utils37.createJsonResponseHandler)(
|
|
6699
6828
|
openaiTranscriptionResponseSchema
|
|
6700
6829
|
),
|
|
6701
6830
|
abortSignal: options.abortSignal,
|
|
@@ -6727,21 +6856,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6727
6856
|
};
|
|
6728
6857
|
|
|
6729
6858
|
// src/version.ts
|
|
6730
|
-
var VERSION = true ? "4.0.0-beta.
|
|
6859
|
+
var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
|
|
6731
6860
|
|
|
6732
6861
|
// src/openai-provider.ts
|
|
6733
6862
|
function createOpenAI(options = {}) {
|
|
6734
6863
|
var _a, _b;
|
|
6735
|
-
const baseURL = (_a = (0,
|
|
6736
|
-
(0,
|
|
6864
|
+
const baseURL = (_a = (0, import_provider_utils38.withoutTrailingSlash)(
|
|
6865
|
+
(0, import_provider_utils38.loadOptionalSetting)({
|
|
6737
6866
|
settingValue: options.baseURL,
|
|
6738
6867
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6739
6868
|
})
|
|
6740
6869
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6741
6870
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6742
|
-
const getHeaders = () => (0,
|
|
6871
|
+
const getHeaders = () => (0, import_provider_utils38.withUserAgentSuffix)(
|
|
6743
6872
|
{
|
|
6744
|
-
Authorization: `Bearer ${(0,
|
|
6873
|
+
Authorization: `Bearer ${(0, import_provider_utils38.loadApiKey)({
|
|
6745
6874
|
apiKey: options.apiKey,
|
|
6746
6875
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6747
6876
|
description: "OpenAI"
|
|
@@ -6788,6 +6917,12 @@ function createOpenAI(options = {}) {
|
|
|
6788
6917
|
headers: getHeaders,
|
|
6789
6918
|
fetch: options.fetch
|
|
6790
6919
|
});
|
|
6920
|
+
const createFiles = () => new OpenAIFiles({
|
|
6921
|
+
provider: `${providerName}.files`,
|
|
6922
|
+
baseURL,
|
|
6923
|
+
headers: getHeaders,
|
|
6924
|
+
fetch: options.fetch
|
|
6925
|
+
});
|
|
6791
6926
|
const createLanguageModel = (modelId) => {
|
|
6792
6927
|
if (new.target) {
|
|
6793
6928
|
throw new Error(
|
|
@@ -6802,6 +6937,7 @@ function createOpenAI(options = {}) {
|
|
|
6802
6937
|
url: ({ path }) => `${baseURL}${path}`,
|
|
6803
6938
|
headers: getHeaders,
|
|
6804
6939
|
fetch: options.fetch,
|
|
6940
|
+
// Soft-deprecated. TODO: remove in v8
|
|
6805
6941
|
fileIdPrefixes: ["file-"]
|
|
6806
6942
|
});
|
|
6807
6943
|
};
|
|
@@ -6823,6 +6959,7 @@ function createOpenAI(options = {}) {
|
|
|
6823
6959
|
provider.transcriptionModel = createTranscriptionModel;
|
|
6824
6960
|
provider.speech = createSpeechModel;
|
|
6825
6961
|
provider.speechModel = createSpeechModel;
|
|
6962
|
+
provider.files = createFiles;
|
|
6826
6963
|
provider.tools = openaiTools;
|
|
6827
6964
|
return provider;
|
|
6828
6965
|
}
|