@ai-sdk/anthropic 2.0.28 → 2.0.30

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.
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, LanguageModelV2CallOptions, LanguageModel
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -233,6 +233,42 @@ declare const anthropicTools: {
233
233
  displayHeightPx: number;
234
234
  displayNumber?: number;
235
235
  }>;
236
+ /**
237
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
238
+ * Claude can create, read, update, and delete files that persist between sessions,
239
+ * allowing it to build knowledge over time without keeping everything in the context window.
240
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
241
+ *
242
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
243
+ *
244
+ * Tool name must be `memory`.
245
+ */
246
+ memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
247
+ command: "view";
248
+ path: string;
249
+ view_range?: [number, number];
250
+ } | {
251
+ command: "create";
252
+ path: string;
253
+ file_text: string;
254
+ } | {
255
+ command: "str_replace";
256
+ path: string;
257
+ old_str: string;
258
+ new_str: string;
259
+ } | {
260
+ command: "insert";
261
+ path: string;
262
+ insert_line: number;
263
+ insert_text: string;
264
+ } | {
265
+ command: "delete";
266
+ path: string;
267
+ } | {
268
+ command: "rename";
269
+ old_path: string;
270
+ new_path: string;
271
+ }, {}>;
236
272
  /**
237
273
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
238
274
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -455,6 +491,9 @@ type AnthropicTool = {
455
491
  } | {
456
492
  name: string;
457
493
  type: 'bash_20250124' | 'bash_20241022';
494
+ } | {
495
+ name: string;
496
+ type: 'memory_20250818';
458
497
  } | {
459
498
  type: 'web_fetch_20250910';
460
499
  name: string;
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, LanguageModelV2CallOptions, LanguageModel
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -233,6 +233,42 @@ declare const anthropicTools: {
233
233
  displayHeightPx: number;
234
234
  displayNumber?: number;
235
235
  }>;
236
+ /**
237
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
238
+ * Claude can create, read, update, and delete files that persist between sessions,
239
+ * allowing it to build knowledge over time without keeping everything in the context window.
240
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
241
+ *
242
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
243
+ *
244
+ * Tool name must be `memory`.
245
+ */
246
+ memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
247
+ command: "view";
248
+ path: string;
249
+ view_range?: [number, number];
250
+ } | {
251
+ command: "create";
252
+ path: string;
253
+ file_text: string;
254
+ } | {
255
+ command: "str_replace";
256
+ path: string;
257
+ old_str: string;
258
+ new_str: string;
259
+ } | {
260
+ command: "insert";
261
+ path: string;
262
+ insert_line: number;
263
+ insert_text: string;
264
+ } | {
265
+ command: "delete";
266
+ path: string;
267
+ } | {
268
+ command: "rename";
269
+ old_path: string;
270
+ new_path: string;
271
+ }, {}>;
236
272
  /**
237
273
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
238
274
  * helping you debug, fix, and improve your code or other text documents. This allows Claude
@@ -455,6 +491,9 @@ type AnthropicTool = {
455
491
  } | {
456
492
  name: string;
457
493
  type: 'bash_20250124' | 'bash_20241022';
494
+ } | {
495
+ name: string;
496
+ type: 'memory_20250818';
458
497
  } | {
459
498
  type: 'web_fetch_20250910';
460
499
  name: string;
@@ -807,6 +807,14 @@ async function prepareTools({
807
807
  });
808
808
  break;
809
809
  }
810
+ case "anthropic.memory_20250818": {
811
+ betas.add("context-management-2025-06-27");
812
+ anthropicTools2.push({
813
+ name: "memory",
814
+ type: "memory_20250818"
815
+ });
816
+ break;
817
+ }
810
818
  case "anthropic.web_fetch_20250910": {
811
819
  betas.add("web-fetch-2025-09-10");
812
820
  const args = await (0, import_provider_utils7.validateTypes)({
@@ -2618,32 +2626,56 @@ var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFac
2618
2626
  inputSchema: computer_20250124InputSchema
2619
2627
  });
2620
2628
 
2621
- // src/tool/text-editor_20241022.ts
2629
+ // src/tool/memory_20250818.ts
2622
2630
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
2623
2631
  var import_v413 = require("zod/v4");
2624
- var textEditor_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
2632
+ var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
2625
2633
  () => (0, import_provider_utils16.zodSchema)(
2626
- import_v413.z.object({
2627
- command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2628
- path: import_v413.z.string(),
2629
- file_text: import_v413.z.string().optional(),
2630
- insert_line: import_v413.z.number().int().optional(),
2631
- new_str: import_v413.z.string().optional(),
2632
- old_str: import_v413.z.string().optional(),
2633
- view_range: import_v413.z.array(import_v413.z.number().int()).optional()
2634
- })
2634
+ import_v413.z.discriminatedUnion("command", [
2635
+ import_v413.z.object({
2636
+ command: import_v413.z.literal("view"),
2637
+ path: import_v413.z.string(),
2638
+ view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
2639
+ }),
2640
+ import_v413.z.object({
2641
+ command: import_v413.z.literal("create"),
2642
+ path: import_v413.z.string(),
2643
+ file_text: import_v413.z.string()
2644
+ }),
2645
+ import_v413.z.object({
2646
+ command: import_v413.z.literal("str_replace"),
2647
+ path: import_v413.z.string(),
2648
+ old_str: import_v413.z.string(),
2649
+ new_str: import_v413.z.string()
2650
+ }),
2651
+ import_v413.z.object({
2652
+ command: import_v413.z.literal("insert"),
2653
+ path: import_v413.z.string(),
2654
+ insert_line: import_v413.z.number(),
2655
+ insert_text: import_v413.z.string()
2656
+ }),
2657
+ import_v413.z.object({
2658
+ command: import_v413.z.literal("delete"),
2659
+ path: import_v413.z.string()
2660
+ }),
2661
+ import_v413.z.object({
2662
+ command: import_v413.z.literal("rename"),
2663
+ old_path: import_v413.z.string(),
2664
+ new_path: import_v413.z.string()
2665
+ })
2666
+ ])
2635
2667
  )
2636
2668
  );
2637
- var textEditor_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2638
- id: "anthropic.text_editor_20241022",
2639
- name: "str_replace_editor",
2640
- inputSchema: textEditor_20241022InputSchema
2669
+ var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
2670
+ id: "anthropic.memory_20250818",
2671
+ name: "memory",
2672
+ inputSchema: memory_20250818InputSchema
2641
2673
  });
2642
2674
 
2643
- // src/tool/text-editor_20250124.ts
2675
+ // src/tool/text-editor_20241022.ts
2644
2676
  var import_provider_utils17 = require("@ai-sdk/provider-utils");
2645
2677
  var import_v414 = require("zod/v4");
2646
- var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
2678
+ var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
2647
2679
  () => (0, import_provider_utils17.zodSchema)(
2648
2680
  import_v414.z.object({
2649
2681
  command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -2656,19 +2688,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
2656
2688
  })
2657
2689
  )
2658
2690
  );
2659
- var textEditor_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2660
- id: "anthropic.text_editor_20250124",
2691
+ var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
2692
+ id: "anthropic.text_editor_20241022",
2661
2693
  name: "str_replace_editor",
2662
- inputSchema: textEditor_20250124InputSchema
2694
+ inputSchema: textEditor_20241022InputSchema
2663
2695
  });
2664
2696
 
2665
- // src/tool/text-editor_20250429.ts
2697
+ // src/tool/text-editor_20250124.ts
2666
2698
  var import_provider_utils18 = require("@ai-sdk/provider-utils");
2667
2699
  var import_v415 = require("zod/v4");
2668
- var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
2700
+ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
2669
2701
  () => (0, import_provider_utils18.zodSchema)(
2670
2702
  import_v415.z.object({
2671
- command: import_v415.z.enum(["view", "create", "str_replace", "insert"]),
2703
+ command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2672
2704
  path: import_v415.z.string(),
2673
2705
  file_text: import_v415.z.string().optional(),
2674
2706
  insert_line: import_v415.z.number().int().optional(),
@@ -2678,7 +2710,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
2678
2710
  })
2679
2711
  )
2680
2712
  );
2681
- var textEditor_20250429 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
2713
+ var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
2714
+ id: "anthropic.text_editor_20250124",
2715
+ name: "str_replace_editor",
2716
+ inputSchema: textEditor_20250124InputSchema
2717
+ });
2718
+
2719
+ // src/tool/text-editor_20250429.ts
2720
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
2721
+ var import_v416 = require("zod/v4");
2722
+ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
2723
+ () => (0, import_provider_utils19.zodSchema)(
2724
+ import_v416.z.object({
2725
+ command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
2726
+ path: import_v416.z.string(),
2727
+ file_text: import_v416.z.string().optional(),
2728
+ insert_line: import_v416.z.number().int().optional(),
2729
+ new_str: import_v416.z.string().optional(),
2730
+ old_str: import_v416.z.string().optional(),
2731
+ view_range: import_v416.z.array(import_v416.z.number().int()).optional()
2732
+ })
2733
+ )
2734
+ );
2735
+ var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
2682
2736
  id: "anthropic.text_editor_20250429",
2683
2737
  name: "str_replace_based_edit_tool",
2684
2738
  inputSchema: textEditor_20250429InputSchema
@@ -2754,6 +2808,17 @@ var anthropicTools = {
2754
2808
  * @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.
2755
2809
  */
2756
2810
  computer_20250124,
2811
+ /**
2812
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
2813
+ * Claude can create, read, update, and delete files that persist between sessions,
2814
+ * allowing it to build knowledge over time without keeping everything in the context window.
2815
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
2816
+ *
2817
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
2818
+ *
2819
+ * Tool name must be `memory`.
2820
+ */
2821
+ memory_20250818,
2757
2822
  /**
2758
2823
  * Claude can use an Anthropic-defined text editor tool to view and modify text files,
2759
2824
  * helping you debug, fix, and improve your code or other text documents. This allows Claude