@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/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 false
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: structuredOutputs ? strictJsonSchema : void 0
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, _d;
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 = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
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" ? structuredOutputs && responseFormat.schema != null ? {
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: (_d = responseFormat.name) != null ? _d : "response",
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/code-interpreter.ts
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 codeInterpreterInputSchema = lazySchema8(
1758
+ var applyPatchInputSchema = lazySchema8(
1775
1759
  () => zodSchema8(
1776
1760
  z9.object({
1777
- code: z9.string().nullish(),
1778
- containerId: z9.string()
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 codeInterpreterOutputSchema = lazySchema8(
1781
+ var applyPatchOutputSchema = lazySchema8(
1783
1782
  () => zodSchema8(
1784
1783
  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() })
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 = lazySchema8(
1795
- () => zodSchema8(
1796
- z9.object({
1797
- container: z9.union([
1798
- z9.string(),
1799
- z9.object({
1800
- fileIds: z9.array(z9.string()).optional()
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 = createProviderToolFactoryWithOutputSchema({
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 createProviderToolFactoryWithOutputSchema2,
1818
- lazySchema as lazySchema9,
1819
- zodSchema as zodSchema9
1847
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1848
+ lazySchema as lazySchema10,
1849
+ zodSchema as zodSchema10
1820
1850
  } 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()])
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 = z10.object({
1828
- type: z10.enum(["and", "or"]),
1829
- filters: z10.array(
1830
- z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
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 = 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()
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: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1872
+ filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1843
1873
  })
1844
1874
  )
1845
1875
  );
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()
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 = createProviderToolFactoryWithOutputSchema2({
1892
+ var fileSearch = createProviderToolFactoryWithOutputSchema3({
1863
1893
  id: "openai.file_search",
1864
- inputSchema: z10.object({}),
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 createProviderToolFactoryWithOutputSchema3,
1871
- lazySchema as lazySchema10,
1872
- zodSchema as zodSchema10
1900
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1901
+ lazySchema as lazySchema11,
1902
+ zodSchema as zodSchema11
1873
1903
  } 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()
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: 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()
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 = lazySchema10(() => zodSchema10(z11.object({})));
1895
- var imageGenerationOutputSchema = lazySchema10(
1896
- () => zodSchema10(z11.object({ result: z11.string() }))
1924
+ var imageGenerationInputSchema = lazySchema11(() => zodSchema11(z12.object({})));
1925
+ var imageGenerationOutputSchema = lazySchema11(
1926
+ () => zodSchema11(z12.object({ result: z12.string() }))
1897
1927
  );
1898
- var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema3({
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 webSearchArgsSchema = lazySchema12(
1944
+ var localShellInputSchema = lazySchema12(
1945
1945
  () => zodSchema12(
1946
1946
  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()
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 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
- )
1958
+ var localShellOutputSchema = lazySchema12(
1959
+ () => zodSchema12(z13.object({ output: z13.string() }))
1987
1960
  );
1988
- var webSearchToolFactory = createProviderToolFactoryWithOutputSchema5({
1989
- id: "openai.web_search",
1990
- inputSchema: webSearchInputSchema,
1991
- outputSchema: webSearchOutputSchema
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-preview.ts
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 webSearchPreviewArgsSchema = lazySchema13(
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 webSearchPreviewInputSchema = lazySchema13(
2017
- () => zodSchema13(z14.object({}))
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 webSearchPreview = createProviderToolFactoryWithOutputSchema6({
2041
- id: "openai.web_search_preview",
2042
- inputSchema: webSearchPreviewInputSchema,
2043
- outputSchema: webSearchPreviewOutputSchema
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/mcp.ts
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 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
- ])
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 mcpArgsSchema = lazySchema14(
2049
+ var webSearchPreviewOutputSchema = lazySchema14(
2064
2050
  () => zodSchema14(
2065
2051
  z15.object({
2066
- serverLabel: z15.string(),
2067
- allowedTools: z15.union([
2068
- z15.array(z15.string()),
2052
+ action: z15.discriminatedUnion("type", [
2053
+ z15.object({
2054
+ type: z15.literal("search"),
2055
+ query: z15.string().optional()
2056
+ }),
2069
2057
  z15.object({
2070
- readOnly: z15.boolean().optional(),
2071
- toolNames: z15.array(z15.string()).optional()
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: z15.string().optional(),
2075
- connectorId: z15.string().optional(),
2076
- headers: z15.record(z15.string(), z15.string()).optional(),
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: z15.string().optional(),
2088
- serverUrl: z15.string().optional()
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 = 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()
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
- 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(),
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: z15.record(z15.string(), jsonValueSchema).optional()
2145
+ annotations: z16.record(z16.string(), jsonValueSchema).optional()
2116
2146
  })
2117
2147
  ),
2118
- error: z15.union([z15.string(), jsonValueSchema]).optional()
2148
+ error: z16.union([z16.string(), jsonValueSchema]).optional()
2119
2149
  }),
2120
- z15.object({
2121
- type: z15.literal("approvalRequest"),
2122
- serverLabel: z15.string(),
2123
- name: z15.string(),
2124
- arguments: z15.string(),
2125
- approvalRequestId: z15.string()
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 = createProviderToolFactoryWithOutputSchema7({
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 z16 } from "zod/v4";
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 = z16.object({
2534
- itemId: z16.string().nullish(),
2535
- reasoningEncryptedContent: z16.string().nullish()
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 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()
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
- 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()
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: z17.string().nullish()
2641
+ service_tier: z18.string().nullish()
2590
2642
  })
2591
2643
  }),
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()
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
- 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()
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
- z17.object({
2610
- type: z17.literal("reasoning"),
2611
- id: z17.string(),
2612
- encrypted_content: z17.string().nullish()
2661
+ z18.object({
2662
+ type: z18.literal("reasoning"),
2663
+ id: z18.string(),
2664
+ encrypted_content: z18.string().nullish()
2613
2665
  }),
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()
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
- z17.object({
2622
- type: z17.literal("web_search_call"),
2623
- id: z17.string(),
2624
- status: z17.string()
2673
+ z18.object({
2674
+ type: z18.literal("web_search_call"),
2675
+ id: z18.string(),
2676
+ status: z18.string()
2625
2677
  }),
2626
- z17.object({
2627
- type: z17.literal("computer_call"),
2628
- id: z17.string(),
2629
- status: z17.string()
2678
+ z18.object({
2679
+ type: z18.literal("computer_call"),
2680
+ id: z18.string(),
2681
+ status: z18.string()
2630
2682
  }),
2631
- z17.object({
2632
- type: z17.literal("file_search_call"),
2633
- id: z17.string()
2683
+ z18.object({
2684
+ type: z18.literal("file_search_call"),
2685
+ id: z18.string()
2634
2686
  }),
2635
- z17.object({
2636
- type: z17.literal("image_generation_call"),
2637
- id: z17.string()
2687
+ z18.object({
2688
+ type: z18.literal("image_generation_call"),
2689
+ id: z18.string()
2638
2690
  }),
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() })
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: z17.string()
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
- z17.object({
2653
- type: z17.literal("mcp_call"),
2654
- id: z17.string(),
2655
- status: z17.string()
2709
+ z18.object({
2710
+ type: z18.literal("mcp_list_tools"),
2711
+ id: z18.string()
2656
2712
  }),
2657
- z17.object({
2658
- type: z17.literal("mcp_list_tools"),
2659
- id: z17.string()
2713
+ z18.object({
2714
+ type: z18.literal("mcp_approval_request"),
2715
+ id: z18.string()
2660
2716
  }),
2661
- z17.object({
2662
- type: z17.literal("mcp_approval_request"),
2663
- id: z17.string()
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
- 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()
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
- z17.object({
2676
- type: z17.literal("reasoning"),
2677
- id: z17.string(),
2678
- encrypted_content: z17.string().nullish()
2749
+ z18.object({
2750
+ type: z18.literal("reasoning"),
2751
+ id: z18.string(),
2752
+ encrypted_content: z18.string().nullish()
2679
2753
  }),
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")
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
- 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() })
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
- z17.object({
2701
- type: z17.literal("image_generation_call"),
2702
- id: z17.string(),
2703
- result: z17.string()
2774
+ z18.object({
2775
+ type: z18.literal("image_generation_call"),
2776
+ id: z18.string(),
2777
+ result: z18.string()
2704
2778
  }),
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() })
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
- z17.object({
2721
- type: z17.literal("open_page"),
2722
- url: z17.string()
2794
+ z18.object({
2795
+ type: z18.literal("open_page"),
2796
+ url: z18.string()
2723
2797
  }),
2724
- z17.object({
2725
- type: z17.literal("find"),
2726
- url: z17.string(),
2727
- pattern: z17.string()
2798
+ z18.object({
2799
+ type: z18.literal("find"),
2800
+ url: z18.string(),
2801
+ pattern: z18.string()
2728
2802
  })
2729
2803
  ])
2730
2804
  }),
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()])
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: z17.string(),
2742
- filename: z17.string(),
2743
- score: z17.number(),
2744
- text: z17.string()
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
- 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()
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
- z17.object({
2762
- type: z17.literal("computer_call"),
2763
- id: z17.string(),
2764
- status: z17.literal("completed")
2835
+ z18.object({
2836
+ type: z18.literal("computer_call"),
2837
+ id: z18.string(),
2838
+ status: z18.literal("completed")
2765
2839
  }),
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()
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
- 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()
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: 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()
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
- 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()
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
- 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()
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
- 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()
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
- 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()
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
- 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()
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
- 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()
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
- 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()
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
- 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()
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
- z17.object({
2867
- type: z17.literal("file_path"),
2868
- file_id: z17.string(),
2869
- index: z17.number().nullish()
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
- z17.object({
2874
- type: z17.literal("response.reasoning_summary_part.added"),
2875
- item_id: z17.string(),
2876
- summary_index: z17.number()
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
- 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()
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
- z17.object({
2885
- type: z17.literal("response.reasoning_summary_part.done"),
2886
- item_id: z17.string(),
2887
- summary_index: z17.number()
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
- 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()
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
- z17.object({ type: z17.string() }).loose().transform((value) => ({
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 = 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()
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: 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()
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: 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()
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
- 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()
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
- 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()
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
- z17.object({
2969
- type: z17.literal("file_path"),
2970
- file_id: z17.string(),
2971
- index: z17.number().nullish()
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
- 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() })
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
- z17.object({
2994
- type: z17.literal("open_page"),
2995
- url: z17.string()
3089
+ z18.object({
3090
+ type: z18.literal("open_page"),
3091
+ url: z18.string()
2996
3092
  }),
2997
- z17.object({
2998
- type: z17.literal("find"),
2999
- url: z17.string(),
3000
- pattern: z17.string()
3093
+ z18.object({
3094
+ type: z18.literal("find"),
3095
+ url: z18.string(),
3096
+ pattern: z18.string()
3001
3097
  })
3002
3098
  ])
3003
3099
  }),
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()])
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: z17.string(),
3015
- filename: z17.string(),
3016
- score: z17.number(),
3017
- text: z17.string()
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
- 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() })
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
- z17.object({
3034
- type: z17.literal("image_generation_call"),
3035
- id: z17.string(),
3036
- result: z17.string()
3129
+ z18.object({
3130
+ type: z18.literal("image_generation_call"),
3131
+ id: z18.string(),
3132
+ result: z18.string()
3037
3133
  }),
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()
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
- 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()
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
- z17.object({
3059
- type: z17.literal("computer_call"),
3060
- id: z17.string(),
3061
- status: z17.string().optional()
3154
+ z18.object({
3155
+ type: z18.literal("computer_call"),
3156
+ id: z18.string(),
3157
+ status: z18.string().optional()
3062
3158
  }),
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()
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
- 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()
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
- 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()
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: 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()
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
- 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()
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: 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()
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 lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
3136
- import { z as z18 } from "zod/v4";
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 = lazySchema16(
3204
- () => zodSchema16(
3205
- z18.object({
3206
- conversation: z18.string().nullish(),
3207
- include: z18.array(
3208
- z18.enum([
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: z18.string().nullish(),
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: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
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: z18.number().nullish(),
3235
- metadata: z18.any().nullish(),
3236
- parallelToolCalls: z18.boolean().nullish(),
3237
- previousResponseId: z18.string().nullish(),
3238
- promptCacheKey: z18.string().nullish(),
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: 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()
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 : false;
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 lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4709
- import { z as z19 } from "zod/v4";
4710
- var openaiSpeechProviderOptionsSchema = lazySchema17(
4711
- () => zodSchema17(
4712
- z19.object({
4713
- instructions: z19.string().nullish(),
4714
- speed: z19.number().min(0.25).max(4).default(1).nullish()
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 lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
4832
- import { z as z20 } from "zod/v4";
4833
- var openaiTranscriptionResponseSchema = lazySchema18(
4834
- () => zodSchema18(
4835
- z20.object({
4836
- text: z20.string(),
4837
- language: z20.string().nullish(),
4838
- duration: z20.number().nullish(),
4839
- words: z20.array(
4840
- z20.object({
4841
- word: z20.string(),
4842
- start: z20.number(),
4843
- end: z20.number()
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: z20.array(
4847
- z20.object({
4848
- id: z20.number(),
4849
- seek: z20.number(),
4850
- start: z20.number(),
4851
- end: z20.number(),
4852
- text: z20.string(),
4853
- tokens: z20.array(z20.number()),
4854
- temperature: z20.number(),
4855
- avg_logprob: z20.number(),
4856
- compression_ratio: z20.number(),
4857
- no_speech_prob: z20.number()
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 lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
4866
- import { z as z21 } from "zod/v4";
4867
- var openAITranscriptionProviderOptions = lazySchema19(
4868
- () => zodSchema19(
4869
- z21.object({
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: z21.array(z21.string()).optional(),
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: z21.string().optional(),
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: z21.string().optional(),
5063
+ prompt: z22.string().optional(),
4882
5064
  /**
4883
5065
  * The sampling temperature, between 0 and 1.
4884
5066
  * @default 0
4885
5067
  */
4886
- temperature: z21.number().min(0).max(1).default(0).optional(),
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: z21.array(z21.enum(["word", "segment"])).default(["segment"]).optional()
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.73" : "0.0.0-test";
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 = {}) {