@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/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
14
|
// src/version.ts
|
|
15
|
-
var VERSION = true ? "3.0.
|
|
15
|
+
var VERSION = true ? "3.0.25" : "0.0.0-test";
|
|
16
16
|
|
|
17
17
|
// src/anthropic-messages-language-model.ts
|
|
18
18
|
import {
|
|
@@ -1125,6 +1125,19 @@ async function prepareTools({
|
|
|
1125
1125
|
});
|
|
1126
1126
|
break;
|
|
1127
1127
|
}
|
|
1128
|
+
case "anthropic.computer_20251124": {
|
|
1129
|
+
betas.add("computer-use-2025-11-24");
|
|
1130
|
+
anthropicTools2.push({
|
|
1131
|
+
name: "computer",
|
|
1132
|
+
type: "computer_20251124",
|
|
1133
|
+
display_width_px: tool.args.displayWidthPx,
|
|
1134
|
+
display_height_px: tool.args.displayHeightPx,
|
|
1135
|
+
display_number: tool.args.displayNumber,
|
|
1136
|
+
enable_zoom: tool.args.enableZoom,
|
|
1137
|
+
cache_control: void 0
|
|
1138
|
+
});
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1128
1141
|
case "anthropic.computer_20241022": {
|
|
1129
1142
|
betas.add("computer-use-2024-10-22");
|
|
1130
1143
|
anthropicTools2.push({
|
|
@@ -4043,88 +4056,112 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4043
4056
|
inputSchema: computer_20250124InputSchema
|
|
4044
4057
|
});
|
|
4045
4058
|
|
|
4046
|
-
// src/tool/
|
|
4059
|
+
// src/tool/computer_20251124.ts
|
|
4047
4060
|
import {
|
|
4048
4061
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4049
4062
|
lazySchema as lazySchema13,
|
|
4050
4063
|
zodSchema as zodSchema13
|
|
4051
4064
|
} from "@ai-sdk/provider-utils";
|
|
4052
4065
|
import { z as z14 } from "zod/v4";
|
|
4053
|
-
var
|
|
4066
|
+
var computer_20251124InputSchema = lazySchema13(
|
|
4054
4067
|
() => zodSchema13(
|
|
4055
|
-
z14.
|
|
4056
|
-
z14.
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4068
|
+
z14.object({
|
|
4069
|
+
action: z14.enum([
|
|
4070
|
+
"key",
|
|
4071
|
+
"hold_key",
|
|
4072
|
+
"type",
|
|
4073
|
+
"cursor_position",
|
|
4074
|
+
"mouse_move",
|
|
4075
|
+
"left_mouse_down",
|
|
4076
|
+
"left_mouse_up",
|
|
4077
|
+
"left_click",
|
|
4078
|
+
"left_click_drag",
|
|
4079
|
+
"right_click",
|
|
4080
|
+
"middle_click",
|
|
4081
|
+
"double_click",
|
|
4082
|
+
"triple_click",
|
|
4083
|
+
"scroll",
|
|
4084
|
+
"wait",
|
|
4085
|
+
"screenshot",
|
|
4086
|
+
"zoom"
|
|
4087
|
+
]),
|
|
4088
|
+
coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4089
|
+
duration: z14.number().optional(),
|
|
4090
|
+
region: z14.tuple([
|
|
4091
|
+
z14.number().int(),
|
|
4092
|
+
z14.number().int(),
|
|
4093
|
+
z14.number().int(),
|
|
4094
|
+
z14.number().int()
|
|
4095
|
+
]).optional(),
|
|
4096
|
+
scroll_amount: z14.number().optional(),
|
|
4097
|
+
scroll_direction: z14.enum(["up", "down", "left", "right"]).optional(),
|
|
4098
|
+
start_coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4099
|
+
text: z14.string().optional()
|
|
4100
|
+
})
|
|
4088
4101
|
)
|
|
4089
4102
|
);
|
|
4090
|
-
var
|
|
4091
|
-
id: "anthropic.
|
|
4092
|
-
inputSchema:
|
|
4103
|
+
var computer_20251124 = createProviderToolFactory6({
|
|
4104
|
+
id: "anthropic.computer_20251124",
|
|
4105
|
+
inputSchema: computer_20251124InputSchema
|
|
4093
4106
|
});
|
|
4094
4107
|
|
|
4095
|
-
// src/tool/
|
|
4108
|
+
// src/tool/memory_20250818.ts
|
|
4096
4109
|
import {
|
|
4097
4110
|
createProviderToolFactory as createProviderToolFactory7,
|
|
4098
4111
|
lazySchema as lazySchema14,
|
|
4099
4112
|
zodSchema as zodSchema14
|
|
4100
4113
|
} from "@ai-sdk/provider-utils";
|
|
4101
4114
|
import { z as z15 } from "zod/v4";
|
|
4102
|
-
var
|
|
4115
|
+
var memory_20250818InputSchema = lazySchema14(
|
|
4103
4116
|
() => zodSchema14(
|
|
4104
|
-
z15.
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4117
|
+
z15.discriminatedUnion("command", [
|
|
4118
|
+
z15.object({
|
|
4119
|
+
command: z15.literal("view"),
|
|
4120
|
+
path: z15.string(),
|
|
4121
|
+
view_range: z15.tuple([z15.number(), z15.number()]).optional()
|
|
4122
|
+
}),
|
|
4123
|
+
z15.object({
|
|
4124
|
+
command: z15.literal("create"),
|
|
4125
|
+
path: z15.string(),
|
|
4126
|
+
file_text: z15.string()
|
|
4127
|
+
}),
|
|
4128
|
+
z15.object({
|
|
4129
|
+
command: z15.literal("str_replace"),
|
|
4130
|
+
path: z15.string(),
|
|
4131
|
+
old_str: z15.string(),
|
|
4132
|
+
new_str: z15.string()
|
|
4133
|
+
}),
|
|
4134
|
+
z15.object({
|
|
4135
|
+
command: z15.literal("insert"),
|
|
4136
|
+
path: z15.string(),
|
|
4137
|
+
insert_line: z15.number(),
|
|
4138
|
+
insert_text: z15.string()
|
|
4139
|
+
}),
|
|
4140
|
+
z15.object({
|
|
4141
|
+
command: z15.literal("delete"),
|
|
4142
|
+
path: z15.string()
|
|
4143
|
+
}),
|
|
4144
|
+
z15.object({
|
|
4145
|
+
command: z15.literal("rename"),
|
|
4146
|
+
old_path: z15.string(),
|
|
4147
|
+
new_path: z15.string()
|
|
4148
|
+
})
|
|
4149
|
+
])
|
|
4113
4150
|
)
|
|
4114
4151
|
);
|
|
4115
|
-
var
|
|
4116
|
-
id: "anthropic.
|
|
4117
|
-
inputSchema:
|
|
4152
|
+
var memory_20250818 = createProviderToolFactory7({
|
|
4153
|
+
id: "anthropic.memory_20250818",
|
|
4154
|
+
inputSchema: memory_20250818InputSchema
|
|
4118
4155
|
});
|
|
4119
4156
|
|
|
4120
|
-
// src/tool/text-
|
|
4157
|
+
// src/tool/text-editor_20241022.ts
|
|
4121
4158
|
import {
|
|
4122
4159
|
createProviderToolFactory as createProviderToolFactory8,
|
|
4123
4160
|
lazySchema as lazySchema15,
|
|
4124
4161
|
zodSchema as zodSchema15
|
|
4125
4162
|
} from "@ai-sdk/provider-utils";
|
|
4126
4163
|
import { z as z16 } from "zod/v4";
|
|
4127
|
-
var
|
|
4164
|
+
var textEditor_20241022InputSchema = lazySchema15(
|
|
4128
4165
|
() => zodSchema15(
|
|
4129
4166
|
z16.object({
|
|
4130
4167
|
command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4137,22 +4174,22 @@ var textEditor_20250124InputSchema = lazySchema15(
|
|
|
4137
4174
|
})
|
|
4138
4175
|
)
|
|
4139
4176
|
);
|
|
4140
|
-
var
|
|
4141
|
-
id: "anthropic.
|
|
4142
|
-
inputSchema:
|
|
4177
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
4178
|
+
id: "anthropic.text_editor_20241022",
|
|
4179
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4143
4180
|
});
|
|
4144
4181
|
|
|
4145
|
-
// src/tool/text-
|
|
4182
|
+
// src/tool/text-editor_20250124.ts
|
|
4146
4183
|
import {
|
|
4147
4184
|
createProviderToolFactory as createProviderToolFactory9,
|
|
4148
4185
|
lazySchema as lazySchema16,
|
|
4149
4186
|
zodSchema as zodSchema16
|
|
4150
4187
|
} from "@ai-sdk/provider-utils";
|
|
4151
4188
|
import { z as z17 } from "zod/v4";
|
|
4152
|
-
var
|
|
4189
|
+
var textEditor_20250124InputSchema = lazySchema16(
|
|
4153
4190
|
() => zodSchema16(
|
|
4154
4191
|
z17.object({
|
|
4155
|
-
command: z17.enum(["view", "create", "str_replace", "insert"]),
|
|
4192
|
+
command: z17.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4156
4193
|
path: z17.string(),
|
|
4157
4194
|
file_text: z17.string().optional(),
|
|
4158
4195
|
insert_line: z17.number().int().optional(),
|
|
@@ -4162,40 +4199,65 @@ var textEditor_20250429InputSchema = lazySchema16(
|
|
|
4162
4199
|
})
|
|
4163
4200
|
)
|
|
4164
4201
|
);
|
|
4165
|
-
var
|
|
4166
|
-
id: "anthropic.
|
|
4167
|
-
inputSchema:
|
|
4202
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
4203
|
+
id: "anthropic.text_editor_20250124",
|
|
4204
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4168
4205
|
});
|
|
4169
4206
|
|
|
4170
|
-
// src/tool/
|
|
4207
|
+
// src/tool/text-editor_20250429.ts
|
|
4171
4208
|
import {
|
|
4172
|
-
|
|
4209
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
4173
4210
|
lazySchema as lazySchema17,
|
|
4174
4211
|
zodSchema as zodSchema17
|
|
4175
4212
|
} from "@ai-sdk/provider-utils";
|
|
4176
4213
|
import { z as z18 } from "zod/v4";
|
|
4177
|
-
var
|
|
4214
|
+
var textEditor_20250429InputSchema = lazySchema17(
|
|
4178
4215
|
() => zodSchema17(
|
|
4179
|
-
z18.
|
|
4180
|
-
z18.
|
|
4181
|
-
|
|
4182
|
-
|
|
4216
|
+
z18.object({
|
|
4217
|
+
command: z18.enum(["view", "create", "str_replace", "insert"]),
|
|
4218
|
+
path: z18.string(),
|
|
4219
|
+
file_text: z18.string().optional(),
|
|
4220
|
+
insert_line: z18.number().int().optional(),
|
|
4221
|
+
new_str: z18.string().optional(),
|
|
4222
|
+
old_str: z18.string().optional(),
|
|
4223
|
+
view_range: z18.array(z18.number().int()).optional()
|
|
4224
|
+
})
|
|
4225
|
+
)
|
|
4226
|
+
);
|
|
4227
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
4228
|
+
id: "anthropic.text_editor_20250429",
|
|
4229
|
+
inputSchema: textEditor_20250429InputSchema
|
|
4230
|
+
});
|
|
4231
|
+
|
|
4232
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
4233
|
+
import {
|
|
4234
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4235
|
+
lazySchema as lazySchema18,
|
|
4236
|
+
zodSchema as zodSchema18
|
|
4237
|
+
} from "@ai-sdk/provider-utils";
|
|
4238
|
+
import { z as z19 } from "zod/v4";
|
|
4239
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema18(
|
|
4240
|
+
() => zodSchema18(
|
|
4241
|
+
z19.array(
|
|
4242
|
+
z19.object({
|
|
4243
|
+
type: z19.literal("tool_reference"),
|
|
4244
|
+
toolName: z19.string()
|
|
4183
4245
|
})
|
|
4184
4246
|
)
|
|
4185
4247
|
)
|
|
4186
4248
|
);
|
|
4187
|
-
var toolSearchBm25_20251119InputSchema =
|
|
4188
|
-
() =>
|
|
4189
|
-
|
|
4249
|
+
var toolSearchBm25_20251119InputSchema = lazySchema18(
|
|
4250
|
+
() => zodSchema18(
|
|
4251
|
+
z19.object({
|
|
4190
4252
|
/**
|
|
4191
4253
|
* A natural language query to search for tools.
|
|
4192
4254
|
* Claude will use BM25 text search to find relevant tools.
|
|
4193
4255
|
*/
|
|
4194
|
-
query:
|
|
4256
|
+
query: z19.string(),
|
|
4195
4257
|
/**
|
|
4196
4258
|
* Maximum number of tools to return. Optional.
|
|
4197
4259
|
*/
|
|
4198
|
-
limit:
|
|
4260
|
+
limit: z19.number().optional()
|
|
4199
4261
|
})
|
|
4200
4262
|
)
|
|
4201
4263
|
);
|
|
@@ -4267,6 +4329,22 @@ var anthropicTools = {
|
|
|
4267
4329
|
* @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.
|
|
4268
4330
|
*/
|
|
4269
4331
|
computer_20250124,
|
|
4332
|
+
/**
|
|
4333
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
4334
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
4335
|
+
*
|
|
4336
|
+
* This version adds the zoom action for detailed screen region inspection.
|
|
4337
|
+
*
|
|
4338
|
+
* Image results are supported.
|
|
4339
|
+
*
|
|
4340
|
+
* Supported models: Claude Opus 4.5
|
|
4341
|
+
*
|
|
4342
|
+
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
4343
|
+
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
4344
|
+
* @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.
|
|
4345
|
+
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
4346
|
+
*/
|
|
4347
|
+
computer_20251124,
|
|
4270
4348
|
/**
|
|
4271
4349
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
4272
4350
|
* Claude can create, read, update, and delete files that persist between sessions,
|