@ai-sdk/anthropic 3.0.0-beta.23 → 3.0.0-beta.24

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,11 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.0-beta.24
4
+
5
+ ### Patch Changes
6
+
7
+ - d08308b: feat(provider/anthropic): memory tool
8
+
3
9
  ## 3.0.0-beta.23
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -219,6 +219,42 @@ declare const anthropicTools: {
219
219
  displayHeightPx: number;
220
220
  displayNumber?: number;
221
221
  }>;
222
+ /**
223
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
224
+ * Claude can create, read, update, and delete files that persist between sessions,
225
+ * allowing it to build knowledge over time without keeping everything in the context window.
226
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
227
+ *
228
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
229
+ *
230
+ * Tool name must be `memory`.
231
+ */
232
+ memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
233
+ command: "view";
234
+ path: string;
235
+ view_range?: [number, number];
236
+ } | {
237
+ command: "create";
238
+ path: string;
239
+ file_text: string;
240
+ } | {
241
+ command: "str_replace";
242
+ path: string;
243
+ old_str: string;
244
+ new_str: string;
245
+ } | {
246
+ command: "insert";
247
+ path: string;
248
+ insert_line: number;
249
+ insert_text: string;
250
+ } | {
251
+ command: "delete";
252
+ path: string;
253
+ } | {
254
+ command: "rename";
255
+ old_path: string;
256
+ new_path: string;
257
+ }, {}>;
222
258
  /**
223
259
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
224
260
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
package/dist/index.d.ts CHANGED
@@ -219,6 +219,42 @@ declare const anthropicTools: {
219
219
  displayHeightPx: number;
220
220
  displayNumber?: number;
221
221
  }>;
222
+ /**
223
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
224
+ * Claude can create, read, update, and delete files that persist between sessions,
225
+ * allowing it to build knowledge over time without keeping everything in the context window.
226
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
227
+ *
228
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
229
+ *
230
+ * Tool name must be `memory`.
231
+ */
232
+ memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
233
+ command: "view";
234
+ path: string;
235
+ view_range?: [number, number];
236
+ } | {
237
+ command: "create";
238
+ path: string;
239
+ file_text: string;
240
+ } | {
241
+ command: "str_replace";
242
+ path: string;
243
+ old_str: string;
244
+ new_str: string;
245
+ } | {
246
+ command: "insert";
247
+ path: string;
248
+ insert_line: number;
249
+ insert_text: string;
250
+ } | {
251
+ command: "delete";
252
+ path: string;
253
+ } | {
254
+ command: "rename";
255
+ old_path: string;
256
+ new_path: string;
257
+ }, {}>;
222
258
  /**
223
259
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
224
260
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
package/dist/index.js CHANGED
@@ -28,10 +28,10 @@ module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/anthropic-provider.ts
30
30
  var import_provider4 = require("@ai-sdk/provider");
31
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
31
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "3.0.0-beta.23" : "0.0.0-test";
34
+ var VERSION = true ? "3.0.0-beta.24" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -814,6 +814,14 @@ async function prepareTools({
814
814
  });
815
815
  break;
816
816
  }
817
+ case "anthropic.memory_20250818": {
818
+ betas.add("context-management-2025-06-27");
819
+ anthropicTools2.push({
820
+ name: "memory",
821
+ type: "memory_20250818"
822
+ });
823
+ break;
824
+ }
817
825
  case "anthropic.web_fetch_20250910": {
818
826
  betas.add("web-fetch-2025-09-10");
819
827
  const args = await (0, import_provider_utils7.validateTypes)({
@@ -2628,32 +2636,56 @@ var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFac
2628
2636
  inputSchema: computer_20250124InputSchema
2629
2637
  });
2630
2638
 
2631
- // src/tool/text-editor_20241022.ts
2639
+ // src/tool/memory_20250818.ts
2632
2640
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
2633
2641
  var import_v413 = require("zod/v4");
2634
- var textEditor_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
2642
+ var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
2635
2643
  () => (0, import_provider_utils16.zodSchema)(
2636
- import_v413.z.object({
2637
- command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2638
- path: import_v413.z.string(),
2639
- file_text: import_v413.z.string().optional(),
2640
- insert_line: import_v413.z.number().int().optional(),
2641
- new_str: import_v413.z.string().optional(),
2642
- old_str: import_v413.z.string().optional(),
2643
- view_range: import_v413.z.array(import_v413.z.number().int()).optional()
2644
- })
2644
+ import_v413.z.discriminatedUnion("command", [
2645
+ import_v413.z.object({
2646
+ command: import_v413.z.literal("view"),
2647
+ path: import_v413.z.string(),
2648
+ view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
2649
+ }),
2650
+ import_v413.z.object({
2651
+ command: import_v413.z.literal("create"),
2652
+ path: import_v413.z.string(),
2653
+ file_text: import_v413.z.string()
2654
+ }),
2655
+ import_v413.z.object({
2656
+ command: import_v413.z.literal("str_replace"),
2657
+ path: import_v413.z.string(),
2658
+ old_str: import_v413.z.string(),
2659
+ new_str: import_v413.z.string()
2660
+ }),
2661
+ import_v413.z.object({
2662
+ command: import_v413.z.literal("insert"),
2663
+ path: import_v413.z.string(),
2664
+ insert_line: import_v413.z.number(),
2665
+ insert_text: import_v413.z.string()
2666
+ }),
2667
+ import_v413.z.object({
2668
+ command: import_v413.z.literal("delete"),
2669
+ path: import_v413.z.string()
2670
+ }),
2671
+ import_v413.z.object({
2672
+ command: import_v413.z.literal("rename"),
2673
+ old_path: import_v413.z.string(),
2674
+ new_path: import_v413.z.string()
2675
+ })
2676
+ ])
2645
2677
  )
2646
2678
  );
2647
- var textEditor_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2648
- id: "anthropic.text_editor_20241022",
2649
- name: "str_replace_editor",
2650
- inputSchema: textEditor_20241022InputSchema
2679
+ var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2680
+ id: "anthropic.memory_20250818",
2681
+ name: "memory",
2682
+ inputSchema: memory_20250818InputSchema
2651
2683
  });
2652
2684
 
2653
- // src/tool/text-editor_20250124.ts
2685
+ // src/tool/text-editor_20241022.ts
2654
2686
  var import_provider_utils17 = require("@ai-sdk/provider-utils");
2655
2687
  var import_v414 = require("zod/v4");
2656
- var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
2688
+ var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
2657
2689
  () => (0, import_provider_utils17.zodSchema)(
2658
2690
  import_v414.z.object({
2659
2691
  command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -2666,19 +2698,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
2666
2698
  })
2667
2699
  )
2668
2700
  );
2669
- var textEditor_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2670
- id: "anthropic.text_editor_20250124",
2701
+ var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2702
+ id: "anthropic.text_editor_20241022",
2671
2703
  name: "str_replace_editor",
2672
- inputSchema: textEditor_20250124InputSchema
2704
+ inputSchema: textEditor_20241022InputSchema
2673
2705
  });
2674
2706
 
2675
- // src/tool/text-editor_20250429.ts
2707
+ // src/tool/text-editor_20250124.ts
2676
2708
  var import_provider_utils18 = require("@ai-sdk/provider-utils");
2677
2709
  var import_v415 = require("zod/v4");
2678
- var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
2710
+ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
2679
2711
  () => (0, import_provider_utils18.zodSchema)(
2680
2712
  import_v415.z.object({
2681
- command: import_v415.z.enum(["view", "create", "str_replace", "insert"]),
2713
+ command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2682
2714
  path: import_v415.z.string(),
2683
2715
  file_text: import_v415.z.string().optional(),
2684
2716
  insert_line: import_v415.z.number().int().optional(),
@@ -2688,7 +2720,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
2688
2720
  })
2689
2721
  )
2690
2722
  );
2691
- var textEditor_20250429 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
2723
+ var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
2724
+ id: "anthropic.text_editor_20250124",
2725
+ name: "str_replace_editor",
2726
+ inputSchema: textEditor_20250124InputSchema
2727
+ });
2728
+
2729
+ // src/tool/text-editor_20250429.ts
2730
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
2731
+ var import_v416 = require("zod/v4");
2732
+ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
2733
+ () => (0, import_provider_utils19.zodSchema)(
2734
+ import_v416.z.object({
2735
+ command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
2736
+ path: import_v416.z.string(),
2737
+ file_text: import_v416.z.string().optional(),
2738
+ insert_line: import_v416.z.number().int().optional(),
2739
+ new_str: import_v416.z.string().optional(),
2740
+ old_str: import_v416.z.string().optional(),
2741
+ view_range: import_v416.z.array(import_v416.z.number().int()).optional()
2742
+ })
2743
+ )
2744
+ );
2745
+ var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
2692
2746
  id: "anthropic.text_editor_20250429",
2693
2747
  name: "str_replace_based_edit_tool",
2694
2748
  inputSchema: textEditor_20250429InputSchema
@@ -2764,6 +2818,17 @@ var anthropicTools = {
2764
2818
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
2765
2819
  */
