@ai-sdk/anthropic 2.0.0-beta.4 → 2.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [05d2819]
8
+ - @ai-sdk/provider-utils@3.0.0-beta.3
9
+
10
+ ## 2.0.0-beta.5
11
+
12
+ ### Patch Changes
13
+
14
+ - b9ddcdd: feat(anthropic): add text_editor_20250429 tool for Claude 4 models
15
+
3
16
  ## 2.0.0-beta.4
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -60,6 +60,19 @@ declare const anthropicTools: {
60
60
  old_str?: string;
61
61
  view_range?: number[];
62
62
  }, {}>;
63
+ /**
64
+ * Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
65
+ * Note: This version does not support the "undo_edit" command.
66
+ */
67
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
68
+ command: "view" | "create" | "str_replace" | "insert";
69
+ path: string;
70
+ file_text?: string;
71
+ insert_line?: number;
72
+ new_str?: string;
73
+ old_str?: string;
74
+ view_range?: number[];
75
+ }, {}>;
63
76
  /**
64
77
  * Creates a tool for executing actions on a computer. Must have name "computer".
65
78
  *
package/dist/index.d.ts CHANGED
@@ -60,6 +60,19 @@ declare const anthropicTools: {
60
60
  old_str?: string;
61
61
  view_range?: number[];
62
62
  }, {}>;
63
+ /**
64
+ * Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
65
+ * Note: This version does not support the "undo_edit" command.
66
+ */
67
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
68
+ command: "view" | "create" | "str_replace" | "insert";
69
+ path: string;
70
+ file_text?: string;
71
+ insert_line?: number;
72
+ new_str?: string;
73
+ old_str?: string;
74
+ view_range?: number[];
75
+ }, {}>;
63
76
  /**
64
77
  * Creates a tool for executing actions on a computer. Must have name "computer".
65
78
  *
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(src_exports);
37
37
 
38
38
  // src/anthropic-provider.ts
39
39
  var import_provider4 = require("@ai-sdk/provider");
40
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
40
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
41
41
 
42
42
  // src/anthropic-messages-language-model.ts
43
43
  var import_provider3 = require("@ai-sdk/provider");
@@ -207,6 +207,13 @@ function prepareTools({
207
207
  type: "text_editor_20241022"
208
208
  });
209
209
  break;
210
+ case "anthropic.text_editor_20250429":
211
+ betas.add("computer-use-2025-01-24");
212
+ anthropicTools2.push({
213
+ name: "str_replace_based_edit_tool",
214
+ type: "text_editor_20250429"
215
+ });
216
+ break;
210
217
  case "anthropic.bash_20250124":
211
218
  betas.add("computer-use-2025-01-24");
212
219
  anthropicTools2.push({
@@ -1788,6 +1795,23 @@ var textEditor_20250124 = (0, import_provider_utils10.createProviderDefinedToolF
1788
1795
  })
1789
1796
  });
1790
1797
 
1798
+ // src/tool/text-editor_20250429.ts
1799
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1800
+ var import_v411 = require("zod/v4");
1801
+ var textEditor_20250429 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1802
+ id: "anthropic.text_editor_20250429",
1803
+ name: "str_replace_based_edit_tool",
1804
+ inputSchema: import_v411.z.object({
1805
+ command: import_v411.z.enum(["view", "create", "str_replace", "insert"]),
1806
+ path: import_v411.z.string(),
1807
+ file_text: import_v411.z.string().optional(),
1808
+ insert_line: import_v411.z.number().int().optional(),
1809
+ new_str: import_v411.z.string().optional(),
1810
+ old_str: import_v411.z.string().optional(),
1811
+ view_range: import_v411.z.array(import_v411.z.number().int()).optional()
1812
+ })
1813
+ });
1814
+
1791
1815
  // src/anthropic-tools.ts
1792
1816
  var anthropicTools = {
1793
1817
  /**
@@ -1814,6 +1838,11 @@ var anthropicTools = {
1814
1838
  * Creates a tool for editing text. Must have name "str_replace_editor".
1815
1839
  */
1816
1840
  textEditor_20250124,
1841
+ /**
1842
+ * Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
1843
+ * Note: This version does not support the "undo_edit" command.
1844
+ */
1845
+ textEditor_20250429,
1817
1846
  /**
1818
1847
  * Creates a tool for executing actions on a computer. Must have name "computer".
1819
1848
  *
@@ -1850,10 +1879,10 @@ var anthropicTools = {
1850
1879
  // src/anthropic-provider.ts
1851
1880
  function createAnthropic(options = {}) {
1852
1881
  var _a;
1853
- const baseURL = (_a = (0, import_provider_utils11.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
1882
+ const baseURL = (_a = (0, import_provider_utils12.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
1854
1883
  const getHeaders = () => ({
1855
1884
  "anthropic-version": "2023-06-01",
1856
- "x-api-key": (0, import_provider_utils11.loadApiKey)({
1885
+ "x-api-key": (0, import_provider_utils12.loadApiKey)({
1857
1886
  apiKey: options.apiKey,
1858
1887
  environmentVariableName: "ANTHROPIC_API_KEY",
1859
1888
  description: "Anthropic"
@@ -1867,7 +1896,7 @@ function createAnthropic(options = {}) {
1867
1896
  baseURL,
1868
1897
  headers: getHeaders,
1869
1898
  fetch: options.fetch,
1870
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils11.generateId,
1899
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils12.generateId,
1871
1900
  supportedUrls: () => ({
1872
1901
  "image/*": [/^https?:\/\/.*$/]
1873
1902
  })