@ai-sdk/anthropic 3.0.24 → 3.0.25
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 +6 -0
- package/dist/index.d.mts +31 -21
- package/dist/index.d.ts +31 -21
- package/dist/index.js +153 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -76
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +39 -21
- package/dist/internal/index.d.ts +39 -21
- package/dist/internal/index.js +146 -72
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +153 -75
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +22 -5
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +9 -0
- package/src/anthropic-prepare-tools.ts +13 -0
- package/src/anthropic-tools.ts +18 -0
- package/src/tool/computer_20251124.ts +151 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -1109,6 +1109,19 @@ async function prepareTools({
|
|
|
1109
1109
|
});
|
|
1110
1110
|
break;
|
|
1111
1111
|
}
|
|
1112
|
+
case "anthropic.computer_20251124": {
|
|
1113
|
+
betas.add("computer-use-2025-11-24");
|
|
1114
|
+
anthropicTools2.push({
|
|
1115
|
+
name: "computer",
|
|
1116
|
+
type: "computer_20251124",
|
|
1117
|
+
display_width_px: tool.args.displayWidthPx,
|
|
1118
|
+
display_height_px: tool.args.displayHeightPx,
|
|
1119
|
+
display_number: tool.args.displayNumber,
|
|
1120
|
+
enable_zoom: tool.args.enableZoom,
|
|
1121
|
+
cache_control: void 0
|
|
1122
|
+
});
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1112
1125
|
case "anthropic.computer_20241022": {
|
|
1113
1126
|
betas.add("computer-use-2024-10-22");
|
|
1114
1127
|
anthropicTools2.push({
|
|
@@ -4027,88 +4040,112 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4027
4040
|
inputSchema: computer_20250124InputSchema
|
|
4028
4041
|
});
|
|
4029
4042
|
|
|
4030
|
-
// src/tool/
|
|
4043
|
+
// src/tool/computer_20251124.ts
|
|
4031
4044
|
import {
|
|
4032
4045
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4033
4046
|
lazySchema as lazySchema13,
|
|
4034
4047
|
zodSchema as zodSchema13
|
|
4035
4048
|
} from "@ai-sdk/provider-utils";
|
|
4036
4049
|
import { z as z14 } from "zod/v4";
|
|
4037
|
-
var
|
|
4050
|
+
var computer_20251124InputSchema = lazySchema13(
|
|
4038
4051
|
() => zodSchema13(
|
|
4039
|
-
z14.
|
|
4040
|
-
z14.
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4052
|
+
z14.object({
|
|
4053
|
+
action: z14.enum([
|
|
4054
|
+
"key",
|
|
4055
|
+
"hold_key",
|
|
4056
|
+
"type",
|
|
4057
|
+
"cursor_position",
|
|
4058
|
+
"mouse_move",
|
|
4059
|
+
"left_mouse_down",
|
|
4060
|
+
"left_mouse_up",
|
|
4061
|
+
"left_click",
|
|
4062
|
+
"left_click_drag",
|
|
4063
|
+
"right_click",
|
|
4064
|
+
"middle_click",
|
|
4065
|
+
"double_click",
|
|
4066
|
+
"triple_click",
|
|
4067
|
+
"scroll",
|
|
4068
|
+
"wait",
|
|
4069
|
+
"screenshot",
|
|
4070
|
+
"zoom"
|
|
4071
|
+
]),
|
|
4072
|
+
coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4073
|
+
duration: z14.number().optional(),
|
|
4074
|
+
region: z14.tuple([
|
|
4075
|
+
z14.number().int(),
|
|
4076
|
+
z14.number().int(),
|
|
4077
|
+
z14.number().int(),
|
|
4078
|
+
z14.number().int()
|
|
4079
|
+
]).optional(),
|
|
4080
|
+
scroll_amount: z14.number().optional(),
|
|
4081
|
+
scroll_direction: z14.enum(["up", "down", "left", "right"]).optional(),
|
|
4082
|
+
start_coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4083
|
+
text: z14.string().optional()
|
|
4084
|
+
})
|
|
4072
4085
|
)
|
|
4073
4086
|
);
|
|
4074
|
-
var
|
|
4075
|
-
id: "anthropic.
|
|
4076
|
-
inputSchema:
|
|
4087
|
+
var computer_20251124 = createProviderToolFactory6({
|
|
4088
|
+
id: "anthropic.computer_20251124",
|
|
4089
|
+
inputSchema: computer_20251124InputSchema
|
|
4077
4090
|
});
|
|
4078
4091
|
|
|
4079
|
-
// src/tool/
|
|
4092
|
+
// src/tool/memory_20250818.ts
|
|
4080
4093
|
import {
|
|
4081
4094
|
createProviderToolFactory as createProviderToolFactory7,
|
|
4082
4095
|
lazySchema as lazySchema14,
|
|
4083
4096
|
zodSchema as zodSchema14
|
|
4084
4097
|
} from "@ai-sdk/provider-utils";
|
|
4085
4098
|
import { z as z15 } from "zod/v4";
|
|
4086
|
-
var
|
|
4099
|
+
var memory_20250818InputSchema = lazySchema14(
|
|
4087
4100
|
() => zodSchema14(
|
|
4088
|
-
z15.
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4101
|
+
z15.discriminatedUnion("command", [
|
|
4102
|
+
z15.object({
|
|
4103
|
+
command: z15.literal("view"),
|
|
4104
|
+
path: z15.string(),
|
|
4105
|
+
view_range: z15.tuple([z15.number(), z15.number()]).optional()
|
|
4106
|
+
}),
|
|
4107
|
+
z15.object({
|
|
4108
|
+
command: z15.literal("create"),
|
|
4109
|
+
path: z15.string(),
|
|
4110
|
+
file_text: z15.string()
|
|
4111
|
+
}),
|
|
4112
|
+
z15.object({
|
|
4113
|
+
command: z15.literal("str_replace"),
|
|
4114
|
+
path: z15.string(),
|
|
4115
|
+
old_str: z15.string(),
|
|
4116
|
+
new_str: z15.string()
|
|
4117
|
+
}),
|
|
4118
|
+
z15.object({
|
|
4119
|
+
command: z15.literal("insert"),
|
|
4120
|
+
path: z15.string(),
|
|
4121
|
+
insert_line: z15.number(),
|
|
4122
|
+
insert_text: z15.string()
|
|
4123
|
+
}),
|
|
4124
|
+
z15.object({
|
|
4125
|
+
command: z15.literal("delete"),
|
|
4126
|
+
path: z15.string()
|
|
4127
|
+
}),
|
|
4128
|
+
z15.object({
|
|
4129
|
+
command: z15.literal("rename"),
|
|
4130
|
+
old_path: z15.string(),
|
|
4131
|
+
new_path: z15.string()
|
|
4132
|
+
})
|
|
4133
|
+
])
|
|
4097
4134
|
)
|
|
4098
4135
|
);
|
|
4099
|
-
var
|
|
4100
|
-
id: "anthropic.
|
|
4101
|
-
inputSchema:
|
|
4136
|
+
var memory_20250818 = createProviderToolFactory7({
|
|
4137
|
+
id: "anthropic.memory_20250818",
|
|
4138
|
+
inputSchema: memory_20250818InputSchema
|
|
4102
4139
|
});
|
|
4103
4140
|
|
|
4104
|
-
// src/tool/text-
|
|
4141
|
+
// src/tool/text-editor_20241022.ts
|
|
4105
4142
|
import {
|
|
4106
4143
|
createProviderToolFactory as createProviderToolFactory8,
|
|
4107
4144
|
lazySchema as lazySchema15,
|
|
4108
4145
|
zodSchema as zodSchema15
|
|
4109
4146
|
} from "@ai-sdk/provider-utils";
|
|
4110
4147
|
import { z as z16 } from "zod/v4";
|
|
4111
|
-
var
|
|
4148
|
+
var textEditor_20241022InputSchema = lazySchema15(
|
|
4112
4149
|
() => zodSchema15(
|
|
4113
4150
|
z16.object({
|
|
4114
4151
|
command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4121,22 +4158,22 @@ var textEditor_20250124InputSchema = lazySchema15(
|
|
|
4121
4158
|
})
|
|
4122
4159
|
)
|
|
4123
4160
|
);
|
|
4124
|
-
var
|
|
4125
|
-
id: "anthropic.
|
|
4126
|
-
inputSchema:
|
|
4161
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
4162
|
+
id: "anthropic.text_editor_20241022",
|
|
4163
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4127
4164
|
});
|
|
4128
4165
|
|
|
4129
|
-
// src/tool/text-
|
|
4166
|
+
// src/tool/text-editor_20250124.ts
|
|
4130
4167
|
import {
|
|
4131
4168
|
createProviderToolFactory as createProviderToolFactory9,
|
|
4132
4169
|
lazySchema as lazySchema16,
|
|
4133
4170
|
zodSchema as zodSchema16
|
|
4134
4171
|
} from "@ai-sdk/provider-utils";
|
|
4135
4172
|
import { z as z17 } from "zod/v4";
|
|
4136
|
-
var
|
|
4173
|
+
var textEditor_20250124InputSchema = lazySchema16(
|
|
4137
4174
|
() => zodSchema16(
|
|
4138
4175
|
z17.object({
|
|
4139
|
-
command: z17.enum(["view", "create", "str_replace", "insert"]),
|
|
4176
|
+
command: z17.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4140
4177
|
path: z17.string(),
|
|
4141
4178
|
file_text: z17.string().optional(),
|
|
4142
4179
|
insert_line: z17.number().int().optional(),
|
|
@@ -4146,40 +4183,65 @@ var textEditor_20250429InputSchema = lazySchema16(
|
|
|
4146
4183
|
})
|
|
4147
4184
|
)
|
|
4148
4185
|
);
|
|
4149
|
-
var
|
|
4150
|
-
id: "anthropic.
|
|
4151
|
-
inputSchema:
|
|
4186
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
4187
|
+
id: "anthropic.text_editor_20250124",
|
|
4188
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4152
4189
|
});
|
|
4153
4190
|
|
|
4154
|
-
// src/tool/
|
|
4191
|
+
// src/tool/text-editor_20250429.ts
|
|
4155
4192
|
import {
|
|
4156
|
-
|
|
4193
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
4157
4194
|
lazySchema as lazySchema17,
|
|
4158
4195
|
zodSchema as zodSchema17
|
|
4159
4196
|
} from "@ai-sdk/provider-utils";
|
|
4160
4197
|
import { z as z18 } from "zod/v4";
|
|
4161
|
-
var
|
|
4198
|
+
var textEditor_20250429InputSchema = lazySchema17(
|
|
4162
4199
|
() => zodSchema17(
|
|
4163
|
-
z18.
|
|
4164
|
-
z18.
|
|
4165
|
-
|
|
4166
|
-
|
|
4200
|
+
z18.object({
|
|
4201
|
+
command: z18.enum(["view", "create", "str_replace", "insert"]),
|
|
4202
|
+
path: z18.string(),
|
|
4203
|
+
file_text: z18.string().optional(),
|
|
4204
|
+
insert_line: z18.number().int().optional(),
|
|
4205
|
+
new_str: z18.string().optional(),
|
|
4206
|
+
old_str: z18.string().optional(),
|
|
4207
|
+
view_range: z18.array(z18.number().int()).optional()
|
|
4208
|
+
})
|
|
4209
|
+
)
|
|
4210
|
+
);
|
|
4211
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
4212
|
+
id: "anthropic.text_editor_20250429",
|
|
4213
|
+
inputSchema: textEditor_20250429InputSchema
|
|
4214
|
+
});
|
|
4215
|
+
|
|
4216
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
4217
|
+
import {
|
|
4218
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4219
|
+
lazySchema as lazySchema18,
|
|
4220
|
+
zodSchema as zodSchema18
|
|
4221
|
+
} from "@ai-sdk/provider-utils";
|
|
4222
|
+
import { z as z19 } from "zod/v4";
|
|
4223
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema18(
|
|
4224
|
+
() => zodSchema18(
|
|
4225
|
+
z19.array(
|
|
4226
|
+
z19.object({
|
|
4227
|
+
type: z19.literal("tool_reference"),
|
|
4228
|
+
toolName: z19.string()
|
|
4167
4229
|
})
|
|
4168
4230
|
)
|
|
4169
4231
|
)
|
|
4170
4232
|
);
|
|
4171
|
-
var toolSearchBm25_20251119InputSchema =
|
|
4172
|
-
() =>
|
|
4173
|
-
|
|
4233
|
+
var toolSearchBm25_20251119InputSchema = lazySchema18(
|
|
4234
|
+
() => zodSchema18(
|
|
4235
|
+
z19.object({
|
|
4174
4236
|
/**
|
|
4175
4237
|
* A natural language query to search for tools.
|
|
4176
4238
|
* Claude will use BM25 text search to find relevant tools.
|
|
4177
4239
|
*/
|
|
4178
|
-
query:
|
|
4240
|
+
query: z19.string(),
|
|
4179
4241
|
/**
|
|
4180
4242
|
* Maximum number of tools to return. Optional.
|
|
4181
4243
|
*/
|
|
4182
|
-
limit:
|
|
4244
|
+
limit: z19.number().optional()
|
|
4183
4245
|
})
|
|
4184
4246
|
)
|
|
4185
4247
|
);
|
|
@@ -4251,6 +4313,22 @@ var anthropicTools = {
|
|
|
4251
4313
|
* @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.
|
|
4252
4314
|
*/
|
|
4253
4315
|
computer_20250124,
|
|
4316
|
+
/**
|
|
4317
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
4318
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
4319
|
+
*
|
|
4320
|
+
* This version adds the zoom action for detailed screen region inspection.
|
|
4321
|
+
*
|
|
4322
|
+
* Image results are supported.
|
|
4323
|
+
*
|
|
4324
|
+
* Supported models: Claude Opus 4.5
|
|
4325
|
+
*
|
|
4326
|
+
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
4327
|
+
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
4328
|
+
* @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.
|
|
4329
|
+
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
4330
|
+
*/
|
|
4331
|
+
computer_20251124,
|
|
4254
4332
|
/**
|
|
4255
4333
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
4256
4334
|
* Claude can create, read, update, and delete files that persist between sessions,
|