@ai-sdk/anthropic 3.0.47 → 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 +6 -0
- package/dist/index.d.mts +138 -1
- package/dist/index.d.ts +138 -1
- package/dist/index.js +262 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +266 -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 +255 -117
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +265 -123
- 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 +7 -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",
|
|
@@ -2814,7 +2834,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2814
2834
|
betas.add("skills-2025-10-02");
|
|
2815
2835
|
betas.add("files-api-2025-04-14");
|
|
2816
2836
|
if (!(tools == null ? void 0 : tools.some(
|
|
2817
|
-
(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")
|
|
2818
2838
|
))) {
|
|
2819
2839
|
warnings.push({
|
|
2820
2840
|
type: "other",
|
|
@@ -4192,13 +4212,118 @@ var bash_20250124 = (0, import_provider_utils14.createProviderToolFactory)({
|
|
|
4192
4212
|
inputSchema: bash_20250124InputSchema
|
|
4193
4213
|
});
|
|
4194
4214
|
|
|
4195
|
-
// src/tool/
|
|
4215
|
+
// src/tool/code-execution_20260120.ts
|
|
4196
4216
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4197
4217
|
var import_v412 = require("zod/v4");
|
|
4198
|
-
var
|
|
4218
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4219
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
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)(
|
|
4199
4277
|
() => (0, import_provider_utils15.zodSchema)(
|
|
4200
|
-
import_v412.z.
|
|
4201
|
-
|
|
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([
|
|
4202
4327
|
"key",
|
|
4203
4328
|
"type",
|
|
4204
4329
|
"mouse_move",
|
|
@@ -4210,23 +4335,23 @@ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
4210
4335
|
"screenshot",
|
|
4211
4336
|
"cursor_position"
|
|
4212
4337
|
]),
|
|
4213
|
-
coordinate:
|
|
4214
|
-
text:
|
|
4338
|
+
coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
|
|
4339
|
+
text: import_v413.z.string().optional()
|
|
4215
4340
|
})
|
|
4216
4341
|
)
|
|
4217
4342
|
);
|
|
4218
|
-
var computer_20241022 = (0,
|
|
4343
|
+
var computer_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4219
4344
|
id: "anthropic.computer_20241022",
|
|
4220
4345
|
inputSchema: computer_20241022InputSchema
|
|
4221
4346
|
});
|
|
4222
4347
|
|
|
4223
4348
|
// src/tool/computer_20250124.ts
|
|
4224
|
-
var
|
|
4225
|
-
var
|
|
4226
|
-
var computer_20250124InputSchema = (0,
|
|
4227
|
-
() => (0,
|
|
4228
|
-
|
|
4229
|
-
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([
|
|
4230
4355
|
"key",
|
|
4231
4356
|
"hold_key",
|
|
4232
4357
|
"type",
|
|
@@ -4244,27 +4369,27 @@ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4244
4369
|
"wait",
|
|
4245
4370
|
"screenshot"
|
|
4246
4371
|
]),
|
|
4247
|
-
coordinate:
|
|
4248
|
-
duration:
|
|
4249
|
-
scroll_amount:
|
|
4250
|
-
scroll_direction:
|
|
4251
|
-
start_coordinate:
|
|
4252
|
-
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()
|
|
4253
4378
|
})
|
|
4254
4379
|
)
|
|
4255
4380
|
);
|
|
4256
|
-
var computer_20250124 = (0,
|
|
4381
|
+
var computer_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4257
4382
|
id: "anthropic.computer_20250124",
|
|
4258
4383
|
inputSchema: computer_20250124InputSchema
|
|
4259
4384
|
});
|
|
4260
4385
|
|
|
4261
4386
|
// src/tool/computer_20251124.ts
|
|
4262
|
-
var
|
|
4263
|
-
var
|
|
4264
|
-
var computer_20251124InputSchema = (0,
|
|
4265
|
-
() => (0,
|
|
4266
|
-
|
|
4267
|
-
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([
|
|
4268
4393
|
"key",
|
|
4269
4394
|
"hold_key",
|
|
4270
4395
|
"type",
|
|
@@ -4283,97 +4408,75 @@ var computer_20251124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4283
4408
|
"screenshot",
|
|
4284
4409
|
"zoom"
|
|
4285
4410
|
]),
|
|
4286
|
-
coordinate:
|
|
4287
|
-
duration:
|
|
4288
|
-
region:
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
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()
|
|
4293
4418
|
]).optional(),
|
|
4294
|
-
scroll_amount:
|
|
4295
|
-
scroll_direction:
|
|
4296
|
-
start_coordinate:
|
|
4297
|
-
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()
|
|
4298
4423
|
})
|
|
4299
4424
|
)
|
|
4300
4425
|
);
|
|
4301
|
-
var computer_20251124 = (0,
|
|
4426
|
+
var computer_20251124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4302
4427
|
id: "anthropic.computer_20251124",
|
|
4303
4428
|
inputSchema: computer_20251124InputSchema
|
|
4304
4429
|
});
|
|
4305
4430
|
|
|
4306
4431
|
// 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:
|
|
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()
|
|
4316
4441
|
}),
|
|
4317
|
-
|
|
4318
|
-
command:
|
|
4319
|
-
path:
|
|
4320
|
-
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()
|
|
4321
4446
|
}),
|
|
4322
|
-
|
|
4323
|
-
command:
|
|
4324
|
-
path:
|
|
4325
|
-
old_str:
|
|
4326
|
-
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()
|
|
4327
4452
|
}),
|
|
4328
|
-
|
|
4329
|
-
command:
|
|
4330
|
-
path:
|
|
4331
|
-
insert_line:
|
|
4332
|
-
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()
|
|
4333
4458
|
}),
|
|
4334
|
-
|
|
4335
|
-
command:
|
|
4336
|
-
path:
|
|
4459
|
+
import_v416.z.object({
|
|
4460
|
+
command: import_v416.z.literal("delete"),
|
|
4461
|
+
path: import_v416.z.string()
|
|
4337
4462
|
}),
|
|
4338
|
-
|
|
4339
|
-
command:
|
|
4340
|
-
old_path:
|
|
4341
|
-
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()
|
|
4342
4467
|
})
|
|
4343
4468
|
])
|
|
4344
4469
|
)
|
|
4345
4470
|
);
|
|
4346
|
-
var memory_20250818 = (0,
|
|
4471
|
+
var memory_20250818 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4347
4472
|
id: "anthropic.memory_20250818",
|
|
4348
4473
|
inputSchema: memory_20250818InputSchema
|
|
4349
4474
|
});
|
|
4350
4475
|
|
|
4351
4476
|
// 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
4477
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4375
4478
|
var import_v417 = require("zod/v4");
|
|
4376
|
-
var
|
|
4479
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4377
4480
|
() => (0, import_provider_utils20.zodSchema)(
|
|
4378
4481
|
import_v417.z.object({
|
|
4379
4482
|
command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4387,18 +4490,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4387
4490
|
})
|
|
4388
4491
|
)
|
|
4389
4492
|
);
|
|
4390
|
-
var
|
|
4391
|
-
id: "anthropic.
|
|
4392
|
-
inputSchema:
|
|
4493
|
+
var textEditor_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4494
|
+
id: "anthropic.text_editor_20241022",
|
|
4495
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4393
4496
|
});
|
|
4394
4497
|
|
|
4395
|
-
// src/tool/text-
|
|
4498
|
+
// src/tool/text-editor_20250124.ts
|
|
4396
4499
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4397
4500
|
var import_v418 = require("zod/v4");
|
|
4398
|
-
var
|
|
4501
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4399
4502
|
() => (0, import_provider_utils21.zodSchema)(
|
|
4400
4503
|
import_v418.z.object({
|
|
4401
|
-
command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4504
|
+
command: import_v418.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4402
4505
|
path: import_v418.z.string(),
|
|
4403
4506
|
file_text: import_v418.z.string().optional(),
|
|
4404
4507
|
insert_line: import_v418.z.number().int().optional(),
|
|
@@ -4409,47 +4512,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
4409
4512
|
})
|
|
4410
4513
|
)
|
|
4411
4514
|
);
|
|
4412
|
-
var
|
|
4413
|
-
id: "anthropic.
|
|
4414
|
-
inputSchema:
|
|
4515
|
+
var textEditor_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4516
|
+
id: "anthropic.text_editor_20250124",
|
|
4517
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4415
4518
|
});
|
|
4416
4519
|
|
|
4417
|
-
// src/tool/
|
|
4520
|
+
// src/tool/text-editor_20250429.ts
|
|
4418
4521
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4419
4522
|
var import_v419 = require("zod/v4");
|
|
4420
|
-
var
|
|
4523
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4421
4524
|
() => (0, import_provider_utils22.zodSchema)(
|
|
4422
|
-
import_v419.z.
|
|
4423
|
-
import_v419.z.
|
|
4424
|
-
|
|
4425
|
-
|
|
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()
|
|
4426
4551
|
})
|
|
4427
4552
|
)
|
|
4428
4553
|
)
|
|
4429
4554
|
);
|
|
4430
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4431
|
-
() => (0,
|
|
4432
|
-
|
|
4555
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4556
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4557
|
+
import_v420.z.object({
|
|
4433
4558
|
/**
|
|
4434
4559
|
* A natural language query to search for tools.
|
|
4435
4560
|
* Claude will use BM25 text search to find relevant tools.
|
|
4436
4561
|
*/
|
|
4437
|
-
query:
|
|
4562
|
+
query: import_v420.z.string(),
|
|
4438
4563
|
/**
|
|
4439
4564
|
* Maximum number of tools to return. Optional.
|
|
4440
4565
|
*/
|
|
4441
|
-
limit:
|
|
4566
|
+
limit: import_v420.z.number().optional()
|
|
4442
4567
|
})
|
|
4443
4568
|
)
|
|
4444
4569
|
);
|
|
4445
|
-
var
|
|
4570
|
+
var factory8 = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
4446
4571
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4447
4572
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4448
4573
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4449
4574
|
supportsDeferredResults: true
|
|
4450
4575
|
});
|
|
4451
4576
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4452
|
-
return
|
|
4577
|
+
return factory8(args);
|
|
4453
4578
|
};
|
|
4454
4579
|
|
|
4455
4580
|
// src/anthropic-tools.ts
|
|
@@ -4488,6 +4613,19 @@ var anthropicTools = {
|
|
|
4488
4613
|
* This is the latest version with enhanced Bash support and file operations.
|
|
4489
4614
|
*/
|
|
4490
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,
|
|
4491
4629
|
/**
|
|
4492
4630
|
* Claude can interact with computer environments through the computer use tool, which
|
|
4493
4631
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -4625,8 +4763,8 @@ var anthropicTools = {
|
|
|
4625
4763
|
// src/anthropic-provider.ts
|
|
4626
4764
|
function createAnthropic(options = {}) {
|
|
4627
4765
|
var _a, _b;
|
|
4628
|
-
const baseURL = (_a = (0,
|
|
4629
|
-
(0,
|
|
4766
|
+
const baseURL = (_a = (0, import_provider_utils24.withoutTrailingSlash)(
|
|
4767
|
+
(0, import_provider_utils24.loadOptionalSetting)({
|
|
4630
4768
|
settingValue: options.baseURL,
|
|
4631
4769
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4632
4770
|
})
|
|
@@ -4640,13 +4778,13 @@ function createAnthropic(options = {}) {
|
|
|
4640
4778
|
}
|
|
4641
4779
|
const getHeaders = () => {
|
|
4642
4780
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
4643
|
-
"x-api-key": (0,
|
|
4781
|
+
"x-api-key": (0, import_provider_utils24.loadApiKey)({
|
|
4644
4782
|
apiKey: options.apiKey,
|
|
4645
4783
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4646
4784
|
description: "Anthropic"
|
|
4647
4785
|
})
|
|
4648
4786
|
};
|
|
4649
|
-
return (0,
|
|
4787
|
+
return (0, import_provider_utils24.withUserAgentSuffix)(
|
|
4650
4788
|
{
|
|
4651
4789
|
"anthropic-version": "2023-06-01",
|
|
4652
4790
|
...authHeaders,
|
|
@@ -4662,7 +4800,7 @@ function createAnthropic(options = {}) {
|
|
|
4662
4800
|
baseURL,
|
|
4663
4801
|
headers: getHeaders,
|
|
4664
4802
|
fetch: options.fetch,
|
|
4665
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
4803
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId,
|
|
4666
4804
|
supportedUrls: () => ({
|
|
4667
4805
|
"image/*": [/^https?:\/\/.*$/],
|
|
4668
4806
|
"application/pdf": [/^https?:\/\/.*$/]
|