@ai-sdk/anthropic 1.1.12 → 1.1.13

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
+ ## 1.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 3004b14: feat(provider/anthropic): add bash_20250124 and text_editor_20250124 tools
8
+
3
9
  ## 1.1.12
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -69,6 +69,43 @@ declare function bashTool_20241022<RESULT>(options?: {
69
69
  execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
70
70
  experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
71
71
  };
72
+ declare const Bash20250124Parameters: z.ZodObject<{
73
+ command: z.ZodString;
74
+ restart: z.ZodOptional<z.ZodBoolean>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ command: string;
77
+ restart?: boolean | undefined;
78
+ }, {
79
+ command: string;
80
+ restart?: boolean | undefined;
81
+ }>;
82
+ /**
83
+ * Creates a tool for running a bash command. Must have name "bash".
84
+ *
85
+ * Image results are supported.
86
+ *
87
+ * @param execute - The function to execute the tool. Optional.
88
+ */
89
+ declare function bashTool_20250124<RESULT>(options?: {
90
+ execute?: ExecuteFunction<{
91
+ /**
92
+ * The bash command to run. Required unless the tool is being restarted.
93
+ */
94
+ command: string;
95
+ /**
96
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
97
+ */
98
+ restart?: boolean;
99
+ }, RESULT>;
100
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
101
+ }): {
102
+ type: 'provider-defined';
103
+ id: 'anthropic.bash_20250124';
104
+ args: {};
105
+ parameters: typeof Bash20250124Parameters;
106
+ execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
107
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
108
+ };
72
109
  declare const TextEditor20241022Parameters: z.ZodObject<{
73
110
  command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
74
111
  path: z.ZodString;
@@ -141,6 +178,78 @@ declare function textEditorTool_20241022<RESULT>(options?: {
141
178
  execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
142
179
  experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
143
180
  };
181
+ declare const TextEditor20250124Parameters: z.ZodObject<{
182
+ command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
183
+ path: z.ZodString;
184
+ file_text: z.ZodOptional<z.ZodString>;
185
+ insert_line: z.ZodOptional<z.ZodNumber>;
186
+ new_str: z.ZodOptional<z.ZodString>;
187
+ old_str: z.ZodOptional<z.ZodString>;
188
+ view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ path: string;
191
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
192
+ file_text?: string | undefined;
193
+ insert_line?: number | undefined;
194
+ new_str?: string | undefined;
195
+ old_str?: string | undefined;
196
+ view_range?: number[] | undefined;
197
+ }, {
198
+ path: string;
199
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
200
+ file_text?: string | undefined;
201
+ insert_line?: number | undefined;
202
+ new_str?: string | undefined;
203
+ old_str?: string | undefined;
204
+ view_range?: number[] | undefined;
205
+ }>;
206
+ /**
207
+ * Creates a tool for editing text. Must have name "str_replace_editor".
208
+ *
209
+ * Image results are supported.
210
+ *
211
+ * @param execute - The function to execute the tool. Optional.
212
+ */
213
+ declare function textEditorTool_20250124<RESULT>(options?: {
214
+ execute?: ExecuteFunction<{
215
+ /**
216
+ * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
217
+ */
218
+ command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
219
+ /**
220
+ * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
221
+ */
222
+ path: string;
223
+ /**
224
+ * Required parameter of `create` command, with the content of the file to be created.
225
+ */
226
+ file_text?: string;
227
+ /**
228
+ * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
229
+ */
230
+ insert_line?: number;
231
+ /**
232
+ * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.
233
+ */
234
+ new_str?: string;
235
+ /**
236
+ * Required parameter of `str_replace` command containing the string in `path` to replace.
237
+ */
238
+ old_str?: string;
239
+ /**
240
+ * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
241
+ */
242
+ view_range?: number[];
243
+ }, RESULT>;
244
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
245
+ }): {
246
+ type: 'provider-defined';
247
+ id: 'anthropic.text_editor_20250124';
248
+ args: {};
249
+ parameters: typeof TextEditor20250124Parameters;
250
+ execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
251
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
252
+ };
144
253
  declare const Computer20241022Parameters: z.ZodObject<{
145
254
  action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
146
255
  coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
@@ -300,7 +409,9 @@ declare function computerTool_20250124<RESULT>(options: {
300
409
  };
301
410
  declare const anthropicTools: {
302
411
  bash_20241022: typeof bashTool_20241022;
412
+ bash_20250124: typeof bashTool_20250124;
303
413
  textEditor_20241022: typeof textEditorTool_20241022;
414
+ textEditor_20250124: typeof textEditorTool_20250124;
304
415
  computer_20241022: typeof computerTool_20241022;
305
416
  computer_20250124: typeof computerTool_20250124;
306
417
  };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,43 @@ declare function bashTool_20241022<RESULT>(options?: {
69
69
  execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
70
70
  experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
71
71
  };
72
+ declare const Bash20250124Parameters: z.ZodObject<{
73
+ command: z.ZodString;
74
+ restart: z.ZodOptional<z.ZodBoolean>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ command: string;
77
+ restart?: boolean | undefined;
78
+ }, {
79
+ command: string;
80
+ restart?: boolean | undefined;
81
+ }>;
82
+ /**
83
+ * Creates a tool for running a bash command. Must have name "bash".
84
+ *
85
+ * Image results are supported.
86
+ *
87
+ * @param execute - The function to execute the tool. Optional.
88
+ */
89
+ declare function bashTool_20250124<RESULT>(options?: {
90
+ execute?: ExecuteFunction<{
91
+ /**
92
+ * The bash command to run. Required unless the tool is being restarted.
93
+ */
94
+ command: string;
95
+ /**
96
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
97
+ */
98
+ restart?: boolean;
99
+ }, RESULT>;
100
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
101
+ }): {
102
+ type: 'provider-defined';
103
+ id: 'anthropic.bash_20250124';
104
+ args: {};
105
+ parameters: typeof Bash20250124Parameters;
106
+ execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
107
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
108
+ };
72
109
  declare const TextEditor20241022Parameters: z.ZodObject<{
73
110
  command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
74
111
  path: z.ZodString;
@@ -141,6 +178,78 @@ declare function textEditorTool_20241022<RESULT>(options?: {
141
178
  execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
142
179
  experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
143
180
  };
181
+ declare const TextEditor20250124Parameters: z.ZodObject<{
182
+ command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
183
+ path: z.ZodString;
184
+ file_text: z.ZodOptional<z.ZodString>;
185
+ insert_line: z.ZodOptional<z.ZodNumber>;
186
+ new_str: z.ZodOptional<z.ZodString>;
187
+ old_str: z.ZodOptional<z.ZodString>;
188
+ view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ path: string;
191
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
192
+ file_text?: string | undefined;
193
+ insert_line?: number | undefined;
194
+ new_str?: string | undefined;
195
+ old_str?: string | undefined;
196
+ view_range?: number[] | undefined;
197
+ }, {
198
+ path: string;
199
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
200
+ file_text?: string | undefined;
201
+ insert_line?: number | undefined;
202
+ new_str?: string | undefined;
203
+ old_str?: string | undefined;
204
+ view_range?: number[] | undefined;
205
+ }>;
206
+ /**
207
+ * Creates a tool for editing text. Must have name "str_replace_editor".
208
+ *
209
+ * Image results are supported.
210
+ *
211
+ * @param execute - The function to execute the tool. Optional.
212
+ */
213
+ declare function textEditorTool_20250124<RESULT>(options?: {
214
+ execute?: ExecuteFunction<{
215
+ /**
216
+ * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
217
+ */
218
+ command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
219
+ /**
220
+ * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
221
+ */
222
+ path: string;
223
+ /**
224
+ * Required parameter of `create` command, with the content of the file to be created.
225
+ */
226
+ file_text?: string;
227
+ /**
228
+ * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
229
+ */
230
+ insert_line?: number;
231
+ /**
232
+ * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.
233
+ */
234
+ new_str?: string;
235
+ /**
236
+ * Required parameter of `str_replace` command containing the string in `path` to replace.
237
+ */
238
+ old_str?: string;
239
+ /**
240
+ * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
241
+ */
242
+ view_range?: number[];
243
+ }, RESULT>;
244
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
245
+ }): {
246
+ type: 'provider-defined';
247
+ id: 'anthropic.text_editor_20250124';
248
+ args: {};
249
+ parameters: typeof TextEditor20250124Parameters;
250
+ execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
251
+ experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
252
+ };
144
253
  declare const Computer20241022Parameters: z.ZodObject<{
145
254
  action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
146
255
  coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
@@ -300,7 +409,9 @@ declare function computerTool_20250124<RESULT>(options: {
300
409
  };
301
410
  declare const anthropicTools: {
302
411
  bash_20241022: typeof bashTool_20241022;
412
+ bash_20250124: typeof bashTool_20250124;
303
413
  textEditor_20241022: typeof textEditorTool_20241022;
414
+ textEditor_20250124: typeof textEditorTool_20250124;
304
415
  computer_20241022: typeof computerTool_20241022;
305
416
  computer_20250124: typeof computerTool_20250124;
306
417
  };
package/dist/index.js CHANGED
@@ -91,6 +91,13 @@ function prepareTools(mode) {
91
91
  display_number: tool.args.displayNumber
92
92
  });
93
93
  break;
94
+ case "anthropic.text_editor_20250124":
95
+ betas.add("computer-use-2025-01-24");
96
+ anthropicTools2.push({
97
+ name: tool.name,
98
+ type: "text_editor_20250124"
99
+ });
100
+ break;
94
101
  case "anthropic.text_editor_20241022":
95
102
  betas.add("computer-use-2024-10-22");
96
103
  anthropicTools2.push({
@@ -98,6 +105,13 @@ function prepareTools(mode) {
98
105
  type: "text_editor_20241022"
99
106
  });
100
107
  break;
108
+ case "anthropic.bash_20250124":
109
+ betas.add("computer-use-2025-01-24");
110
+ anthropicTools2.push({
111
+ name: tool.name,
112
+ type: "bash_20250124"
113
+ });
114
+ break;
101
115
  case "anthropic.bash_20241022":
102
116
  betas.add("computer-use-2024-10-22");
103
117
  anthropicTools2.push({
@@ -1009,6 +1023,20 @@ function bashTool_20241022(options = {}) {
1009
1023
  experimental_toToolResultContent: options.experimental_toToolResultContent
1010
1024
  };
1011
1025
  }
1026
+ var Bash20250124Parameters = import_zod3.z.object({
1027
+ command: import_zod3.z.string(),
1028
+ restart: import_zod3.z.boolean().optional()
1029
+ });
1030
+ function bashTool_20250124(options = {}) {
1031
+ return {
1032
+ type: "provider-defined",
1033
+ id: "anthropic.bash_20250124",
1034
+ args: {},
1035
+ parameters: Bash20250124Parameters,
1036
+ execute: options.execute,
1037
+ experimental_toToolResultContent: options.experimental_toToolResultContent
1038
+ };
1039
+ }
1012
1040
  var TextEditor20241022Parameters = import_zod3.z.object({
1013
1041
  command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1014
1042
  path: import_zod3.z.string(),
@@ -1028,6 +1056,25 @@ function textEditorTool_20241022(options = {}) {
1028
1056
  experimental_toToolResultContent: options.experimental_toToolResultContent
1029
1057
  };
1030
1058
  }
1059
+ var TextEditor20250124Parameters = import_zod3.z.object({
1060
+ command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1061
+ path: import_zod3.z.string(),
1062
+ file_text: import_zod3.z.string().optional(),
1063
+ insert_line: import_zod3.z.number().int().optional(),
1064
+ new_str: import_zod3.z.string().optional(),
1065
+ old_str: import_zod3.z.string().optional(),
1066
+ view_range: import_zod3.z.array(import_zod3.z.number().int()).optional()
1067
+ });
1068
+ function textEditorTool_20250124(options = {}) {
1069
+ return {
1070
+ type: "provider-defined",
1071
+ id: "anthropic.text_editor_20250124",
1072
+ args: {},
1073
+ parameters: TextEditor20250124Parameters,
1074
+ execute: options.execute,
1075
+ experimental_toToolResultContent: options.experimental_toToolResultContent
1076
+ };
1077
+ }
1031
1078
  var Computer20241022Parameters = import_zod3.z.object({
1032
1079
  action: import_zod3.z.enum([
1033
1080
  "key",
@@ -1100,7 +1147,9 @@ function computerTool_20250124(options) {
1100
1147
  }
1101
1148
  var anthropicTools = {
1102
1149
  bash_20241022: bashTool_20241022,
1150
+ bash_20250124: bashTool_20250124,
1103
1151
  textEditor_20241022: textEditorTool_20241022,
1152
+ textEditor_20250124: textEditorTool_20250124,
1104
1153
  computer_20241022: computerTool_20241022,
1105
1154
  computer_20250124: computerTool_20250124
1106
1155
  };