@ai-sdk/anthropic 3.0.46 → 3.0.48
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 +12 -0
- package/dist/index.d.mts +138 -1
- package/dist/index.d.ts +138 -1
- package/dist/index.js +265 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +269 -124
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +141 -1
- package/dist/internal/index.d.ts +141 -1
- package/dist/internal/index.js +258 -117
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +268 -123
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +21 -15
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +23 -1
- package/src/anthropic-messages-language-model.ts +10 -2
- package/src/anthropic-prepare-tools.ts +10 -1
- package/src/anthropic-tools.ts +15 -0
- package/src/convert-to-anthropic-messages-prompt.ts +6 -2
- package/src/tool/code-execution_20260120.ts +277 -0
package/dist/index.js
CHANGED
|
@@ -29,10 +29,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
32
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.48" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -123,6 +123,10 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
123
123
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
124
124
|
tool_id: import_v42.z.string()
|
|
125
125
|
}),
|
|
126
|
+
import_v42.z.object({
|
|
127
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
128
|
+
tool_id: import_v42.z.string()
|
|
129
|
+
}),
|
|
126
130
|
import_v42.z.object({
|
|
127
131
|
type: import_v42.z.literal("direct")
|
|
128
132
|
})
|
|
@@ -379,6 +383,10 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
379
383
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
380
384
|
tool_id: import_v42.z.string()
|
|
381
385
|
}),
|
|
386
|
+
import_v42.z.object({
|
|
387
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
388
|
+
tool_id: import_v42.z.string()
|
|
389
|
+
}),
|
|
382
390
|
import_v42.z.object({
|
|
383
391
|
type: import_v42.z.literal("direct")
|
|
384
392
|
})
|
|
@@ -417,6 +425,10 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
417
425
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
418
426
|
tool_id: import_v42.z.string()
|
|
419
427
|
}),
|
|
428
|
+
import_v42.z.object({
|
|
429
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
430
|
+
tool_id: import_v42.z.string()
|
|
431
|
+
}),
|
|
420
432
|
import_v42.z.object({
|
|
421
433
|
type: import_v42.z.literal("direct")
|
|
422
434
|
})
|
|
@@ -1166,6 +1178,13 @@ async function prepareTools({
|
|
|
1166
1178
|
});
|
|
1167
1179
|
break;
|
|
1168
1180
|
}
|
|
1181
|
+
case "anthropic.code_execution_20260120": {
|
|
1182
|
+
anthropicTools2.push({
|
|
1183
|
+
type: "code_execution_20260120",
|
|
1184
|
+
name: "code_execution"
|
|
1185
|
+
});
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1169
1188
|
case "anthropic.computer_20250124": {
|
|
1170
1189
|
betas.add("computer-use-2025-01-24");
|
|
1171
1190
|
anthropicTools2.push({
|
|
@@ -2093,8 +2112,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2093
2112
|
break;
|
|
2094
2113
|
}
|
|
2095
2114
|
const callerOptions = (_l = part.providerOptions) == null ? void 0 : _l.anthropic;
|
|
2096
|
-
const caller = (callerOptions == null ? void 0 : callerOptions.caller) ? callerOptions.caller.type === "code_execution_20250825" && callerOptions.caller.toolId ? {
|
|
2097
|
-
type:
|
|
2115
|
+
const caller = (callerOptions == null ? void 0 : callerOptions.caller) ? (callerOptions.caller.type === "code_execution_20250825" || callerOptions.caller.type === "code_execution_20260120") && callerOptions.caller.toolId ? {
|
|
2116
|
+
type: callerOptions.caller.type,
|
|
2098
2117
|
tool_id: callerOptions.caller.toolId
|
|
2099
2118
|
} : callerOptions.caller.type === "direct" ? { type: "direct" } : void 0 : void 0;
|
|
2100
2119
|
anthropicContent.push({
|
|
@@ -2600,6 +2619,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2600
2619
|
providerToolNames: {
|
|
2601
2620
|
"anthropic.code_execution_20250522": "code_execution",
|
|
2602
2621
|
"anthropic.code_execution_20250825": "code_execution",
|
|
2622
|
+
"anthropic.code_execution_20260120": "code_execution",
|
|
2603
2623
|
"anthropic.computer_20241022": "computer",
|
|
2604
2624
|
"anthropic.computer_20250124": "computer",
|
|
2605
2625
|
"anthropic.text_editor_20241022": "str_replace_editor",
|
|
@@ -2648,6 +2668,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2648
2668
|
...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
|
|
2649
2669
|
speed: anthropicOptions.speed
|
|
2650
2670
|
},
|
|
2671
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2672
|
+
cache_control: anthropicOptions.cacheControl
|
|
2673
|
+
},
|
|
2651
2674
|
// structured output:
|
|
2652
2675
|
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2653
2676
|
output_format: {
|
|
@@ -2811,7 +2834,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2811
2834
|
betas.add("skills-2025-10-02");
|
|
2812
2835
|
betas.add("files-api-2025-04-14");
|
|
2813
2836
|
if (!(tools == null ? void 0 : tools.some(
|
|
2814
|
-
(tool) => tool.type === "provider" && tool.id === "anthropic.code_execution_20250825"
|
|
2837
|
+
(tool) => tool.type === "provider" && (tool.id === "anthropic.code_execution_20250825" || tool.id === "anthropic.code_execution_20260120")
|
|
2815
2838
|
))) {
|
|
2816
2839
|
warnings.push({
|
|
2817
2840
|
type: "other",
|
|
@@ -4189,13 +4212,118 @@ var bash_20250124 = (0, import_provider_utils14.createProviderToolFactory)({
|
|
|
4189
4212
|
inputSchema: bash_20250124InputSchema
|
|
4190
4213
|
});
|
|
4191
4214
|
|
|
4192
|
-
// src/tool/
|
|
4215
|
+
// src/tool/code-execution_20260120.ts
|
|
4193
4216
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4194
4217
|
var import_v412 = require("zod/v4");
|
|
4195
|
-
var
|
|
4218
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4196
4219
|
() => (0, import_provider_utils15.zodSchema)(
|
|
4197
|
-
import_v412.z.
|
|
4198
|
-
|
|
4220
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4221
|
+
import_v412.z.object({
|
|
4222
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
4223
|
+
stdout: import_v412.z.string(),
|
|
4224
|
+
stderr: import_v412.z.string(),
|
|
4225
|
+
return_code: import_v412.z.number(),
|
|
4226
|
+
content: import_v412.z.array(
|
|
4227
|
+
import_v412.z.object({
|
|
4228
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
4229
|
+
file_id: import_v412.z.string()
|
|
4230
|
+
})
|
|
4231
|
+
).optional().default([])
|
|
4232
|
+
}),
|
|
4233
|
+
import_v412.z.object({
|
|
4234
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4235
|
+
content: import_v412.z.array(
|
|
4236
|
+
import_v412.z.object({
|
|
4237
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4238
|
+
file_id: import_v412.z.string()
|
|
4239
|
+
})
|
|
4240
|
+
),
|
|
4241
|
+
stdout: import_v412.z.string(),
|
|
4242
|
+
stderr: import_v412.z.string(),
|
|
4243
|
+
return_code: import_v412.z.number()
|
|
4244
|
+
}),
|
|
4245
|
+
import_v412.z.object({
|
|
4246
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4247
|
+
error_code: import_v412.z.string()
|
|
4248
|
+
}),
|
|
4249
|
+
import_v412.z.object({
|
|
4250
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4251
|
+
error_code: import_v412.z.string()
|
|
4252
|
+
}),
|
|
4253
|
+
import_v412.z.object({
|
|
4254
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4255
|
+
content: import_v412.z.string(),
|
|
4256
|
+
file_type: import_v412.z.string(),
|
|
4257
|
+
num_lines: import_v412.z.number().nullable(),
|
|
4258
|
+
start_line: import_v412.z.number().nullable(),
|
|
4259
|
+
total_lines: import_v412.z.number().nullable()
|
|
4260
|
+
}),
|
|
4261
|
+
import_v412.z.object({
|
|
4262
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4263
|
+
is_file_update: import_v412.z.boolean()
|
|
4264
|
+
}),
|
|
4265
|
+
import_v412.z.object({
|
|
4266
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4267
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4268
|
+
new_lines: import_v412.z.number().nullable(),
|
|
4269
|
+
new_start: import_v412.z.number().nullable(),
|
|
4270
|
+
old_lines: import_v412.z.number().nullable(),
|
|
4271
|
+
old_start: import_v412.z.number().nullable()
|
|
4272
|
+
})
|
|
4273
|
+
])
|
|
4274
|
+
)
|
|
4275
|
+
);
|
|
4276
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4277
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
4278
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4279
|
+
import_v412.z.object({
|
|
4280
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4281
|
+
code: import_v412.z.string()
|
|
4282
|
+
}),
|
|
4283
|
+
import_v412.z.object({
|
|
4284
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
4285
|
+
command: import_v412.z.string()
|
|
4286
|
+
}),
|
|
4287
|
+
import_v412.z.discriminatedUnion("command", [
|
|
4288
|
+
import_v412.z.object({
|
|
4289
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4290
|
+
command: import_v412.z.literal("view"),
|
|
4291
|
+
path: import_v412.z.string()
|
|
4292
|
+
}),
|
|
4293
|
+
import_v412.z.object({
|
|
4294
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4295
|
+
command: import_v412.z.literal("create"),
|
|
4296
|
+
path: import_v412.z.string(),
|
|
4297
|
+
file_text: import_v412.z.string().nullish()
|
|
4298
|
+
}),
|
|
4299
|
+
import_v412.z.object({
|
|
4300
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4301
|
+
command: import_v412.z.literal("str_replace"),
|
|
4302
|
+
path: import_v412.z.string(),
|
|
4303
|
+
old_str: import_v412.z.string(),
|
|
4304
|
+
new_str: import_v412.z.string()
|
|
4305
|
+
})
|
|
4306
|
+
])
|
|
4307
|
+
])
|
|
4308
|
+
)
|
|
4309
|
+
);
|
|
4310
|
+
var factory7 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
4311
|
+
id: "anthropic.code_execution_20260120",
|
|
4312
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
4313
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
4314
|
+
supportsDeferredResults: true
|
|
4315
|
+
});
|
|
4316
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
4317
|
+
return factory7(args);
|
|
4318
|
+
};
|
|
4319
|
+
|
|
4320
|
+
// src/tool/computer_20241022.ts
|
|
4321
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4322
|
+
var import_v413 = require("zod/v4");
|
|
4323
|
+
var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4324
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4325
|
+
import_v413.z.object({
|
|
4326
|
+
action: import_v413.z.enum([
|
|
4199
4327
|
"key",
|
|
4200
4328
|
"type",
|
|
4201
4329
|
"mouse_move",
|
|
@@ -4207,23 +4335,23 @@ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
4207
4335
|
"screenshot",
|
|
4208
4336
|
"cursor_position"
|
|
4209
4337
|
]),
|
|
4210
|
-
coordinate:
|
|
4211
|
-
text:
|
|
4338
|
+
coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
|
|
4339
|
+
text: import_v413.z.string().optional()
|
|
4212
4340
|
})
|
|
4213
4341
|
)
|
|
4214
4342
|
);
|
|
4215
|
-
var computer_20241022 = (0,
|
|
4343
|
+
var computer_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4216
4344
|
id: "anthropic.computer_20241022",
|
|
4217
4345
|
inputSchema: computer_20241022InputSchema
|
|
4218
4346
|
});
|
|
4219
4347
|
|
|
4220
4348
|
// src/tool/computer_20250124.ts
|
|
4221
|
-
var
|
|
4222
|
-
var
|
|
4223
|
-
var computer_20250124InputSchema = (0,
|
|
4224
|
-
() => (0,
|
|
4225
|
-
|
|
4226
|
-
action:
|
|
4349
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4350
|
+
var import_v414 = require("zod/v4");
|
|
4351
|
+
var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4352
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4353
|
+
import_v414.z.object({
|
|
4354
|
+
action: import_v414.z.enum([
|
|
4227
4355
|
"key",
|
|
4228
4356
|
"hold_key",
|
|
4229
4357
|
"type",
|
|
@@ -4241,27 +4369,27 @@ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4241
4369
|
"wait",
|
|
4242
4370
|
"screenshot"
|
|
4243
4371
|
]),
|
|
4244
|
-
coordinate:
|
|
4245
|
-
duration:
|
|
4246
|
-
scroll_amount:
|
|
4247
|
-
scroll_direction:
|
|
4248
|
-
start_coordinate:
|
|
4249
|
-
text:
|
|
4372
|
+
coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4373
|
+
duration: import_v414.z.number().optional(),
|
|
4374
|
+
scroll_amount: import_v414.z.number().optional(),
|
|
4375
|
+
scroll_direction: import_v414.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4376
|
+
start_coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4377
|
+
text: import_v414.z.string().optional()
|
|
4250
4378
|
})
|
|
4251
4379
|
)
|
|
4252
4380
|
);
|
|
4253
|
-
var computer_20250124 = (0,
|
|
4381
|
+
var computer_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4254
4382
|
id: "anthropic.computer_20250124",
|
|
4255
4383
|
inputSchema: computer_20250124InputSchema
|
|
4256
4384
|
});
|
|
4257
4385
|
|
|
4258
4386
|
// src/tool/computer_20251124.ts
|
|
4259
|
-
var
|
|
4260
|
-
var
|
|
4261
|
-
var computer_20251124InputSchema = (0,
|
|
4262
|
-
() => (0,
|
|
4263
|
-
|
|
4264
|
-
action:
|
|
4387
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4388
|
+
var import_v415 = require("zod/v4");
|
|
4389
|
+
var computer_20251124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4390
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4391
|
+
import_v415.z.object({
|
|
4392
|
+
action: import_v415.z.enum([
|
|
4265
4393
|
"key",
|
|
4266
4394
|
"hold_key",
|
|
4267
4395
|
"type",
|
|
@@ -4280,97 +4408,75 @@ var computer_20251124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4280
4408
|
"screenshot",
|
|
4281
4409
|
"zoom"
|
|
4282
4410
|
]),
|
|
4283
|
-
coordinate:
|
|
4284
|
-
duration:
|
|
4285
|
-
region:
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4411
|
+
coordinate: import_v415.z.tuple([import_v415.z.number().int(), import_v415.z.number().int()]).optional(),
|
|
4412
|
+
duration: import_v415.z.number().optional(),
|
|
4413
|
+
region: import_v415.z.tuple([
|
|
4414
|
+
import_v415.z.number().int(),
|
|
4415
|
+
import_v415.z.number().int(),
|
|
4416
|
+
import_v415.z.number().int(),
|
|
4417
|
+
import_v415.z.number().int()
|
|
4290
4418
|
]).optional(),
|
|
4291
|
-
scroll_amount:
|
|
4292
|
-
scroll_direction:
|
|
4293
|
-
start_coordinate:
|
|
4294
|
-
text:
|
|
4419
|
+
scroll_amount: import_v415.z.number().optional(),
|
|
4420
|
+
scroll_direction: import_v415.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4421
|
+
start_coordinate: import_v415.z.tuple([import_v415.z.number().int(), import_v415.z.number().int()]).optional(),
|
|
4422
|
+
text: import_v415.z.string().optional()
|
|
4295
4423
|
})
|
|
4296
4424
|
)
|
|
4297
4425
|
);
|
|
4298
|
-
var computer_20251124 = (0,
|
|
4426
|
+
var computer_20251124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4299
4427
|
id: "anthropic.computer_20251124",
|
|
4300
4428
|
inputSchema: computer_20251124InputSchema
|
|
4301
4429
|
});
|
|
4302
4430
|
|
|
4303
4431
|
// src/tool/memory_20250818.ts
|
|
4304
|
-
var
|
|
4305
|
-
var
|
|
4306
|
-
var memory_20250818InputSchema = (0,
|
|
4307
|
-
() => (0,
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
command:
|
|
4311
|
-
path:
|
|
4312
|
-
view_range:
|
|
4432
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4433
|
+
var import_v416 = require("zod/v4");
|
|
4434
|
+
var memory_20250818InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4435
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4436
|
+
import_v416.z.discriminatedUnion("command", [
|
|
4437
|
+
import_v416.z.object({
|
|
4438
|
+
command: import_v416.z.literal("view"),
|
|
4439
|
+
path: import_v416.z.string(),
|
|
4440
|
+
view_range: import_v416.z.tuple([import_v416.z.number(), import_v416.z.number()]).optional()
|
|
4313
4441
|
}),
|
|
4314
|
-
|
|
4315
|
-
command:
|
|
4316
|
-
path:
|
|
4317
|
-
file_text:
|
|
4442
|
+
import_v416.z.object({
|
|
4443
|
+
command: import_v416.z.literal("create"),
|
|
4444
|
+
path: import_v416.z.string(),
|
|
4445
|
+
file_text: import_v416.z.string()
|
|
4318
4446
|
}),
|
|
4319
|
-
|
|
4320
|
-
command:
|
|
4321
|
-
path:
|
|
4322
|
-
old_str:
|
|
4323
|
-
new_str:
|
|
4447
|
+
import_v416.z.object({
|
|
4448
|
+
command: import_v416.z.literal("str_replace"),
|
|
4449
|
+
path: import_v416.z.string(),
|
|
4450
|
+
old_str: import_v416.z.string(),
|
|
4451
|
+
new_str: import_v416.z.string()
|
|
4324
4452
|
}),
|
|
4325
|
-
|
|
4326
|
-
command:
|
|
4327
|
-
path:
|
|
4328
|
-
insert_line:
|
|
4329
|
-
insert_text:
|
|
4453
|
+
import_v416.z.object({
|
|
4454
|
+
command: import_v416.z.literal("insert"),
|
|
4455
|
+
path: import_v416.z.string(),
|
|
4456
|
+
insert_line: import_v416.z.number(),
|
|
4457
|
+
insert_text: import_v416.z.string()
|
|
4330
4458
|
}),
|
|
4331
|
-
|
|
4332
|
-
command:
|
|
4333
|
-
path:
|
|
4459
|
+
import_v416.z.object({
|
|
4460
|
+
command: import_v416.z.literal("delete"),
|
|
4461
|
+
path: import_v416.z.string()
|
|
4334
4462
|
}),
|
|
4335
|
-
|
|
4336
|
-
command:
|
|
4337
|
-
old_path:
|
|
4338
|
-
new_path:
|
|
4463
|
+
import_v416.z.object({
|
|
4464
|
+
command: import_v416.z.literal("rename"),
|
|
4465
|
+
old_path: import_v416.z.string(),
|
|
4466
|
+
new_path: import_v416.z.string()
|
|
4339
4467
|
})
|
|
4340
4468
|
])
|
|
4341
4469
|
)
|
|
4342
4470
|
);
|
|
4343
|
-
var memory_20250818 = (0,
|
|
4471
|
+
var memory_20250818 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4344
4472
|
id: "anthropic.memory_20250818",
|
|
4345
4473
|
inputSchema: memory_20250818InputSchema
|
|
4346
4474
|
});
|
|
4347
4475
|
|
|
4348
4476
|
// src/tool/text-editor_20241022.ts
|
|
4349
|
-
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4350
|
-
var import_v416 = require("zod/v4");
|
|
4351
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4352
|
-
() => (0, import_provider_utils19.zodSchema)(
|
|
4353
|
-
import_v416.z.object({
|
|
4354
|
-
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4355
|
-
path: import_v416.z.string(),
|
|
4356
|
-
file_text: import_v416.z.string().optional(),
|
|
4357
|
-
insert_line: import_v416.z.number().int().optional(),
|
|
4358
|
-
new_str: import_v416.z.string().optional(),
|
|
4359
|
-
insert_text: import_v416.z.string().optional(),
|
|
4360
|
-
old_str: import_v416.z.string().optional(),
|
|
4361
|
-
view_range: import_v416.z.array(import_v416.z.number().int()).optional()
|
|
4362
|
-
})
|
|
4363
|
-
)
|
|
4364
|
-
);
|
|
4365
|
-
var textEditor_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4366
|
-
id: "anthropic.text_editor_20241022",
|
|
4367
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4368
|
-
});
|
|
4369
|
-
|
|
4370
|
-
// src/tool/text-editor_20250124.ts
|
|
4371
4477
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4372
4478
|
var import_v417 = require("zod/v4");
|
|
4373
|
-
var
|
|
4479
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4374
4480
|
() => (0, import_provider_utils20.zodSchema)(
|
|
4375
4481
|
import_v417.z.object({
|
|
4376
4482
|
command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4384,18 +4490,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4384
4490
|
})
|
|
4385
4491
|
)
|
|
4386
4492
|
);
|
|
4387
|
-
var
|
|
4388
|
-
id: "anthropic.
|
|
4389
|
-
inputSchema:
|
|
4493
|
+
var textEditor_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4494
|
+
id: "anthropic.text_editor_20241022",
|
|
4495
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4390
4496
|
});
|
|
4391
4497
|
|
|
4392
|
-
// src/tool/text-
|
|
4498
|
+
// src/tool/text-editor_20250124.ts
|
|
4393
4499
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4394
4500
|
var import_v418 = require("zod/v4");
|
|
4395
|
-
var
|
|
4501
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4396
4502
|
() => (0, import_provider_utils21.zodSchema)(
|
|
4397
4503
|
import_v418.z.object({
|
|
4398
|
-
command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4504
|
+
command: import_v418.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4399
4505
|
path: import_v418.z.string(),
|
|
4400
4506
|
file_text: import_v418.z.string().optional(),
|
|
4401
4507
|
insert_line: import_v418.z.number().int().optional(),
|
|
@@ -4406,47 +4512,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
4406
4512
|
})
|
|
4407
4513
|
)
|
|
4408
4514
|
);
|
|
4409
|
-
var
|
|
4410
|
-
id: "anthropic.
|
|
4411
|
-
inputSchema:
|
|
4515
|
+
var textEditor_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4516
|
+
id: "anthropic.text_editor_20250124",
|
|
4517
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4412
4518
|
});
|
|
4413
4519
|
|
|
4414
|
-
// src/tool/
|
|
4520
|
+
// src/tool/text-editor_20250429.ts
|
|
4415
4521
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4416
4522
|
var import_v419 = require("zod/v4");
|
|
4417
|
-
var
|
|
4523
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4418
4524
|
() => (0, import_provider_utils22.zodSchema)(
|
|
4419
|
-
import_v419.z.
|
|
4420
|
-
import_v419.z.
|
|
4421
|
-
|
|
4422
|
-
|
|
4525
|
+
import_v419.z.object({
|
|
4526
|
+
command: import_v419.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4527
|
+
path: import_v419.z.string(),
|
|
4528
|
+
file_text: import_v419.z.string().optional(),
|
|
4529
|
+
insert_line: import_v419.z.number().int().optional(),
|
|
4530
|
+
new_str: import_v419.z.string().optional(),
|
|
4531
|
+
insert_text: import_v419.z.string().optional(),
|
|
4532
|
+
old_str: import_v419.z.string().optional(),
|
|
4533
|
+
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4534
|
+
})
|
|
4535
|
+
)
|
|
4536
|
+
);
|
|
4537
|
+
var textEditor_20250429 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4538
|
+
id: "anthropic.text_editor_20250429",
|
|
4539
|
+
inputSchema: textEditor_20250429InputSchema
|
|
4540
|
+
});
|
|
4541
|
+
|
|
4542
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
4543
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4544
|
+
var import_v420 = require("zod/v4");
|
|
4545
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4546
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4547
|
+
import_v420.z.array(
|
|
4548
|
+
import_v420.z.object({
|
|
4549
|
+
type: import_v420.z.literal("tool_reference"),
|
|
4550
|
+
toolName: import_v420.z.string()
|
|
4423
4551
|
})
|
|
4424
4552
|
)
|
|
4425
4553
|
)
|
|
4426
4554
|
);
|
|
4427
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4428
|
-
() => (0,
|
|
4429
|
-
|
|
4555
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4556
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4557
|
+
import_v420.z.object({
|
|
4430
4558
|
/**
|
|
4431
4559
|
* A natural language query to search for tools.
|
|
4432
4560
|
* Claude will use BM25 text search to find relevant tools.
|
|
4433
4561
|
*/
|
|
4434
|
-
query:
|
|
4562
|
+
query: import_v420.z.string(),
|
|
4435
4563
|
/**
|
|
4436
4564
|
* Maximum number of tools to return. Optional.
|
|
4437
4565
|
*/
|
|
4438
|
-
limit:
|
|
4566
|
+
limit: import_v420.z.number().optional()
|
|
4439
4567
|
})
|
|
4440
4568
|
)
|
|
4441
4569
|
);
|
|
4442
|
-
var
|
|
4570
|
+
var factory8 = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
4443
4571
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4444
4572
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4445
4573
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4446
4574
|
supportsDeferredResults: true
|
|
4447
4575
|
});
|
|
4448
4576
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4449
|
-
return
|
|
4577
|
+
return factory8(args);
|
|
4450
4578
|
};
|
|
4451
4579
|
|
|
4452
4580
|
// src/anthropic-tools.ts
|
|
@@ -4485,6 +4613,19 @@ var anthropicTools = {
|
|
|
4485
4613
|
* This is the latest version with enhanced Bash support and file operations.
|
|
4486
4614
|
*/
|
|
4487
4615
|
codeExecution_20250825,
|
|
4616
|
+
/**
|
|
4617
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
4618
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
4619
|
+
* the API conversation.
|
|
4620
|
+
*
|
|
4621
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
4622
|
+
* including writing code, in a secure, sandboxed environment.
|
|
4623
|
+
*
|
|
4624
|
+
* This is the recommended version. Does not require a beta header.
|
|
4625
|
+
*
|
|
4626
|
+
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
4627
|
+
*/
|
|
4628
|
+
codeExecution_20260120,
|
|
4488
4629
|
/**
|
|
4489
4630
|
* Claude can interact with computer environments through the computer use tool, which
|
|
4490
4631
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -4622,8 +4763,8 @@ var anthropicTools = {
|
|
|
4622
4763
|
// src/anthropic-provider.ts
|
|
4623
4764
|
function createAnthropic(options = {}) {
|
|
4624
4765
|
var _a, _b;
|
|
4625
|
-
const baseURL = (_a = (0,
|
|
4626
|
-
(0,
|
|
4766
|
+
const baseURL = (_a = (0, import_provider_utils24.withoutTrailingSlash)(
|
|
4767
|
+
(0, import_provider_utils24.loadOptionalSetting)({
|
|
4627
4768
|
settingValue: options.baseURL,
|
|
4628
4769
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4629
4770
|
})
|
|
@@ -4637,13 +4778,13 @@ function createAnthropic(options = {}) {
|
|
|
4637
4778
|
}
|
|
4638
4779
|
const getHeaders = () => {
|
|
4639
4780
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
4640
|
-
"x-api-key": (0,
|
|
4781
|
+
"x-api-key": (0, import_provider_utils24.loadApiKey)({
|
|
4641
4782
|
apiKey: options.apiKey,
|
|
4642
4783
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4643
4784
|
description: "Anthropic"
|
|
4644
4785
|
})
|
|
4645
4786
|
};
|
|
4646
|
-
return (0,
|
|
4787
|
+
return (0, import_provider_utils24.withUserAgentSuffix)(
|
|
4647
4788
|
{
|
|
4648
4789
|
"anthropic-version": "2023-06-01",
|
|
4649
4790
|
...authHeaders,
|
|
@@ -4659,7 +4800,7 @@ function createAnthropic(options = {}) {
|
|
|
4659
4800
|
baseURL,
|
|
4660
4801
|
headers: getHeaders,
|
|
4661
4802
|
fetch: options.fetch,
|
|
4662
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
4803
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId,
|
|
4663
4804
|
supportedUrls: () => ({
|
|
4664
4805
|
"image/*": [/^https?:\/\/.*$/],
|
|
4665
4806
|
"application/pdf": [/^https?:\/\/.*$/]
|