@ai-sdk/anthropic 2.0.70 → 2.0.72
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 +140 -0
- package/dist/index.d.ts +140 -0
- package/dist/index.js +237 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +236 -90
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +140 -0
- package/dist/internal/index.d.ts +140 -0
- package/dist/internal/index.js +230 -88
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +235 -89
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -5
package/dist/index.js
CHANGED
|
@@ -18,20 +18,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
anthropic: () => anthropic,
|
|
25
25
|
createAnthropic: () => createAnthropic
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/anthropic-provider.ts
|
|
30
30
|
var import_provider4 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.72" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -673,6 +673,20 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
673
673
|
type: import_v43.z.literal("ephemeral"),
|
|
674
674
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
675
675
|
}).optional(),
|
|
676
|
+
/**
|
|
677
|
+
* Metadata to include with the request.
|
|
678
|
+
*
|
|
679
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
680
|
+
*/
|
|
681
|
+
metadata: import_v43.z.object({
|
|
682
|
+
/**
|
|
683
|
+
* An external identifier for the user associated with the request.
|
|
684
|
+
*
|
|
685
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
686
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
687
|
+
*/
|
|
688
|
+
userId: import_v43.z.string().optional()
|
|
689
|
+
}).optional(),
|
|
676
690
|
/**
|
|
677
691
|
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
678
692
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
@@ -994,6 +1008,13 @@ async function prepareTools({
|
|
|
994
1008
|
});
|
|
995
1009
|
break;
|
|
996
1010
|
}
|
|
1011
|
+
case "anthropic.code_execution_20260120": {
|
|
1012
|
+
anthropicTools2.push({
|
|
1013
|
+
type: "code_execution_20260120",
|
|
1014
|
+
name: "code_execution"
|
|
1015
|
+
});
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
997
1018
|
case "anthropic.computer_20250124": {
|
|
998
1019
|
betas.add("computer-use-2025-01-24");
|
|
999
1020
|
anthropicTools2.push({
|
|
@@ -1951,7 +1972,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1951
1972
|
toolChoice,
|
|
1952
1973
|
providerOptions
|
|
1953
1974
|
}) {
|
|
1954
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1975
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1955
1976
|
const warnings = [];
|
|
1956
1977
|
if (frequencyPenalty != null) {
|
|
1957
1978
|
warnings.push({
|
|
@@ -2055,6 +2076,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2055
2076
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2056
2077
|
cache_control: anthropicOptions.cacheControl
|
|
2057
2078
|
},
|
|
2079
|
+
...((_e = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _e.userId) != null && {
|
|
2080
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
2081
|
+
},
|
|
2058
2082
|
// structured output:
|
|
2059
2083
|
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2060
2084
|
output_format: {
|
|
@@ -2066,7 +2090,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2066
2090
|
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
2067
2091
|
container: {
|
|
2068
2092
|
id: anthropicOptions.container.id,
|
|
2069
|
-
skills: (
|
|
2093
|
+
skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
|
|
2070
2094
|
type: skill.type,
|
|
2071
2095
|
skill_id: skill.skillId,
|
|
2072
2096
|
version: skill.version
|
|
@@ -2175,7 +2199,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2175
2199
|
betas.add("skills-2025-10-02");
|
|
2176
2200
|
betas.add("files-api-2025-04-14");
|
|
2177
2201
|
if (!(tools == null ? void 0 : tools.some(
|
|
2178
|
-
(tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
|
|
2202
|
+
(tool) => tool.type === "provider-defined" && (tool.id === "anthropic.code_execution_20250825" || tool.id === "anthropic.code_execution_20260120")
|
|
2179
2203
|
))) {
|
|
2180
2204
|
warnings.push({
|
|
2181
2205
|
type: "other",
|
|
@@ -2229,7 +2253,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2229
2253
|
...betas,
|
|
2230
2254
|
...toolsBetas,
|
|
2231
2255
|
...userSuppliedBetas,
|
|
2232
|
-
...(
|
|
2256
|
+
...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
|
|
2233
2257
|
]),
|
|
2234
2258
|
usesJsonResponseTool: jsonResponseTool != null
|
|
2235
2259
|
};
|
|
@@ -3278,13 +3302,118 @@ var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory
|
|
|
3278
3302
|
inputSchema: bash_20250124InputSchema
|
|
3279
3303
|
});
|
|
3280
3304
|
|
|
3281
|
-
// src/tool/
|
|
3305
|
+
// src/tool/code-execution_20260120.ts
|
|
3282
3306
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
3283
3307
|
var import_v411 = require("zod/v4");
|
|
3284
|
-
var
|
|
3308
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
3285
3309
|
() => (0, import_provider_utils14.zodSchema)(
|
|
3286
|
-
import_v411.z.
|
|
3287
|
-
|
|
3310
|
+
import_v411.z.discriminatedUnion("type", [
|
|
3311
|
+
import_v411.z.object({
|
|
3312
|
+
type: import_v411.z.literal("code_execution_result"),
|
|
3313
|
+
stdout: import_v411.z.string(),
|
|
3314
|
+
stderr: import_v411.z.string(),
|
|
3315
|
+
return_code: import_v411.z.number(),
|
|
3316
|
+
content: import_v411.z.array(
|
|
3317
|
+
import_v411.z.object({
|
|
3318
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
3319
|
+
file_id: import_v411.z.string()
|
|
3320
|
+
})
|
|
3321
|
+
).optional().default([])
|
|
3322
|
+
}),
|
|
3323
|
+
import_v411.z.object({
|
|
3324
|
+
type: import_v411.z.literal("bash_code_execution_result"),
|
|
3325
|
+
content: import_v411.z.array(
|
|
3326
|
+
import_v411.z.object({
|
|
3327
|
+
type: import_v411.z.literal("bash_code_execution_output"),
|
|
3328
|
+
file_id: import_v411.z.string()
|
|
3329
|
+
})
|
|
3330
|
+
),
|
|
3331
|
+
stdout: import_v411.z.string(),
|
|
3332
|
+
stderr: import_v411.z.string(),
|
|
3333
|
+
return_code: import_v411.z.number()
|
|
3334
|
+
}),
|
|
3335
|
+
import_v411.z.object({
|
|
3336
|
+
type: import_v411.z.literal("bash_code_execution_tool_result_error"),
|
|
3337
|
+
error_code: import_v411.z.string()
|
|
3338
|
+
}),
|
|
3339
|
+
import_v411.z.object({
|
|
3340
|
+
type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
|
|
3341
|
+
error_code: import_v411.z.string()
|
|
3342
|
+
}),
|
|
3343
|
+
import_v411.z.object({
|
|
3344
|
+
type: import_v411.z.literal("text_editor_code_execution_view_result"),
|
|
3345
|
+
content: import_v411.z.string(),
|
|
3346
|
+
file_type: import_v411.z.string(),
|
|
3347
|
+
num_lines: import_v411.z.number().nullable(),
|
|
3348
|
+
start_line: import_v411.z.number().nullable(),
|
|
3349
|
+
total_lines: import_v411.z.number().nullable()
|
|
3350
|
+
}),
|
|
3351
|
+
import_v411.z.object({
|
|
3352
|
+
type: import_v411.z.literal("text_editor_code_execution_create_result"),
|
|
3353
|
+
is_file_update: import_v411.z.boolean()
|
|
3354
|
+
}),
|
|
3355
|
+
import_v411.z.object({
|
|
3356
|
+
type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
|
|
3357
|
+
lines: import_v411.z.array(import_v411.z.string()).nullable(),
|
|
3358
|
+
new_lines: import_v411.z.number().nullable(),
|
|
3359
|
+
new_start: import_v411.z.number().nullable(),
|
|
3360
|
+
old_lines: import_v411.z.number().nullable(),
|
|
3361
|
+
old_start: import_v411.z.number().nullable()
|
|
3362
|
+
})
|
|
3363
|
+
])
|
|
3364
|
+
)
|
|
3365
|
+
);
|
|
3366
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
3367
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
3368
|
+
import_v411.z.discriminatedUnion("type", [
|
|
3369
|
+
import_v411.z.object({
|
|
3370
|
+
type: import_v411.z.literal("programmatic-tool-call"),
|
|
3371
|
+
code: import_v411.z.string()
|
|
3372
|
+
}),
|
|
3373
|
+
import_v411.z.object({
|
|
3374
|
+
type: import_v411.z.literal("bash_code_execution"),
|
|
3375
|
+
command: import_v411.z.string()
|
|
3376
|
+
}),
|
|
3377
|
+
import_v411.z.discriminatedUnion("command", [
|
|
3378
|
+
import_v411.z.object({
|
|
3379
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
3380
|
+
command: import_v411.z.literal("view"),
|
|
3381
|
+
path: import_v411.z.string()
|
|
3382
|
+
}),
|
|
3383
|
+
import_v411.z.object({
|
|
3384
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
3385
|
+
command: import_v411.z.literal("create"),
|
|
3386
|
+
path: import_v411.z.string(),
|
|
3387
|
+
file_text: import_v411.z.string().nullish()
|
|
3388
|
+
}),
|
|
3389
|
+
import_v411.z.object({
|
|
3390
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
3391
|
+
command: import_v411.z.literal("str_replace"),
|
|
3392
|
+
path: import_v411.z.string(),
|
|
3393
|
+
old_str: import_v411.z.string(),
|
|
3394
|
+
new_str: import_v411.z.string()
|
|
3395
|
+
})
|
|
3396
|
+
])
|
|
3397
|
+
])
|
|
3398
|
+
)
|
|
3399
|
+
);
|
|
3400
|
+
var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3401
|
+
id: "anthropic.code_execution_20260120",
|
|
3402
|
+
name: "code_execution",
|
|
3403
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
3404
|
+
outputSchema: codeExecution_20260120OutputSchema
|
|
3405
|
+
});
|
|
3406
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
3407
|
+
return factory6(args);
|
|
3408
|
+
};
|
|
3409
|
+
|
|
3410
|
+
// src/tool/computer_20241022.ts
|
|
3411
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
3412
|
+
var import_v412 = require("zod/v4");
|
|
3413
|
+
var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
3414
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
3415
|
+
import_v412.z.object({
|
|
3416
|
+
action: import_v412.z.enum([
|
|
3288
3417
|
"key",
|
|
3289
3418
|
"type",
|
|
3290
3419
|
"mouse_move",
|
|
@@ -3296,24 +3425,24 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
3296
3425
|
"screenshot",
|
|
3297
3426
|
"cursor_position"
|
|
3298
3427
|
]),
|
|
3299
|
-
coordinate:
|
|
3300
|
-
text:
|
|
3428
|
+
coordinate: import_v412.z.array(import_v412.z.number().int()).optional(),
|
|
3429
|
+
text: import_v412.z.string().optional()
|
|
3301
3430
|
})
|
|
3302
3431
|
)
|
|
3303
3432
|
);
|
|
3304
|
-
var computer_20241022 = (0,
|
|
3433
|
+
var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
3305
3434
|
id: "anthropic.computer_20241022",
|
|
3306
3435
|
name: "computer",
|
|
3307
3436
|
inputSchema: computer_20241022InputSchema
|
|
3308
3437
|
});
|
|
3309
3438
|
|
|
3310
3439
|
// src/tool/computer_20250124.ts
|
|
3311
|
-
var
|
|
3312
|
-
var
|
|
3313
|
-
var computer_20250124InputSchema = (0,
|
|
3314
|
-
() => (0,
|
|
3315
|
-
|
|
3316
|
-
action:
|
|
3440
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
3441
|
+
var import_v413 = require("zod/v4");
|
|
3442
|
+
var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
3443
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
3444
|
+
import_v413.z.object({
|
|
3445
|
+
action: import_v413.z.enum([
|
|
3317
3446
|
"key",
|
|
3318
3447
|
"hold_key",
|
|
3319
3448
|
"type",
|
|
@@ -3331,93 +3460,71 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
3331
3460
|
"wait",
|
|
3332
3461
|
"screenshot"
|
|
3333
3462
|
]),
|
|
3334
|
-
coordinate:
|
|
3335
|
-
duration:
|
|
3336
|
-
scroll_amount:
|
|
3337
|
-
scroll_direction:
|
|
3338
|
-
start_coordinate:
|
|
3339
|
-
text:
|
|
3463
|
+
coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
|
|
3464
|
+
duration: import_v413.z.number().optional(),
|
|
3465
|
+
scroll_amount: import_v413.z.number().optional(),
|
|
3466
|
+
scroll_direction: import_v413.z.enum(["up", "down", "left", "right"]).optional(),
|
|
3467
|
+
start_coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
|
|
3468
|
+
text: import_v413.z.string().optional()
|
|
3340
3469
|
})
|
|
3341
3470
|
)
|
|
3342
3471
|
);
|
|
3343
|
-
var computer_20250124 = (0,
|
|
3472
|
+
var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
3344
3473
|
id: "anthropic.computer_20250124",
|
|
3345
3474
|
name: "computer",
|
|
3346
3475
|
inputSchema: computer_20250124InputSchema
|
|
3347
3476
|
});
|
|
3348
3477
|
|
|
3349
3478
|
// src/tool/memory_20250818.ts
|
|
3350
|
-
var
|
|
3351
|
-
var
|
|
3352
|
-
var memory_20250818InputSchema = (0,
|
|
3353
|
-
() => (0,
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
command:
|
|
3357
|
-
path:
|
|
3358
|
-
view_range:
|
|
3479
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
3480
|
+
var import_v414 = require("zod/v4");
|
|
3481
|
+
var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
3482
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
3483
|
+
import_v414.z.discriminatedUnion("command", [
|
|
3484
|
+
import_v414.z.object({
|
|
3485
|
+
command: import_v414.z.literal("view"),
|
|
3486
|
+
path: import_v414.z.string(),
|
|
3487
|
+
view_range: import_v414.z.tuple([import_v414.z.number(), import_v414.z.number()]).optional()
|
|
3359
3488
|
}),
|
|
3360
|
-
|
|
3361
|
-
command:
|
|
3362
|
-
path:
|
|
3363
|
-
file_text:
|
|
3489
|
+
import_v414.z.object({
|
|
3490
|
+
command: import_v414.z.literal("create"),
|
|
3491
|
+
path: import_v414.z.string(),
|
|
3492
|
+
file_text: import_v414.z.string()
|
|
3364
3493
|
}),
|
|
3365
|
-
|
|
3366
|
-
command:
|
|
3367
|
-
path:
|
|
3368
|
-
old_str:
|
|
3369
|
-
new_str:
|
|
3494
|
+
import_v414.z.object({
|
|
3495
|
+
command: import_v414.z.literal("str_replace"),
|
|
3496
|
+
path: import_v414.z.string(),
|
|
3497
|
+
old_str: import_v414.z.string(),
|
|
3498
|
+
new_str: import_v414.z.string()
|
|
3370
3499
|
}),
|
|
3371
|
-
|
|
3372
|
-
command:
|
|
3373
|
-
path:
|
|
3374
|
-
insert_line:
|
|
3375
|
-
insert_text:
|
|
3500
|
+
import_v414.z.object({
|
|
3501
|
+
command: import_v414.z.literal("insert"),
|
|
3502
|
+
path: import_v414.z.string(),
|
|
3503
|
+
insert_line: import_v414.z.number(),
|
|
3504
|
+
insert_text: import_v414.z.string()
|
|
3376
3505
|
}),
|
|
3377
|
-
|
|
3378
|
-
command:
|
|
3379
|
-
path:
|
|
3506
|
+
import_v414.z.object({
|
|
3507
|
+
command: import_v414.z.literal("delete"),
|
|
3508
|
+
path: import_v414.z.string()
|
|
3380
3509
|
}),
|
|
3381
|
-
|
|
3382
|
-
command:
|
|
3383
|
-
old_path:
|
|
3384
|
-
new_path:
|
|
3510
|
+
import_v414.z.object({
|
|
3511
|
+
command: import_v414.z.literal("rename"),
|
|
3512
|
+
old_path: import_v414.z.string(),
|
|
3513
|
+
new_path: import_v414.z.string()
|
|
3385
3514
|
})
|
|
3386
3515
|
])
|
|
3387
3516
|
)
|
|
3388
3517
|
);
|
|
3389
|
-
var memory_20250818 = (0,
|
|
3518
|
+
var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
3390
3519
|
id: "anthropic.memory_20250818",
|
|
3391
3520
|
name: "memory",
|
|
3392
3521
|
inputSchema: memory_20250818InputSchema
|
|
3393
3522
|
});
|
|
3394
3523
|
|
|
3395
3524
|
// src/tool/text-editor_20241022.ts
|
|
3396
|
-
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
3397
|
-
var import_v414 = require("zod/v4");
|
|
3398
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
3399
|
-
() => (0, import_provider_utils17.zodSchema)(
|
|
3400
|
-
import_v414.z.object({
|
|
3401
|
-
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
3402
|
-
path: import_v414.z.string(),
|
|
3403
|
-
file_text: import_v414.z.string().optional(),
|
|
3404
|
-
insert_line: import_v414.z.number().int().optional(),
|
|
3405
|
-
new_str: import_v414.z.string().optional(),
|
|
3406
|
-
old_str: import_v414.z.string().optional(),
|
|
3407
|
-
view_range: import_v414.z.array(import_v414.z.number().int()).optional()
|
|
3408
|
-
})
|
|
3409
|
-
)
|
|
3410
|
-
);
|
|
3411
|
-
var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
3412
|
-
id: "anthropic.text_editor_20241022",
|
|
3413
|
-
name: "str_replace_editor",
|
|
3414
|
-
inputSchema: textEditor_20241022InputSchema
|
|
3415
|
-
});
|
|
3416
|
-
|
|
3417
|
-
// src/tool/text-editor_20250124.ts
|
|
3418
3525
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
3419
3526
|
var import_v415 = require("zod/v4");
|
|
3420
|
-
var
|
|
3527
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
3421
3528
|
() => (0, import_provider_utils18.zodSchema)(
|
|
3422
3529
|
import_v415.z.object({
|
|
3423
3530
|
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -3430,19 +3537,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
3430
3537
|
})
|
|
3431
3538
|
)
|
|
3432
3539
|
);
|
|
3433
|
-
var
|
|
3434
|
-
id: "anthropic.
|
|
3540
|
+
var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
3541
|
+
id: "anthropic.text_editor_20241022",
|
|
3435
3542
|
name: "str_replace_editor",
|
|
3436
|
-
inputSchema:
|
|
3543
|
+
inputSchema: textEditor_20241022InputSchema
|
|
3437
3544
|
});
|
|
3438
3545
|
|
|
3439
|
-
// src/tool/text-
|
|
3546
|
+
// src/tool/text-editor_20250124.ts
|
|
3440
3547
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
3441
3548
|
var import_v416 = require("zod/v4");
|
|
3442
|
-
var
|
|
3549
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
3443
3550
|
() => (0, import_provider_utils19.zodSchema)(
|
|
3444
3551
|
import_v416.z.object({
|
|
3445
|
-
command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
|
|
3552
|
+
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
3446
3553
|
path: import_v416.z.string(),
|
|
3447
3554
|
file_text: import_v416.z.string().optional(),
|
|
3448
3555
|
insert_line: import_v416.z.number().int().optional(),
|
|
@@ -3452,7 +3559,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
3452
3559
|
})
|
|
3453
3560
|
)
|
|
3454
3561
|
);
|
|
3455
|
-
var
|
|
3562
|
+
var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
|
|
3563
|
+
id: "anthropic.text_editor_20250124",
|
|
3564
|
+
name: "str_replace_editor",
|
|
3565
|
+
inputSchema: textEditor_20250124InputSchema
|
|
3566
|
+
});
|
|
3567
|
+
|
|
3568
|
+
// src/tool/text-editor_20250429.ts
|
|
3569
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
3570
|
+
var import_v417 = require("zod/v4");
|
|
3571
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
3572
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
3573
|
+
import_v417.z.object({
|
|
3574
|
+
command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
|
|
3575
|
+
path: import_v417.z.string(),
|
|
3576
|
+
file_text: import_v417.z.string().optional(),
|
|
3577
|
+
insert_line: import_v417.z.number().int().optional(),
|
|
3578
|
+
new_str: import_v417.z.string().optional(),
|
|
3579
|
+
old_str: import_v417.z.string().optional(),
|
|
3580
|
+
view_range: import_v417.z.array(import_v417.z.number().int()).optional()
|
|
3581
|
+
})
|
|
3582
|
+
)
|
|
3583
|
+
);
|
|
3584
|
+
var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
|
|
3456
3585
|
id: "anthropic.text_editor_20250429",
|
|
3457
3586
|
name: "str_replace_based_edit_tool",
|
|
3458
3587
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -3502,6 +3631,19 @@ var anthropicTools = {
|
|
|
3502
3631
|
* Tool name must be `code_execution`.
|
|
3503
3632
|
*/
|
|
3504
3633
|
codeExecution_20250825,
|
|
3634
|
+
/**
|
|
3635
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
3636
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
3637
|
+
* the API conversation.
|
|
3638
|
+
*
|
|
3639
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
3640
|
+
* including writing code, in a secure, sandboxed environment.
|
|
3641
|
+
*
|
|
3642
|
+
* This is the recommended version. Does not require a beta header.
|
|
3643
|
+
*
|
|
3644
|
+
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
3645
|
+
*/
|
|
3646
|
+
codeExecution_20260120,
|
|
3505
3647
|
/**
|
|
3506
3648
|
* Claude can interact with computer environments through the computer use tool, which
|
|
3507
3649
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -3613,17 +3755,17 @@ var anthropicTools = {
|
|
|
3613
3755
|
// src/anthropic-provider.ts
|
|
3614
3756
|
function createAnthropic(options = {}) {
|
|
3615
3757
|
var _a, _b;
|
|
3616
|
-
const baseURL = (_a = (0,
|
|
3617
|
-
(0,
|
|
3758
|
+
const baseURL = (_a = (0, import_provider_utils21.withoutTrailingSlash)(
|
|
3759
|
+
(0, import_provider_utils21.loadOptionalSetting)({
|
|
3618
3760
|
settingValue: options.baseURL,
|
|
3619
3761
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
3620
3762
|
})
|
|
3621
3763
|
)) != null ? _a : "https://api.anthropic.com/v1";
|
|
3622
3764
|
const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
|
|
3623
|
-
const getHeaders = () => (0,
|
|
3765
|
+
const getHeaders = () => (0, import_provider_utils21.withUserAgentSuffix)(
|
|
3624
3766
|
{
|
|
3625
3767
|
"anthropic-version": "2023-06-01",
|
|
3626
|
-
"x-api-key": (0,
|
|
3768
|
+
"x-api-key": (0, import_provider_utils21.loadApiKey)({
|
|
3627
3769
|
apiKey: options.apiKey,
|
|
3628
3770
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
3629
3771
|
description: "Anthropic"
|
|
@@ -3639,7 +3781,7 @@ function createAnthropic(options = {}) {
|
|
|
3639
3781
|
baseURL,
|
|
3640
3782
|
headers: getHeaders,
|
|
3641
3783
|
fetch: options.fetch,
|
|
3642
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
3784
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils21.generateId,
|
|
3643
3785
|
supportedUrls: () => ({
|
|
3644
3786
|
"image/*": [/^https?:\/\/.*$/]
|
|
3645
3787
|
})
|