2766
2820
  computer_20250124,
2821
+ /**
2822
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
2823
+ * Claude can create, read, update, and delete files that persist between sessions,
2824
+ * allowing it to build knowledge over time without keeping everything in the context window.
2825
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
2826
+ *
2827
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
2828
+ *
2829
+ * Tool name must be `memory`.
2830
+ */
2831
+ memory_20250818,
2767
2832
  /**
2768
2833
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
2769
2834
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -2838,11 +2903,11 @@ var anthropicTools = {
2838
2903
  // src/anthropic-provider.ts
2839
2904
  function createAnthropic(options = {}) {
2840
2905
  var _a;
2841
- const baseURL = (_a = (0, import_provider_utils19.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
2842
- const getHeaders = () => (0, import_provider_utils19.withUserAgentSuffix)(
2906
+ const baseURL = (_a = (0, import_provider_utils20.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
2907
+ const getHeaders = () => (0, import_provider_utils20.withUserAgentSuffix)(
2843
2908
  {
2844
2909
  "anthropic-version": "2023-06-01",
2845
- "x-api-key": (0, import_provider_utils19.loadApiKey)({
2910
+ "x-api-key": (0, import_provider_utils20.loadApiKey)({
2846
2911
  apiKey: options.apiKey,
2847
2912
  environmentVariableName: "ANTHROPIC_API_KEY",
2848
2913
  description: "Anthropic"
@@ -2858,7 +2923,7 @@ function createAnthropic(options = {}) {
2858
2923
  baseURL,
2859
2924
  headers: getHeaders,
2860
2925
  fetch: options.fetch,
2861
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils19.generateId,
2926
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils20.generateId,
2862
2927
  supportedUrls: () => ({
2863
2928
  "image/*": [/^https?:\/\/.*$/]
2864
2929
  })