@ai-sdk/anthropic 1.1.10 → 1.1.11
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 +7 -0
- package/dist/index.d.mts +57 -11
- package/dist/index.d.ts +57 -11
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -2
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +57 -11
- package/internal/dist/index.d.ts +57 -11
- package/internal/dist/index.js +31 -2
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +31 -2
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 1.1.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 00276ae: feat (provider/anthropic): update types for Anthropic computer_20250124 tool
|
|
8
|
+
- a4f8714: feat (provider/anthropic): update beta flag for sonnet-3-7 when using new computer-use tool
|
|
9
|
+
|
|
3
10
|
## 1.1.10
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -196,6 +196,31 @@ declare function computerTool_20241022<RESULT>(options: {
|
|
|
196
196
|
execute: ExecuteFunction<z.infer<typeof Computer20241022Parameters>, RESULT>;
|
|
197
197
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
198
198
|
};
|
|
199
|
+
declare const Computer20250124Parameters: z.ZodObject<{
|
|
200
|
+
action: z.ZodEnum<["key", "hold_key", "type", "cursor_position", "mouse_move", "left_mouse_down", "left_mouse_up", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "triple_click", "scroll", "wait", "screenshot"]>;
|
|
201
|
+
coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
202
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
scroll_amount: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
205
|
+
start_coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
206
|
+
text: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
|
|
209
|
+
text?: string | undefined;
|
|
210
|
+
coordinate?: [number, number] | undefined;
|
|
211
|
+
duration?: number | undefined;
|
|
212
|
+
scroll_amount?: number | undefined;
|
|
213
|
+
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
214
|
+
start_coordinate?: [number, number] | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
|
|
217
|
+
text?: string | undefined;
|
|
218
|
+
coordinate?: [number, number] | undefined;
|
|
219
|
+
duration?: number | undefined;
|
|
220
|
+
scroll_amount?: number | undefined;
|
|
221
|
+
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
222
|
+
start_coordinate?: [number, number] | undefined;
|
|
223
|
+
}>;
|
|
199
224
|
/**
|
|
200
225
|
* Creates a tool for executing actions on a computer. Must have name "computer".
|
|
201
226
|
*
|
|
@@ -212,27 +237,48 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
212
237
|
displayNumber?: number;
|
|
213
238
|
execute?: ExecuteFunction<{
|
|
214
239
|
/**
|
|
215
|
-
* The action to perform. The available actions are:
|
|
216
240
|
* - `key`: Press a key or key-combination on the keyboard.
|
|
217
241
|
* - This supports xdotool's `key` syntax.
|
|
218
242
|
* - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
|
|
243
|
+
* - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
|
|
219
244
|
* - `type`: Type a string of text on the keyboard.
|
|
220
245
|
* - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
|
|
221
246
|
* - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
|
|
222
|
-
* - `
|
|
223
|
-
* - `
|
|
224
|
-
* - `
|
|
225
|
-
* - `
|
|
226
|
-
* - `
|
|
247
|
+
* - `left_mouse_down`: Press the left mouse button.
|
|
248
|
+
* - `left_mouse_up`: Release the left mouse button.
|
|
249
|
+
* - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.
|
|
250
|
+
* - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
|
|
251
|
+
* - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
252
|
+
* - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
253
|
+
* - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
254
|
+
* - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
255
|
+
* - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.
|
|
256
|
+
* - `wait`: Wait for a specified duration (in seconds).
|
|
227
257
|
* - `screenshot`: Take a screenshot of the screen.
|
|
228
258
|
*/
|
|
229
|
-
action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | '
|
|
259
|
+
action: 'key' | 'hold_key' | 'type' | 'cursor_position' | 'mouse_move' | 'left_mouse_down' | 'left_mouse_up' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'triple_click' | 'scroll' | 'wait' | 'screenshot';
|
|
230
260
|
/**
|
|
231
261
|
* (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
|
|
232
262
|
*/
|
|
233
|
-
coordinate?: number
|
|
263
|
+
coordinate?: [number, number];
|
|
234
264
|
/**
|
|
235
|
-
* Required only by `action=
|
|
265
|
+
* The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
|
|
266
|
+
*/
|
|
267
|
+
duration?: number;
|
|
268
|
+
/**
|
|
269
|
+
* The number of 'clicks' to scroll. Required only by `action=scroll`.
|
|
270
|
+
*/
|
|
271
|
+
scroll_amount?: number;
|
|
272
|
+
/**
|
|
273
|
+
* The direction to scroll the screen. Required only by `action=scroll`.
|
|
274
|
+
*/
|
|
275
|
+
scroll_direction?: 'up' | 'down' | 'left' | 'right';
|
|
276
|
+
/**
|
|
277
|
+
* (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.
|
|
278
|
+
*/
|
|
279
|
+
start_coordinate?: [number, number];
|
|
280
|
+
/**
|
|
281
|
+
* Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.
|
|
236
282
|
*/
|
|
237
283
|
text?: string;
|
|
238
284
|
}, RESULT>;
|
|
@@ -241,8 +287,8 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
241
287
|
type: 'provider-defined';
|
|
242
288
|
id: 'anthropic.computer_20250124';
|
|
243
289
|
args: {};
|
|
244
|
-
parameters: typeof
|
|
245
|
-
execute: ExecuteFunction<z.infer<typeof
|
|
290
|
+
parameters: typeof Computer20250124Parameters;
|
|
291
|
+
execute: ExecuteFunction<z.infer<typeof Computer20250124Parameters>, RESULT>;
|
|
246
292
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
247
293
|
};
|
|
248
294
|
declare const anthropicTools: {
|
package/dist/index.d.ts
CHANGED
|
@@ -196,6 +196,31 @@ declare function computerTool_20241022<RESULT>(options: {
|
|
|
196
196
|
execute: ExecuteFunction<z.infer<typeof Computer20241022Parameters>, RESULT>;
|
|
197
197
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
198
198
|
};
|
|
199
|
+
declare const Computer20250124Parameters: z.ZodObject<{
|
|
200
|
+
action: z.ZodEnum<["key", "hold_key", "type", "cursor_position", "mouse_move", "left_mouse_down", "left_mouse_up", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "triple_click", "scroll", "wait", "screenshot"]>;
|
|
201
|
+
coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
202
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
scroll_amount: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
205
|
+
start_coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
206
|
+
text: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
|
|
209
|
+
text?: string | undefined;
|
|
210
|
+
coordinate?: [number, number] | undefined;
|
|
211
|
+
duration?: number | undefined;
|
|
212
|
+
scroll_amount?: number | undefined;
|
|
213
|
+
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
214
|
+
start_coordinate?: [number, number] | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
|
|
217
|
+
text?: string | undefined;
|
|
218
|
+
coordinate?: [number, number] | undefined;
|
|
219
|
+
duration?: number | undefined;
|
|
220
|
+
scroll_amount?: number | undefined;
|
|
221
|
+
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
222
|
+
start_coordinate?: [number, number] | undefined;
|
|
223
|
+
}>;
|
|
199
224
|
/**
|
|
200
225
|
* Creates a tool for executing actions on a computer. Must have name "computer".
|
|
201
226
|
*
|
|
@@ -212,27 +237,48 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
212
237
|
displayNumber?: number;
|
|
213
238
|
execute?: ExecuteFunction<{
|
|
214
239
|
/**
|
|
215
|
-
* The action to perform. The available actions are:
|
|
216
240
|
* - `key`: Press a key or key-combination on the keyboard.
|
|
217
241
|
* - This supports xdotool's `key` syntax.
|
|
218
242
|
* - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
|
|
243
|
+
* - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
|
|
219
244
|
* - `type`: Type a string of text on the keyboard.
|
|
220
245
|
* - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
|
|
221
246
|
* - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
|
|
222
|
-
* - `
|
|
223
|
-
* - `
|
|
224
|
-
* - `
|
|
225
|
-
* - `
|
|
226
|
-
* - `
|
|
247
|
+
* - `left_mouse_down`: Press the left mouse button.
|
|
248
|
+
* - `left_mouse_up`: Release the left mouse button.
|
|
249
|
+
* - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.
|
|
250
|
+
* - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
|
|
251
|
+
* - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
252
|
+
* - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
253
|
+
* - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
254
|
+
* - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
255
|
+
* - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.
|
|
256
|
+
* - `wait`: Wait for a specified duration (in seconds).
|
|
227
257
|
* - `screenshot`: Take a screenshot of the screen.
|
|
228
258
|
*/
|
|
229
|
-
action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | '
|
|
259
|
+
action: 'key' | 'hold_key' | 'type' | 'cursor_position' | 'mouse_move' | 'left_mouse_down' | 'left_mouse_up' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'triple_click' | 'scroll' | 'wait' | 'screenshot';
|
|
230
260
|
/**
|
|
231
261
|
* (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
|
|
232
262
|
*/
|
|
233
|
-
coordinate?: number
|
|
263
|
+
coordinate?: [number, number];
|
|
234
264
|
/**
|
|
235
|
-
* Required only by `action=
|
|
265
|
+
* The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
|
|
266
|
+
*/
|
|
267
|
+
duration?: number;
|
|
268
|
+
/**
|
|
269
|
+
* The number of 'clicks' to scroll. Required only by `action=scroll`.
|
|
270
|
+
*/
|
|
271
|
+
scroll_amount?: number;
|
|
272
|
+
/**
|
|
273
|
+
* The direction to scroll the screen. Required only by `action=scroll`.
|
|
274
|
+
*/
|
|
275
|
+
scroll_direction?: 'up' | 'down' | 'left' | 'right';
|
|
276
|
+
/**
|
|
277
|
+
* (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.
|
|
278
|
+
*/
|
|
279
|
+
start_coordinate?: [number, number];
|
|
280
|
+
/**
|
|
281
|
+
* Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.
|
|
236
282
|
*/
|
|
237
283
|
text?: string;
|
|
238
284
|
}, RESULT>;
|
|
@@ -241,8 +287,8 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
241
287
|
type: 'provider-defined';
|
|
242
288
|
id: 'anthropic.computer_20250124';
|
|
243
289
|
args: {};
|
|
244
|
-
parameters: typeof
|
|
245
|
-
execute: ExecuteFunction<z.infer<typeof
|
|
290
|
+
parameters: typeof Computer20250124Parameters;
|
|
291
|
+
execute: ExecuteFunction<z.infer<typeof Computer20250124Parameters>, RESULT>;
|
|
246
292
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
247
293
|
};
|
|
248
294
|
declare const anthropicTools: {
|
package/dist/index.js
CHANGED
|
@@ -70,9 +70,9 @@ function prepareTools(mode) {
|
|
|
70
70
|
});
|
|
71
71
|
break;
|
|
72
72
|
case "provider-defined":
|
|
73
|
-
betas.add("computer-use-2024-10-22");
|
|
74
73
|
switch (tool.id) {
|
|
75
74
|
case "anthropic.computer_20250124":
|
|
75
|
+
betas.add("computer-use-2025-01-24");
|
|
76
76
|
anthropicTools2.push({
|
|
77
77
|
name: tool.name,
|
|
78
78
|
type: "computer_20250124",
|
|
@@ -82,6 +82,7 @@ function prepareTools(mode) {
|
|
|
82
82
|
});
|
|
83
83
|
break;
|
|
84
84
|
case "anthropic.computer_20241022":
|
|
85
|
+
betas.add("computer-use-2024-10-22");
|
|
85
86
|
anthropicTools2.push({
|
|
86
87
|
name: tool.name,
|
|
87
88
|
type: "computer_20241022",
|
|
@@ -91,12 +92,14 @@ function prepareTools(mode) {
|
|
|
91
92
|
});
|
|
92
93
|
break;
|
|
93
94
|
case "anthropic.text_editor_20241022":
|
|
95
|
+
betas.add("computer-use-2024-10-22");
|
|
94
96
|
anthropicTools2.push({
|
|
95
97
|
name: tool.name,
|
|
96
98
|
type: "text_editor_20241022"
|
|
97
99
|
});
|
|
98
100
|
break;
|
|
99
101
|
case "anthropic.bash_20241022":
|
|
102
|
+
betas.add("computer-use-2024-10-22");
|
|
100
103
|
anthropicTools2.push({
|
|
101
104
|
name: tool.name,
|
|
102
105
|
type: "bash_20241022"
|
|
@@ -1044,6 +1047,32 @@ function computerTool_20241022(options) {
|
|
|
1044
1047
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1045
1048
|
};
|
|
1046
1049
|
}
|
|
1050
|
+
var Computer20250124Parameters = import_zod3.z.object({
|
|
1051
|
+
action: import_zod3.z.enum([
|
|
1052
|
+
"key",
|
|
1053
|
+
"hold_key",
|
|
1054
|
+
"type",
|
|
1055
|
+
"cursor_position",
|
|
1056
|
+
"mouse_move",
|
|
1057
|
+
"left_mouse_down",
|
|
1058
|
+
"left_mouse_up",
|
|
1059
|
+
"left_click",
|
|
1060
|
+
"left_click_drag",
|
|
1061
|
+
"right_click",
|
|
1062
|
+
"middle_click",
|
|
1063
|
+
"double_click",
|
|
1064
|
+
"triple_click",
|
|
1065
|
+
"scroll",
|
|
1066
|
+
"wait",
|
|
1067
|
+
"screenshot"
|
|
1068
|
+
]),
|
|
1069
|
+
coordinate: import_zod3.z.tuple([import_zod3.z.number().int(), import_zod3.z.number().int()]).optional(),
|
|
1070
|
+
duration: import_zod3.z.number().optional(),
|
|
1071
|
+
scroll_amount: import_zod3.z.number().optional(),
|
|
1072
|
+
scroll_direction: import_zod3.z.enum(["up", "down", "left", "right"]).optional(),
|
|
1073
|
+
start_coordinate: import_zod3.z.tuple([import_zod3.z.number().int(), import_zod3.z.number().int()]).optional(),
|
|
1074
|
+
text: import_zod3.z.string().optional()
|
|
1075
|
+
});
|
|
1047
1076
|
function computerTool_20250124(options) {
|
|
1048
1077
|
return {
|
|
1049
1078
|
type: "provider-defined",
|
|
@@ -1053,7 +1082,7 @@ function computerTool_20250124(options) {
|
|
|
1053
1082
|
displayHeightPx: options.displayHeightPx,
|
|
1054
1083
|
displayNumber: options.displayNumber
|
|
1055
1084
|
},
|
|
1056
|
-
parameters:
|
|
1085
|
+
parameters: Computer20250124Parameters,
|
|
1057
1086
|
execute: options.execute,
|
|
1058
1087
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1059
1088
|
};
|