@ai-sdk/openai 3.0.0-beta.72 → 3.0.0-beta.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1764,46 +1764,92 @@ var OpenAIImageModel = class {
1764
1764
  }
1765
1765
  };
1766
1766
 
1767
- // src/tool/code-interpreter.ts
1767
+ // src/tool/apply-patch.ts
1768
1768
  import {
1769
- createProviderDefinedToolFactoryWithOutputSchema,
1769
+ createProviderToolFactoryWithOutputSchema,
1770
1770
  lazySchema as lazySchema8,
1771
1771
  zodSchema as zodSchema8
1772
1772
  } from "@ai-sdk/provider-utils";
1773
1773
  import { z as z9 } from "zod/v4";
1774
- var codeInterpreterInputSchema = lazySchema8(
1774
+ var applyPatchInputSchema = lazySchema8(
1775
1775
  () => zodSchema8(
1776
1776
  z9.object({
1777
- code: z9.string().nullish(),
1778
- containerId: z9.string()
1777
+ callId: z9.string(),
1778
+ operation: z9.discriminatedUnion("type", [
1779
+ z9.object({
1780
+ type: z9.literal("create_file"),
1781
+ path: z9.string(),
1782
+ diff: z9.string()
1783
+ }),
1784
+ z9.object({
1785
+ type: z9.literal("delete_file"),
1786
+ path: z9.string()
1787
+ }),
1788
+ z9.object({
1789
+ type: z9.literal("update_file"),
1790
+ path: z9.string(),
1791
+ diff: z9.string()
1792
+ })
1793
+ ])
1779
1794
  })
1780
1795
  )
1781
1796
  );
1782
- var codeInterpreterOutputSchema = lazySchema8(
1797
+ var applyPatchOutputSchema = lazySchema8(
1783
1798
  () => zodSchema8(
1784
1799
  z9.object({
1785
- outputs: z9.array(
1786
- z9.discriminatedUnion("type", [
1787
- z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1788
- z9.object({ type: z9.literal("image"), url: z9.string() })
1800
+ status: z9.enum(["completed", "failed"]),
1801
+ output: z9.string().optional()
1802
+ })
1803
+ )
1804
+ );
1805
+ var applyPatchArgsSchema = lazySchema8(() => zodSchema8(z9.object({})));
1806
+ var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
1807
+ id: "openai.apply_patch",
1808
+ inputSchema: applyPatchInputSchema,
1809
+ outputSchema: applyPatchOutputSchema
1810
+ });
1811
+ var applyPatch = () => applyPatchToolFactory({});
1812
+
1813
+ // src/tool/code-interpreter.ts
1814
+ import {
1815
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1816
+ lazySchema as lazySchema9,
1817
+ zodSchema as zodSchema9
1818
+ } from "@ai-sdk/provider-utils";
1819
+ import { z as z10 } from "zod/v4";
1820
+ var codeInterpreterInputSchema = lazySchema9(
1821
+ () => zodSchema9(
1822
+ z10.object({
1823
+ code: z10.string().nullish(),
1824
+ containerId: z10.string()
1825
+ })
1826
+ )
1827
+ );
1828
+ var codeInterpreterOutputSchema = lazySchema9(
1829
+ () => zodSchema9(
1830
+ z10.object({
1831
+ outputs: z10.array(
1832
+ z10.discriminatedUnion("type", [
1833
+ z10.object({ type: z10.literal("logs"), logs: z10.string() }),
1834
+ z10.object({ type: z10.literal("image"), url: z10.string() })
1789
1835
  ])
1790
1836
  ).nullish()
1791
1837
  })
1792
1838
  )
1793
1839
  );
1794
- var codeInterpreterArgsSchema = lazySchema8(
1795
- () => zodSchema8(
1796
- z9.object({
1797
- container: z9.union([
1798
- z9.string(),
1799
- z9.object({
1800
- fileIds: z9.array(z9.string()).optional()
1840
+ var codeInterpreterArgsSchema = lazySchema9(
1841
+ () => zodSchema9(
1842
+ z10.object({
1843
+ container: z10.union([
1844
+ z10.string(),
1845
+ z10.object({
1846
+ fileIds: z10.array(z10.string()).optional()
1801
1847
  })
1802
1848
  ]).optional()
1803
1849
  })
1804
1850
  )
1805
1851
  );
1806
- var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
1852
+ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema2({
1807
1853
  id: "openai.code_interpreter",
1808
1854
  inputSchema: codeInterpreterInputSchema,
1809
1855
  outputSchema: codeInterpreterOutputSchema
@@ -1814,88 +1860,88 @@ var codeInterpreter = (args = {}) => {
1814
1860
 
1815
1861
  // src/tool/file-search.ts
1816
1862
  import {
1817
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1818
- lazySchema as lazySchema9,
1819
- zodSchema as zodSchema9
1863
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1864
+ lazySchema as lazySchema10,
1865
+ zodSchema as zodSchema10
1820
1866
  } from "@ai-sdk/provider-utils";
1821
- import { z as z10 } from "zod/v4";
1822
- var comparisonFilterSchema = z10.object({
1823
- key: z10.string(),
1824
- type: z10.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
1825
- value: z10.union([z10.string(), z10.number(), z10.boolean()])
1867
+ import { z as z11 } from "zod/v4";
1868
+ var comparisonFilterSchema = z11.object({
1869
+ key: z11.string(),
1870
+ type: z11.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
1871
+ value: z11.union([z11.string(), z11.number(), z11.boolean()])
1826
1872
  });
1827
- var compoundFilterSchema = z10.object({
1828
- type: z10.enum(["and", "or"]),
1829
- filters: z10.array(
1830
- z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
1873
+ var compoundFilterSchema = z11.object({
1874
+ type: z11.enum(["and", "or"]),
1875
+ filters: z11.array(
1876
+ z11.union([comparisonFilterSchema, z11.lazy(() => compoundFilterSchema)])
1831
1877
  )
1832
1878
  });
1833
- var fileSearchArgsSchema = lazySchema9(
1834
- () => zodSchema9(
1835
- z10.object({
1836
- vectorStoreIds: z10.array(z10.string()),
1837
- maxNumResults: z10.number().optional(),
1838
- ranking: z10.object({
1839
- ranker: z10.string().optional(),
1840
- scoreThreshold: z10.number().optional()
1879
+ var fileSearchArgsSchema = lazySchema10(
1880
+ () => zodSchema10(
1881
+ z11.object({
1882
+ vectorStoreIds: z11.array(z11.string()),
1883
+ maxNumResults: z11.number().optional(),
1884
+ ranking: z11.object({
1885
+ ranker: z11.string().optional(),
1886
+ scoreThreshold: z11.number().optional()
1841
1887
  }).optional(),
1842
- filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1888
+ filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1843
1889
  })
1844
1890
  )
1845
1891
  );
1846
- var fileSearchOutputSchema = lazySchema9(
1847
- () => zodSchema9(
1848
- z10.object({
1849
- queries: z10.array(z10.string()),
1850
- results: z10.array(
1851
- z10.object({
1852
- attributes: z10.record(z10.string(), z10.unknown()),
1853
- fileId: z10.string(),
1854
- filename: z10.string(),
1855
- score: z10.number(),
1856
- text: z10.string()
1892
+ var fileSearchOutputSchema = lazySchema10(
1893
+ () => zodSchema10(
1894
+ z11.object({
1895
+ queries: z11.array(z11.string()),
1896
+ results: z11.array(
1897
+ z11.object({
1898
+ attributes: z11.record(z11.string(), z11.unknown()),
1899
+ fileId: z11.string(),
1900
+ filename: z11.string(),
1901
+ score: z11.number(),
1902
+ text: z11.string()
1857
1903
  })
1858
1904
  ).nullable()
1859
1905
  })
1860
1906
  )
1861
1907
  );
1862
- var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1908
+ var fileSearch = createProviderToolFactoryWithOutputSchema3({
1863
1909
  id: "openai.file_search",
1864
- inputSchema: z10.object({}),
1910
+ inputSchema: z11.object({}),
1865
1911
  outputSchema: fileSearchOutputSchema
1866
1912
  });
1867
1913
 
1868
1914
  // src/tool/image-generation.ts
1869
1915
  import {
1870
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
1871
- lazySchema as lazySchema10,
1872
- zodSchema as zodSchema10
1916
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1917
+ lazySchema as lazySchema11,
1918
+ zodSchema as zodSchema11
1873
1919
  } from "@ai-sdk/provider-utils";
1874
- import { z as z11 } from "zod/v4";
1875
- var imageGenerationArgsSchema = lazySchema10(
1876
- () => zodSchema10(
1877
- z11.object({
1878
- background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1879
- inputFidelity: z11.enum(["low", "high"]).optional(),
1880
- inputImageMask: z11.object({
1881
- fileId: z11.string().optional(),
1882
- imageUrl: z11.string().optional()
1920
+ import { z as z12 } from "zod/v4";
1921
+ var imageGenerationArgsSchema = lazySchema11(
1922
+ () => zodSchema11(
1923
+ z12.object({
1924
+ background: z12.enum(["auto", "opaque", "transparent"]).optional(),
1925
+ inputFidelity: z12.enum(["low", "high"]).optional(),
1926
+ inputImageMask: z12.object({
1927
+ fileId: z12.string().optional(),
1928
+ imageUrl: z12.string().optional()
1883
1929
  }).optional(),
1884
- model: z11.string().optional(),
1885
- moderation: z11.enum(["auto"]).optional(),
1886
- outputCompression: z11.number().int().min(0).max(100).optional(),
1887
- outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1888
- partialImages: z11.number().int().min(0).max(3).optional(),
1889
- quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1890
- size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1930
+ model: z12.string().optional(),
1931
+ moderation: z12.enum(["auto"]).optional(),
1932
+ outputCompression: z12.number().int().min(0).max(100).optional(),
1933
+ outputFormat: z12.enum(["png", "jpeg", "webp"]).optional(),
1934
+ partialImages: z12.number().int().min(0).max(3).optional(),
1935
+ quality: z12.enum(["auto", "low", "medium", "high"]).optional(),
1936
+ size: z12.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1891
1937
  }).strict()
1892
1938
  )
1893
1939
  );
1894
- var imageGenerationInputSchema = lazySchema10(() => zodSchema10(z11.object({})));
1895
- var imageGenerationOutputSchema = lazySchema10(
1896
- () => zodSchema10(z11.object({ result: z11.string() }))
1940
+ var imageGenerationInputSchema = lazySchema11(() => zodSchema11(z12.object({})));
1941
+ var imageGenerationOutputSchema = lazySchema11(
1942
+ () => zodSchema11(z12.object({ result: z12.string() }))
1897
1943
  );
1898
- var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
1944
+ var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
1899
1945
  id: "openai.image_generation",
1900
1946
  inputSchema: imageGenerationInputSchema,
1901
1947
  outputSchema: imageGenerationOutputSchema
@@ -1906,102 +1952,46 @@ var imageGeneration = (args = {}) => {
1906
1952
 
1907
1953
  // src/tool/local-shell.ts
1908
1954
  import {
1909
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
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 = createProviderDefinedToolFactoryWithOutputSchema4({
1932
- id: "openai.local_shell",
1933
- inputSchema: localShellInputSchema,
1934
- outputSchema: localShellOutputSchema
1935
- });
1936
-
1937
- // src/tool/web-search.ts
1938
- import {
1939
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
1955
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1940
1956
  lazySchema as lazySchema12,
1941
1957
  zodSchema as zodSchema12
1942
1958
  } from "@ai-sdk/provider-utils";
1943
1959
  import { z as z13 } from "zod/v4";
1944
- var webSearchArgsSchema = lazySchema12(
1960
+ var localShellInputSchema = lazySchema12(
1945
1961
  () => zodSchema12(
1946
1962
  z13.object({
1947
- externalWebAccess: z13.boolean().optional(),
1948
- filters: z13.object({ allowedDomains: z13.array(z13.string()).optional() }).optional(),
1949
- searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1950
- userLocation: z13.object({
1951
- type: z13.literal("approximate"),
1952
- country: z13.string().optional(),
1953
- city: z13.string().optional(),
1954
- region: z13.string().optional(),
1955
- timezone: z13.string().optional()
1956
- }).optional()
1963
+ action: z13.object({
1964
+ type: z13.literal("exec"),
1965
+ command: z13.array(z13.string()),
1966
+ timeoutMs: z13.number().optional(),
1967
+ user: z13.string().optional(),
1968
+ workingDirectory: z13.string().optional(),
1969
+ env: z13.record(z13.string(), z13.string()).optional()
1970
+ })
1957
1971
  })
1958
1972
  )
1959
1973
  );
1960
- var webSearchInputSchema = lazySchema12(() => zodSchema12(z13.object({})));
1961
- var webSearchOutputSchema = lazySchema12(
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
- )
1974
+ var localShellOutputSchema = lazySchema12(
1975
+ () => zodSchema12(z13.object({ output: z13.string() }))
1987
1976
  );
1988
- var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
1989
- id: "openai.web_search",
1990
- inputSchema: webSearchInputSchema,
1991
- outputSchema: webSearchOutputSchema
1977
+ var localShell = createProviderToolFactoryWithOutputSchema5({
1978
+ id: "openai.local_shell",
1979
+ inputSchema: localShellInputSchema,
1980
+ outputSchema: localShellOutputSchema
1992
1981
  });
1993
- var webSearch = (args = {}) => webSearchToolFactory(args);
1994
1982
 
1995
- // src/tool/web-search-preview.ts
1983
+ // src/tool/web-search.ts
1996
1984
  import {
1997
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
1985
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1998
1986
  lazySchema as lazySchema13,
1999
1987
  zodSchema as zodSchema13
2000
1988
  } from "@ai-sdk/provider-utils";
2001
1989
  import { z as z14 } from "zod/v4";
2002
- var webSearchPreviewArgsSchema = lazySchema13(
1990
+ var webSearchArgsSchema = lazySchema13(
2003
1991
  () => zodSchema13(
2004
1992
  z14.object({
1993
+ externalWebAccess: z14.boolean().optional(),
1994
+ filters: z14.object({ allowedDomains: z14.array(z14.string()).optional() }).optional(),
2005
1995
  searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
2006
1996
  userLocation: z14.object({
2007
1997
  type: z14.literal("approximate"),
@@ -2013,10 +2003,8 @@ var webSearchPreviewArgsSchema = lazySchema13(
2013
2003
  })
2014
2004
  )
2015
2005
  );
2016
- var webSearchPreviewInputSchema = lazySchema13(
2017
- () => zodSchema13(z14.object({}))
2018
- );
2019
- var webSearchPreviewOutputSchema = lazySchema13(
2006
+ var webSearchInputSchema = lazySchema13(() => zodSchema13(z14.object({})));
2007
+ var webSearchOutputSchema = lazySchema13(
2020
2008
  () => zodSchema13(
2021
2009
  z14.object({
2022
2010
  action: z14.discriminatedUnion("type", [
@@ -2033,47 +2021,105 @@ var webSearchPreviewOutputSchema = lazySchema13(
2033
2021
  url: z14.string(),
2034
2022
  pattern: z14.string()
2035
2023
  })
2036
- ])
2024
+ ]),
2025
+ sources: z14.array(
2026
+ z14.discriminatedUnion("type", [
2027
+ z14.object({ type: z14.literal("url"), url: z14.string() }),
2028
+ z14.object({ type: z14.literal("api"), name: z14.string() })
2029
+ ])
2030
+ ).optional()
2037
2031
  })
2038
2032
  )
2039
2033
  );
2040
- var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema6({
2041
- id: "openai.web_search_preview",
2042
- inputSchema: webSearchPreviewInputSchema,
2043
- outputSchema: webSearchPreviewOutputSchema
2034
+ var webSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
2035
+ id: "openai.web_search",
2036
+ inputSchema: webSearchInputSchema,
2037
+ outputSchema: webSearchOutputSchema
2044
2038
  });
2039
+ var webSearch = (args = {}) => webSearchToolFactory(args);
2045
2040
 
2046
- // src/tool/mcp.ts
2041
+ // src/tool/web-search-preview.ts
2047
2042
  import {
2048
- createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema7,
2043
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2049
2044
  lazySchema as lazySchema14,
2050
2045
  zodSchema as zodSchema14
2051
2046
  } from "@ai-sdk/provider-utils";
2052
2047
  import { z as z15 } from "zod/v4";
2053
- var jsonValueSchema = z15.lazy(
2054
- () => z15.union([
2055
- z15.string(),
2056
- z15.number(),
2057
- z15.boolean(),
2058
- z15.null(),
2059
- z15.array(jsonValueSchema),
2060
- z15.record(z15.string(), jsonValueSchema)
2061
- ])
2048
+ var webSearchPreviewArgsSchema = lazySchema14(
2049
+ () => zodSchema14(
2050
+ z15.object({
2051
+ searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2052
+ userLocation: z15.object({
2053
+ type: z15.literal("approximate"),
2054
+ country: z15.string().optional(),
2055
+ city: z15.string().optional(),
2056
+ region: z15.string().optional(),
2057
+ timezone: z15.string().optional()
2058
+ }).optional()
2059
+ })
2060
+ )
2062
2061
  );
2063
- var mcpArgsSchema = lazySchema14(
2062
+ var webSearchPreviewInputSchema = lazySchema14(
2063
+ () => zodSchema14(z15.object({}))
2064
+ );
2065
+ var webSearchPreviewOutputSchema = lazySchema14(
2064
2066
  () => zodSchema14(
2065
2067
  z15.object({
2066
- serverLabel: z15.string(),
2067
- allowedTools: z15.union([
2068
- z15.array(z15.string()),
2068
+ action: z15.discriminatedUnion("type", [
2069
+ z15.object({
2070
+ type: z15.literal("search"),
2071
+ query: z15.string().optional()
2072
+ }),
2069
2073
  z15.object({
2070
- readOnly: z15.boolean().optional(),
2071
- toolNames: z15.array(z15.string()).optional()
2074
+ type: z15.literal("openPage"),
2075
+ url: z15.string()
2076
+ }),
2077
+ z15.object({
2078
+ type: z15.literal("find"),
2079
+ url: z15.string(),
2080
+ pattern: z15.string()
2081
+ })
2082
+ ])
2083
+ })
2084
+ )
2085
+ );
2086
+ var webSearchPreview = createProviderToolFactoryWithOutputSchema7({
2087
+ id: "openai.web_search_preview",
2088
+ inputSchema: webSearchPreviewInputSchema,
2089
+ outputSchema: webSearchPreviewOutputSchema
2090
+ });
2091
+
2092
+ // src/tool/mcp.ts
2093
+ import {
2094
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2095
+ lazySchema as lazySchema15,
2096
+ zodSchema as zodSchema15
2097
+ } from "@ai-sdk/provider-utils";
2098
+ import { z as z16 } from "zod/v4";
2099
+ var jsonValueSchema = z16.lazy(
2100
+ () => z16.union([
2101
+ z16.string(),
2102
+ z16.number(),
2103
+ z16.boolean(),
2104
+ z16.null(),
2105
+ z16.array(jsonValueSchema),
2106
+ z16.record(z16.string(), jsonValueSchema)
2107
+ ])
2108
+ );
2109
+ var mcpArgsSchema = lazySchema15(
2110
+ () => zodSchema15(
2111
+ z16.object({
2112
+ serverLabel: z16.string(),
2113
+ allowedTools: z16.union([
2114
+ z16.array(z16.string()),
2115
+ z16.object({
2116
+ readOnly: z16.boolean().optional(),
2117
+ toolNames: z16.array(z16.string()).optional()
2072
2118
  })
2073
2119
  ]).optional(),
2074
- authorization: z15.string().optional(),
2075
- connectorId: z15.string().optional(),
2076
- headers: z15.record(z15.string(), z15.string()).optional(),
2120
+ authorization: z16.string().optional(),
2121
+ connectorId: z16.string().optional(),
2122
+ headers: z16.record(z16.string(), z16.string()).optional(),
2077
2123
  // TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
2078
2124
  // requireApproval: z
2079
2125
  // .union([
@@ -2084,50 +2130,50 @@ var mcpArgsSchema = lazySchema14(
2084
2130
  // }),
2085
2131
  // ])
2086
2132
  // .optional(),
2087
- serverDescription: z15.string().optional(),
2088
- serverUrl: z15.string().optional()
2133
+ serverDescription: z16.string().optional(),
2134
+ serverUrl: z16.string().optional()
2089
2135
  }).refine(
2090
2136
  (v) => v.serverUrl != null || v.connectorId != null,
2091
2137
  "One of serverUrl or connectorId must be provided."
2092
2138
  )
2093
2139
  )
2094
2140
  );
2095
- var mcpInputSchema = lazySchema14(() => zodSchema14(z15.object({})));
2096
- var mcpOutputSchema = lazySchema14(
2097
- () => zodSchema14(
2098
- z15.discriminatedUnion("type", [
2099
- z15.object({
2100
- type: z15.literal("call"),
2101
- serverLabel: z15.string(),
2102
- name: z15.string(),
2103
- arguments: z15.string(),
2104
- output: z15.string().nullable().optional(),
2105
- error: z15.union([z15.string(), jsonValueSchema]).optional()
2141
+ var mcpInputSchema = lazySchema15(() => zodSchema15(z16.object({})));
2142
+ var mcpOutputSchema = lazySchema15(
2143
+ () => zodSchema15(
2144
+ z16.discriminatedUnion("type", [
2145
+ z16.object({
2146
+ type: z16.literal("call"),
2147
+ serverLabel: z16.string(),
2148
+ name: z16.string(),
2149
+ arguments: z16.string(),
2150
+ output: z16.string().nullable().optional(),
2151
+ error: z16.union([z16.string(), jsonValueSchema]).optional()
2106
2152
  }),
2107
- z15.object({
2108
- type: z15.literal("listTools"),
2109
- serverLabel: z15.string(),
2110
- tools: z15.array(
2111
- z15.object({
2112
- name: z15.string(),
2113
- description: z15.string().optional(),
2153
+ z16.object({
2154
+ type: z16.literal("listTools"),
2155
+ serverLabel: z16.string(),
2156
+ tools: z16.array(
2157
+ z16.object({
2158
+ name: z16.string(),
2159
+ description: z16.string().optional(),
2114
2160
  inputSchema: jsonValueSchema,
2115
- annotations: z15.record(z15.string(), jsonValueSchema).optional()
2161
+ annotations: z16.record(z16.string(), jsonValueSchema).optional()
2116
2162
  })
2117
2163
  ),
2118
- error: z15.union([z15.string(), jsonValueSchema]).optional()
2164
+ error: z16.union([z16.string(), jsonValueSchema]).optional()
2119
2165
  }),
2120
- z15.object({
2121
- type: z15.literal("approvalRequest"),
2122
- serverLabel: z15.string(),
2123
- name: z15.string(),
2124
- arguments: z15.string(),
2125
- approvalRequestId: z15.string()
2166
+ z16.object({
2167
+ type: z16.literal("approvalRequest"),
2168
+ serverLabel: z16.string(),
2169
+ name: z16.string(),
2170
+ arguments: z16.string(),
2171
+ approvalRequestId: z16.string()
2126
2172
  })
2127
2173
  ])
2128
2174
  )
2129
2175
  );
2130
- var mcpToolFactory = createProviderDefinedToolFactoryWithOutputSchema7({
2176
+ var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
2131
2177
  id: "openai.mcp",
2132
2178
  inputSchema: mcpInputSchema,
2133
2179
  outputSchema: mcpOutputSchema
@@ -2136,6 +2182,14 @@ var mcp = (args) => mcpToolFactory(args);
2136
2182
 
2137
2183
  // src/openai-tools.ts
2138
2184
  var openaiTools = {
2185
+ /**
2186
+ * The apply_patch tool lets GPT-5.1 create, update, and delete files in your
2187
+ * codebase using structured diffs. Instead of just suggesting edits, the model
2188
+ * emits patch operations that your application applies and then reports back on,
2189
+ * enabling iterative, multi-step code editing workflows.
2190
+ *
2191
+ */
2192
+ applyPatch,
2139
2193
  /**
2140
2194
  * The Code Interpreter tool allows models to write and run Python code in a
2141
2195
  * sandboxed environment to solve complex problems in domains like data analysis,
@@ -2236,7 +2290,7 @@ import {
2236
2290
  parseProviderOptions as parseProviderOptions4,
2237
2291
  validateTypes
2238
2292
  } from "@ai-sdk/provider-utils";
2239
- import { z as z16 } from "zod/v4";
2293
+ import { z as z17 } from "zod/v4";
2240
2294
  function isFileId(data, prefixes) {
2241
2295
  if (!prefixes) return false;
2242
2296
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2247,7 +2301,8 @@ async function convertToOpenAIResponsesInput({
2247
2301
  systemMessageMode,
2248
2302
  fileIdPrefixes,
2249
2303
  store,
2250
- hasLocalShellTool = false
2304
+ hasLocalShellTool = false,
2305
+ hasApplyPatchTool = false
2251
2306
  }) {
2252
2307
  var _a, _b, _c, _d, _e;
2253
2308
  const input = [];
@@ -2470,6 +2525,19 @@ async function convertToOpenAIResponsesInput({
2470
2525
  });
2471
2526
  break;
2472
2527
  }
2528
+ if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
2529
+ const parsedOutput = await validateTypes({
2530
+ value: output.value,
2531
+ schema: applyPatchOutputSchema
2532
+ });
2533
+ input.push({
2534
+ type: "apply_patch_call_output",
2535
+ call_id: part.toolCallId,
2536
+ status: parsedOutput.status,
2537
+ output: parsedOutput.output
2538
+ });
2539
+ break;
2540
+ }
2473
2541
  let contentValue;
2474
2542
  switch (output.type) {
2475
2543
  case "text":
@@ -2530,9 +2598,9 @@ async function convertToOpenAIResponsesInput({
2530
2598
  }
2531
2599
  return { input, warnings };
2532
2600
  }
2533
- var openaiResponsesReasoningProviderOptionsSchema = z16.object({
2534
- itemId: z16.string().nullish(),
2535
- reasoningEncryptedContent: z16.string().nullish()
2601
+ var openaiResponsesReasoningProviderOptionsSchema = z17.object({
2602
+ itemId: z17.string().nullish(),
2603
+ reasoningEncryptedContent: z17.string().nullish()
2536
2604
  });
2537
2605
 
2538
2606
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2554,349 +2622,393 @@ function mapOpenAIResponseFinishReason({
2554
2622
  }
2555
2623
 
2556
2624
  // src/responses/openai-responses-api.ts
2557
- import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
2558
- import { z as z17 } from "zod/v4";
2559
- var openaiResponsesChunkSchema = lazySchema15(
2560
- () => zodSchema15(
2561
- z17.union([
2562
- z17.object({
2563
- type: z17.literal("response.output_text.delta"),
2564
- item_id: z17.string(),
2565
- delta: z17.string(),
2566
- logprobs: z17.array(
2567
- z17.object({
2568
- token: z17.string(),
2569
- logprob: z17.number(),
2570
- top_logprobs: z17.array(
2571
- z17.object({
2572
- token: z17.string(),
2573
- logprob: z17.number()
2625
+ import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
2626
+ import { z as z18 } from "zod/v4";
2627
+ var openaiResponsesChunkSchema = lazySchema16(
2628
+ () => zodSchema16(
2629
+ z18.union([
2630
+ z18.object({
2631
+ type: z18.literal("response.output_text.delta"),
2632
+ item_id: z18.string(),
2633
+ delta: z18.string(),
2634
+ logprobs: z18.array(
2635
+ z18.object({
2636
+ token: z18.string(),
2637
+ logprob: z18.number(),
2638
+ top_logprobs: z18.array(
2639
+ z18.object({
2640
+ token: z18.string(),
2641
+ logprob: z18.number()
2574
2642
  })
2575
2643
  )
2576
2644
  })
2577
2645
  ).nullish()
2578
2646
  }),
2579
- z17.object({
2580
- type: z17.enum(["response.completed", "response.incomplete"]),
2581
- response: z17.object({
2582
- incomplete_details: z17.object({ reason: z17.string() }).nullish(),
2583
- usage: z17.object({
2584
- input_tokens: z17.number(),
2585
- input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
2586
- output_tokens: z17.number(),
2587
- output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
2647
+ z18.object({
2648
+ type: z18.enum(["response.completed", "response.incomplete"]),
2649
+ response: z18.object({
2650
+ incomplete_details: z18.object({ reason: z18.string() }).nullish(),
2651
+ usage: z18.object({
2652
+ input_tokens: z18.number(),
2653
+ input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
2654
+ output_tokens: z18.number(),
2655
+ output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
2588
2656
  }),
2589
- service_tier: z17.string().nullish()
2657
+ service_tier: z18.string().nullish()
2590
2658
  })
2591
2659
  }),
2592
- z17.object({
2593
- type: z17.literal("response.created"),
2594
- response: z17.object({
2595
- id: z17.string(),
2596
- created_at: z17.number(),
2597
- model: z17.string(),
2598
- service_tier: z17.string().nullish()
2660
+ z18.object({
2661
+ type: z18.literal("response.created"),
2662
+ response: z18.object({
2663
+ id: z18.string(),
2664
+ created_at: z18.number(),
2665
+ model: z18.string(),
2666
+ service_tier: z18.string().nullish()
2599
2667
  })
2600
2668
  }),
2601
- z17.object({
2602
- type: z17.literal("response.output_item.added"),
2603
- output_index: z17.number(),
2604
- item: z17.discriminatedUnion("type", [
2605
- z17.object({
2606
- type: z17.literal("message"),
2607
- id: z17.string()
2669
+ z18.object({
2670
+ type: z18.literal("response.output_item.added"),
2671
+ output_index: z18.number(),
2672
+ item: z18.discriminatedUnion("type", [
2673
+ z18.object({
2674
+ type: z18.literal("message"),
2675
+ id: z18.string()
2608
2676
  }),
2609
- z17.object({
2610
- type: z17.literal("reasoning"),
2611
- id: z17.string(),
2612
- encrypted_content: z17.string().nullish()
2677
+ z18.object({
2678
+ type: z18.literal("reasoning"),
2679
+ id: z18.string(),
2680
+ encrypted_content: z18.string().nullish()
2613
2681
  }),
2614
- z17.object({
2615
- type: z17.literal("function_call"),
2616
- id: z17.string(),
2617
- call_id: z17.string(),
2618
- name: z17.string(),
2619
- arguments: z17.string()
2682
+ z18.object({
2683
+ type: z18.literal("function_call"),
2684
+ id: z18.string(),
2685
+ call_id: z18.string(),
2686
+ name: z18.string(),
2687
+ arguments: z18.string()
2620
2688
  }),
2621
- z17.object({
2622
- type: z17.literal("web_search_call"),
2623
- id: z17.string(),
2624
- status: z17.string()
2689
+ z18.object({
2690
+ type: z18.literal("web_search_call"),
2691
+ id: z18.string(),
2692
+ status: z18.string()
2625
2693
  }),
2626
- z17.object({
2627
- type: z17.literal("computer_call"),
2628
- id: z17.string(),
2629
- status: z17.string()
2694
+ z18.object({
2695
+ type: z18.literal("computer_call"),
2696
+ id: z18.string(),
2697
+ status: z18.string()
2630
2698
  }),
2631
- z17.object({
2632
- type: z17.literal("file_search_call"),
2633
- id: z17.string()
2699
+ z18.object({
2700
+ type: z18.literal("file_search_call"),
2701
+ id: z18.string()
2634
2702
  }),
2635
- z17.object({
2636
- type: z17.literal("image_generation_call"),
2637
- id: z17.string()
2703
+ z18.object({
2704
+ type: z18.literal("image_generation_call"),
2705
+ id: z18.string()
2638
2706
  }),
2639
- z17.object({
2640
- type: z17.literal("code_interpreter_call"),
2641
- id: z17.string(),
2642
- container_id: z17.string(),
2643
- code: z17.string().nullable(),
2644
- outputs: z17.array(
2645
- z17.discriminatedUnion("type", [
2646
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2647
- z17.object({ type: z17.literal("image"), url: z17.string() })
2707
+ z18.object({
2708
+ type: z18.literal("code_interpreter_call"),
2709
+ id: z18.string(),
2710
+ container_id: z18.string(),
2711
+ code: z18.string().nullable(),
2712
+ outputs: z18.array(
2713
+ z18.discriminatedUnion("type", [
2714
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
2715
+ z18.object({ type: z18.literal("image"), url: z18.string() })
2648
2716
  ])
2649
2717
  ).nullable(),
2650
- status: z17.string()
2718
+ status: z18.string()
2719
+ }),
2720
+ z18.object({
2721
+ type: z18.literal("mcp_call"),
2722
+ id: z18.string(),
2723
+ status: z18.string()
2651
2724
  }),
2652
- z17.object({
2653
- type: z17.literal("mcp_call"),
2654
- id: z17.string(),
2655
- status: z17.string()
2725
+ z18.object({
2726
+ type: z18.literal("mcp_list_tools"),
2727
+ id: z18.string()
2656
2728
  }),
2657
- z17.object({
2658
- type: z17.literal("mcp_list_tools"),
2659
- id: z17.string()
2729
+ z18.object({
2730
+ type: z18.literal("mcp_approval_request"),
2731
+ id: z18.string()
2660
2732
  }),
2661
- z17.object({
2662
- type: z17.literal("mcp_approval_request"),
2663
- id: z17.string()
2733
+ z18.object({
2734
+ type: z18.literal("apply_patch_call"),
2735
+ id: z18.string(),
2736
+ call_id: z18.string(),
2737
+ status: z18.enum(["in_progress", "completed"]),
2738
+ operation: z18.discriminatedUnion("type", [
2739
+ z18.object({
2740
+ type: z18.literal("create_file"),
2741
+ path: z18.string(),
2742
+ diff: z18.string()
2743
+ }),
2744
+ z18.object({
2745
+ type: z18.literal("delete_file"),
2746
+ path: z18.string()
2747
+ }),
2748
+ z18.object({
2749
+ type: z18.literal("update_file"),
2750
+ path: z18.string(),
2751
+ diff: z18.string()
2752
+ })
2753
+ ])
2664
2754
  })
2665
2755
  ])
2666
2756
  }),
2667
- z17.object({
2668
- type: z17.literal("response.output_item.done"),
2669
- output_index: z17.number(),
2670
- item: z17.discriminatedUnion("type", [
2671
- z17.object({
2672
- type: z17.literal("message"),
2673
- id: z17.string()
2757
+ z18.object({
2758
+ type: z18.literal("response.output_item.done"),
2759
+ output_index: z18.number(),
2760
+ item: z18.discriminatedUnion("type", [
2761
+ z18.object({
2762
+ type: z18.literal("message"),
2763
+ id: z18.string()
2674
2764
  }),
2675
- z17.object({
2676
- type: z17.literal("reasoning"),
2677
- id: z17.string(),
2678
- encrypted_content: z17.string().nullish()
2765
+ z18.object({
2766
+ type: z18.literal("reasoning"),
2767
+ id: z18.string(),
2768
+ encrypted_content: z18.string().nullish()
2679
2769
  }),
2680
- z17.object({
2681
- type: z17.literal("function_call"),
2682
- id: z17.string(),
2683
- call_id: z17.string(),
2684
- name: z17.string(),
2685
- arguments: z17.string(),
2686
- status: z17.literal("completed")
2770
+ z18.object({
2771
+ type: z18.literal("function_call"),
2772
+ id: z18.string(),
2773
+ call_id: z18.string(),
2774
+ name: z18.string(),
2775
+ arguments: z18.string(),
2776
+ status: z18.literal("completed")
2687
2777
  }),
2688
- z17.object({
2689
- type: z17.literal("code_interpreter_call"),
2690
- id: z17.string(),
2691
- code: z17.string().nullable(),
2692
- container_id: z17.string(),
2693
- outputs: z17.array(
2694
- z17.discriminatedUnion("type", [
2695
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2696
- z17.object({ type: z17.literal("image"), url: z17.string() })
2778
+ z18.object({
2779
+ type: z18.literal("code_interpreter_call"),
2780
+ id: z18.string(),
2781
+ code: z18.string().nullable(),
2782
+ container_id: z18.string(),
2783
+ outputs: z18.array(
2784
+ z18.discriminatedUnion("type", [
2785
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
2786
+ z18.object({ type: z18.literal("image"), url: z18.string() })
2697
2787
  ])
2698
2788
  ).nullable()
2699
2789
  }),
2700
- z17.object({
2701
- type: z17.literal("image_generation_call"),
2702
- id: z17.string(),
2703
- result: z17.string()
2790
+ z18.object({
2791
+ type: z18.literal("image_generation_call"),
2792
+ id: z18.string(),
2793
+ result: z18.string()
2704
2794
  }),
2705
- z17.object({
2706
- type: z17.literal("web_search_call"),
2707
- id: z17.string(),
2708
- status: z17.string(),
2709
- action: z17.discriminatedUnion("type", [
2710
- z17.object({
2711
- type: z17.literal("search"),
2712
- query: z17.string().nullish(),
2713
- sources: z17.array(
2714
- z17.discriminatedUnion("type", [
2715
- z17.object({ type: z17.literal("url"), url: z17.string() }),
2716
- z17.object({ type: z17.literal("api"), name: z17.string() })
2795
+ z18.object({
2796
+ type: z18.literal("web_search_call"),
2797
+ id: z18.string(),
2798
+ status: z18.string(),
2799
+ action: z18.discriminatedUnion("type", [
2800
+ z18.object({
2801
+ type: z18.literal("search"),
2802
+ query: z18.string().nullish(),
2803
+ sources: z18.array(
2804
+ z18.discriminatedUnion("type", [
2805
+ z18.object({ type: z18.literal("url"), url: z18.string() }),
2806
+ z18.object({ type: z18.literal("api"), name: z18.string() })
2717
2807
  ])
2718
2808
  ).nullish()
2719
2809
  }),
2720
- z17.object({
2721
- type: z17.literal("open_page"),
2722
- url: z17.string()
2810
+ z18.object({
2811
+ type: z18.literal("open_page"),
2812
+ url: z18.string()
2723
2813
  }),
2724
- z17.object({
2725
- type: z17.literal("find"),
2726
- url: z17.string(),
2727
- pattern: z17.string()
2814
+ z18.object({
2815
+ type: z18.literal("find"),
2816
+ url: z18.string(),
2817
+ pattern: z18.string()
2728
2818
  })
2729
2819
  ])
2730
2820
  }),
2731
- z17.object({
2732
- type: z17.literal("file_search_call"),
2733
- id: z17.string(),
2734
- queries: z17.array(z17.string()),
2735
- results: z17.array(
2736
- z17.object({
2737
- attributes: z17.record(
2738
- z17.string(),
2739
- z17.union([z17.string(), z17.number(), z17.boolean()])
2821
+ z18.object({
2822
+ type: z18.literal("file_search_call"),
2823
+ id: z18.string(),
2824
+ queries: z18.array(z18.string()),
2825
+ results: z18.array(
2826
+ z18.object({
2827
+ attributes: z18.record(
2828
+ z18.string(),
2829
+ z18.union([z18.string(), z18.number(), z18.boolean()])
2740
2830
  ),
2741
- file_id: z17.string(),
2742
- filename: z17.string(),
2743
- score: z17.number(),
2744
- text: z17.string()
2831
+ file_id: z18.string(),
2832
+ filename: z18.string(),
2833
+ score: z18.number(),
2834
+ text: z18.string()
2745
2835
  })
2746
2836
  ).nullish()
2747
2837
  }),
2748
- z17.object({
2749
- type: z17.literal("local_shell_call"),
2750
- id: z17.string(),
2751
- call_id: z17.string(),
2752
- action: z17.object({
2753
- type: z17.literal("exec"),
2754
- command: z17.array(z17.string()),
2755
- timeout_ms: z17.number().optional(),
2756
- user: z17.string().optional(),
2757
- working_directory: z17.string().optional(),
2758
- env: z17.record(z17.string(), z17.string()).optional()
2838
+ z18.object({
2839
+ type: z18.literal("local_shell_call"),
2840
+ id: z18.string(),
2841
+ call_id: z18.string(),
2842
+ action: z18.object({
2843
+ type: z18.literal("exec"),
2844
+ command: z18.array(z18.string()),
2845
+ timeout_ms: z18.number().optional(),
2846
+ user: z18.string().optional(),
2847
+ working_directory: z18.string().optional(),
2848
+ env: z18.record(z18.string(), z18.string()).optional()
2759
2849
  })
2760
2850
  }),
2761
- z17.object({
2762
- type: z17.literal("computer_call"),
2763
- id: z17.string(),
2764
- status: z17.literal("completed")
2851
+ z18.object({
2852
+ type: z18.literal("computer_call"),
2853
+ id: z18.string(),
2854
+ status: z18.literal("completed")
2765
2855
  }),
2766
- z17.object({
2767
- type: z17.literal("mcp_call"),
2768
- id: z17.string(),
2769
- status: z17.string(),
2770
- arguments: z17.string(),
2771
- name: z17.string(),
2772
- server_label: z17.string(),
2773
- output: z17.string().nullish(),
2774
- error: z17.union([
2775
- z17.string(),
2776
- z17.object({
2777
- type: z17.string().optional(),
2778
- code: z17.union([z17.number(), z17.string()]).optional(),
2779
- message: z17.string().optional()
2856
+ z18.object({
2857
+ type: z18.literal("mcp_call"),
2858
+ id: z18.string(),
2859
+ status: z18.string(),
2860
+ arguments: z18.string(),
2861
+ name: z18.string(),
2862
+ server_label: z18.string(),
2863
+ output: z18.string().nullish(),
2864
+ error: z18.union([
2865
+ z18.string(),
2866
+ z18.object({
2867
+ type: z18.string().optional(),
2868
+ code: z18.union([z18.number(), z18.string()]).optional(),
2869
+ message: z18.string().optional()
2780
2870
  }).loose()
2781
2871
  ]).nullish()
2782
2872
  }),
2783
- z17.object({
2784
- type: z17.literal("mcp_list_tools"),
2785
- id: z17.string(),
2786
- server_label: z17.string(),
2787
- tools: z17.array(
2788
- z17.object({
2789
- name: z17.string(),
2790
- description: z17.string().optional(),
2791
- input_schema: z17.any(),
2792
- annotations: z17.record(z17.string(), z17.unknown()).optional()
2873
+ z18.object({
2874
+ type: z18.literal("mcp_list_tools"),
2875
+ id: z18.string(),
2876
+ server_label: z18.string(),
2877
+ tools: z18.array(
2878
+ z18.object({
2879
+ name: z18.string(),
2880
+ description: z18.string().optional(),
2881
+ input_schema: z18.any(),
2882
+ annotations: z18.record(z18.string(), z18.unknown()).optional()
2793
2883
  })
2794
2884
  ),
2795
- error: z17.union([
2796
- z17.string(),
2797
- z17.object({
2798
- type: z17.string().optional(),
2799
- code: z17.union([z17.number(), z17.string()]).optional(),
2800
- message: z17.string().optional()
2885
+ error: z18.union([
2886
+ z18.string(),
2887
+ z18.object({
2888
+ type: z18.string().optional(),
2889
+ code: z18.union([z18.number(), z18.string()]).optional(),
2890
+ message: z18.string().optional()
2801
2891
  }).loose()
2802
2892
  ]).optional()
2803
2893
  }),
2804
- z17.object({
2805
- type: z17.literal("mcp_approval_request"),
2806
- id: z17.string(),
2807
- server_label: z17.string(),
2808
- name: z17.string(),
2809
- arguments: z17.string(),
2810
- approval_request_id: z17.string()
2894
+ z18.object({
2895
+ type: z18.literal("mcp_approval_request"),
2896
+ id: z18.string(),
2897
+ server_label: z18.string(),
2898
+ name: z18.string(),
2899
+ arguments: z18.string(),
2900
+ approval_request_id: z18.string()
2901
+ }),
2902
+ z18.object({
2903
+ type: z18.literal("apply_patch_call"),
2904
+ id: z18.string(),
2905
+ call_id: z18.string(),
2906
+ status: z18.enum(["in_progress", "completed"]),
2907
+ operation: z18.discriminatedUnion("type", [
2908
+ z18.object({
2909
+ type: z18.literal("create_file"),
2910
+ path: z18.string(),
2911
+ diff: z18.string()
2912
+ }),
2913
+ z18.object({
2914
+ type: z18.literal("delete_file"),
2915
+ path: z18.string()
2916
+ }),
2917
+ z18.object({
2918
+ type: z18.literal("update_file"),
2919
+ path: z18.string(),
2920
+ diff: z18.string()
2921
+ })
2922
+ ])
2811
2923
  })
2812
2924
  ])
2813
2925
  }),
2814
- z17.object({
2815
- type: z17.literal("response.function_call_arguments.delta"),
2816
- item_id: z17.string(),
2817
- output_index: z17.number(),
2818
- delta: z17.string()
2926
+ z18.object({
2927
+ type: z18.literal("response.function_call_arguments.delta"),
2928
+ item_id: z18.string(),
2929
+ output_index: z18.number(),
2930
+ delta: z18.string()
2819
2931
  }),
2820
- z17.object({
2821
- type: z17.literal("response.image_generation_call.partial_image"),
2822
- item_id: z17.string(),
2823
- output_index: z17.number(),
2824
- partial_image_b64: z17.string()
2932
+ z18.object({
2933
+ type: z18.literal("response.image_generation_call.partial_image"),
2934
+ item_id: z18.string(),
2935
+ output_index: z18.number(),
2936
+ partial_image_b64: z18.string()
2825
2937
  }),
2826
- z17.object({
2827
- type: z17.literal("response.code_interpreter_call_code.delta"),
2828
- item_id: z17.string(),
2829
- output_index: z17.number(),
2830
- delta: z17.string()
2938
+ z18.object({
2939
+ type: z18.literal("response.code_interpreter_call_code.delta"),
2940
+ item_id: z18.string(),
2941
+ output_index: z18.number(),
2942
+ delta: z18.string()
2831
2943
  }),
2832
- z17.object({
2833
- type: z17.literal("response.code_interpreter_call_code.done"),
2834
- item_id: z17.string(),
2835
- output_index: z17.number(),
2836
- code: z17.string()
2944
+ z18.object({
2945
+ type: z18.literal("response.code_interpreter_call_code.done"),
2946
+ item_id: z18.string(),
2947
+ output_index: z18.number(),
2948
+ code: z18.string()
2837
2949
  }),
2838
- z17.object({
2839
- type: z17.literal("response.output_text.annotation.added"),
2840
- annotation: z17.discriminatedUnion("type", [
2841
- z17.object({
2842
- type: z17.literal("url_citation"),
2843
- start_index: z17.number(),
2844
- end_index: z17.number(),
2845
- url: z17.string(),
2846
- title: z17.string()
2950
+ z18.object({
2951
+ type: z18.literal("response.output_text.annotation.added"),
2952
+ annotation: z18.discriminatedUnion("type", [
2953
+ z18.object({
2954
+ type: z18.literal("url_citation"),
2955
+ start_index: z18.number(),
2956
+ end_index: z18.number(),
2957
+ url: z18.string(),
2958
+ title: z18.string()
2847
2959
  }),
2848
- z17.object({
2849
- type: z17.literal("file_citation"),
2850
- file_id: z17.string(),
2851
- filename: z17.string().nullish(),
2852
- index: z17.number().nullish(),
2853
- start_index: z17.number().nullish(),
2854
- end_index: z17.number().nullish(),
2855
- quote: z17.string().nullish()
2960
+ z18.object({
2961
+ type: z18.literal("file_citation"),
2962
+ file_id: z18.string(),
2963
+ filename: z18.string().nullish(),
2964
+ index: z18.number().nullish(),
2965
+ start_index: z18.number().nullish(),
2966
+ end_index: z18.number().nullish(),
2967
+ quote: z18.string().nullish()
2856
2968
  }),
2857
- z17.object({
2858
- type: z17.literal("container_file_citation"),
2859
- container_id: z17.string(),
2860
- file_id: z17.string(),
2861
- filename: z17.string().nullish(),
2862
- start_index: z17.number().nullish(),
2863
- end_index: z17.number().nullish(),
2864
- index: z17.number().nullish()
2969
+ z18.object({
2970
+ type: z18.literal("container_file_citation"),
2971
+ container_id: z18.string(),
2972
+ file_id: z18.string(),
2973
+ filename: z18.string().nullish(),
2974
+ start_index: z18.number().nullish(),
2975
+ end_index: z18.number().nullish(),
2976
+ index: z18.number().nullish()
2865
2977
  }),
2866
- z17.object({
2867
- type: z17.literal("file_path"),
2868
- file_id: z17.string(),
2869
- index: z17.number().nullish()
2978
+ z18.object({
2979
+ type: z18.literal("file_path"),
2980
+ file_id: z18.string(),
2981
+ index: z18.number().nullish()
2870
2982
  })
2871
2983
  ])
2872
2984
  }),
2873
- z17.object({
2874
- type: z17.literal("response.reasoning_summary_part.added"),
2875
- item_id: z17.string(),
2876
- summary_index: z17.number()
2985
+ z18.object({
2986
+ type: z18.literal("response.reasoning_summary_part.added"),
2987
+ item_id: z18.string(),
2988
+ summary_index: z18.number()
2877
2989
  }),
2878
- z17.object({
2879
- type: z17.literal("response.reasoning_summary_text.delta"),
2880
- item_id: z17.string(),
2881
- summary_index: z17.number(),
2882
- delta: z17.string()
2990
+ z18.object({
2991
+ type: z18.literal("response.reasoning_summary_text.delta"),
2992
+ item_id: z18.string(),
2993
+ summary_index: z18.number(),
2994
+ delta: z18.string()
2883
2995
  }),
2884
- z17.object({
2885
- type: z17.literal("response.reasoning_summary_part.done"),
2886
- item_id: z17.string(),
2887
- summary_index: z17.number()
2996
+ z18.object({
2997
+ type: z18.literal("response.reasoning_summary_part.done"),
2998
+ item_id: z18.string(),
2999
+ summary_index: z18.number()
2888
3000
  }),
2889
- z17.object({
2890
- type: z17.literal("error"),
2891
- sequence_number: z17.number(),
2892
- error: z17.object({
2893
- type: z17.string(),
2894
- code: z17.string(),
2895
- message: z17.string(),
2896
- param: z17.string().nullish()
3001
+ z18.object({
3002
+ type: z18.literal("error"),
3003
+ sequence_number: z18.number(),
3004
+ error: z18.object({
3005
+ type: z18.string(),
3006
+ code: z18.string(),
3007
+ message: z18.string(),
3008
+ param: z18.string().nullish()
2897
3009
  })
2898
3010
  }),
2899
- z17.object({ type: z17.string() }).loose().transform((value) => ({
3011
+ z18.object({ type: z18.string() }).loose().transform((value) => ({
2900
3012
  type: "unknown_chunk",
2901
3013
  message: value.type
2902
3014
  }))
@@ -2904,236 +3016,258 @@ var openaiResponsesChunkSchema = lazySchema15(
2904
3016
  ])
2905
3017
  )
2906
3018
  );
2907
- var openaiResponsesResponseSchema = lazySchema15(
2908
- () => zodSchema15(
2909
- z17.object({
2910
- id: z17.string().optional(),
2911
- created_at: z17.number().optional(),
2912
- error: z17.object({
2913
- message: z17.string(),
2914
- type: z17.string(),
2915
- param: z17.string().nullish(),
2916
- code: z17.string()
3019
+ var openaiResponsesResponseSchema = lazySchema16(
3020
+ () => zodSchema16(
3021
+ z18.object({
3022
+ id: z18.string().optional(),
3023
+ created_at: z18.number().optional(),
3024
+ error: z18.object({
3025
+ message: z18.string(),
3026
+ type: z18.string(),
3027
+ param: z18.string().nullish(),
3028
+ code: z18.string()
2917
3029
  }).nullish(),
2918
- model: z17.string().optional(),
2919
- output: z17.array(
2920
- z17.discriminatedUnion("type", [
2921
- z17.object({
2922
- type: z17.literal("message"),
2923
- role: z17.literal("assistant"),
2924
- id: z17.string(),
2925
- content: z17.array(
2926
- z17.object({
2927
- type: z17.literal("output_text"),
2928
- text: z17.string(),
2929
- logprobs: z17.array(
2930
- z17.object({
2931
- token: z17.string(),
2932
- logprob: z17.number(),
2933
- top_logprobs: z17.array(
2934
- z17.object({
2935
- token: z17.string(),
2936
- logprob: z17.number()
3030
+ model: z18.string().optional(),
3031
+ output: z18.array(
3032
+ z18.discriminatedUnion("type", [
3033
+ z18.object({
3034
+ type: z18.literal("message"),
3035
+ role: z18.literal("assistant"),
3036
+ id: z18.string(),
3037
+ content: z18.array(
3038
+ z18.object({
3039
+ type: z18.literal("output_text"),
3040
+ text: z18.string(),
3041
+ logprobs: z18.array(
3042
+ z18.object({
3043
+ token: z18.string(),
3044
+ logprob: z18.number(),
3045
+ top_logprobs: z18.array(
3046
+ z18.object({
3047
+ token: z18.string(),
3048
+ logprob: z18.number()
2937
3049
  })
2938
3050
  )
2939
3051
  })
2940
3052
  ).nullish(),
2941
- annotations: z17.array(
2942
- z17.discriminatedUnion("type", [
2943
- z17.object({
2944
- type: z17.literal("url_citation"),
2945
- start_index: z17.number(),
2946
- end_index: z17.number(),
2947
- url: z17.string(),
2948
- title: z17.string()
3053
+ annotations: z18.array(
3054
+ z18.discriminatedUnion("type", [
3055
+ z18.object({
3056
+ type: z18.literal("url_citation"),
3057
+ start_index: z18.number(),
3058
+ end_index: z18.number(),
3059
+ url: z18.string(),
3060
+ title: z18.string()
2949
3061
  }),
2950
- z17.object({
2951
- type: z17.literal("file_citation"),
2952
- file_id: z17.string(),
2953
- filename: z17.string().nullish(),
2954
- index: z17.number().nullish(),
2955
- start_index: z17.number().nullish(),
2956
- end_index: z17.number().nullish(),
2957
- quote: z17.string().nullish()
3062
+ z18.object({
3063
+ type: z18.literal("file_citation"),
3064
+ file_id: z18.string(),
3065
+ filename: z18.string().nullish(),
3066
+ index: z18.number().nullish(),
3067
+ start_index: z18.number().nullish(),
3068
+ end_index: z18.number().nullish(),
3069
+ quote: z18.string().nullish()
2958
3070
  }),
2959
- z17.object({
2960
- type: z17.literal("container_file_citation"),
2961
- container_id: z17.string(),
2962
- file_id: z17.string(),
2963
- filename: z17.string().nullish(),
2964
- start_index: z17.number().nullish(),
2965
- end_index: z17.number().nullish(),
2966
- index: z17.number().nullish()
3071
+ z18.object({
3072
+ type: z18.literal("container_file_citation"),
3073
+ container_id: z18.string(),
3074
+ file_id: z18.string(),
3075
+ filename: z18.string().nullish(),
3076
+ start_index: z18.number().nullish(),
3077
+ end_index: z18.number().nullish(),
3078
+ index: z18.number().nullish()
2967
3079
  }),
2968
- z17.object({
2969
- type: z17.literal("file_path"),
2970
- file_id: z17.string(),
2971
- index: z17.number().nullish()
3080
+ z18.object({
3081
+ type: z18.literal("file_path"),
3082
+ file_id: z18.string(),
3083
+ index: z18.number().nullish()
2972
3084
  })
2973
3085
  ])
2974
3086
  )
2975
3087
  })
2976
3088
  )
2977
3089
  }),
2978
- z17.object({
2979
- type: z17.literal("web_search_call"),
2980
- id: z17.string(),
2981
- status: z17.string(),
2982
- action: z17.discriminatedUnion("type", [
2983
- z17.object({
2984
- type: z17.literal("search"),
2985
- query: z17.string().nullish(),
2986
- sources: z17.array(
2987
- z17.discriminatedUnion("type", [
2988
- z17.object({ type: z17.literal("url"), url: z17.string() }),
2989
- z17.object({ type: z17.literal("api"), name: z17.string() })
3090
+ z18.object({
3091
+ type: z18.literal("web_search_call"),
3092
+ id: z18.string(),
3093
+ status: z18.string(),
3094
+ action: z18.discriminatedUnion("type", [
3095
+ z18.object({
3096
+ type: z18.literal("search"),
3097
+ query: z18.string().nullish(),
3098
+ sources: z18.array(
3099
+ z18.discriminatedUnion("type", [
3100
+ z18.object({ type: z18.literal("url"), url: z18.string() }),
3101
+ z18.object({ type: z18.literal("api"), name: z18.string() })
2990
3102
  ])
2991
3103
  ).nullish()
2992
3104
  }),
2993
- z17.object({
2994
- type: z17.literal("open_page"),
2995
- url: z17.string()
3105
+ z18.object({
3106
+ type: z18.literal("open_page"),
3107
+ url: z18.string()
2996
3108
  }),
2997
- z17.object({
2998
- type: z17.literal("find"),
2999
- url: z17.string(),
3000
- pattern: z17.string()
3109
+ z18.object({
3110
+ type: z18.literal("find"),
3111
+ url: z18.string(),
3112
+ pattern: z18.string()
3001
3113
  })
3002
3114
  ])
3003
3115
  }),
3004
- z17.object({
3005
- type: z17.literal("file_search_call"),
3006
- id: z17.string(),
3007
- queries: z17.array(z17.string()),
3008
- results: z17.array(
3009
- z17.object({
3010
- attributes: z17.record(
3011
- z17.string(),
3012
- z17.union([z17.string(), z17.number(), z17.boolean()])
3116
+ z18.object({
3117
+ type: z18.literal("file_search_call"),
3118
+ id: z18.string(),
3119
+ queries: z18.array(z18.string()),
3120
+ results: z18.array(
3121
+ z18.object({
3122
+ attributes: z18.record(
3123
+ z18.string(),
3124
+ z18.union([z18.string(), z18.number(), z18.boolean()])
3013
3125
  ),
3014
- file_id: z17.string(),
3015
- filename: z17.string(),
3016
- score: z17.number(),
3017
- text: z17.string()
3126
+ file_id: z18.string(),
3127
+ filename: z18.string(),
3128
+ score: z18.number(),
3129
+ text: z18.string()
3018
3130
  })
3019
3131
  ).nullish()
3020
3132
  }),
3021
- z17.object({
3022
- type: z17.literal("code_interpreter_call"),
3023
- id: z17.string(),
3024
- code: z17.string().nullable(),
3025
- container_id: z17.string(),
3026
- outputs: z17.array(
3027
- z17.discriminatedUnion("type", [
3028
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3029
- z17.object({ type: z17.literal("image"), url: z17.string() })
3133
+ z18.object({
3134
+ type: z18.literal("code_interpreter_call"),
3135
+ id: z18.string(),
3136
+ code: z18.string().nullable(),
3137
+ container_id: z18.string(),
3138
+ outputs: z18.array(
3139
+ z18.discriminatedUnion("type", [
3140
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3141
+ z18.object({ type: z18.literal("image"), url: z18.string() })
3030
3142
  ])
3031
3143
  ).nullable()
3032
3144
  }),
3033
- z17.object({
3034
- type: z17.literal("image_generation_call"),
3035
- id: z17.string(),
3036
- result: z17.string()
3145
+ z18.object({
3146
+ type: z18.literal("image_generation_call"),
3147
+ id: z18.string(),
3148
+ result: z18.string()
3037
3149
  }),
3038
- z17.object({
3039
- type: z17.literal("local_shell_call"),
3040
- id: z17.string(),
3041
- call_id: z17.string(),
3042
- action: z17.object({
3043
- type: z17.literal("exec"),
3044
- command: z17.array(z17.string()),
3045
- timeout_ms: z17.number().optional(),
3046
- user: z17.string().optional(),
3047
- working_directory: z17.string().optional(),
3048
- env: z17.record(z17.string(), z17.string()).optional()
3150
+ z18.object({
3151
+ type: z18.literal("local_shell_call"),
3152
+ id: z18.string(),
3153
+ call_id: z18.string(),
3154
+ action: z18.object({
3155
+ type: z18.literal("exec"),
3156
+ command: z18.array(z18.string()),
3157
+ timeout_ms: z18.number().optional(),
3158
+ user: z18.string().optional(),
3159
+ working_directory: z18.string().optional(),
3160
+ env: z18.record(z18.string(), z18.string()).optional()
3049
3161
  })
3050
3162
  }),
3051
- z17.object({
3052
- type: z17.literal("function_call"),
3053
- call_id: z17.string(),
3054
- name: z17.string(),
3055
- arguments: z17.string(),
3056
- id: z17.string()
3163
+ z18.object({
3164
+ type: z18.literal("function_call"),
3165
+ call_id: z18.string(),
3166
+ name: z18.string(),
3167
+ arguments: z18.string(),
3168
+ id: z18.string()
3057
3169
  }),
3058
- z17.object({
3059
- type: z17.literal("computer_call"),
3060
- id: z17.string(),
3061
- status: z17.string().optional()
3170
+ z18.object({
3171
+ type: z18.literal("computer_call"),
3172
+ id: z18.string(),
3173
+ status: z18.string().optional()
3062
3174
  }),
3063
- z17.object({
3064
- type: z17.literal("reasoning"),
3065
- id: z17.string(),
3066
- encrypted_content: z17.string().nullish(),
3067
- summary: z17.array(
3068
- z17.object({
3069
- type: z17.literal("summary_text"),
3070
- text: z17.string()
3175
+ z18.object({
3176
+ type: z18.literal("reasoning"),
3177
+ id: z18.string(),
3178
+ encrypted_content: z18.string().nullish(),
3179
+ summary: z18.array(
3180
+ z18.object({
3181
+ type: z18.literal("summary_text"),
3182
+ text: z18.string()
3071
3183
  })
3072
3184
  )
3073
3185
  }),
3074
- z17.object({
3075
- type: z17.literal("mcp_call"),
3076
- id: z17.string(),
3077
- status: z17.string(),
3078
- arguments: z17.string(),
3079
- name: z17.string(),
3080
- server_label: z17.string(),
3081
- output: z17.string().nullish(),
3082
- error: z17.union([
3083
- z17.string(),
3084
- z17.object({
3085
- type: z17.string().optional(),
3086
- code: z17.union([z17.number(), z17.string()]).optional(),
3087
- message: z17.string().optional()
3186
+ z18.object({
3187
+ type: z18.literal("mcp_call"),
3188
+ id: z18.string(),
3189
+ status: z18.string(),
3190
+ arguments: z18.string(),
3191
+ name: z18.string(),
3192
+ server_label: z18.string(),
3193
+ output: z18.string().nullish(),
3194
+ error: z18.union([
3195
+ z18.string(),
3196
+ z18.object({
3197
+ type: z18.string().optional(),
3198
+ code: z18.union([z18.number(), z18.string()]).optional(),
3199
+ message: z18.string().optional()
3088
3200
  }).loose()
3089
3201
  ]).nullish()
3090
3202
  }),
3091
- z17.object({
3092
- type: z17.literal("mcp_list_tools"),
3093
- id: z17.string(),
3094
- server_label: z17.string(),
3095
- tools: z17.array(
3096
- z17.object({
3097
- name: z17.string(),
3098
- description: z17.string().optional(),
3099
- input_schema: z17.any(),
3100
- annotations: z17.record(z17.string(), z17.unknown()).optional()
3203
+ z18.object({
3204
+ type: z18.literal("mcp_list_tools"),
3205
+ id: z18.string(),
3206
+ server_label: z18.string(),
3207
+ tools: z18.array(
3208
+ z18.object({
3209
+ name: z18.string(),
3210
+ description: z18.string().optional(),
3211
+ input_schema: z18.any(),
3212
+ annotations: z18.record(z18.string(), z18.unknown()).optional()
3101
3213
  })
3102
3214
  ),
3103
- error: z17.union([
3104
- z17.string(),
3105
- z17.object({
3106
- type: z17.string().optional(),
3107
- code: z17.union([z17.number(), z17.string()]).optional(),
3108
- message: z17.string().optional()
3215
+ error: z18.union([
3216
+ z18.string(),
3217
+ z18.object({
3218
+ type: z18.string().optional(),
3219
+ code: z18.union([z18.number(), z18.string()]).optional(),
3220
+ message: z18.string().optional()
3109
3221
  }).loose()
3110
3222
  ]).optional()
3111
3223
  }),
3112
- z17.object({
3113
- type: z17.literal("mcp_approval_request"),
3114
- id: z17.string(),
3115
- server_label: z17.string(),
3116
- name: z17.string(),
3117
- arguments: z17.string(),
3118
- approval_request_id: z17.string()
3224
+ z18.object({
3225
+ type: z18.literal("mcp_approval_request"),
3226
+ id: z18.string(),
3227
+ server_label: z18.string(),
3228
+ name: z18.string(),
3229
+ arguments: z18.string(),
3230
+ approval_request_id: z18.string()
3231
+ }),
3232
+ z18.object({
3233
+ type: z18.literal("apply_patch_call"),
3234
+ id: z18.string(),
3235
+ call_id: z18.string(),
3236
+ status: z18.enum(["in_progress", "completed"]),
3237
+ operation: z18.discriminatedUnion("type", [
3238
+ z18.object({
3239
+ type: z18.literal("create_file"),
3240
+ path: z18.string(),
3241
+ diff: z18.string()
3242
+ }),
3243
+ z18.object({
3244
+ type: z18.literal("delete_file"),
3245
+ path: z18.string()
3246
+ }),
3247
+ z18.object({
3248
+ type: z18.literal("update_file"),
3249
+ path: z18.string(),
3250
+ diff: z18.string()
3251
+ })
3252
+ ])
3119
3253
  })
3120
3254
  ])
3121
3255
  ).optional(),
3122
- service_tier: z17.string().nullish(),
3123
- incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3124
- usage: z17.object({
3125
- input_tokens: z17.number(),
3126
- input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3127
- output_tokens: z17.number(),
3128
- output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3256
+ service_tier: z18.string().nullish(),
3257
+ incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3258
+ usage: z18.object({
3259
+ input_tokens: z18.number(),
3260
+ input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
3261
+ output_tokens: z18.number(),
3262
+ output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
3129
3263
  }).optional()
3130
3264
  })
3131
3265
  )
3132
3266
  );
3133
3267
 
3134
3268
  // src/responses/openai-responses-options.ts
3135
- import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
3136
- import { z as z18 } from "zod/v4";
3269
+ import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
3270
+ import { z as z19 } from "zod/v4";
3137
3271
  var TOP_LOGPROBS_MAX = 20;
3138
3272
  var openaiResponsesReasoningModelIds = [
3139
3273
  "o1",
@@ -3200,19 +3334,19 @@ var openaiResponsesModelIds = [
3200
3334
  "gpt-5-chat-latest",
3201
3335
  ...openaiResponsesReasoningModelIds
3202
3336
  ];
3203
- var openaiResponsesProviderOptionsSchema = lazySchema16(
3204
- () => zodSchema16(
3205
- z18.object({
3206
- conversation: z18.string().nullish(),
3207
- include: z18.array(
3208
- z18.enum([
3337
+ var openaiResponsesProviderOptionsSchema = lazySchema17(
3338
+ () => zodSchema17(
3339
+ z19.object({
3340
+ conversation: z19.string().nullish(),
3341
+ include: z19.array(
3342
+ z19.enum([
3209
3343
  "reasoning.encrypted_content",
3210
3344
  // handled internally by default, only needed for unknown reasoning models
3211
3345
  "file_search_call.results",
3212
3346
  "message.output_text.logprobs"
3213
3347
  ])
3214
3348
  ).nullish(),
3215
- instructions: z18.string().nullish(),
3349
+ instructions: z19.string().nullish(),
3216
3350
  /**
3217
3351
  * Return the log probabilities of the tokens.
3218
3352
  *
@@ -3225,17 +3359,17 @@ var openaiResponsesProviderOptionsSchema = lazySchema16(
3225
3359
  * @see https://platform.openai.com/docs/api-reference/responses/create
3226
3360
  * @see https://cookbook.openai.com/examples/using_logprobs
3227
3361
  */
3228
- logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3362
+ logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3229
3363
  /**
3230
3364
  * The maximum number of total calls to built-in tools that can be processed in a response.
3231
3365
  * This maximum number applies across all built-in tool calls, not per individual tool.
3232
3366
  * Any further attempts to call a tool by the model will be ignored.
3233
3367
  */
3234
- maxToolCalls: z18.number().nullish(),
3235
- metadata: z18.any().nullish(),
3236
- parallelToolCalls: z18.boolean().nullish(),
3237
- previousResponseId: z18.string().nullish(),
3238
- promptCacheKey: z18.string().nullish(),
3368
+ maxToolCalls: z19.number().nullish(),
3369
+ metadata: z19.any().nullish(),
3370
+ parallelToolCalls: z19.boolean().nullish(),
3371
+ previousResponseId: z19.string().nullish(),
3372
+ promptCacheKey: z19.string().nullish(),
3239
3373
  /**
3240
3374
  * The retention policy for the prompt cache.
3241
3375
  * - 'in_memory': Default. Standard prompt caching behavior.
@@ -3244,16 +3378,16 @@ var openaiResponsesProviderOptionsSchema = lazySchema16(
3244
3378
  *
3245
3379
  * @default 'in_memory'
3246
3380
  */
3247
- promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
3248
- reasoningEffort: z18.string().nullish(),
3249
- reasoningSummary: z18.string().nullish(),
3250
- safetyIdentifier: z18.string().nullish(),
3251
- serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
3252
- store: z18.boolean().nullish(),
3253
- strictJsonSchema: z18.boolean().nullish(),
3254
- textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
3255
- truncation: z18.enum(["auto", "disabled"]).nullish(),
3256
- user: z18.string().nullish()
3381
+ promptCacheRetention: z19.enum(["in_memory", "24h"]).nullish(),
3382
+ reasoningEffort: z19.string().nullish(),
3383
+ reasoningSummary: z19.string().nullish(),
3384
+ safetyIdentifier: z19.string().nullish(),
3385
+ serviceTier: z19.enum(["auto", "flex", "priority", "default"]).nullish(),
3386
+ store: z19.boolean().nullish(),
3387
+ strictJsonSchema: z19.boolean().nullish(),
3388
+ textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
3389
+ truncation: z19.enum(["auto", "disabled"]).nullish(),
3390
+ user: z19.string().nullish()
3257
3391
  })
3258
3392
  )
3259
3393
  );
@@ -3285,7 +3419,7 @@ async function prepareResponsesTools({
3285
3419
  strict: strictJsonSchema
3286
3420
  });
3287
3421
  break;
3288
- case "provider-defined": {
3422
+ case "provider": {
3289
3423
  switch (tool.id) {
3290
3424
  case "openai.file_search": {
3291
3425
  const args = await validateTypes2({
@@ -3310,6 +3444,12 @@ async function prepareResponsesTools({
3310
3444
  });
3311
3445
  break;
3312
3446
  }
3447
+ case "openai.apply_patch": {
3448
+ openaiTools2.push({
3449
+ type: "apply_patch"
3450
+ });
3451
+ break;
3452
+ }
3313
3453
  case "openai.web_search_preview": {
3314
3454
  const args = await validateTypes2({
3315
3455
  value: tool.args,
@@ -3414,7 +3554,7 @@ async function prepareResponsesTools({
3414
3554
  case "tool":
3415
3555
  return {
3416
3556
  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 },
3557
+ 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
3558
  toolWarnings
3419
3559
  };
3420
3560
  default: {
@@ -3494,7 +3634,8 @@ var OpenAIResponsesLanguageModel = class {
3494
3634
  "openai.local_shell": "local_shell",
3495
3635
  "openai.web_search": "web_search",
3496
3636
  "openai.web_search_preview": "web_search_preview",
3497
- "openai.mcp": "mcp"
3637
+ "openai.mcp": "mcp",
3638
+ "openai.apply_patch": "apply_patch"
3498
3639
  }
3499
3640
  });
3500
3641
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
@@ -3503,7 +3644,8 @@ var OpenAIResponsesLanguageModel = class {
3503
3644
  systemMessageMode: modelConfig.systemMessageMode,
3504
3645
  fileIdPrefixes: this.config.fileIdPrefixes,
3505
3646
  store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
3506
- hasLocalShellTool: hasOpenAITool("openai.local_shell")
3647
+ hasLocalShellTool: hasOpenAITool("openai.local_shell"),
3648
+ hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
3507
3649
  });
3508
3650
  warnings.push(...inputWarnings);
3509
3651
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -3516,16 +3658,14 @@ var OpenAIResponsesLanguageModel = class {
3516
3658
  }
3517
3659
  }
3518
3660
  function hasOpenAITool(id) {
3519
- return (tools == null ? void 0 : tools.find(
3520
- (tool) => tool.type === "provider-defined" && tool.id === id
3521
- )) != null;
3661
+ return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
3522
3662
  }
3523
3663
  const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
3524
3664
  if (topLogprobs) {
3525
3665
  addInclude("message.output_text.logprobs");
3526
3666
  }
3527
3667
  const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
3528
- (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
3668
+ (tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
3529
3669
  )) == null ? void 0 : _c.name;
3530
3670
  if (webSearchToolName) {
3531
3671
  addInclude("web_search_call.action.sources");
@@ -4006,6 +4146,23 @@ var OpenAIResponsesLanguageModel = class {
4006
4146
  });
4007
4147
  break;
4008
4148
  }
4149
+ case "apply_patch_call": {
4150
+ content.push({
4151
+ type: "tool-call",
4152
+ toolCallId: part.call_id,
4153
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4154
+ input: JSON.stringify({
4155
+ callId: part.call_id,
4156
+ operation: part.operation
4157
+ }),
4158
+ providerMetadata: {
4159
+ [providerKey]: {
4160
+ itemId: part.id
4161
+ }
4162
+ }
4163
+ });
4164
+ break;
4165
+ }
4009
4166
  }
4010
4167
  }
4011
4168
  const providerMetadata = {
@@ -4193,6 +4350,27 @@ var OpenAIResponsesLanguageModel = class {
4193
4350
  input: "{}",
4194
4351
  providerExecuted: true
4195
4352
  });
4353
+ } else if (value.item.type === "apply_patch_call") {
4354
+ ongoingToolCalls[value.output_index] = {
4355
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4356
+ toolCallId: value.item.call_id
4357
+ };
4358
+ if (value.item.status === "completed") {
4359
+ controller.enqueue({
4360
+ type: "tool-call",
4361
+ toolCallId: value.item.call_id,
4362
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4363
+ input: JSON.stringify({
4364
+ callId: value.item.call_id,
4365
+ operation: value.item.operation
4366
+ }),
4367
+ providerMetadata: {
4368
+ [providerKey]: {
4369
+ itemId: value.item.id
4370
+ }
4371
+ }
4372
+ });
4373
+ }
4196
4374
  } else if (value.item.type === "message") {
4197
4375
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
4198
4376
  controller.enqueue({
@@ -4356,6 +4534,24 @@ var OpenAIResponsesLanguageModel = class {
4356
4534
  ...value.item.error != null ? { error: value.item.error } : {}
4357
4535
  }
4358
4536
  });
4537
+ } else if (value.item.type === "apply_patch_call") {
4538
+ ongoingToolCalls[value.output_index] = void 0;
4539
+ if (value.item.status === "completed") {
4540
+ controller.enqueue({
4541
+ type: "tool-call",
4542
+ toolCallId: value.item.call_id,
4543
+ toolName: toolNameMapping.toCustomToolName("apply_patch"),
4544
+ input: JSON.stringify({
4545
+ callId: value.item.call_id,
4546
+ operation: value.item.operation
4547
+ }),
4548
+ providerMetadata: {
4549
+ [providerKey]: {
4550
+ itemId: value.item.id
4551
+ }
4552
+ }
4553
+ });
4554
+ }
4359
4555
  } else if (value.item.type === "mcp_approval_request") {
4360
4556
  ongoingToolCalls[value.output_index] = void 0;
4361
4557
  controller.enqueue({
@@ -4707,13 +4903,13 @@ import {
4707
4903
  } from "@ai-sdk/provider-utils";
4708
4904
 
4709
4905
  // src/speech/openai-speech-options.ts
4710
- import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4711
- import { z as z19 } from "zod/v4";
4712
- var openaiSpeechProviderOptionsSchema = lazySchema17(
4713
- () => zodSchema17(
4714
- z19.object({
4715
- instructions: z19.string().nullish(),
4716
- speed: z19.number().min(0.25).max(4).default(1).nullish()
4906
+ import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
4907
+ import { z as z20 } from "zod/v4";
4908
+ var openaiSpeechProviderOptionsSchema = lazySchema18(
4909
+ () => zodSchema18(
4910
+ z20.object({
4911
+ instructions: z20.string().nullish(),
4912
+ speed: z20.number().min(0.25).max(4).default(1).nullish()
4717
4913
  })
4718
4914
  )
4719
4915
  );
@@ -4830,33 +5026,33 @@ import {
4830
5026
  } from "@ai-sdk/provider-utils";
4831
5027
 
4832
5028
  // src/transcription/openai-transcription-api.ts
4833
- import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
4834
- import { z as z20 } from "zod/v4";
4835
- var openaiTranscriptionResponseSchema = lazySchema18(
4836
- () => zodSchema18(
4837
- z20.object({
4838
- text: z20.string(),
4839
- language: z20.string().nullish(),
4840
- duration: z20.number().nullish(),
4841
- words: z20.array(
4842
- z20.object({
4843
- word: z20.string(),
4844
- start: z20.number(),
4845
- end: z20.number()
5029
+ import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
5030
+ import { z as z21 } from "zod/v4";
5031
+ var openaiTranscriptionResponseSchema = lazySchema19(
5032
+ () => zodSchema19(
5033
+ z21.object({
5034
+ text: z21.string(),
5035
+ language: z21.string().nullish(),
5036
+ duration: z21.number().nullish(),
5037
+ words: z21.array(
5038
+ z21.object({
5039
+ word: z21.string(),
5040
+ start: z21.number(),
5041
+ end: z21.number()
4846
5042
  })
4847
5043
  ).nullish(),
4848
- segments: z20.array(
4849
- z20.object({
4850
- id: z20.number(),
4851
- seek: z20.number(),
4852
- start: z20.number(),
4853
- end: z20.number(),
4854
- text: z20.string(),
4855
- tokens: z20.array(z20.number()),
4856
- temperature: z20.number(),
4857
- avg_logprob: z20.number(),
4858
- compression_ratio: z20.number(),
4859
- no_speech_prob: z20.number()
5044
+ segments: z21.array(
5045
+ z21.object({
5046
+ id: z21.number(),
5047
+ seek: z21.number(),
5048
+ start: z21.number(),
5049
+ end: z21.number(),
5050
+ text: z21.string(),
5051
+ tokens: z21.array(z21.number()),
5052
+ temperature: z21.number(),
5053
+ avg_logprob: z21.number(),
5054
+ compression_ratio: z21.number(),
5055
+ no_speech_prob: z21.number()
4860
5056
  })
4861
5057
  ).nullish()
4862
5058
  })
@@ -4864,33 +5060,33 @@ var openaiTranscriptionResponseSchema = lazySchema18(
4864
5060
  );
4865
5061
 
4866
5062
  // src/transcription/openai-transcription-options.ts
4867
- import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
4868
- import { z as z21 } from "zod/v4";
4869
- var openAITranscriptionProviderOptions = lazySchema19(
4870
- () => zodSchema19(
4871
- z21.object({
5063
+ import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
5064
+ import { z as z22 } from "zod/v4";
5065
+ var openAITranscriptionProviderOptions = lazySchema20(
5066
+ () => zodSchema20(
5067
+ z22.object({
4872
5068
  /**
4873
5069
  * Additional information to include in the transcription response.
4874
5070
  */
4875
- include: z21.array(z21.string()).optional(),
5071
+ include: z22.array(z22.string()).optional(),
4876
5072
  /**
4877
5073
  * The language of the input audio in ISO-639-1 format.
4878
5074
  */
4879
- language: z21.string().optional(),
5075
+ language: z22.string().optional(),
4880
5076
  /**
4881
5077
  * An optional text to guide the model's style or continue a previous audio segment.
4882
5078
  */
4883
- prompt: z21.string().optional(),
5079
+ prompt: z22.string().optional(),
4884
5080
  /**
4885
5081
  * The sampling temperature, between 0 and 1.
4886
5082
  * @default 0
4887
5083
  */
4888
- temperature: z21.number().min(0).max(1).default(0).optional(),
5084
+ temperature: z22.number().min(0).max(1).default(0).optional(),
4889
5085
  /**
4890
5086
  * The timestamp granularities to populate for this transcription.
4891
5087
  * @default ['segment']
4892
5088
  */
4893
- timestampGranularities: z21.array(z21.enum(["word", "segment"])).default(["segment"]).optional()
5089
+ timestampGranularities: z22.array(z22.enum(["word", "segment"])).default(["segment"]).optional()
4894
5090
  })
4895
5091
  )
4896
5092
  );
@@ -5063,7 +5259,7 @@ var OpenAITranscriptionModel = class {
5063
5259
  };
5064
5260
 
5065
5261
  // src/version.ts
5066
- var VERSION = true ? "3.0.0-beta.72" : "0.0.0-test";
5262
+ var VERSION = true ? "3.0.0-beta.74" : "0.0.0-test";
5067
5263
 
5068
5264
  // src/openai-provider.ts
5069
5265
  function createOpenAI(options = {}) {