@ai-sdk/anthropic 3.0.47 → 3.0.49
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 +275 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +279 -138
- 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 +268 -131
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +278 -137
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +10 -9
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +23 -1
- package/src/anthropic-messages-language-model.ts +24 -25
- package/src/anthropic-messages-options.ts +1 -1
- 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.49" : "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
|
})
|
|
@@ -777,7 +789,7 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
777
789
|
/**
|
|
778
790
|
* Determines how structured outputs are generated.
|
|
779
791
|
*
|
|
780
|
-
* - `outputFormat`: Use the `
|
|
792
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
781
793
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
782
794
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
783
795
|
*/
|
|
@@ -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",
|
|
@@ -2642,8 +2662,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2642
2662
|
...thinkingBudget != null && { budget_tokens: thinkingBudget }
|
|
2643
2663
|
}
|
|
2644
2664
|
},
|
|
2645
|
-
...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
|
|
2646
|
-
output_config: {
|
|
2665
|
+
...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
|
|
2666
|
+
output_config: {
|
|
2667
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
|
|
2668
|
+
effort: anthropicOptions.effort
|
|
2669
|
+
},
|
|
2670
|
+
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2671
|
+
format: {
|
|
2672
|
+
type: "json_schema",
|
|
2673
|
+
schema: responseFormat.schema
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2647
2677
|
},
|
|
2648
2678
|
...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
|
|
2649
2679
|
speed: anthropicOptions.speed
|
|
@@ -2651,13 +2681,6 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2651
2681
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2652
2682
|
cache_control: anthropicOptions.cacheControl
|
|
2653
2683
|
},
|
|
2654
|
-
// structured output:
|
|
2655
|
-
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2656
|
-
output_format: {
|
|
2657
|
-
type: "json_schema",
|
|
2658
|
-
schema: responseFormat.schema
|
|
2659
|
-
}
|
|
2660
|
-
},
|
|
2661
2684
|
// mcp servers:
|
|
2662
2685
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
2663
2686
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -2814,7 +2837,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2814
2837
|
betas.add("skills-2025-10-02");
|
|
2815
2838
|
betas.add("files-api-2025-04-14");
|
|
2816
2839
|
if (!(tools == null ? void 0 : tools.some(
|
|
2817
|
-
(tool) => tool.type === "provider" && tool.id === "anthropic.code_execution_20250825"
|
|
2840
|
+
(tool) => tool.type === "provider" && (tool.id === "anthropic.code_execution_20250825" || tool.id === "anthropic.code_execution_20260120")
|
|
2818
2841
|
))) {
|
|
2819
2842
|
warnings.push({
|
|
2820
2843
|
type: "other",
|
|
@@ -2831,10 +2854,6 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2831
2854
|
if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
|
|
2832
2855
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
2833
2856
|
}
|
|
2834
|
-
const usingNativeOutputFormat = useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
|
|
2835
|
-
if (usingNativeOutputFormat) {
|
|
2836
|
-
betas.add("structured-outputs-2025-11-13");
|
|
2837
|
-
}
|
|
2838
2857
|
const {
|
|
2839
2858
|
tools: anthropicTools2,
|
|
2840
2859
|
toolChoice: anthropicToolChoice,
|
|
@@ -4192,13 +4211,118 @@ var bash_20250124 = (0, import_provider_utils14.createProviderToolFactory)({
|
|
|
4192
4211
|
inputSchema: bash_20250124InputSchema
|
|
4193
4212
|
});
|
|
4194
4213
|
|
|
4195
|
-
// src/tool/
|
|
4214
|
+
// src/tool/code-execution_20260120.ts
|
|
4196
4215
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4197
4216
|
var import_v412 = require("zod/v4");
|
|
4198
|
-
var
|
|
4217
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4199
4218
|
() => (0, import_provider_utils15.zodSchema)(
|
|
4200
|
-
import_v412.z.
|
|
4201
|
-
|
|
4219
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4220
|
+
import_v412.z.object({
|
|
4221
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
4222
|
+
stdout: import_v412.z.string(),
|
|
4223
|
+
stderr: import_v412.z.string(),
|
|
4224
|
+
return_code: import_v412.z.number(),
|
|
4225
|
+
content: import_v412.z.array(
|
|
4226
|
+
import_v412.z.object({
|
|
4227
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
4228
|
+
file_id: import_v412.z.string()
|
|
4229
|
+
})
|
|
4230
|
+
).optional().default([])
|
|
4231
|
+
}),
|
|
4232
|
+
import_v412.z.object({
|
|
4233
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4234
|
+
content: import_v412.z.array(
|
|
4235
|
+
import_v412.z.object({
|
|
4236
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4237
|
+
file_id: import_v412.z.string()
|
|
4238
|
+
})
|
|
4239
|
+
),
|
|
4240
|
+
stdout: import_v412.z.string(),
|
|
4241
|
+
stderr: import_v412.z.string(),
|
|
4242
|
+
return_code: import_v412.z.number()
|
|
4243
|
+
}),
|
|
4244
|
+
import_v412.z.object({
|
|
4245
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4246
|
+
error_code: import_v412.z.string()
|
|
4247
|
+
}),
|
|
4248
|
+
import_v412.z.object({
|
|
4249
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4250
|
+
error_code: import_v412.z.string()
|
|
4251
|
+
}),
|
|
4252
|
+
import_v412.z.object({
|
|
4253
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4254
|
+
content: import_v412.z.string(),
|
|
4255
|
+
file_type: import_v412.z.string(),
|
|
4256
|
+
num_lines: import_v412.z.number().nullable(),
|
|
4257
|
+
start_line: import_v412.z.number().nullable(),
|
|
4258
|
+
total_lines: import_v412.z.number().nullable()
|
|
4259
|
+
}),
|
|
4260
|
+
import_v412.z.object({
|
|
4261
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4262
|
+
is_file_update: import_v412.z.boolean()
|
|
4263
|
+
}),
|
|
4264
|
+
import_v412.z.object({
|
|
4265
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4266
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4267
|
+
new_lines: import_v412.z.number().nullable(),
|
|
4268
|
+
new_start: import_v412.z.number().nullable(),
|
|
4269
|
+
old_lines: import_v412.z.number().nullable(),
|
|
4270
|
+
old_start: import_v412.z.number().nullable()
|
|
4271
|
+
})
|
|
4272
|
+
])
|
|
4273
|
+
)
|
|
4274
|
+
);
|
|
4275
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4276
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
4277
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4278
|
+
import_v412.z.object({
|
|
4279
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4280
|
+
code: import_v412.z.string()
|
|
4281
|
+
}),
|
|
4282
|
+
import_v412.z.object({
|
|
4283
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
4284
|
+
command: import_v412.z.string()
|
|
4285
|
+
}),
|
|
4286
|
+
import_v412.z.discriminatedUnion("command", [
|
|
4287
|
+
import_v412.z.object({
|
|
4288
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4289
|
+
command: import_v412.z.literal("view"),
|
|
4290
|
+
path: import_v412.z.string()
|
|
4291
|
+
}),
|
|
4292
|
+
import_v412.z.object({
|
|
4293
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4294
|
+
command: import_v412.z.literal("create"),
|
|
4295
|
+
path: import_v412.z.string(),
|
|
4296
|
+
file_text: import_v412.z.string().nullish()
|
|
4297
|
+
}),
|
|
4298
|
+
import_v412.z.object({
|
|
4299
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4300
|
+
command: import_v412.z.literal("str_replace"),
|
|
4301
|
+
path: import_v412.z.string(),
|
|
4302
|
+
old_str: import_v412.z.string(),
|
|
4303
|
+
new_str: import_v412.z.string()
|
|
4304
|
+
})
|
|
4305
|
+
])
|
|
4306
|
+
])
|
|
4307
|
+
)
|
|
4308
|
+
);
|
|
4309
|
+
var factory7 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
4310
|
+
id: "anthropic.code_execution_20260120",
|
|
4311
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
4312
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
4313
|
+
supportsDeferredResults: true
|
|
4314
|
+
});
|
|
4315
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
4316
|
+
return factory7(args);
|
|
4317
|
+
};
|
|
4318
|
+
|
|
4319
|
+
// src/tool/computer_20241022.ts
|
|
4320
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4321
|
+
var import_v413 = require("zod/v4");
|
|
4322
|
+
var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4323
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4324
|
+
import_v413.z.object({
|
|
4325
|
+
action: import_v413.z.enum([
|
|
4202
4326
|
"key",
|
|
4203
4327
|
"type",
|
|
4204
4328
|
"mouse_move",
|
|
@@ -4210,23 +4334,23 @@ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
4210
4334
|
"screenshot",
|
|
4211
4335
|
"cursor_position"
|
|
4212
4336
|
]),
|
|
4213
|
-
coordinate:
|
|
4214
|
-
text:
|
|
4337
|
+
coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
|
|
4338
|
+
text: import_v413.z.string().optional()
|
|
4215
4339
|
})
|
|
4216
4340
|
)
|
|
4217
4341
|
);
|
|
4218
|
-
var computer_20241022 = (0,
|
|
4342
|
+
var computer_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4219
4343
|
id: "anthropic.computer_20241022",
|
|
4220
4344
|
inputSchema: computer_20241022InputSchema
|
|
4221
4345
|
});
|
|
4222
4346
|
|
|
4223
4347
|
// src/tool/computer_20250124.ts
|
|
4224
|
-
var
|
|
4225
|
-
var
|
|
4226
|
-
var computer_20250124InputSchema = (0,
|
|
4227
|
-
() => (0,
|
|
4228
|
-
|
|
4229
|
-
action:
|
|
4348
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4349
|
+
var import_v414 = require("zod/v4");
|
|
4350
|
+
var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4351
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4352
|
+
import_v414.z.object({
|
|
4353
|
+
action: import_v414.z.enum([
|
|
4230
4354
|
"key",
|
|
4231
4355
|
"hold_key",
|
|
4232
4356
|
"type",
|
|
@@ -4244,27 +4368,27 @@ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4244
4368
|
"wait",
|
|
4245
4369
|
"screenshot"
|
|
4246
4370
|
]),
|
|
4247
|
-
coordinate:
|
|
4248
|
-
duration:
|
|
4249
|
-
scroll_amount:
|
|
4250
|
-
scroll_direction:
|
|
4251
|
-
start_coordinate:
|
|
4252
|
-
text:
|
|
4371
|
+
coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4372
|
+
duration: import_v414.z.number().optional(),
|
|
4373
|
+
scroll_amount: import_v414.z.number().optional(),
|
|
4374
|
+
scroll_direction: import_v414.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4375
|
+
start_coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4376
|
+
text: import_v414.z.string().optional()
|
|
4253
4377
|
})
|
|
4254
4378
|
)
|
|
4255
4379
|
);
|
|
4256
|
-
var computer_20250124 = (0,
|
|
4380
|
+
var computer_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4257
4381
|
id: "anthropic.computer_20250124",
|
|
4258
4382
|
inputSchema: computer_20250124InputSchema
|
|
4259
4383
|
});
|
|
4260
4384
|
|
|
4261
4385
|
// src/tool/computer_20251124.ts
|
|
4262
|
-
var
|
|
4263
|
-
var
|
|
4264
|
-
var computer_20251124InputSchema = (0,
|
|
4265
|
-
() => (0,
|
|
4266
|
-
|
|
4267
|
-
action:
|
|
4386
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4387
|
+
var import_v415 = require("zod/v4");
|
|
4388
|
+
var computer_20251124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4389
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4390
|
+
import_v415.z.object({
|
|
4391
|
+
action: import_v415.z.enum([
|
|
4268
4392
|
"key",
|
|
4269
4393
|
"hold_key",
|
|
4270
4394
|
"type",
|
|
@@ -4283,97 +4407,75 @@ var computer_20251124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4283
4407
|
"screenshot",
|
|
4284
4408
|
"zoom"
|
|
4285
4409
|
]),
|
|
4286
|
-
coordinate:
|
|
4287
|
-
duration:
|
|
4288
|
-
region:
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4410
|
+
coordinate: import_v415.z.tuple([import_v415.z.number().int(), import_v415.z.number().int()]).optional(),
|
|
4411
|
+
duration: import_v415.z.number().optional(),
|
|
4412
|
+
region: import_v415.z.tuple([
|
|
4413
|
+
import_v415.z.number().int(),
|
|
4414
|
+
import_v415.z.number().int(),
|
|
4415
|
+
import_v415.z.number().int(),
|
|
4416
|
+
import_v415.z.number().int()
|
|
4293
4417
|
]).optional(),
|
|
4294
|
-
scroll_amount:
|
|
4295
|
-
scroll_direction:
|
|
4296
|
-
start_coordinate:
|
|
4297
|
-
text:
|
|
4418
|
+
scroll_amount: import_v415.z.number().optional(),
|
|
4419
|
+
scroll_direction: import_v415.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4420
|
+
start_coordinate: import_v415.z.tuple([import_v415.z.number().int(), import_v415.z.number().int()]).optional(),
|
|
4421
|
+
text: import_v415.z.string().optional()
|
|
4298
4422
|
})
|
|
4299
4423
|
)
|
|
4300
4424
|
);
|
|
4301
|
-
var computer_20251124 = (0,
|
|
4425
|
+
var computer_20251124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4302
4426
|
id: "anthropic.computer_20251124",
|
|
4303
4427
|
inputSchema: computer_20251124InputSchema
|
|
4304
4428
|
});
|
|
4305
4429
|
|
|
4306
4430
|
// src/tool/memory_20250818.ts
|
|
4307
|
-
var
|
|
4308
|
-
var
|
|
4309
|
-
var memory_20250818InputSchema = (0,
|
|
4310
|
-
() => (0,
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
command:
|
|
4314
|
-
path:
|
|
4315
|
-
view_range:
|
|
4431
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4432
|
+
var import_v416 = require("zod/v4");
|
|
4433
|
+
var memory_20250818InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4434
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4435
|
+
import_v416.z.discriminatedUnion("command", [
|
|
4436
|
+
import_v416.z.object({
|
|
4437
|
+
command: import_v416.z.literal("view"),
|
|
4438
|
+
path: import_v416.z.string(),
|
|
4439
|
+
view_range: import_v416.z.tuple([import_v416.z.number(), import_v416.z.number()]).optional()
|
|
4316
4440
|
}),
|
|
4317
|
-
|
|
4318
|
-
command:
|
|
4319
|
-
path:
|
|
4320
|
-
file_text:
|
|
4441
|
+
import_v416.z.object({
|
|
4442
|
+
command: import_v416.z.literal("create"),
|
|
4443
|
+
path: import_v416.z.string(),
|
|
4444
|
+
file_text: import_v416.z.string()
|
|
4321
4445
|
}),
|
|
4322
|
-
|
|
4323
|
-
command:
|
|
4324
|
-
path:
|
|
4325
|
-
old_str:
|
|
4326
|
-
new_str:
|
|
4446
|
+
import_v416.z.object({
|
|
4447
|
+
command: import_v416.z.literal("str_replace"),
|
|
4448
|
+
path: import_v416.z.string(),
|
|
4449
|
+
old_str: import_v416.z.string(),
|
|
4450
|
+
new_str: import_v416.z.string()
|
|
4327
4451
|
}),
|
|
4328
|
-
|
|
4329
|
-
command:
|
|
4330
|
-
path:
|
|
4331
|
-
insert_line:
|
|
4332
|
-
insert_text:
|
|
4452
|
+
import_v416.z.object({
|
|
4453
|
+
command: import_v416.z.literal("insert"),
|
|
4454
|
+
path: import_v416.z.string(),
|
|
4455
|
+
insert_line: import_v416.z.number(),
|
|
4456
|
+
insert_text: import_v416.z.string()
|
|
4333
4457
|
}),
|
|
4334
|
-
|
|
4335
|
-
command:
|
|
4336
|
-
path:
|
|
4458
|
+
import_v416.z.object({
|
|
4459
|
+
command: import_v416.z.literal("delete"),
|
|
4460
|
+
path: import_v416.z.string()
|
|
4337
4461
|
}),
|
|
4338
|
-
|
|
4339
|
-
command:
|
|
4340
|
-
old_path:
|
|
4341
|
-
new_path:
|
|
4462
|
+
import_v416.z.object({
|
|
4463
|
+
command: import_v416.z.literal("rename"),
|
|
4464
|
+
old_path: import_v416.z.string(),
|
|
4465
|
+
new_path: import_v416.z.string()
|
|
4342
4466
|
})
|
|
4343
4467
|
])
|
|
4344
4468
|
)
|
|
4345
4469
|
);
|
|
4346
|
-
var memory_20250818 = (0,
|
|
4470
|
+
var memory_20250818 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4347
4471
|
id: "anthropic.memory_20250818",
|
|
4348
4472
|
inputSchema: memory_20250818InputSchema
|
|
4349
4473
|
});
|
|
4350
4474
|
|
|
4351
4475
|
// src/tool/text-editor_20241022.ts
|
|
4352
|
-
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4353
|
-
var import_v416 = require("zod/v4");
|
|
4354
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4355
|
-
() => (0, import_provider_utils19.zodSchema)(
|
|
4356
|
-
import_v416.z.object({
|
|
4357
|
-
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4358
|
-
path: import_v416.z.string(),
|
|
4359
|
-
file_text: import_v416.z.string().optional(),
|
|
4360
|
-
insert_line: import_v416.z.number().int().optional(),
|
|
4361
|
-
new_str: import_v416.z.string().optional(),
|
|
4362
|
-
insert_text: import_v416.z.string().optional(),
|
|
4363
|
-
old_str: import_v416.z.string().optional(),
|
|
4364
|
-
view_range: import_v416.z.array(import_v416.z.number().int()).optional()
|
|
4365
|
-
})
|
|
4366
|
-
)
|
|
4367
|
-
);
|
|
4368
|
-
var textEditor_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4369
|
-
id: "anthropic.text_editor_20241022",
|
|
4370
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4371
|
-
});
|
|
4372
|
-
|
|
4373
|
-
// src/tool/text-editor_20250124.ts
|
|
4374
4476
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4375
4477
|
var import_v417 = require("zod/v4");
|
|
4376
|
-
var
|
|
4478
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4377
4479
|
() => (0, import_provider_utils20.zodSchema)(
|
|
4378
4480
|
import_v417.z.object({
|
|
4379
4481
|
command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4387,18 +4489,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4387
4489
|
})
|
|
4388
4490
|
)
|
|
4389
4491
|
);
|
|
4390
|
-
var
|
|
4391
|
-
id: "anthropic.
|
|
4392
|
-
inputSchema:
|
|
4492
|
+
var textEditor_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4493
|
+
id: "anthropic.text_editor_20241022",
|
|
4494
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4393
4495
|
});
|
|
4394
4496
|
|
|
4395
|
-
// src/tool/text-
|
|
4497
|
+
// src/tool/text-editor_20250124.ts
|
|
4396
4498
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4397
4499
|
var import_v418 = require("zod/v4");
|
|
4398
|
-
var
|
|
4500
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4399
4501
|
() => (0, import_provider_utils21.zodSchema)(
|
|
4400
4502
|
import_v418.z.object({
|
|
4401
|
-
command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4503
|
+
command: import_v418.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4402
4504
|
path: import_v418.z.string(),
|
|
4403
4505
|
file_text: import_v418.z.string().optional(),
|
|
4404
4506
|
insert_line: import_v418.z.number().int().optional(),
|
|
@@ -4409,47 +4511,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
4409
4511
|
})
|
|
4410
4512
|
)
|
|
4411
4513
|
);
|
|
4412
|
-
var
|
|
4413
|
-
id: "anthropic.
|
|
4414
|
-
inputSchema:
|
|
4514
|
+
var textEditor_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4515
|
+
id: "anthropic.text_editor_20250124",
|
|
4516
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4415
4517
|
});
|
|
4416
4518
|
|
|
4417
|
-
// src/tool/
|
|
4519
|
+
// src/tool/text-editor_20250429.ts
|
|
4418
4520
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4419
4521
|
var import_v419 = require("zod/v4");
|
|
4420
|
-
var
|
|
4522
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4421
4523
|
() => (0, import_provider_utils22.zodSchema)(
|
|
4422
|
-
import_v419.z.
|
|
4423
|
-
import_v419.z.
|
|
4424
|
-
|
|
4425
|
-
|
|
4524
|
+
import_v419.z.object({
|
|
4525
|
+
command: import_v419.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4526
|
+
path: import_v419.z.string(),
|
|
4527
|
+
file_text: import_v419.z.string().optional(),
|
|
4528
|
+
insert_line: import_v419.z.number().int().optional(),
|
|
4529
|
+
new_str: import_v419.z.string().optional(),
|
|
4530
|
+
insert_text: import_v419.z.string().optional(),
|
|
4531
|
+
old_str: import_v419.z.string().optional(),
|
|
4532
|
+
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4533
|
+
})
|
|
4534
|
+
)
|
|
4535
|
+
);
|
|
4536
|
+
var textEditor_20250429 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4537
|
+
id: "anthropic.text_editor_20250429",
|
|
4538
|
+
inputSchema: textEditor_20250429InputSchema
|
|
4539
|
+
});
|
|
4540
|
+
|
|
4541
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
4542
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4543
|
+
var import_v420 = require("zod/v4");
|
|
4544
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4545
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4546
|
+
import_v420.z.array(
|
|
4547
|
+
import_v420.z.object({
|
|
4548
|
+
type: import_v420.z.literal("tool_reference"),
|
|
4549
|
+
toolName: import_v420.z.string()
|
|
4426
4550
|
})
|
|
4427
4551
|
)
|
|
4428
4552
|
)
|
|
4429
4553
|
);
|
|
4430
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4431
|
-
() => (0,
|
|
4432
|
-
|
|
4554
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4555
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4556
|
+
import_v420.z.object({
|
|
4433
4557
|
/**
|
|
4434
4558
|
* A natural language query to search for tools.
|
|
4435
4559
|
* Claude will use BM25 text search to find relevant tools.
|
|
4436
4560
|
*/
|
|
4437
|
-
query:
|
|
4561
|
+
query: import_v420.z.string(),
|
|
4438
4562
|
/**
|
|
4439
4563
|
* Maximum number of tools to return. Optional.
|
|
4440
4564
|
*/
|
|
4441
|
-
limit:
|
|
4565
|
+
limit: import_v420.z.number().optional()
|
|
4442
4566
|
})
|
|
4443
4567
|
)
|
|
4444
4568
|
);
|
|
4445
|
-
var
|
|
4569
|
+
var factory8 = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
4446
4570
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4447
4571
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4448
4572
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4449
4573
|
supportsDeferredResults: true
|
|
4450
4574
|
});
|
|
4451
4575
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4452
|
-
return
|
|
4576
|
+
return factory8(args);
|
|
4453
4577
|
};
|
|
4454
4578
|
|
|
4455
4579
|
// src/anthropic-tools.ts
|
|
@@ -4488,6 +4612,19 @@ var anthropicTools = {
|
|
|
4488
4612
|
* This is the latest version with enhanced Bash support and file operations.
|
|
4489
4613
|
*/
|
|
4490
4614
|
codeExecution_20250825,
|
|
4615
|
+
/**
|
|
4616
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
4617
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
4618
|
+
* the API conversation.
|
|
4619
|
+
*
|
|
4620
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
4621
|
+
* including writing code, in a secure, sandboxed environment.
|
|
4622
|
+
*
|
|
4623
|
+
* This is the recommended version. Does not require a beta header.
|
|
4624
|
+
*
|
|
4625
|
+
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
4626
|
+
*/
|
|
4627
|
+
codeExecution_20260120,
|
|
4491
4628
|
/**
|
|
4492
4629
|
* Claude can interact with computer environments through the computer use tool, which
|
|
4493
4630
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -4625,8 +4762,8 @@ var anthropicTools = {
|
|
|
4625
4762
|
// src/anthropic-provider.ts
|
|
4626
4763
|
function createAnthropic(options = {}) {
|
|
4627
4764
|
var _a, _b;
|
|
4628
|
-
const baseURL = (_a = (0,
|
|
4629
|
-
(0,
|
|
4765
|
+
const baseURL = (_a = (0, import_provider_utils24.withoutTrailingSlash)(
|
|
4766
|
+
(0, import_provider_utils24.loadOptionalSetting)({
|
|
4630
4767
|
settingValue: options.baseURL,
|
|
4631
4768
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4632
4769
|
})
|
|
@@ -4640,13 +4777,13 @@ function createAnthropic(options = {}) {
|
|
|
4640
4777
|
}
|
|
4641
4778
|
const getHeaders = () => {
|
|
4642
4779
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
4643
|
-
"x-api-key": (0,
|
|
4780
|
+
"x-api-key": (0, import_provider_utils24.loadApiKey)({
|
|
4644
4781
|
apiKey: options.apiKey,
|
|
4645
4782
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4646
4783
|
description: "Anthropic"
|
|
4647
4784
|
})
|
|
4648
4785
|
};
|
|
4649
|
-
return (0,
|
|
4786
|
+
return (0, import_provider_utils24.withUserAgentSuffix)(
|
|
4650
4787
|
{
|
|
4651
4788
|
"anthropic-version": "2023-06-01",
|
|
4652
4789
|
...authHeaders,
|
|
@@ -4662,7 +4799,7 @@ function createAnthropic(options = {}) {
|
|
|
4662
4799
|
baseURL,
|
|
4663
4800
|
headers: getHeaders,
|
|
4664
4801
|
fetch: options.fetch,
|
|
4665
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
4802
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId,
|
|
4666
4803
|
supportedUrls: () => ({
|
|
4667
4804
|
"image/*": [/^https?:\/\/.*$/],
|
|
4668
4805
|
"application/pdf": [/^https?:\/\/.*$/]
|