@ai-sdk/openai 3.0.0-beta.73 → 3.0.0-beta.75
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 +12 -0
- package/dist/index.d.mts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +967 -789
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +933 -751
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +128 -2
- package/dist/internal/index.d.ts +128 -2
- package/dist/internal/index.js +910 -730
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +890 -711
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -452,12 +452,6 @@ var openaiChatLanguageModelOptions = lazySchema2(
|
|
|
452
452
|
* Parameters for prediction mode.
|
|
453
453
|
*/
|
|
454
454
|
prediction: z3.record(z3.string(), z3.any()).optional(),
|
|
455
|
-
/**
|
|
456
|
-
* Whether to use structured outputs.
|
|
457
|
-
*
|
|
458
|
-
* @default true
|
|
459
|
-
*/
|
|
460
|
-
structuredOutputs: z3.boolean().optional(),
|
|
461
455
|
/**
|
|
462
456
|
* Service tier for the request.
|
|
463
457
|
* - 'auto': Default service tier. The request will be processed with the service tier configured in the
|
|
@@ -472,7 +466,7 @@ var openaiChatLanguageModelOptions = lazySchema2(
|
|
|
472
466
|
/**
|
|
473
467
|
* Whether to use strict JSON schema validation.
|
|
474
468
|
*
|
|
475
|
-
* @default
|
|
469
|
+
* @default true
|
|
476
470
|
*/
|
|
477
471
|
strictJsonSchema: z3.boolean().optional(),
|
|
478
472
|
/**
|
|
@@ -513,7 +507,6 @@ import {
|
|
|
513
507
|
function prepareChatTools({
|
|
514
508
|
tools,
|
|
515
509
|
toolChoice,
|
|
516
|
-
structuredOutputs,
|
|
517
510
|
strictJsonSchema
|
|
518
511
|
}) {
|
|
519
512
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -531,7 +524,7 @@ function prepareChatTools({
|
|
|
531
524
|
name: tool.name,
|
|
532
525
|
description: tool.description,
|
|
533
526
|
parameters: tool.inputSchema,
|
|
534
|
-
strict:
|
|
527
|
+
strict: strictJsonSchema
|
|
535
528
|
}
|
|
536
529
|
});
|
|
537
530
|
break;
|
|
@@ -600,24 +593,16 @@ var OpenAIChatLanguageModel = class {
|
|
|
600
593
|
toolChoice,
|
|
601
594
|
providerOptions
|
|
602
595
|
}) {
|
|
603
|
-
var _a, _b, _c
|
|
596
|
+
var _a, _b, _c;
|
|
604
597
|
const warnings = [];
|
|
605
598
|
const openaiOptions = (_a = await parseProviderOptions({
|
|
606
599
|
provider: "openai",
|
|
607
600
|
providerOptions,
|
|
608
601
|
schema: openaiChatLanguageModelOptions
|
|
609
602
|
})) != null ? _a : {};
|
|
610
|
-
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
611
603
|
if (topK != null) {
|
|
612
604
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
613
605
|
}
|
|
614
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
|
|
615
|
-
warnings.push({
|
|
616
|
-
type: "unsupported",
|
|
617
|
-
feature: "responseFormat",
|
|
618
|
-
details: "JSON response format schema is only supported with structuredOutputs"
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
606
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
622
607
|
{
|
|
623
608
|
prompt,
|
|
@@ -625,7 +610,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
625
610
|
}
|
|
626
611
|
);
|
|
627
612
|
warnings.push(...messageWarnings);
|
|
628
|
-
const strictJsonSchema = (
|
|
613
|
+
const strictJsonSchema = (_b = openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
629
614
|
const baseArgs = {
|
|
630
615
|
// model id:
|
|
631
616
|
model: this.modelId,
|
|
@@ -641,12 +626,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
641
626
|
top_p: topP,
|
|
642
627
|
frequency_penalty: frequencyPenalty,
|
|
643
628
|
presence_penalty: presencePenalty,
|
|
644
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
629
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
|
|
645
630
|
type: "json_schema",
|
|
646
631
|
json_schema: {
|
|
647
632
|
schema: responseFormat.schema,
|
|
648
633
|
strict: strictJsonSchema,
|
|
649
|
-
name: (
|
|
634
|
+
name: (_c = responseFormat.name) != null ? _c : "response",
|
|
650
635
|
description: responseFormat.description
|
|
651
636
|
}
|
|
652
637
|
} : { type: "json_object" } : void 0,
|
|
@@ -760,7 +745,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
760
745
|
} = prepareChatTools({
|
|
761
746
|
tools,
|
|
762
747
|
toolChoice,
|
|
763
|
-
structuredOutputs,
|
|
764
748
|
strictJsonSchema
|
|
765
749
|
});
|
|
766
750
|
return {
|
|
@@ -1764,46 +1748,92 @@ var OpenAIImageModel = class {
|
|
|
1764
1748
|
}
|
|
1765
1749
|
};
|
|
1766
1750
|
|
|
1767
|
-
// src/tool/
|
|
1751
|
+
// src/tool/apply-patch.ts
|
|
1768
1752
|
import {
|
|
1769
1753
|
createProviderToolFactoryWithOutputSchema,
|
|
1770
1754
|
lazySchema as lazySchema8,
|
|
1771
1755
|
zodSchema as zodSchema8
|
|
1772
1756
|
} from "@ai-sdk/provider-utils";
|
|
1773
1757
|
import { z as z9 } from "zod/v4";
|
|
1774
|
-
var
|
|
1758
|
+
var applyPatchInputSchema = lazySchema8(
|
|
1775
1759
|
() => zodSchema8(
|
|
1776
1760
|
z9.object({
|
|
1777
|
-
|
|
1778
|
-
|
|
1761
|
+
callId: z9.string(),
|
|
1762
|
+
operation: z9.discriminatedUnion("type", [
|
|
1763
|
+
z9.object({
|
|
1764
|
+
type: z9.literal("create_file"),
|
|
1765
|
+
path: z9.string(),
|
|
1766
|
+
diff: z9.string()
|
|
1767
|
+
}),
|
|
1768
|
+
z9.object({
|
|
1769
|
+
type: z9.literal("delete_file"),
|
|
1770
|
+
path: z9.string()
|
|
1771
|
+
}),
|
|
1772
|
+
z9.object({
|
|
1773
|
+
type: z9.literal("update_file"),
|
|
1774
|
+
path: z9.string(),
|
|
1775
|
+
diff: z9.string()
|
|
1776
|
+
})
|
|
1777
|
+
])
|
|
1779
1778
|
})
|
|
1780
1779
|
)
|
|
1781
1780
|
);
|
|
1782
|
-
var
|
|
1781
|
+
var applyPatchOutputSchema = lazySchema8(
|
|
1783
1782
|
() => zodSchema8(
|
|
1784
1783
|
z9.object({
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1784
|
+
status: z9.enum(["completed", "failed"]),
|
|
1785
|
+
output: z9.string().optional()
|
|
1786
|
+
})
|
|
1787
|
+
)
|
|
1788
|
+
);
|
|
1789
|
+
var applyPatchArgsSchema = lazySchema8(() => zodSchema8(z9.object({})));
|
|
1790
|
+
var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
|
|
1791
|
+
id: "openai.apply_patch",
|
|
1792
|
+
inputSchema: applyPatchInputSchema,
|
|
1793
|
+
outputSchema: applyPatchOutputSchema
|
|
1794
|
+
});
|
|
1795
|
+
var applyPatch = () => applyPatchToolFactory({});
|
|
1796
|
+
|
|
1797
|
+
// src/tool/code-interpreter.ts
|
|
1798
|
+
import {
|
|
1799
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1800
|
+
lazySchema as lazySchema9,
|
|
1801
|
+
zodSchema as zodSchema9
|
|
1802
|
+
} from "@ai-sdk/provider-utils";
|
|
1803
|
+
import { z as z10 } from "zod/v4";
|
|
1804
|
+
var codeInterpreterInputSchema = lazySchema9(
|
|
1805
|
+
() => zodSchema9(
|
|
1806
|
+
z10.object({
|
|
1807
|
+
code: z10.string().nullish(),
|
|
1808
|
+
containerId: z10.string()
|
|
1809
|
+
})
|
|
1810
|
+
)
|
|
1811
|
+
);
|
|
1812
|
+
var codeInterpreterOutputSchema = lazySchema9(
|
|
1813
|
+
() => zodSchema9(
|
|
1814
|
+
z10.object({
|
|
1815
|
+
outputs: z10.array(
|
|
1816
|
+
z10.discriminatedUnion("type", [
|
|
1817
|
+
z10.object({ type: z10.literal("logs"), logs: z10.string() }),
|
|
1818
|
+
z10.object({ type: z10.literal("image"), url: z10.string() })
|
|
1789
1819
|
])
|
|
1790
1820
|
).nullish()
|
|
1791
1821
|
})
|
|
1792
1822
|
)
|
|
1793
1823
|
);
|
|
1794
|
-
var codeInterpreterArgsSchema =
|
|
1795
|
-
() =>
|
|
1796
|
-
|
|
1797
|
-
container:
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
fileIds:
|
|
1824
|
+
var codeInterpreterArgsSchema = lazySchema9(
|
|
1825
|
+
() => zodSchema9(
|
|
1826
|
+
z10.object({
|
|
1827
|
+
container: z10.union([
|
|
1828
|
+
z10.string(),
|
|
1829
|
+
z10.object({
|
|
1830
|
+
fileIds: z10.array(z10.string()).optional()
|
|
1801
1831
|
})
|
|
1802
1832
|
]).optional()
|
|
1803
1833
|
})
|
|
1804
1834
|
)
|
|
1805
1835
|
);
|
|
1806
|
-
var codeInterpreterToolFactory =
|
|
1836
|
+
var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema2({
|
|
1807
1837
|
id: "openai.code_interpreter",
|
|
1808
1838
|
inputSchema: codeInterpreterInputSchema,
|
|
1809
1839
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -1814,88 +1844,88 @@ var codeInterpreter = (args = {}) => {
|
|
|
1814
1844
|
|
|
1815
1845
|
// src/tool/file-search.ts
|
|
1816
1846
|
import {
|
|
1817
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1818
|
-
lazySchema as
|
|
1819
|
-
zodSchema as
|
|
1847
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1848
|
+
lazySchema as lazySchema10,
|
|
1849
|
+
zodSchema as zodSchema10
|
|
1820
1850
|
} from "@ai-sdk/provider-utils";
|
|
1821
|
-
import { z as
|
|
1822
|
-
var comparisonFilterSchema =
|
|
1823
|
-
key:
|
|
1824
|
-
type:
|
|
1825
|
-
value:
|
|
1851
|
+
import { z as z11 } from "zod/v4";
|
|
1852
|
+
var comparisonFilterSchema = z11.object({
|
|
1853
|
+
key: z11.string(),
|
|
1854
|
+
type: z11.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
1855
|
+
value: z11.union([z11.string(), z11.number(), z11.boolean()])
|
|
1826
1856
|
});
|
|
1827
|
-
var compoundFilterSchema =
|
|
1828
|
-
type:
|
|
1829
|
-
filters:
|
|
1830
|
-
|
|
1857
|
+
var compoundFilterSchema = z11.object({
|
|
1858
|
+
type: z11.enum(["and", "or"]),
|
|
1859
|
+
filters: z11.array(
|
|
1860
|
+
z11.union([comparisonFilterSchema, z11.lazy(() => compoundFilterSchema)])
|
|
1831
1861
|
)
|
|
1832
1862
|
});
|
|
1833
|
-
var fileSearchArgsSchema =
|
|
1834
|
-
() =>
|
|
1835
|
-
|
|
1836
|
-
vectorStoreIds:
|
|
1837
|
-
maxNumResults:
|
|
1838
|
-
ranking:
|
|
1839
|
-
ranker:
|
|
1840
|
-
scoreThreshold:
|
|
1863
|
+
var fileSearchArgsSchema = lazySchema10(
|
|
1864
|
+
() => zodSchema10(
|
|
1865
|
+
z11.object({
|
|
1866
|
+
vectorStoreIds: z11.array(z11.string()),
|
|
1867
|
+
maxNumResults: z11.number().optional(),
|
|
1868
|
+
ranking: z11.object({
|
|
1869
|
+
ranker: z11.string().optional(),
|
|
1870
|
+
scoreThreshold: z11.number().optional()
|
|
1841
1871
|
}).optional(),
|
|
1842
|
-
filters:
|
|
1872
|
+
filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1843
1873
|
})
|
|
1844
1874
|
)
|
|
1845
1875
|
);
|
|
1846
|
-
var fileSearchOutputSchema =
|
|
1847
|
-
() =>
|
|
1848
|
-
|
|
1849
|
-
queries:
|
|
1850
|
-
results:
|
|
1851
|
-
|
|
1852
|
-
attributes:
|
|
1853
|
-
fileId:
|
|
1854
|
-
filename:
|
|
1855
|
-
score:
|
|
1856
|
-
text:
|
|
1876
|
+
var fileSearchOutputSchema = lazySchema10(
|
|
1877
|
+
() => zodSchema10(
|
|
1878
|
+
z11.object({
|
|
1879
|
+
queries: z11.array(z11.string()),
|
|
1880
|
+
results: z11.array(
|
|
1881
|
+
z11.object({
|
|
1882
|
+
attributes: z11.record(z11.string(), z11.unknown()),
|
|
1883
|
+
fileId: z11.string(),
|
|
1884
|
+
filename: z11.string(),
|
|
1885
|
+
score: z11.number(),
|
|
1886
|
+
text: z11.string()
|
|
1857
1887
|
})
|
|
1858
1888
|
).nullable()
|
|
1859
1889
|
})
|
|
1860
1890
|
)
|
|
1861
1891
|
);
|
|
1862
|
-
var fileSearch =
|
|
1892
|
+
var fileSearch = createProviderToolFactoryWithOutputSchema3({
|
|
1863
1893
|
id: "openai.file_search",
|
|
1864
|
-
inputSchema:
|
|
1894
|
+
inputSchema: z11.object({}),
|
|
1865
1895
|
outputSchema: fileSearchOutputSchema
|
|
1866
1896
|
});
|
|
1867
1897
|
|
|
1868
1898
|
// src/tool/image-generation.ts
|
|
1869
1899
|
import {
|
|
1870
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1871
|
-
lazySchema as
|
|
1872
|
-
zodSchema as
|
|
1900
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1901
|
+
lazySchema as lazySchema11,
|
|
1902
|
+
zodSchema as zodSchema11
|
|
1873
1903
|
} from "@ai-sdk/provider-utils";
|
|
1874
|
-
import { z as
|
|
1875
|
-
var imageGenerationArgsSchema =
|
|
1876
|
-
() =>
|
|
1877
|
-
|
|
1878
|
-
background:
|
|
1879
|
-
inputFidelity:
|
|
1880
|
-
inputImageMask:
|
|
1881
|
-
fileId:
|
|
1882
|
-
imageUrl:
|
|
1904
|
+
import { z as z12 } from "zod/v4";
|
|
1905
|
+
var imageGenerationArgsSchema = lazySchema11(
|
|
1906
|
+
() => zodSchema11(
|
|
1907
|
+
z12.object({
|
|
1908
|
+
background: z12.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1909
|
+
inputFidelity: z12.enum(["low", "high"]).optional(),
|
|
1910
|
+
inputImageMask: z12.object({
|
|
1911
|
+
fileId: z12.string().optional(),
|
|
1912
|
+
imageUrl: z12.string().optional()
|
|
1883
1913
|
}).optional(),
|
|
1884
|
-
model:
|
|
1885
|
-
moderation:
|
|
1886
|
-
outputCompression:
|
|
1887
|
-
outputFormat:
|
|
1888
|
-
partialImages:
|
|
1889
|
-
quality:
|
|
1890
|
-
size:
|
|
1914
|
+
model: z12.string().optional(),
|
|
1915
|
+
moderation: z12.enum(["auto"]).optional(),
|
|
1916
|
+
outputCompression: z12.number().int().min(0).max(100).optional(),
|
|
1917
|
+
outputFormat: z12.enum(["png", "jpeg", "webp"]).optional(),
|
|
1918
|
+
partialImages: z12.number().int().min(0).max(3).optional(),
|
|
1919
|
+
quality: z12.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1920
|
+
size: z12.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1891
1921
|
}).strict()
|
|
1892
1922
|
)
|
|
1893
1923
|
);
|
|
1894
|
-
var imageGenerationInputSchema =
|
|
1895
|
-
var imageGenerationOutputSchema =
|
|
1896
|
-
() =>
|
|
1924
|
+
var imageGenerationInputSchema = lazySchema11(() => zodSchema11(z12.object({})));
|
|
1925
|
+
var imageGenerationOutputSchema = lazySchema11(
|
|
1926
|
+
() => zodSchema11(z12.object({ result: z12.string() }))
|
|
1897
1927
|
);
|
|
1898
|
-
var imageGenerationToolFactory =
|
|
1928
|
+
var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
|
|
1899
1929
|
id: "openai.image_generation",
|
|
1900
1930
|
inputSchema: imageGenerationInputSchema,
|
|
1901
1931
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -1905,103 +1935,47 @@ var imageGeneration = (args = {}) => {
|
|
|
1905
1935
|
};
|
|
1906
1936
|
|
|
1907
1937
|
// src/tool/local-shell.ts
|
|
1908
|
-
import {
|
|
1909
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1910
|
-
lazySchema as lazySchema11,
|
|
1911
|
-
zodSchema as zodSchema11
|
|
1912
|
-
} from "@ai-sdk/provider-utils";
|
|
1913
|
-
import { z as z12 } from "zod/v4";
|
|
1914
|
-
var localShellInputSchema = lazySchema11(
|
|
1915
|
-
() => zodSchema11(
|
|
1916
|
-
z12.object({
|
|
1917
|
-
action: z12.object({
|
|
1918
|
-
type: z12.literal("exec"),
|
|
1919
|
-
command: z12.array(z12.string()),
|
|
1920
|
-
timeoutMs: z12.number().optional(),
|
|
1921
|
-
user: z12.string().optional(),
|
|
1922
|
-
workingDirectory: z12.string().optional(),
|
|
1923
|
-
env: z12.record(z12.string(), z12.string()).optional()
|
|
1924
|
-
})
|
|
1925
|
-
})
|
|
1926
|
-
)
|
|
1927
|
-
);
|
|
1928
|
-
var localShellOutputSchema = lazySchema11(
|
|
1929
|
-
() => zodSchema11(z12.object({ output: z12.string() }))
|
|
1930
|
-
);
|
|
1931
|
-
var localShell = createProviderToolFactoryWithOutputSchema4({
|
|
1932
|
-
id: "openai.local_shell",
|
|
1933
|
-
inputSchema: localShellInputSchema,
|
|
1934
|
-
outputSchema: localShellOutputSchema
|
|
1935
|
-
});
|
|
1936
|
-
|
|
1937
|
-
// src/tool/web-search.ts
|
|
1938
1938
|
import {
|
|
1939
1939
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1940
1940
|
lazySchema as lazySchema12,
|
|
1941
1941
|
zodSchema as zodSchema12
|
|
1942
1942
|
} from "@ai-sdk/provider-utils";
|
|
1943
1943
|
import { z as z13 } from "zod/v4";
|
|
1944
|
-
var
|
|
1944
|
+
var localShellInputSchema = lazySchema12(
|
|
1945
1945
|
() => zodSchema12(
|
|
1946
1946
|
z13.object({
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
timezone: z13.string().optional()
|
|
1956
|
-
}).optional()
|
|
1947
|
+
action: z13.object({
|
|
1948
|
+
type: z13.literal("exec"),
|
|
1949
|
+
command: z13.array(z13.string()),
|
|
1950
|
+
timeoutMs: z13.number().optional(),
|
|
1951
|
+
user: z13.string().optional(),
|
|
1952
|
+
workingDirectory: z13.string().optional(),
|
|
1953
|
+
env: z13.record(z13.string(), z13.string()).optional()
|
|
1954
|
+
})
|
|
1957
1955
|
})
|
|
1958
1956
|
)
|
|
1959
1957
|
);
|
|
1960
|
-
var
|
|
1961
|
-
|
|
1962
|
-
() => zodSchema12(
|
|
1963
|
-
z13.object({
|
|
1964
|
-
action: z13.discriminatedUnion("type", [
|
|
1965
|
-
z13.object({
|
|
1966
|
-
type: z13.literal("search"),
|
|
1967
|
-
query: z13.string().optional()
|
|
1968
|
-
}),
|
|
1969
|
-
z13.object({
|
|
1970
|
-
type: z13.literal("openPage"),
|
|
1971
|
-
url: z13.string()
|
|
1972
|
-
}),
|
|
1973
|
-
z13.object({
|
|
1974
|
-
type: z13.literal("find"),
|
|
1975
|
-
url: z13.string(),
|
|
1976
|
-
pattern: z13.string()
|
|
1977
|
-
})
|
|
1978
|
-
]),
|
|
1979
|
-
sources: z13.array(
|
|
1980
|
-
z13.discriminatedUnion("type", [
|
|
1981
|
-
z13.object({ type: z13.literal("url"), url: z13.string() }),
|
|
1982
|
-
z13.object({ type: z13.literal("api"), name: z13.string() })
|
|
1983
|
-
])
|
|
1984
|
-
).optional()
|
|
1985
|
-
})
|
|
1986
|
-
)
|
|
1958
|
+
var localShellOutputSchema = lazySchema12(
|
|
1959
|
+
() => zodSchema12(z13.object({ output: z13.string() }))
|
|
1987
1960
|
);
|
|
1988
|
-
var
|
|
1989
|
-
id: "openai.
|
|
1990
|
-
inputSchema:
|
|
1991
|
-
outputSchema:
|
|
1961
|
+
var localShell = createProviderToolFactoryWithOutputSchema5({
|
|
1962
|
+
id: "openai.local_shell",
|
|
1963
|
+
inputSchema: localShellInputSchema,
|
|
1964
|
+
outputSchema: localShellOutputSchema
|
|
1992
1965
|
});
|
|
1993
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
1994
1966
|
|
|
1995
|
-
// src/tool/web-search
|
|
1967
|
+
// src/tool/web-search.ts
|
|
1996
1968
|
import {
|
|
1997
1969
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1998
1970
|
lazySchema as lazySchema13,
|
|
1999
1971
|
zodSchema as zodSchema13
|
|
2000
1972
|
} from "@ai-sdk/provider-utils";
|
|
2001
1973
|
import { z as z14 } from "zod/v4";
|
|
2002
|
-
var
|
|
1974
|
+
var webSearchArgsSchema = lazySchema13(
|
|
2003
1975
|
() => zodSchema13(
|
|
2004
1976
|
z14.object({
|
|
1977
|
+
externalWebAccess: z14.boolean().optional(),
|
|
1978
|
+
filters: z14.object({ allowedDomains: z14.array(z14.string()).optional() }).optional(),
|
|
2005
1979
|
searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
|
|
2006
1980
|
userLocation: z14.object({
|
|
2007
1981
|
type: z14.literal("approximate"),
|
|
@@ -2013,10 +1987,8 @@ var webSearchPreviewArgsSchema = lazySchema13(
|
|
|
2013
1987
|
})
|
|
2014
1988
|
)
|
|
2015
1989
|
);
|
|
2016
|
-
var
|
|
2017
|
-
|
|
2018
|
-
);
|
|
2019
|
-
var webSearchPreviewOutputSchema = lazySchema13(
|
|
1990
|
+
var webSearchInputSchema = lazySchema13(() => zodSchema13(z14.object({})));
|
|
1991
|
+
var webSearchOutputSchema = lazySchema13(
|
|
2020
1992
|
() => zodSchema13(
|
|
2021
1993
|
z14.object({
|
|
2022
1994
|
action: z14.discriminatedUnion("type", [
|
|
@@ -2033,47 +2005,105 @@ var webSearchPreviewOutputSchema = lazySchema13(
|
|
|
2033
2005
|
url: z14.string(),
|
|
2034
2006
|
pattern: z14.string()
|
|
2035
2007
|
})
|
|
2036
|
-
])
|
|
2008
|
+
]),
|
|
2009
|
+
sources: z14.array(
|
|
2010
|
+
z14.discriminatedUnion("type", [
|
|
2011
|
+
z14.object({ type: z14.literal("url"), url: z14.string() }),
|
|
2012
|
+
z14.object({ type: z14.literal("api"), name: z14.string() })
|
|
2013
|
+
])
|
|
2014
|
+
).optional()
|
|
2037
2015
|
})
|
|
2038
2016
|
)
|
|
2039
2017
|
);
|
|
2040
|
-
var
|
|
2041
|
-
id: "openai.
|
|
2042
|
-
inputSchema:
|
|
2043
|
-
outputSchema:
|
|
2018
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
|
|
2019
|
+
id: "openai.web_search",
|
|
2020
|
+
inputSchema: webSearchInputSchema,
|
|
2021
|
+
outputSchema: webSearchOutputSchema
|
|
2044
2022
|
});
|
|
2023
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2045
2024
|
|
|
2046
|
-
// src/tool/
|
|
2025
|
+
// src/tool/web-search-preview.ts
|
|
2047
2026
|
import {
|
|
2048
2027
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
2049
2028
|
lazySchema as lazySchema14,
|
|
2050
2029
|
zodSchema as zodSchema14
|
|
2051
2030
|
} from "@ai-sdk/provider-utils";
|
|
2052
2031
|
import { z as z15 } from "zod/v4";
|
|
2053
|
-
var
|
|
2054
|
-
() =>
|
|
2055
|
-
z15.
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2032
|
+
var webSearchPreviewArgsSchema = lazySchema14(
|
|
2033
|
+
() => zodSchema14(
|
|
2034
|
+
z15.object({
|
|
2035
|
+
searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
|
|
2036
|
+
userLocation: z15.object({
|
|
2037
|
+
type: z15.literal("approximate"),
|
|
2038
|
+
country: z15.string().optional(),
|
|
2039
|
+
city: z15.string().optional(),
|
|
2040
|
+
region: z15.string().optional(),
|
|
2041
|
+
timezone: z15.string().optional()
|
|
2042
|
+
}).optional()
|
|
2043
|
+
})
|
|
2044
|
+
)
|
|
2045
|
+
);
|
|
2046
|
+
var webSearchPreviewInputSchema = lazySchema14(
|
|
2047
|
+
() => zodSchema14(z15.object({}))
|
|
2062
2048
|
);
|
|
2063
|
-
var
|
|
2049
|
+
var webSearchPreviewOutputSchema = lazySchema14(
|
|
2064
2050
|
() => zodSchema14(
|
|
2065
2051
|
z15.object({
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2052
|
+
action: z15.discriminatedUnion("type", [
|
|
2053
|
+
z15.object({
|
|
2054
|
+
type: z15.literal("search"),
|
|
2055
|
+
query: z15.string().optional()
|
|
2056
|
+
}),
|
|
2069
2057
|
z15.object({
|
|
2070
|
-
|
|
2071
|
-
|
|
2058
|
+
type: z15.literal("openPage"),
|
|
2059
|
+
url: z15.string()
|
|
2060
|
+
}),
|
|
2061
|
+
z15.object({
|
|
2062
|
+
type: z15.literal("find"),
|
|
2063
|
+
url: z15.string(),
|
|
2064
|
+
pattern: z15.string()
|
|
2065
|
+
})
|
|
2066
|
+
])
|
|
2067
|
+
})
|
|
2068
|
+
)
|
|
2069
|
+
);
|
|
2070
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema7({
|
|
2071
|
+
id: "openai.web_search_preview",
|
|
2072
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
2073
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
// src/tool/mcp.ts
|
|
2077
|
+
import {
|
|
2078
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2079
|
+
lazySchema as lazySchema15,
|
|
2080
|
+
zodSchema as zodSchema15
|
|
2081
|
+
} from "@ai-sdk/provider-utils";
|
|
2082
|
+
import { z as z16 } from "zod/v4";
|
|
2083
|
+
var jsonValueSchema = z16.lazy(
|
|
2084
|
+
() => z16.union([
|
|
2085
|
+
z16.string(),
|
|
2086
|
+
z16.number(),
|
|
2087
|
+
z16.boolean(),
|
|
2088
|
+
z16.null(),
|
|
2089
|
+
z16.array(jsonValueSchema),
|
|
2090
|
+
z16.record(z16.string(), jsonValueSchema)
|
|
2091
|
+
])
|
|
2092
|
+
);
|
|
2093
|
+
var mcpArgsSchema = lazySchema15(
|
|
2094
|
+
() => zodSchema15(
|
|
2095
|
+
z16.object({
|
|
2096
|
+
serverLabel: z16.string(),
|
|
2097
|
+
allowedTools: z16.union([
|
|
2098
|
+
z16.array(z16.string()),
|
|
2099
|
+
z16.object({
|
|
2100
|
+
readOnly: z16.boolean().optional(),
|
|
2101
|
+
toolNames: z16.array(z16.string()).optional()
|
|
2072
2102
|
})
|
|
2073
2103
|
]).optional(),
|
|
2074
|
-
authorization:
|
|
2075
|
-
connectorId:
|
|
2076
|
-
headers:
|
|
2104
|
+
authorization: z16.string().optional(),
|
|
2105
|
+
connectorId: z16.string().optional(),
|
|
2106
|
+
headers: z16.record(z16.string(), z16.string()).optional(),
|
|
2077
2107
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
2078
2108
|
// requireApproval: z
|
|
2079
2109
|
// .union([
|
|
@@ -2084,50 +2114,50 @@ var mcpArgsSchema = lazySchema14(
|
|
|
2084
2114
|
// }),
|
|
2085
2115
|
// ])
|
|
2086
2116
|
// .optional(),
|
|
2087
|
-
serverDescription:
|
|
2088
|
-
serverUrl:
|
|
2117
|
+
serverDescription: z16.string().optional(),
|
|
2118
|
+
serverUrl: z16.string().optional()
|
|
2089
2119
|
}).refine(
|
|
2090
2120
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2091
2121
|
"One of serverUrl or connectorId must be provided."
|
|
2092
2122
|
)
|
|
2093
2123
|
)
|
|
2094
2124
|
);
|
|
2095
|
-
var mcpInputSchema =
|
|
2096
|
-
var mcpOutputSchema =
|
|
2097
|
-
() =>
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
type:
|
|
2101
|
-
serverLabel:
|
|
2102
|
-
name:
|
|
2103
|
-
arguments:
|
|
2104
|
-
output:
|
|
2105
|
-
error:
|
|
2125
|
+
var mcpInputSchema = lazySchema15(() => zodSchema15(z16.object({})));
|
|
2126
|
+
var mcpOutputSchema = lazySchema15(
|
|
2127
|
+
() => zodSchema15(
|
|
2128
|
+
z16.discriminatedUnion("type", [
|
|
2129
|
+
z16.object({
|
|
2130
|
+
type: z16.literal("call"),
|
|
2131
|
+
serverLabel: z16.string(),
|
|
2132
|
+
name: z16.string(),
|
|
2133
|
+
arguments: z16.string(),
|
|
2134
|
+
output: z16.string().nullable().optional(),
|
|
2135
|
+
error: z16.union([z16.string(), jsonValueSchema]).optional()
|
|
2106
2136
|
}),
|
|
2107
|
-
|
|
2108
|
-
type:
|
|
2109
|
-
serverLabel:
|
|
2110
|
-
tools:
|
|
2111
|
-
|
|
2112
|
-
name:
|
|
2113
|
-
description:
|
|
2137
|
+
z16.object({
|
|
2138
|
+
type: z16.literal("listTools"),
|
|
2139
|
+
serverLabel: z16.string(),
|
|
2140
|
+
tools: z16.array(
|
|
2141
|
+
z16.object({
|
|
2142
|
+
name: z16.string(),
|
|
2143
|
+
description: z16.string().optional(),
|
|
2114
2144
|
inputSchema: jsonValueSchema,
|
|
2115
|
-
annotations:
|
|
2145
|
+
annotations: z16.record(z16.string(), jsonValueSchema).optional()
|
|
2116
2146
|
})
|
|
2117
2147
|
),
|
|
2118
|
-
error:
|
|
2148
|
+
error: z16.union([z16.string(), jsonValueSchema]).optional()
|
|
2119
2149
|
}),
|
|
2120
|
-
|
|
2121
|
-
type:
|
|
2122
|
-
serverLabel:
|
|
2123
|
-
name:
|
|
2124
|
-
arguments:
|
|
2125
|
-
approvalRequestId:
|
|
2150
|
+
z16.object({
|
|
2151
|
+
type: z16.literal("approvalRequest"),
|
|
2152
|
+
serverLabel: z16.string(),
|
|
2153
|
+
name: z16.string(),
|
|
2154
|
+
arguments: z16.string(),
|
|
2155
|
+
approvalRequestId: z16.string()
|
|
2126
2156
|
})
|
|
2127
2157
|
])
|
|
2128
2158
|
)
|
|
2129
2159
|
);
|
|
2130
|
-
var mcpToolFactory =
|
|
2160
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
2131
2161
|
id: "openai.mcp",
|
|
2132
2162
|
inputSchema: mcpInputSchema,
|
|
2133
2163
|
outputSchema: mcpOutputSchema
|
|
@@ -2136,6 +2166,14 @@ var mcp = (args) => mcpToolFactory(args);
|
|
|
2136
2166
|
|
|
2137
2167
|
// src/openai-tools.ts
|
|
2138
2168
|
var openaiTools = {
|
|
2169
|
+
/**
|
|
2170
|
+
* The apply_patch tool lets GPT-5.1 create, update, and delete files in your
|
|
2171
|
+
* codebase using structured diffs. Instead of just suggesting edits, the model
|
|
2172
|
+
* emits patch operations that your application applies and then reports back on,
|
|
2173
|
+
* enabling iterative, multi-step code editing workflows.
|
|
2174
|
+
*
|
|
2175
|
+
*/
|
|
2176
|
+
applyPatch,
|
|
2139
2177
|
/**
|
|
2140
2178
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
2141
2179
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -2236,7 +2274,7 @@ import {
|
|
|
2236
2274
|
parseProviderOptions as parseProviderOptions4,
|
|
2237
2275
|
validateTypes
|
|
2238
2276
|
} from "@ai-sdk/provider-utils";
|
|
2239
|
-
import { z as
|
|
2277
|
+
import { z as z17 } from "zod/v4";
|
|
2240
2278
|
function isFileId(data, prefixes) {
|
|
2241
2279
|
if (!prefixes) return false;
|
|
2242
2280
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2247,7 +2285,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2247
2285
|
systemMessageMode,
|
|
2248
2286
|
fileIdPrefixes,
|
|
2249
2287
|
store,
|
|
2250
|
-
hasLocalShellTool = false
|
|
2288
|
+
hasLocalShellTool = false,
|
|
2289
|
+
hasApplyPatchTool = false
|
|
2251
2290
|
}) {
|
|
2252
2291
|
var _a, _b, _c, _d, _e;
|
|
2253
2292
|
const input = [];
|
|
@@ -2470,6 +2509,19 @@ async function convertToOpenAIResponsesInput({
|
|
|
2470
2509
|
});
|
|
2471
2510
|
break;
|
|
2472
2511
|
}
|
|
2512
|
+
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2513
|
+
const parsedOutput = await validateTypes({
|
|
2514
|
+
value: output.value,
|
|
2515
|
+
schema: applyPatchOutputSchema
|
|
2516
|
+
});
|
|
2517
|
+
input.push({
|
|
2518
|
+
type: "apply_patch_call_output",
|
|
2519
|
+
call_id: part.toolCallId,
|
|
2520
|
+
status: parsedOutput.status,
|
|
2521
|
+
output: parsedOutput.output
|
|
2522
|
+
});
|
|
2523
|
+
break;
|
|
2524
|
+
}
|
|
2473
2525
|
let contentValue;
|
|
2474
2526
|
switch (output.type) {
|
|
2475
2527
|
case "text":
|
|
@@ -2530,9 +2582,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2530
2582
|
}
|
|
2531
2583
|
return { input, warnings };
|
|
2532
2584
|
}
|
|
2533
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2534
|
-
itemId:
|
|
2535
|
-
reasoningEncryptedContent:
|
|
2585
|
+
var openaiResponsesReasoningProviderOptionsSchema = z17.object({
|
|
2586
|
+
itemId: z17.string().nullish(),
|
|
2587
|
+
reasoningEncryptedContent: z17.string().nullish()
|
|
2536
2588
|
});
|
|
2537
2589
|
|
|
2538
2590
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2554,349 +2606,393 @@ function mapOpenAIResponseFinishReason({
|
|
|
2554
2606
|
}
|
|
2555
2607
|
|
|
2556
2608
|
// src/responses/openai-responses-api.ts
|
|
2557
|
-
import { lazySchema as
|
|
2558
|
-
import { z as
|
|
2559
|
-
var openaiResponsesChunkSchema =
|
|
2560
|
-
() =>
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
type:
|
|
2564
|
-
item_id:
|
|
2565
|
-
delta:
|
|
2566
|
-
logprobs:
|
|
2567
|
-
|
|
2568
|
-
token:
|
|
2569
|
-
logprob:
|
|
2570
|
-
top_logprobs:
|
|
2571
|
-
|
|
2572
|
-
token:
|
|
2573
|
-
logprob:
|
|
2609
|
+
import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
|
|
2610
|
+
import { z as z18 } from "zod/v4";
|
|
2611
|
+
var openaiResponsesChunkSchema = lazySchema16(
|
|
2612
|
+
() => zodSchema16(
|
|
2613
|
+
z18.union([
|
|
2614
|
+
z18.object({
|
|
2615
|
+
type: z18.literal("response.output_text.delta"),
|
|
2616
|
+
item_id: z18.string(),
|
|
2617
|
+
delta: z18.string(),
|
|
2618
|
+
logprobs: z18.array(
|
|
2619
|
+
z18.object({
|
|
2620
|
+
token: z18.string(),
|
|
2621
|
+
logprob: z18.number(),
|
|
2622
|
+
top_logprobs: z18.array(
|
|
2623
|
+
z18.object({
|
|
2624
|
+
token: z18.string(),
|
|
2625
|
+
logprob: z18.number()
|
|
2574
2626
|
})
|
|
2575
2627
|
)
|
|
2576
2628
|
})
|
|
2577
2629
|
).nullish()
|
|
2578
2630
|
}),
|
|
2579
|
-
|
|
2580
|
-
type:
|
|
2581
|
-
response:
|
|
2582
|
-
incomplete_details:
|
|
2583
|
-
usage:
|
|
2584
|
-
input_tokens:
|
|
2585
|
-
input_tokens_details:
|
|
2586
|
-
output_tokens:
|
|
2587
|
-
output_tokens_details:
|
|
2631
|
+
z18.object({
|
|
2632
|
+
type: z18.enum(["response.completed", "response.incomplete"]),
|
|
2633
|
+
response: z18.object({
|
|
2634
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
2635
|
+
usage: z18.object({
|
|
2636
|
+
input_tokens: z18.number(),
|
|
2637
|
+
input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
|
|
2638
|
+
output_tokens: z18.number(),
|
|
2639
|
+
output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
|
|
2588
2640
|
}),
|
|
2589
|
-
service_tier:
|
|
2641
|
+
service_tier: z18.string().nullish()
|
|
2590
2642
|
})
|
|
2591
2643
|
}),
|
|
2592
|
-
|
|
2593
|
-
type:
|
|
2594
|
-
response:
|
|
2595
|
-
id:
|
|
2596
|
-
created_at:
|
|
2597
|
-
model:
|
|
2598
|
-
service_tier:
|
|
2644
|
+
z18.object({
|
|
2645
|
+
type: z18.literal("response.created"),
|
|
2646
|
+
response: z18.object({
|
|
2647
|
+
id: z18.string(),
|
|
2648
|
+
created_at: z18.number(),
|
|
2649
|
+
model: z18.string(),
|
|
2650
|
+
service_tier: z18.string().nullish()
|
|
2599
2651
|
})
|
|
2600
2652
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
output_index:
|
|
2604
|
-
item:
|
|
2605
|
-
|
|
2606
|
-
type:
|
|
2607
|
-
id:
|
|
2653
|
+
z18.object({
|
|
2654
|
+
type: z18.literal("response.output_item.added"),
|
|
2655
|
+
output_index: z18.number(),
|
|
2656
|
+
item: z18.discriminatedUnion("type", [
|
|
2657
|
+
z18.object({
|
|
2658
|
+
type: z18.literal("message"),
|
|
2659
|
+
id: z18.string()
|
|
2608
2660
|
}),
|
|
2609
|
-
|
|
2610
|
-
type:
|
|
2611
|
-
id:
|
|
2612
|
-
encrypted_content:
|
|
2661
|
+
z18.object({
|
|
2662
|
+
type: z18.literal("reasoning"),
|
|
2663
|
+
id: z18.string(),
|
|
2664
|
+
encrypted_content: z18.string().nullish()
|
|
2613
2665
|
}),
|
|
2614
|
-
|
|
2615
|
-
type:
|
|
2616
|
-
id:
|
|
2617
|
-
call_id:
|
|
2618
|
-
name:
|
|
2619
|
-
arguments:
|
|
2666
|
+
z18.object({
|
|
2667
|
+
type: z18.literal("function_call"),
|
|
2668
|
+
id: z18.string(),
|
|
2669
|
+
call_id: z18.string(),
|
|
2670
|
+
name: z18.string(),
|
|
2671
|
+
arguments: z18.string()
|
|
2620
2672
|
}),
|
|
2621
|
-
|
|
2622
|
-
type:
|
|
2623
|
-
id:
|
|
2624
|
-
status:
|
|
2673
|
+
z18.object({
|
|
2674
|
+
type: z18.literal("web_search_call"),
|
|
2675
|
+
id: z18.string(),
|
|
2676
|
+
status: z18.string()
|
|
2625
2677
|
}),
|
|
2626
|
-
|
|
2627
|
-
type:
|
|
2628
|
-
id:
|
|
2629
|
-
status:
|
|
2678
|
+
z18.object({
|
|
2679
|
+
type: z18.literal("computer_call"),
|
|
2680
|
+
id: z18.string(),
|
|
2681
|
+
status: z18.string()
|
|
2630
2682
|
}),
|
|
2631
|
-
|
|
2632
|
-
type:
|
|
2633
|
-
id:
|
|
2683
|
+
z18.object({
|
|
2684
|
+
type: z18.literal("file_search_call"),
|
|
2685
|
+
id: z18.string()
|
|
2634
2686
|
}),
|
|
2635
|
-
|
|
2636
|
-
type:
|
|
2637
|
-
id:
|
|
2687
|
+
z18.object({
|
|
2688
|
+
type: z18.literal("image_generation_call"),
|
|
2689
|
+
id: z18.string()
|
|
2638
2690
|
}),
|
|
2639
|
-
|
|
2640
|
-
type:
|
|
2641
|
-
id:
|
|
2642
|
-
container_id:
|
|
2643
|
-
code:
|
|
2644
|
-
outputs:
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2691
|
+
z18.object({
|
|
2692
|
+
type: z18.literal("code_interpreter_call"),
|
|
2693
|
+
id: z18.string(),
|
|
2694
|
+
container_id: z18.string(),
|
|
2695
|
+
code: z18.string().nullable(),
|
|
2696
|
+
outputs: z18.array(
|
|
2697
|
+
z18.discriminatedUnion("type", [
|
|
2698
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
2699
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
2648
2700
|
])
|
|
2649
2701
|
).nullable(),
|
|
2650
|
-
status:
|
|
2702
|
+
status: z18.string()
|
|
2703
|
+
}),
|
|
2704
|
+
z18.object({
|
|
2705
|
+
type: z18.literal("mcp_call"),
|
|
2706
|
+
id: z18.string(),
|
|
2707
|
+
status: z18.string()
|
|
2651
2708
|
}),
|
|
2652
|
-
|
|
2653
|
-
type:
|
|
2654
|
-
id:
|
|
2655
|
-
status: z17.string()
|
|
2709
|
+
z18.object({
|
|
2710
|
+
type: z18.literal("mcp_list_tools"),
|
|
2711
|
+
id: z18.string()
|
|
2656
2712
|
}),
|
|
2657
|
-
|
|
2658
|
-
type:
|
|
2659
|
-
id:
|
|
2713
|
+
z18.object({
|
|
2714
|
+
type: z18.literal("mcp_approval_request"),
|
|
2715
|
+
id: z18.string()
|
|
2660
2716
|
}),
|
|
2661
|
-
|
|
2662
|
-
type:
|
|
2663
|
-
id:
|
|
2717
|
+
z18.object({
|
|
2718
|
+
type: z18.literal("apply_patch_call"),
|
|
2719
|
+
id: z18.string(),
|
|
2720
|
+
call_id: z18.string(),
|
|
2721
|
+
status: z18.enum(["in_progress", "completed"]),
|
|
2722
|
+
operation: z18.discriminatedUnion("type", [
|
|
2723
|
+
z18.object({
|
|
2724
|
+
type: z18.literal("create_file"),
|
|
2725
|
+
path: z18.string(),
|
|
2726
|
+
diff: z18.string()
|
|
2727
|
+
}),
|
|
2728
|
+
z18.object({
|
|
2729
|
+
type: z18.literal("delete_file"),
|
|
2730
|
+
path: z18.string()
|
|
2731
|
+
}),
|
|
2732
|
+
z18.object({
|
|
2733
|
+
type: z18.literal("update_file"),
|
|
2734
|
+
path: z18.string(),
|
|
2735
|
+
diff: z18.string()
|
|
2736
|
+
})
|
|
2737
|
+
])
|
|
2664
2738
|
})
|
|
2665
2739
|
])
|
|
2666
2740
|
}),
|
|
2667
|
-
|
|
2668
|
-
type:
|
|
2669
|
-
output_index:
|
|
2670
|
-
item:
|
|
2671
|
-
|
|
2672
|
-
type:
|
|
2673
|
-
id:
|
|
2741
|
+
z18.object({
|
|
2742
|
+
type: z18.literal("response.output_item.done"),
|
|
2743
|
+
output_index: z18.number(),
|
|
2744
|
+
item: z18.discriminatedUnion("type", [
|
|
2745
|
+
z18.object({
|
|
2746
|
+
type: z18.literal("message"),
|
|
2747
|
+
id: z18.string()
|
|
2674
2748
|
}),
|
|
2675
|
-
|
|
2676
|
-
type:
|
|
2677
|
-
id:
|
|
2678
|
-
encrypted_content:
|
|
2749
|
+
z18.object({
|
|
2750
|
+
type: z18.literal("reasoning"),
|
|
2751
|
+
id: z18.string(),
|
|
2752
|
+
encrypted_content: z18.string().nullish()
|
|
2679
2753
|
}),
|
|
2680
|
-
|
|
2681
|
-
type:
|
|
2682
|
-
id:
|
|
2683
|
-
call_id:
|
|
2684
|
-
name:
|
|
2685
|
-
arguments:
|
|
2686
|
-
status:
|
|
2754
|
+
z18.object({
|
|
2755
|
+
type: z18.literal("function_call"),
|
|
2756
|
+
id: z18.string(),
|
|
2757
|
+
call_id: z18.string(),
|
|
2758
|
+
name: z18.string(),
|
|
2759
|
+
arguments: z18.string(),
|
|
2760
|
+
status: z18.literal("completed")
|
|
2687
2761
|
}),
|
|
2688
|
-
|
|
2689
|
-
type:
|
|
2690
|
-
id:
|
|
2691
|
-
code:
|
|
2692
|
-
container_id:
|
|
2693
|
-
outputs:
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2762
|
+
z18.object({
|
|
2763
|
+
type: z18.literal("code_interpreter_call"),
|
|
2764
|
+
id: z18.string(),
|
|
2765
|
+
code: z18.string().nullable(),
|
|
2766
|
+
container_id: z18.string(),
|
|
2767
|
+
outputs: z18.array(
|
|
2768
|
+
z18.discriminatedUnion("type", [
|
|
2769
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
2770
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
2697
2771
|
])
|
|
2698
2772
|
).nullable()
|
|
2699
2773
|
}),
|
|
2700
|
-
|
|
2701
|
-
type:
|
|
2702
|
-
id:
|
|
2703
|
-
result:
|
|
2774
|
+
z18.object({
|
|
2775
|
+
type: z18.literal("image_generation_call"),
|
|
2776
|
+
id: z18.string(),
|
|
2777
|
+
result: z18.string()
|
|
2704
2778
|
}),
|
|
2705
|
-
|
|
2706
|
-
type:
|
|
2707
|
-
id:
|
|
2708
|
-
status:
|
|
2709
|
-
action:
|
|
2710
|
-
|
|
2711
|
-
type:
|
|
2712
|
-
query:
|
|
2713
|
-
sources:
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2779
|
+
z18.object({
|
|
2780
|
+
type: z18.literal("web_search_call"),
|
|
2781
|
+
id: z18.string(),
|
|
2782
|
+
status: z18.string(),
|
|
2783
|
+
action: z18.discriminatedUnion("type", [
|
|
2784
|
+
z18.object({
|
|
2785
|
+
type: z18.literal("search"),
|
|
2786
|
+
query: z18.string().nullish(),
|
|
2787
|
+
sources: z18.array(
|
|
2788
|
+
z18.discriminatedUnion("type", [
|
|
2789
|
+
z18.object({ type: z18.literal("url"), url: z18.string() }),
|
|
2790
|
+
z18.object({ type: z18.literal("api"), name: z18.string() })
|
|
2717
2791
|
])
|
|
2718
2792
|
).nullish()
|
|
2719
2793
|
}),
|
|
2720
|
-
|
|
2721
|
-
type:
|
|
2722
|
-
url:
|
|
2794
|
+
z18.object({
|
|
2795
|
+
type: z18.literal("open_page"),
|
|
2796
|
+
url: z18.string()
|
|
2723
2797
|
}),
|
|
2724
|
-
|
|
2725
|
-
type:
|
|
2726
|
-
url:
|
|
2727
|
-
pattern:
|
|
2798
|
+
z18.object({
|
|
2799
|
+
type: z18.literal("find"),
|
|
2800
|
+
url: z18.string(),
|
|
2801
|
+
pattern: z18.string()
|
|
2728
2802
|
})
|
|
2729
2803
|
])
|
|
2730
2804
|
}),
|
|
2731
|
-
|
|
2732
|
-
type:
|
|
2733
|
-
id:
|
|
2734
|
-
queries:
|
|
2735
|
-
results:
|
|
2736
|
-
|
|
2737
|
-
attributes:
|
|
2738
|
-
|
|
2739
|
-
|
|
2805
|
+
z18.object({
|
|
2806
|
+
type: z18.literal("file_search_call"),
|
|
2807
|
+
id: z18.string(),
|
|
2808
|
+
queries: z18.array(z18.string()),
|
|
2809
|
+
results: z18.array(
|
|
2810
|
+
z18.object({
|
|
2811
|
+
attributes: z18.record(
|
|
2812
|
+
z18.string(),
|
|
2813
|
+
z18.union([z18.string(), z18.number(), z18.boolean()])
|
|
2740
2814
|
),
|
|
2741
|
-
file_id:
|
|
2742
|
-
filename:
|
|
2743
|
-
score:
|
|
2744
|
-
text:
|
|
2815
|
+
file_id: z18.string(),
|
|
2816
|
+
filename: z18.string(),
|
|
2817
|
+
score: z18.number(),
|
|
2818
|
+
text: z18.string()
|
|
2745
2819
|
})
|
|
2746
2820
|
).nullish()
|
|
2747
2821
|
}),
|
|
2748
|
-
|
|
2749
|
-
type:
|
|
2750
|
-
id:
|
|
2751
|
-
call_id:
|
|
2752
|
-
action:
|
|
2753
|
-
type:
|
|
2754
|
-
command:
|
|
2755
|
-
timeout_ms:
|
|
2756
|
-
user:
|
|
2757
|
-
working_directory:
|
|
2758
|
-
env:
|
|
2822
|
+
z18.object({
|
|
2823
|
+
type: z18.literal("local_shell_call"),
|
|
2824
|
+
id: z18.string(),
|
|
2825
|
+
call_id: z18.string(),
|
|
2826
|
+
action: z18.object({
|
|
2827
|
+
type: z18.literal("exec"),
|
|
2828
|
+
command: z18.array(z18.string()),
|
|
2829
|
+
timeout_ms: z18.number().optional(),
|
|
2830
|
+
user: z18.string().optional(),
|
|
2831
|
+
working_directory: z18.string().optional(),
|
|
2832
|
+
env: z18.record(z18.string(), z18.string()).optional()
|
|
2759
2833
|
})
|
|
2760
2834
|
}),
|
|
2761
|
-
|
|
2762
|
-
type:
|
|
2763
|
-
id:
|
|
2764
|
-
status:
|
|
2835
|
+
z18.object({
|
|
2836
|
+
type: z18.literal("computer_call"),
|
|
2837
|
+
id: z18.string(),
|
|
2838
|
+
status: z18.literal("completed")
|
|
2765
2839
|
}),
|
|
2766
|
-
|
|
2767
|
-
type:
|
|
2768
|
-
id:
|
|
2769
|
-
status:
|
|
2770
|
-
arguments:
|
|
2771
|
-
name:
|
|
2772
|
-
server_label:
|
|
2773
|
-
output:
|
|
2774
|
-
error:
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
code:
|
|
2779
|
-
message:
|
|
2840
|
+
z18.object({
|
|
2841
|
+
type: z18.literal("mcp_call"),
|
|
2842
|
+
id: z18.string(),
|
|
2843
|
+
status: z18.string(),
|
|
2844
|
+
arguments: z18.string(),
|
|
2845
|
+
name: z18.string(),
|
|
2846
|
+
server_label: z18.string(),
|
|
2847
|
+
output: z18.string().nullish(),
|
|
2848
|
+
error: z18.union([
|
|
2849
|
+
z18.string(),
|
|
2850
|
+
z18.object({
|
|
2851
|
+
type: z18.string().optional(),
|
|
2852
|
+
code: z18.union([z18.number(), z18.string()]).optional(),
|
|
2853
|
+
message: z18.string().optional()
|
|
2780
2854
|
}).loose()
|
|
2781
2855
|
]).nullish()
|
|
2782
2856
|
}),
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2785
|
-
id:
|
|
2786
|
-
server_label:
|
|
2787
|
-
tools:
|
|
2788
|
-
|
|
2789
|
-
name:
|
|
2790
|
-
description:
|
|
2791
|
-
input_schema:
|
|
2792
|
-
annotations:
|
|
2857
|
+
z18.object({
|
|
2858
|
+
type: z18.literal("mcp_list_tools"),
|
|
2859
|
+
id: z18.string(),
|
|
2860
|
+
server_label: z18.string(),
|
|
2861
|
+
tools: z18.array(
|
|
2862
|
+
z18.object({
|
|
2863
|
+
name: z18.string(),
|
|
2864
|
+
description: z18.string().optional(),
|
|
2865
|
+
input_schema: z18.any(),
|
|
2866
|
+
annotations: z18.record(z18.string(), z18.unknown()).optional()
|
|
2793
2867
|
})
|
|
2794
2868
|
),
|
|
2795
|
-
error:
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
type:
|
|
2799
|
-
code:
|
|
2800
|
-
message:
|
|
2869
|
+
error: z18.union([
|
|
2870
|
+
z18.string(),
|
|
2871
|
+
z18.object({
|
|
2872
|
+
type: z18.string().optional(),
|
|
2873
|
+
code: z18.union([z18.number(), z18.string()]).optional(),
|
|
2874
|
+
message: z18.string().optional()
|
|
2801
2875
|
}).loose()
|
|
2802
2876
|
]).optional()
|
|
2803
2877
|
}),
|
|
2804
|
-
|
|
2805
|
-
type:
|
|
2806
|
-
id:
|
|
2807
|
-
server_label:
|
|
2808
|
-
name:
|
|
2809
|
-
arguments:
|
|
2810
|
-
approval_request_id:
|
|
2878
|
+
z18.object({
|
|
2879
|
+
type: z18.literal("mcp_approval_request"),
|
|
2880
|
+
id: z18.string(),
|
|
2881
|
+
server_label: z18.string(),
|
|
2882
|
+
name: z18.string(),
|
|
2883
|
+
arguments: z18.string(),
|
|
2884
|
+
approval_request_id: z18.string()
|
|
2885
|
+
}),
|
|
2886
|
+
z18.object({
|
|
2887
|
+
type: z18.literal("apply_patch_call"),
|
|
2888
|
+
id: z18.string(),
|
|
2889
|
+
call_id: z18.string(),
|
|
2890
|
+
status: z18.enum(["in_progress", "completed"]),
|
|
2891
|
+
operation: z18.discriminatedUnion("type", [
|
|
2892
|
+
z18.object({
|
|
2893
|
+
type: z18.literal("create_file"),
|
|
2894
|
+
path: z18.string(),
|
|
2895
|
+
diff: z18.string()
|
|
2896
|
+
}),
|
|
2897
|
+
z18.object({
|
|
2898
|
+
type: z18.literal("delete_file"),
|
|
2899
|
+
path: z18.string()
|
|
2900
|
+
}),
|
|
2901
|
+
z18.object({
|
|
2902
|
+
type: z18.literal("update_file"),
|
|
2903
|
+
path: z18.string(),
|
|
2904
|
+
diff: z18.string()
|
|
2905
|
+
})
|
|
2906
|
+
])
|
|
2811
2907
|
})
|
|
2812
2908
|
])
|
|
2813
2909
|
}),
|
|
2814
|
-
|
|
2815
|
-
type:
|
|
2816
|
-
item_id:
|
|
2817
|
-
output_index:
|
|
2818
|
-
delta:
|
|
2910
|
+
z18.object({
|
|
2911
|
+
type: z18.literal("response.function_call_arguments.delta"),
|
|
2912
|
+
item_id: z18.string(),
|
|
2913
|
+
output_index: z18.number(),
|
|
2914
|
+
delta: z18.string()
|
|
2819
2915
|
}),
|
|
2820
|
-
|
|
2821
|
-
type:
|
|
2822
|
-
item_id:
|
|
2823
|
-
output_index:
|
|
2824
|
-
partial_image_b64:
|
|
2916
|
+
z18.object({
|
|
2917
|
+
type: z18.literal("response.image_generation_call.partial_image"),
|
|
2918
|
+
item_id: z18.string(),
|
|
2919
|
+
output_index: z18.number(),
|
|
2920
|
+
partial_image_b64: z18.string()
|
|
2825
2921
|
}),
|
|
2826
|
-
|
|
2827
|
-
type:
|
|
2828
|
-
item_id:
|
|
2829
|
-
output_index:
|
|
2830
|
-
delta:
|
|
2922
|
+
z18.object({
|
|
2923
|
+
type: z18.literal("response.code_interpreter_call_code.delta"),
|
|
2924
|
+
item_id: z18.string(),
|
|
2925
|
+
output_index: z18.number(),
|
|
2926
|
+
delta: z18.string()
|
|
2831
2927
|
}),
|
|
2832
|
-
|
|
2833
|
-
type:
|
|
2834
|
-
item_id:
|
|
2835
|
-
output_index:
|
|
2836
|
-
code:
|
|
2928
|
+
z18.object({
|
|
2929
|
+
type: z18.literal("response.code_interpreter_call_code.done"),
|
|
2930
|
+
item_id: z18.string(),
|
|
2931
|
+
output_index: z18.number(),
|
|
2932
|
+
code: z18.string()
|
|
2837
2933
|
}),
|
|
2838
|
-
|
|
2839
|
-
type:
|
|
2840
|
-
annotation:
|
|
2841
|
-
|
|
2842
|
-
type:
|
|
2843
|
-
start_index:
|
|
2844
|
-
end_index:
|
|
2845
|
-
url:
|
|
2846
|
-
title:
|
|
2934
|
+
z18.object({
|
|
2935
|
+
type: z18.literal("response.output_text.annotation.added"),
|
|
2936
|
+
annotation: z18.discriminatedUnion("type", [
|
|
2937
|
+
z18.object({
|
|
2938
|
+
type: z18.literal("url_citation"),
|
|
2939
|
+
start_index: z18.number(),
|
|
2940
|
+
end_index: z18.number(),
|
|
2941
|
+
url: z18.string(),
|
|
2942
|
+
title: z18.string()
|
|
2847
2943
|
}),
|
|
2848
|
-
|
|
2849
|
-
type:
|
|
2850
|
-
file_id:
|
|
2851
|
-
filename:
|
|
2852
|
-
index:
|
|
2853
|
-
start_index:
|
|
2854
|
-
end_index:
|
|
2855
|
-
quote:
|
|
2944
|
+
z18.object({
|
|
2945
|
+
type: z18.literal("file_citation"),
|
|
2946
|
+
file_id: z18.string(),
|
|
2947
|
+
filename: z18.string().nullish(),
|
|
2948
|
+
index: z18.number().nullish(),
|
|
2949
|
+
start_index: z18.number().nullish(),
|
|
2950
|
+
end_index: z18.number().nullish(),
|
|
2951
|
+
quote: z18.string().nullish()
|
|
2856
2952
|
}),
|
|
2857
|
-
|
|
2858
|
-
type:
|
|
2859
|
-
container_id:
|
|
2860
|
-
file_id:
|
|
2861
|
-
filename:
|
|
2862
|
-
start_index:
|
|
2863
|
-
end_index:
|
|
2864
|
-
index:
|
|
2953
|
+
z18.object({
|
|
2954
|
+
type: z18.literal("container_file_citation"),
|
|
2955
|
+
container_id: z18.string(),
|
|
2956
|
+
file_id: z18.string(),
|
|
2957
|
+
filename: z18.string().nullish(),
|
|
2958
|
+
start_index: z18.number().nullish(),
|
|
2959
|
+
end_index: z18.number().nullish(),
|
|
2960
|
+
index: z18.number().nullish()
|
|
2865
2961
|
}),
|
|
2866
|
-
|
|
2867
|
-
type:
|
|
2868
|
-
file_id:
|
|
2869
|
-
index:
|
|
2962
|
+
z18.object({
|
|
2963
|
+
type: z18.literal("file_path"),
|
|
2964
|
+
file_id: z18.string(),
|
|
2965
|
+
index: z18.number().nullish()
|
|
2870
2966
|
})
|
|
2871
2967
|
])
|
|
2872
2968
|
}),
|
|
2873
|
-
|
|
2874
|
-
type:
|
|
2875
|
-
item_id:
|
|
2876
|
-
summary_index:
|
|
2969
|
+
z18.object({
|
|
2970
|
+
type: z18.literal("response.reasoning_summary_part.added"),
|
|
2971
|
+
item_id: z18.string(),
|
|
2972
|
+
summary_index: z18.number()
|
|
2877
2973
|
}),
|
|
2878
|
-
|
|
2879
|
-
type:
|
|
2880
|
-
item_id:
|
|
2881
|
-
summary_index:
|
|
2882
|
-
delta:
|
|
2974
|
+
z18.object({
|
|
2975
|
+
type: z18.literal("response.reasoning_summary_text.delta"),
|
|
2976
|
+
item_id: z18.string(),
|
|
2977
|
+
summary_index: z18.number(),
|
|
2978
|
+
delta: z18.string()
|
|
2883
2979
|
}),
|
|
2884
|
-
|
|
2885
|
-
type:
|
|
2886
|
-
item_id:
|
|
2887
|
-
summary_index:
|
|
2980
|
+
z18.object({
|
|
2981
|
+
type: z18.literal("response.reasoning_summary_part.done"),
|
|
2982
|
+
item_id: z18.string(),
|
|
2983
|
+
summary_index: z18.number()
|
|
2888
2984
|
}),
|
|
2889
|
-
|
|
2890
|
-
type:
|
|
2891
|
-
sequence_number:
|
|
2892
|
-
error:
|
|
2893
|
-
type:
|
|
2894
|
-
code:
|
|
2895
|
-
message:
|
|
2896
|
-
param:
|
|
2985
|
+
z18.object({
|
|
2986
|
+
type: z18.literal("error"),
|
|
2987
|
+
sequence_number: z18.number(),
|
|
2988
|
+
error: z18.object({
|
|
2989
|
+
type: z18.string(),
|
|
2990
|
+
code: z18.string(),
|
|
2991
|
+
message: z18.string(),
|
|
2992
|
+
param: z18.string().nullish()
|
|
2897
2993
|
})
|
|
2898
2994
|
}),
|
|
2899
|
-
|
|
2995
|
+
z18.object({ type: z18.string() }).loose().transform((value) => ({
|
|
2900
2996
|
type: "unknown_chunk",
|
|
2901
2997
|
message: value.type
|
|
2902
2998
|
}))
|
|
@@ -2904,236 +3000,258 @@ var openaiResponsesChunkSchema = lazySchema15(
|
|
|
2904
3000
|
])
|
|
2905
3001
|
)
|
|
2906
3002
|
);
|
|
2907
|
-
var openaiResponsesResponseSchema =
|
|
2908
|
-
() =>
|
|
2909
|
-
|
|
2910
|
-
id:
|
|
2911
|
-
created_at:
|
|
2912
|
-
error:
|
|
2913
|
-
message:
|
|
2914
|
-
type:
|
|
2915
|
-
param:
|
|
2916
|
-
code:
|
|
3003
|
+
var openaiResponsesResponseSchema = lazySchema16(
|
|
3004
|
+
() => zodSchema16(
|
|
3005
|
+
z18.object({
|
|
3006
|
+
id: z18.string().optional(),
|
|
3007
|
+
created_at: z18.number().optional(),
|
|
3008
|
+
error: z18.object({
|
|
3009
|
+
message: z18.string(),
|
|
3010
|
+
type: z18.string(),
|
|
3011
|
+
param: z18.string().nullish(),
|
|
3012
|
+
code: z18.string()
|
|
2917
3013
|
}).nullish(),
|
|
2918
|
-
model:
|
|
2919
|
-
output:
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
type:
|
|
2923
|
-
role:
|
|
2924
|
-
id:
|
|
2925
|
-
content:
|
|
2926
|
-
|
|
2927
|
-
type:
|
|
2928
|
-
text:
|
|
2929
|
-
logprobs:
|
|
2930
|
-
|
|
2931
|
-
token:
|
|
2932
|
-
logprob:
|
|
2933
|
-
top_logprobs:
|
|
2934
|
-
|
|
2935
|
-
token:
|
|
2936
|
-
logprob:
|
|
3014
|
+
model: z18.string().optional(),
|
|
3015
|
+
output: z18.array(
|
|
3016
|
+
z18.discriminatedUnion("type", [
|
|
3017
|
+
z18.object({
|
|
3018
|
+
type: z18.literal("message"),
|
|
3019
|
+
role: z18.literal("assistant"),
|
|
3020
|
+
id: z18.string(),
|
|
3021
|
+
content: z18.array(
|
|
3022
|
+
z18.object({
|
|
3023
|
+
type: z18.literal("output_text"),
|
|
3024
|
+
text: z18.string(),
|
|
3025
|
+
logprobs: z18.array(
|
|
3026
|
+
z18.object({
|
|
3027
|
+
token: z18.string(),
|
|
3028
|
+
logprob: z18.number(),
|
|
3029
|
+
top_logprobs: z18.array(
|
|
3030
|
+
z18.object({
|
|
3031
|
+
token: z18.string(),
|
|
3032
|
+
logprob: z18.number()
|
|
2937
3033
|
})
|
|
2938
3034
|
)
|
|
2939
3035
|
})
|
|
2940
3036
|
).nullish(),
|
|
2941
|
-
annotations:
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
type:
|
|
2945
|
-
start_index:
|
|
2946
|
-
end_index:
|
|
2947
|
-
url:
|
|
2948
|
-
title:
|
|
3037
|
+
annotations: z18.array(
|
|
3038
|
+
z18.discriminatedUnion("type", [
|
|
3039
|
+
z18.object({
|
|
3040
|
+
type: z18.literal("url_citation"),
|
|
3041
|
+
start_index: z18.number(),
|
|
3042
|
+
end_index: z18.number(),
|
|
3043
|
+
url: z18.string(),
|
|
3044
|
+
title: z18.string()
|
|
2949
3045
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
file_id:
|
|
2953
|
-
filename:
|
|
2954
|
-
index:
|
|
2955
|
-
start_index:
|
|
2956
|
-
end_index:
|
|
2957
|
-
quote:
|
|
3046
|
+
z18.object({
|
|
3047
|
+
type: z18.literal("file_citation"),
|
|
3048
|
+
file_id: z18.string(),
|
|
3049
|
+
filename: z18.string().nullish(),
|
|
3050
|
+
index: z18.number().nullish(),
|
|
3051
|
+
start_index: z18.number().nullish(),
|
|
3052
|
+
end_index: z18.number().nullish(),
|
|
3053
|
+
quote: z18.string().nullish()
|
|
2958
3054
|
}),
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
container_id:
|
|
2962
|
-
file_id:
|
|
2963
|
-
filename:
|
|
2964
|
-
start_index:
|
|
2965
|
-
end_index:
|
|
2966
|
-
index:
|
|
3055
|
+
z18.object({
|
|
3056
|
+
type: z18.literal("container_file_citation"),
|
|
3057
|
+
container_id: z18.string(),
|
|
3058
|
+
file_id: z18.string(),
|
|
3059
|
+
filename: z18.string().nullish(),
|
|
3060
|
+
start_index: z18.number().nullish(),
|
|
3061
|
+
end_index: z18.number().nullish(),
|
|
3062
|
+
index: z18.number().nullish()
|
|
2967
3063
|
}),
|
|
2968
|
-
|
|
2969
|
-
type:
|
|
2970
|
-
file_id:
|
|
2971
|
-
index:
|
|
3064
|
+
z18.object({
|
|
3065
|
+
type: z18.literal("file_path"),
|
|
3066
|
+
file_id: z18.string(),
|
|
3067
|
+
index: z18.number().nullish()
|
|
2972
3068
|
})
|
|
2973
3069
|
])
|
|
2974
3070
|
)
|
|
2975
3071
|
})
|
|
2976
3072
|
)
|
|
2977
3073
|
}),
|
|
2978
|
-
|
|
2979
|
-
type:
|
|
2980
|
-
id:
|
|
2981
|
-
status:
|
|
2982
|
-
action:
|
|
2983
|
-
|
|
2984
|
-
type:
|
|
2985
|
-
query:
|
|
2986
|
-
sources:
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
3074
|
+
z18.object({
|
|
3075
|
+
type: z18.literal("web_search_call"),
|
|
3076
|
+
id: z18.string(),
|
|
3077
|
+
status: z18.string(),
|
|
3078
|
+
action: z18.discriminatedUnion("type", [
|
|
3079
|
+
z18.object({
|
|
3080
|
+
type: z18.literal("search"),
|
|
3081
|
+
query: z18.string().nullish(),
|
|
3082
|
+
sources: z18.array(
|
|
3083
|
+
z18.discriminatedUnion("type", [
|
|
3084
|
+
z18.object({ type: z18.literal("url"), url: z18.string() }),
|
|
3085
|
+
z18.object({ type: z18.literal("api"), name: z18.string() })
|
|
2990
3086
|
])
|
|
2991
3087
|
).nullish()
|
|
2992
3088
|
}),
|
|
2993
|
-
|
|
2994
|
-
type:
|
|
2995
|
-
url:
|
|
3089
|
+
z18.object({
|
|
3090
|
+
type: z18.literal("open_page"),
|
|
3091
|
+
url: z18.string()
|
|
2996
3092
|
}),
|
|
2997
|
-
|
|
2998
|
-
type:
|
|
2999
|
-
url:
|
|
3000
|
-
pattern:
|
|
3093
|
+
z18.object({
|
|
3094
|
+
type: z18.literal("find"),
|
|
3095
|
+
url: z18.string(),
|
|
3096
|
+
pattern: z18.string()
|
|
3001
3097
|
})
|
|
3002
3098
|
])
|
|
3003
3099
|
}),
|
|
3004
|
-
|
|
3005
|
-
type:
|
|
3006
|
-
id:
|
|
3007
|
-
queries:
|
|
3008
|
-
results:
|
|
3009
|
-
|
|
3010
|
-
attributes:
|
|
3011
|
-
|
|
3012
|
-
|
|
3100
|
+
z18.object({
|
|
3101
|
+
type: z18.literal("file_search_call"),
|
|
3102
|
+
id: z18.string(),
|
|
3103
|
+
queries: z18.array(z18.string()),
|
|
3104
|
+
results: z18.array(
|
|
3105
|
+
z18.object({
|
|
3106
|
+
attributes: z18.record(
|
|
3107
|
+
z18.string(),
|
|
3108
|
+
z18.union([z18.string(), z18.number(), z18.boolean()])
|
|
3013
3109
|
),
|
|
3014
|
-
file_id:
|
|
3015
|
-
filename:
|
|
3016
|
-
score:
|
|
3017
|
-
text:
|
|
3110
|
+
file_id: z18.string(),
|
|
3111
|
+
filename: z18.string(),
|
|
3112
|
+
score: z18.number(),
|
|
3113
|
+
text: z18.string()
|
|
3018
3114
|
})
|
|
3019
3115
|
).nullish()
|
|
3020
3116
|
}),
|
|
3021
|
-
|
|
3022
|
-
type:
|
|
3023
|
-
id:
|
|
3024
|
-
code:
|
|
3025
|
-
container_id:
|
|
3026
|
-
outputs:
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3117
|
+
z18.object({
|
|
3118
|
+
type: z18.literal("code_interpreter_call"),
|
|
3119
|
+
id: z18.string(),
|
|
3120
|
+
code: z18.string().nullable(),
|
|
3121
|
+
container_id: z18.string(),
|
|
3122
|
+
outputs: z18.array(
|
|
3123
|
+
z18.discriminatedUnion("type", [
|
|
3124
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3125
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
3030
3126
|
])
|
|
3031
3127
|
).nullable()
|
|
3032
3128
|
}),
|
|
3033
|
-
|
|
3034
|
-
type:
|
|
3035
|
-
id:
|
|
3036
|
-
result:
|
|
3129
|
+
z18.object({
|
|
3130
|
+
type: z18.literal("image_generation_call"),
|
|
3131
|
+
id: z18.string(),
|
|
3132
|
+
result: z18.string()
|
|
3037
3133
|
}),
|
|
3038
|
-
|
|
3039
|
-
type:
|
|
3040
|
-
id:
|
|
3041
|
-
call_id:
|
|
3042
|
-
action:
|
|
3043
|
-
type:
|
|
3044
|
-
command:
|
|
3045
|
-
timeout_ms:
|
|
3046
|
-
user:
|
|
3047
|
-
working_directory:
|
|
3048
|
-
env:
|
|
3134
|
+
z18.object({
|
|
3135
|
+
type: z18.literal("local_shell_call"),
|
|
3136
|
+
id: z18.string(),
|
|
3137
|
+
call_id: z18.string(),
|
|
3138
|
+
action: z18.object({
|
|
3139
|
+
type: z18.literal("exec"),
|
|
3140
|
+
command: z18.array(z18.string()),
|
|
3141
|
+
timeout_ms: z18.number().optional(),
|
|
3142
|
+
user: z18.string().optional(),
|
|
3143
|
+
working_directory: z18.string().optional(),
|
|
3144
|
+
env: z18.record(z18.string(), z18.string()).optional()
|
|
3049
3145
|
})
|
|
3050
3146
|
}),
|
|
3051
|
-
|
|
3052
|
-
type:
|
|
3053
|
-
call_id:
|
|
3054
|
-
name:
|
|
3055
|
-
arguments:
|
|
3056
|
-
id:
|
|
3147
|
+
z18.object({
|
|
3148
|
+
type: z18.literal("function_call"),
|
|
3149
|
+
call_id: z18.string(),
|
|
3150
|
+
name: z18.string(),
|
|
3151
|
+
arguments: z18.string(),
|
|
3152
|
+
id: z18.string()
|
|
3057
3153
|
}),
|
|
3058
|
-
|
|
3059
|
-
type:
|
|
3060
|
-
id:
|
|
3061
|
-
status:
|
|
3154
|
+
z18.object({
|
|
3155
|
+
type: z18.literal("computer_call"),
|
|
3156
|
+
id: z18.string(),
|
|
3157
|
+
status: z18.string().optional()
|
|
3062
3158
|
}),
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
id:
|
|
3066
|
-
encrypted_content:
|
|
3067
|
-
summary:
|
|
3068
|
-
|
|
3069
|
-
type:
|
|
3070
|
-
text:
|
|
3159
|
+
z18.object({
|
|
3160
|
+
type: z18.literal("reasoning"),
|
|
3161
|
+
id: z18.string(),
|
|
3162
|
+
encrypted_content: z18.string().nullish(),
|
|
3163
|
+
summary: z18.array(
|
|
3164
|
+
z18.object({
|
|
3165
|
+
type: z18.literal("summary_text"),
|
|
3166
|
+
text: z18.string()
|
|
3071
3167
|
})
|
|
3072
3168
|
)
|
|
3073
3169
|
}),
|
|
3074
|
-
|
|
3075
|
-
type:
|
|
3076
|
-
id:
|
|
3077
|
-
status:
|
|
3078
|
-
arguments:
|
|
3079
|
-
name:
|
|
3080
|
-
server_label:
|
|
3081
|
-
output:
|
|
3082
|
-
error:
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
type:
|
|
3086
|
-
code:
|
|
3087
|
-
message:
|
|
3170
|
+
z18.object({
|
|
3171
|
+
type: z18.literal("mcp_call"),
|
|
3172
|
+
id: z18.string(),
|
|
3173
|
+
status: z18.string(),
|
|
3174
|
+
arguments: z18.string(),
|
|
3175
|
+
name: z18.string(),
|
|
3176
|
+
server_label: z18.string(),
|
|
3177
|
+
output: z18.string().nullish(),
|
|
3178
|
+
error: z18.union([
|
|
3179
|
+
z18.string(),
|
|
3180
|
+
z18.object({
|
|
3181
|
+
type: z18.string().optional(),
|
|
3182
|
+
code: z18.union([z18.number(), z18.string()]).optional(),
|
|
3183
|
+
message: z18.string().optional()
|
|
3088
3184
|
}).loose()
|
|
3089
3185
|
]).nullish()
|
|
3090
3186
|
}),
|
|
3091
|
-
|
|
3092
|
-
type:
|
|
3093
|
-
id:
|
|
3094
|
-
server_label:
|
|
3095
|
-
tools:
|
|
3096
|
-
|
|
3097
|
-
name:
|
|
3098
|
-
description:
|
|
3099
|
-
input_schema:
|
|
3100
|
-
annotations:
|
|
3187
|
+
z18.object({
|
|
3188
|
+
type: z18.literal("mcp_list_tools"),
|
|
3189
|
+
id: z18.string(),
|
|
3190
|
+
server_label: z18.string(),
|
|
3191
|
+
tools: z18.array(
|
|
3192
|
+
z18.object({
|
|
3193
|
+
name: z18.string(),
|
|
3194
|
+
description: z18.string().optional(),
|
|
3195
|
+
input_schema: z18.any(),
|
|
3196
|
+
annotations: z18.record(z18.string(), z18.unknown()).optional()
|
|
3101
3197
|
})
|
|
3102
3198
|
),
|
|
3103
|
-
error:
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
type:
|
|
3107
|
-
code:
|
|
3108
|
-
message:
|
|
3199
|
+
error: z18.union([
|
|
3200
|
+
z18.string(),
|
|
3201
|
+
z18.object({
|
|
3202
|
+
type: z18.string().optional(),
|
|
3203
|
+
code: z18.union([z18.number(), z18.string()]).optional(),
|
|
3204
|
+
message: z18.string().optional()
|
|
3109
3205
|
}).loose()
|
|
3110
3206
|
]).optional()
|
|
3111
3207
|
}),
|
|
3112
|
-
|
|
3113
|
-
type:
|
|
3114
|
-
id:
|
|
3115
|
-
server_label:
|
|
3116
|
-
name:
|
|
3117
|
-
arguments:
|
|
3118
|
-
approval_request_id:
|
|
3208
|
+
z18.object({
|
|
3209
|
+
type: z18.literal("mcp_approval_request"),
|
|
3210
|
+
id: z18.string(),
|
|
3211
|
+
server_label: z18.string(),
|
|
3212
|
+
name: z18.string(),
|
|
3213
|
+
arguments: z18.string(),
|
|
3214
|
+
approval_request_id: z18.string()
|
|
3215
|
+
}),
|
|
3216
|
+
z18.object({
|
|
3217
|
+
type: z18.literal("apply_patch_call"),
|
|
3218
|
+
id: z18.string(),
|
|
3219
|
+
call_id: z18.string(),
|
|
3220
|
+
status: z18.enum(["in_progress", "completed"]),
|
|
3221
|
+
operation: z18.discriminatedUnion("type", [
|
|
3222
|
+
z18.object({
|
|
3223
|
+
type: z18.literal("create_file"),
|
|
3224
|
+
path: z18.string(),
|
|
3225
|
+
diff: z18.string()
|
|
3226
|
+
}),
|
|
3227
|
+
z18.object({
|
|
3228
|
+
type: z18.literal("delete_file"),
|
|
3229
|
+
path: z18.string()
|
|
3230
|
+
}),
|
|
3231
|
+
z18.object({
|
|
3232
|
+
type: z18.literal("update_file"),
|
|
3233
|
+
path: z18.string(),
|
|
3234
|
+
diff: z18.string()
|
|
3235
|
+
})
|
|
3236
|
+
])
|
|
3119
3237
|
})
|
|
3120
3238
|
])
|
|
3121
3239
|
).optional(),
|
|
3122
|
-
service_tier:
|
|
3123
|
-
incomplete_details:
|
|
3124
|
-
usage:
|
|
3125
|
-
input_tokens:
|
|
3126
|
-
input_tokens_details:
|
|
3127
|
-
output_tokens:
|
|
3128
|
-
output_tokens_details:
|
|
3240
|
+
service_tier: z18.string().nullish(),
|
|
3241
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
3242
|
+
usage: z18.object({
|
|
3243
|
+
input_tokens: z18.number(),
|
|
3244
|
+
input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
|
|
3245
|
+
output_tokens: z18.number(),
|
|
3246
|
+
output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
|
|
3129
3247
|
}).optional()
|
|
3130
3248
|
})
|
|
3131
3249
|
)
|
|
3132
3250
|
);
|
|
3133
3251
|
|
|
3134
3252
|
// src/responses/openai-responses-options.ts
|
|
3135
|
-
import { lazySchema as
|
|
3136
|
-
import { z as
|
|
3253
|
+
import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
|
|
3254
|
+
import { z as z19 } from "zod/v4";
|
|
3137
3255
|
var TOP_LOGPROBS_MAX = 20;
|
|
3138
3256
|
var openaiResponsesReasoningModelIds = [
|
|
3139
3257
|
"o1",
|
|
@@ -3200,19 +3318,19 @@ var openaiResponsesModelIds = [
|
|
|
3200
3318
|
"gpt-5-chat-latest",
|
|
3201
3319
|
...openaiResponsesReasoningModelIds
|
|
3202
3320
|
];
|
|
3203
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3204
|
-
() =>
|
|
3205
|
-
|
|
3206
|
-
conversation:
|
|
3207
|
-
include:
|
|
3208
|
-
|
|
3321
|
+
var openaiResponsesProviderOptionsSchema = lazySchema17(
|
|
3322
|
+
() => zodSchema17(
|
|
3323
|
+
z19.object({
|
|
3324
|
+
conversation: z19.string().nullish(),
|
|
3325
|
+
include: z19.array(
|
|
3326
|
+
z19.enum([
|
|
3209
3327
|
"reasoning.encrypted_content",
|
|
3210
3328
|
// handled internally by default, only needed for unknown reasoning models
|
|
3211
3329
|
"file_search_call.results",
|
|
3212
3330
|
"message.output_text.logprobs"
|
|
3213
3331
|
])
|
|
3214
3332
|
).nullish(),
|
|
3215
|
-
instructions:
|
|
3333
|
+
instructions: z19.string().nullish(),
|
|
3216
3334
|
/**
|
|
3217
3335
|
* Return the log probabilities of the tokens.
|
|
3218
3336
|
*
|
|
@@ -3225,17 +3343,17 @@ var openaiResponsesProviderOptionsSchema = lazySchema16(
|
|
|
3225
3343
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3226
3344
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3227
3345
|
*/
|
|
3228
|
-
logprobs:
|
|
3346
|
+
logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3229
3347
|
/**
|
|
3230
3348
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3231
3349
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3232
3350
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3233
3351
|
*/
|
|
3234
|
-
maxToolCalls:
|
|
3235
|
-
metadata:
|
|
3236
|
-
parallelToolCalls:
|
|
3237
|
-
previousResponseId:
|
|
3238
|
-
promptCacheKey:
|
|
3352
|
+
maxToolCalls: z19.number().nullish(),
|
|
3353
|
+
metadata: z19.any().nullish(),
|
|
3354
|
+
parallelToolCalls: z19.boolean().nullish(),
|
|
3355
|
+
previousResponseId: z19.string().nullish(),
|
|
3356
|
+
promptCacheKey: z19.string().nullish(),
|
|
3239
3357
|
/**
|
|
3240
3358
|
* The retention policy for the prompt cache.
|
|
3241
3359
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3244,16 +3362,16 @@ var openaiResponsesProviderOptionsSchema = lazySchema16(
|
|
|
3244
3362
|
*
|
|
3245
3363
|
* @default 'in_memory'
|
|
3246
3364
|
*/
|
|
3247
|
-
promptCacheRetention:
|
|
3248
|
-
reasoningEffort:
|
|
3249
|
-
reasoningSummary:
|
|
3250
|
-
safetyIdentifier:
|
|
3251
|
-
serviceTier:
|
|
3252
|
-
store:
|
|
3253
|
-
strictJsonSchema:
|
|
3254
|
-
textVerbosity:
|
|
3255
|
-
truncation:
|
|
3256
|
-
user:
|
|
3365
|
+
promptCacheRetention: z19.enum(["in_memory", "24h"]).nullish(),
|
|
3366
|
+
reasoningEffort: z19.string().nullish(),
|
|
3367
|
+
reasoningSummary: z19.string().nullish(),
|
|
3368
|
+
safetyIdentifier: z19.string().nullish(),
|
|
3369
|
+
serviceTier: z19.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3370
|
+
store: z19.boolean().nullish(),
|
|
3371
|
+
strictJsonSchema: z19.boolean().nullish(),
|
|
3372
|
+
textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
|
|
3373
|
+
truncation: z19.enum(["auto", "disabled"]).nullish(),
|
|
3374
|
+
user: z19.string().nullish()
|
|
3257
3375
|
})
|
|
3258
3376
|
)
|
|
3259
3377
|
);
|
|
@@ -3310,6 +3428,12 @@ async function prepareResponsesTools({
|
|
|
3310
3428
|
});
|
|
3311
3429
|
break;
|
|
3312
3430
|
}
|
|
3431
|
+
case "openai.apply_patch": {
|
|
3432
|
+
openaiTools2.push({
|
|
3433
|
+
type: "apply_patch"
|
|
3434
|
+
});
|
|
3435
|
+
break;
|
|
3436
|
+
}
|
|
3313
3437
|
case "openai.web_search_preview": {
|
|
3314
3438
|
const args = await validateTypes2({
|
|
3315
3439
|
value: tool.args,
|
|
@@ -3414,7 +3538,7 @@ async function prepareResponsesTools({
|
|
|
3414
3538
|
case "tool":
|
|
3415
3539
|
return {
|
|
3416
3540
|
tools: openaiTools2,
|
|
3417
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3541
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" || toolChoice.toolName === "apply_patch" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3418
3542
|
toolWarnings
|
|
3419
3543
|
};
|
|
3420
3544
|
default: {
|
|
@@ -3494,7 +3618,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3494
3618
|
"openai.local_shell": "local_shell",
|
|
3495
3619
|
"openai.web_search": "web_search",
|
|
3496
3620
|
"openai.web_search_preview": "web_search_preview",
|
|
3497
|
-
"openai.mcp": "mcp"
|
|
3621
|
+
"openai.mcp": "mcp",
|
|
3622
|
+
"openai.apply_patch": "apply_patch"
|
|
3498
3623
|
}
|
|
3499
3624
|
});
|
|
3500
3625
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
@@ -3503,10 +3628,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3503
3628
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3504
3629
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3505
3630
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
3506
|
-
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
3631
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
3632
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3507
3633
|
});
|
|
3508
3634
|
warnings.push(...inputWarnings);
|
|
3509
|
-
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b :
|
|
3635
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
3510
3636
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
3511
3637
|
function addInclude(key) {
|
|
3512
3638
|
if (include == null) {
|
|
@@ -4004,6 +4130,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4004
4130
|
});
|
|
4005
4131
|
break;
|
|
4006
4132
|
}
|
|
4133
|
+
case "apply_patch_call": {
|
|
4134
|
+
content.push({
|
|
4135
|
+
type: "tool-call",
|
|
4136
|
+
toolCallId: part.call_id,
|
|
4137
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4138
|
+
input: JSON.stringify({
|
|
4139
|
+
callId: part.call_id,
|
|
4140
|
+
operation: part.operation
|
|
4141
|
+
}),
|
|
4142
|
+
providerMetadata: {
|
|
4143
|
+
[providerKey]: {
|
|
4144
|
+
itemId: part.id
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
});
|
|
4148
|
+
break;
|
|
4149
|
+
}
|
|
4007
4150
|
}
|
|
4008
4151
|
}
|
|
4009
4152
|
const providerMetadata = {
|
|
@@ -4191,6 +4334,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4191
4334
|
input: "{}",
|
|
4192
4335
|
providerExecuted: true
|
|
4193
4336
|
});
|
|
4337
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4338
|
+
ongoingToolCalls[value.output_index] = {
|
|
4339
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4340
|
+
toolCallId: value.item.call_id
|
|
4341
|
+
};
|
|
4342
|
+
if (value.item.status === "completed") {
|
|
4343
|
+
controller.enqueue({
|
|
4344
|
+
type: "tool-call",
|
|
4345
|
+
toolCallId: value.item.call_id,
|
|
4346
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4347
|
+
input: JSON.stringify({
|
|
4348
|
+
callId: value.item.call_id,
|
|
4349
|
+
operation: value.item.operation
|
|
4350
|
+
}),
|
|
4351
|
+
providerMetadata: {
|
|
4352
|
+
[providerKey]: {
|
|
4353
|
+
itemId: value.item.id
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
});
|
|
4357
|
+
}
|
|
4194
4358
|
} else if (value.item.type === "message") {
|
|
4195
4359
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4196
4360
|
controller.enqueue({
|
|
@@ -4354,6 +4518,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4354
4518
|
...value.item.error != null ? { error: value.item.error } : {}
|
|
4355
4519
|
}
|
|
4356
4520
|
});
|
|
4521
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4522
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4523
|
+
if (value.item.status === "completed") {
|
|
4524
|
+
controller.enqueue({
|
|
4525
|
+
type: "tool-call",
|
|
4526
|
+
toolCallId: value.item.call_id,
|
|
4527
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4528
|
+
input: JSON.stringify({
|
|
4529
|
+
callId: value.item.call_id,
|
|
4530
|
+
operation: value.item.operation
|
|
4531
|
+
}),
|
|
4532
|
+
providerMetadata: {
|
|
4533
|
+
[providerKey]: {
|
|
4534
|
+
itemId: value.item.id
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
});
|
|
4538
|
+
}
|
|
4357
4539
|
} else if (value.item.type === "mcp_approval_request") {
|
|
4358
4540
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4359
4541
|
controller.enqueue({
|
|
@@ -4705,13 +4887,13 @@ import {
|
|
|
4705
4887
|
} from "@ai-sdk/provider-utils";
|
|
4706
4888
|
|
|
4707
4889
|
// src/speech/openai-speech-options.ts
|
|
4708
|
-
import { lazySchema as
|
|
4709
|
-
import { z as
|
|
4710
|
-
var openaiSpeechProviderOptionsSchema =
|
|
4711
|
-
() =>
|
|
4712
|
-
|
|
4713
|
-
instructions:
|
|
4714
|
-
speed:
|
|
4890
|
+
import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
|
|
4891
|
+
import { z as z20 } from "zod/v4";
|
|
4892
|
+
var openaiSpeechProviderOptionsSchema = lazySchema18(
|
|
4893
|
+
() => zodSchema18(
|
|
4894
|
+
z20.object({
|
|
4895
|
+
instructions: z20.string().nullish(),
|
|
4896
|
+
speed: z20.number().min(0.25).max(4).default(1).nullish()
|
|
4715
4897
|
})
|
|
4716
4898
|
)
|
|
4717
4899
|
);
|
|
@@ -4828,33 +5010,33 @@ import {
|
|
|
4828
5010
|
} from "@ai-sdk/provider-utils";
|
|
4829
5011
|
|
|
4830
5012
|
// src/transcription/openai-transcription-api.ts
|
|
4831
|
-
import { lazySchema as
|
|
4832
|
-
import { z as
|
|
4833
|
-
var openaiTranscriptionResponseSchema =
|
|
4834
|
-
() =>
|
|
4835
|
-
|
|
4836
|
-
text:
|
|
4837
|
-
language:
|
|
4838
|
-
duration:
|
|
4839
|
-
words:
|
|
4840
|
-
|
|
4841
|
-
word:
|
|
4842
|
-
start:
|
|
4843
|
-
end:
|
|
5013
|
+
import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
|
|
5014
|
+
import { z as z21 } from "zod/v4";
|
|
5015
|
+
var openaiTranscriptionResponseSchema = lazySchema19(
|
|
5016
|
+
() => zodSchema19(
|
|
5017
|
+
z21.object({
|
|
5018
|
+
text: z21.string(),
|
|
5019
|
+
language: z21.string().nullish(),
|
|
5020
|
+
duration: z21.number().nullish(),
|
|
5021
|
+
words: z21.array(
|
|
5022
|
+
z21.object({
|
|
5023
|
+
word: z21.string(),
|
|
5024
|
+
start: z21.number(),
|
|
5025
|
+
end: z21.number()
|
|
4844
5026
|
})
|
|
4845
5027
|
).nullish(),
|
|
4846
|
-
segments:
|
|
4847
|
-
|
|
4848
|
-
id:
|
|
4849
|
-
seek:
|
|
4850
|
-
start:
|
|
4851
|
-
end:
|
|
4852
|
-
text:
|
|
4853
|
-
tokens:
|
|
4854
|
-
temperature:
|
|
4855
|
-
avg_logprob:
|
|
4856
|
-
compression_ratio:
|
|
4857
|
-
no_speech_prob:
|
|
5028
|
+
segments: z21.array(
|
|
5029
|
+
z21.object({
|
|
5030
|
+
id: z21.number(),
|
|
5031
|
+
seek: z21.number(),
|
|
5032
|
+
start: z21.number(),
|
|
5033
|
+
end: z21.number(),
|
|
5034
|
+
text: z21.string(),
|
|
5035
|
+
tokens: z21.array(z21.number()),
|
|
5036
|
+
temperature: z21.number(),
|
|
5037
|
+
avg_logprob: z21.number(),
|
|
5038
|
+
compression_ratio: z21.number(),
|
|
5039
|
+
no_speech_prob: z21.number()
|
|
4858
5040
|
})
|
|
4859
5041
|
).nullish()
|
|
4860
5042
|
})
|
|
@@ -4862,33 +5044,33 @@ var openaiTranscriptionResponseSchema = lazySchema18(
|
|
|
4862
5044
|
);
|
|
4863
5045
|
|
|
4864
5046
|
// src/transcription/openai-transcription-options.ts
|
|
4865
|
-
import { lazySchema as
|
|
4866
|
-
import { z as
|
|
4867
|
-
var openAITranscriptionProviderOptions =
|
|
4868
|
-
() =>
|
|
4869
|
-
|
|
5047
|
+
import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
|
|
5048
|
+
import { z as z22 } from "zod/v4";
|
|
5049
|
+
var openAITranscriptionProviderOptions = lazySchema20(
|
|
5050
|
+
() => zodSchema20(
|
|
5051
|
+
z22.object({
|
|
4870
5052
|
/**
|
|
4871
5053
|
* Additional information to include in the transcription response.
|
|
4872
5054
|
*/
|
|
4873
|
-
include:
|
|
5055
|
+
include: z22.array(z22.string()).optional(),
|
|
4874
5056
|
/**
|
|
4875
5057
|
* The language of the input audio in ISO-639-1 format.
|
|
4876
5058
|
*/
|
|
4877
|
-
language:
|
|
5059
|
+
language: z22.string().optional(),
|
|
4878
5060
|
/**
|
|
4879
5061
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4880
5062
|
*/
|
|
4881
|
-
prompt:
|
|
5063
|
+
prompt: z22.string().optional(),
|
|
4882
5064
|
/**
|
|
4883
5065
|
* The sampling temperature, between 0 and 1.
|
|
4884
5066
|
* @default 0
|
|
4885
5067
|
*/
|
|
4886
|
-
temperature:
|
|
5068
|
+
temperature: z22.number().min(0).max(1).default(0).optional(),
|
|
4887
5069
|
/**
|
|
4888
5070
|
* The timestamp granularities to populate for this transcription.
|
|
4889
5071
|
* @default ['segment']
|
|
4890
5072
|
*/
|
|
4891
|
-
timestampGranularities:
|
|
5073
|
+
timestampGranularities: z22.array(z22.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4892
5074
|
})
|
|
4893
5075
|
)
|
|
4894
5076
|
);
|
|
@@ -5061,7 +5243,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5061
5243
|
};
|
|
5062
5244
|
|
|
5063
5245
|
// src/version.ts
|
|
5064
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5246
|
+
var VERSION = true ? "3.0.0-beta.75" : "0.0.0-test";
|
|
5065
5247
|
|
|
5066
5248
|
// src/openai-provider.ts
|
|
5067
5249
|
function createOpenAI(options = {}) {
|