@ai-sdk/anthropic 3.0.118 → 3.0.120
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 +19 -0
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +834 -458
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +826 -446
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +74 -2
- package/dist/internal/index.d.ts +74 -2
- package/dist/internal/index.js +827 -451
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +825 -445
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +125 -14
- package/package.json +2 -2
- package/src/anthropic-messages-api.ts +23 -0
- package/src/anthropic-messages-language-model.ts +264 -6
- package/src/anthropic-messages-options.ts +12 -2
- package/src/anthropic-prepare-tools.ts +76 -0
- package/src/anthropic-tools.ts +25 -0
- package/src/convert-to-anthropic-messages-prompt.ts +77 -1
- package/src/tool/computer-toolset_20260801.ts +165 -0
package/dist/internal/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
|
|
31
31
|
// src/anthropic-messages-language-model.ts
|
|
32
32
|
var import_provider3 = require("@ai-sdk/provider");
|
|
33
|
-
var
|
|
33
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
34
34
|
|
|
35
35
|
// src/anthropic-error.ts
|
|
36
36
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -136,7 +136,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
136
136
|
name: import_v42.z.string(),
|
|
137
137
|
input: import_v42.z.unknown(),
|
|
138
138
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
139
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
139
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
140
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
141
|
+
toolset_name: import_v42.z.string().nullish()
|
|
140
142
|
}),
|
|
141
143
|
import_v42.z.object({
|
|
142
144
|
type: import_v42.z.literal("server_tool_use"),
|
|
@@ -437,7 +439,8 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
437
439
|
id: import_v42.z.string(),
|
|
438
440
|
name: import_v42.z.string(),
|
|
439
441
|
input: import_v42.z.unknown(),
|
|
440
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
442
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
443
|
+
toolset_name: import_v42.z.string().nullish()
|
|
441
444
|
})
|
|
442
445
|
])
|
|
443
446
|
).nullish(),
|
|
@@ -468,7 +471,9 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
468
471
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
469
472
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).optional(),
|
|
470
473
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
471
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
474
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
475
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
476
|
+
toolset_name: import_v42.z.string().nullish()
|
|
472
477
|
}),
|
|
473
478
|
import_v42.z.object({
|
|
474
479
|
type: import_v42.z.literal("redacted_thinking"),
|
|
@@ -879,7 +884,7 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
|
879
884
|
* Overrides the effort level for the turn following this
|
|
880
885
|
* mid-conversation system message.
|
|
881
886
|
*
|
|
882
|
-
* Requires the `mid-conversation-
|
|
887
|
+
* Requires the `mid-conversation-output-config-2026-07-01` beta,
|
|
883
888
|
* which is added automatically.
|
|
884
889
|
*/
|
|
885
890
|
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
@@ -933,6 +938,11 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
933
938
|
*
|
|
934
939
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
935
940
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
941
|
+
*
|
|
942
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
943
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
944
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
945
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
936
946
|
*/
|
|
937
947
|
thinking: import_v43.z.union([
|
|
938
948
|
import_v43.z.discriminatedUnion("type", [
|
|
@@ -1039,7 +1049,11 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
1039
1049
|
*/
|
|
1040
1050
|
toolStreaming: import_v43.z.boolean().optional(),
|
|
1041
1051
|
/**
|
|
1042
|
-
*
|
|
1052
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1053
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1054
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1055
|
+
*
|
|
1056
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1043
1057
|
*/
|
|
1044
1058
|
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1045
1059
|
/**
|
|
@@ -1244,91 +1258,102 @@ var advisor_20260301 = (args) => {
|
|
|
1244
1258
|
return factory(args);
|
|
1245
1259
|
};
|
|
1246
1260
|
|
|
1247
|
-
// src/tool/
|
|
1261
|
+
// src/tool/computer-toolset_20260801.ts
|
|
1248
1262
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1249
1263
|
var import_v45 = require("zod/v4");
|
|
1250
|
-
var
|
|
1264
|
+
var computerToolset_20260801Members = [
|
|
1265
|
+
"screenshot",
|
|
1266
|
+
"zoom",
|
|
1267
|
+
"left_click",
|
|
1268
|
+
"right_click",
|
|
1269
|
+
"middle_click",
|
|
1270
|
+
"double_click",
|
|
1271
|
+
"triple_click",
|
|
1272
|
+
"left_click_drag",
|
|
1273
|
+
"mouse_move",
|
|
1274
|
+
"left_mouse_down",
|
|
1275
|
+
"left_mouse_up",
|
|
1276
|
+
"cursor_position",
|
|
1277
|
+
"scroll",
|
|
1278
|
+
"type",
|
|
1279
|
+
"key",
|
|
1280
|
+
"hold_key",
|
|
1281
|
+
"wait"
|
|
1282
|
+
];
|
|
1283
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1251
1284
|
() => (0, import_provider_utils4.zodSchema)(
|
|
1252
1285
|
import_v45.z.object({
|
|
1253
|
-
|
|
1286
|
+
action: import_v45.z.enum(computerToolset_20260801Members),
|
|
1287
|
+
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
1288
|
+
duration: import_v45.z.number().optional(),
|
|
1289
|
+
region: import_v45.z.tuple([
|
|
1290
|
+
import_v45.z.number().int(),
|
|
1291
|
+
import_v45.z.number().int(),
|
|
1292
|
+
import_v45.z.number().int(),
|
|
1293
|
+
import_v45.z.number().int()
|
|
1294
|
+
]).optional(),
|
|
1295
|
+
repeat: import_v45.z.number().int().optional(),
|
|
1296
|
+
scroll_amount: import_v45.z.number().optional(),
|
|
1297
|
+
scroll_direction: import_v45.z.enum(["up", "down", "left", "right"]).optional(),
|
|
1298
|
+
start_coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
1299
|
+
text: import_v45.z.string().optional()
|
|
1254
1300
|
})
|
|
1255
1301
|
)
|
|
1256
1302
|
);
|
|
1257
|
-
var
|
|
1303
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1258
1304
|
() => (0, import_provider_utils4.zodSchema)(
|
|
1259
1305
|
import_v45.z.object({
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
view_range: import_v45.z.array(import_v45.z.number().int()).optional()
|
|
1306
|
+
configs: import_v45.z.partialRecord(
|
|
1307
|
+
import_v45.z.enum(computerToolset_20260801Members),
|
|
1308
|
+
import_v45.z.object({
|
|
1309
|
+
enabled: import_v45.z.boolean().optional(),
|
|
1310
|
+
deferLoading: import_v45.z.boolean().optional()
|
|
1311
|
+
})
|
|
1312
|
+
).optional()
|
|
1268
1313
|
})
|
|
1269
1314
|
)
|
|
1270
1315
|
);
|
|
1271
|
-
var
|
|
1272
|
-
id: "anthropic.
|
|
1273
|
-
inputSchema:
|
|
1316
|
+
var computerToolset_20260801 = (0, import_provider_utils4.createProviderToolFactory)({
|
|
1317
|
+
id: "anthropic.computer_toolset_20260801",
|
|
1318
|
+
inputSchema: computerToolset_20260801InputSchema
|
|
1274
1319
|
});
|
|
1275
|
-
var textEditor_20250728 = (args = {}) => {
|
|
1276
|
-
return factory2(args);
|
|
1277
|
-
};
|
|
1278
1320
|
|
|
1279
|
-
// src/tool/
|
|
1321
|
+
// src/tool/text-editor_20250728.ts
|
|
1280
1322
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1281
1323
|
var import_v46 = require("zod/v4");
|
|
1282
|
-
var
|
|
1324
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1283
1325
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1284
1326
|
import_v46.z.object({
|
|
1285
|
-
|
|
1286
|
-
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1287
|
-
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1288
|
-
userLocation: import_v46.z.object({
|
|
1289
|
-
type: import_v46.z.literal("approximate"),
|
|
1290
|
-
city: import_v46.z.string().optional(),
|
|
1291
|
-
region: import_v46.z.string().optional(),
|
|
1292
|
-
country: import_v46.z.string().optional(),
|
|
1293
|
-
timezone: import_v46.z.string().optional()
|
|
1294
|
-
}).optional()
|
|
1327
|
+
maxCharacters: import_v46.z.number().optional()
|
|
1295
1328
|
})
|
|
1296
1329
|
)
|
|
1297
1330
|
);
|
|
1298
|
-
var
|
|
1299
|
-
() => (0, import_provider_utils5.zodSchema)(
|
|
1300
|
-
import_v46.z.array(
|
|
1301
|
-
import_v46.z.object({
|
|
1302
|
-
url: import_v46.z.string(),
|
|
1303
|
-
title: import_v46.z.string().nullable(),
|
|
1304
|
-
pageAge: import_v46.z.string().nullable(),
|
|
1305
|
-
encryptedContent: import_v46.z.string(),
|
|
1306
|
-
type: import_v46.z.literal("web_search_result")
|
|
1307
|
-
})
|
|
1308
|
-
)
|
|
1309
|
-
)
|
|
1310
|
-
);
|
|
1311
|
-
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1331
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1312
1332
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1313
1333
|
import_v46.z.object({
|
|
1314
|
-
|
|
1334
|
+
command: import_v46.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1335
|
+
path: import_v46.z.string(),
|
|
1336
|
+
file_text: import_v46.z.string().optional(),
|
|
1337
|
+
insert_line: import_v46.z.number().int().optional(),
|
|
1338
|
+
new_str: import_v46.z.string().optional(),
|
|
1339
|
+
insert_text: import_v46.z.string().optional(),
|
|
1340
|
+
old_str: import_v46.z.string().optional(),
|
|
1341
|
+
view_range: import_v46.z.array(import_v46.z.number().int()).optional()
|
|
1315
1342
|
})
|
|
1316
1343
|
)
|
|
1317
1344
|
);
|
|
1318
|
-
var
|
|
1319
|
-
id: "anthropic.
|
|
1320
|
-
inputSchema:
|
|
1321
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1322
|
-
supportsDeferredResults: true
|
|
1345
|
+
var factory2 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1346
|
+
id: "anthropic.text_editor_20250728",
|
|
1347
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1323
1348
|
});
|
|
1324
|
-
var
|
|
1325
|
-
return
|
|
1349
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1350
|
+
return factory2(args);
|
|
1326
1351
|
};
|
|
1327
1352
|
|
|
1328
|
-
// src/tool/web-
|
|
1353
|
+
// src/tool/web-search_20260209.ts
|
|
1329
1354
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1330
1355
|
var import_v47 = require("zod/v4");
|
|
1331
|
-
var
|
|
1356
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1332
1357
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1333
1358
|
import_v47.z.object({
|
|
1334
1359
|
maxUses: import_v47.z.number().optional(),
|
|
@@ -1344,7 +1369,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1344
1369
|
})
|
|
1345
1370
|
)
|
|
1346
1371
|
);
|
|
1347
|
-
var
|
|
1372
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1348
1373
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1349
1374
|
import_v47.z.array(
|
|
1350
1375
|
import_v47.z.object({
|
|
@@ -1357,84 +1382,76 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1357
1382
|
)
|
|
1358
1383
|
)
|
|
1359
1384
|
);
|
|
1360
|
-
var
|
|
1385
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1361
1386
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1362
1387
|
import_v47.z.object({
|
|
1363
1388
|
query: import_v47.z.string()
|
|
1364
1389
|
})
|
|
1365
1390
|
)
|
|
1366
1391
|
);
|
|
1367
|
-
var
|
|
1368
|
-
id: "anthropic.
|
|
1369
|
-
inputSchema:
|
|
1370
|
-
outputSchema:
|
|
1392
|
+
var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1393
|
+
id: "anthropic.web_search_20260209",
|
|
1394
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1395
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1371
1396
|
supportsDeferredResults: true
|
|
1372
1397
|
});
|
|
1373
|
-
var
|
|
1374
|
-
return
|
|
1398
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1399
|
+
return factory3(args);
|
|
1375
1400
|
};
|
|
1376
1401
|
|
|
1377
|
-
// src/tool/web-
|
|
1402
|
+
// src/tool/web-search_20250305.ts
|
|
1378
1403
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1379
1404
|
var import_v48 = require("zod/v4");
|
|
1380
|
-
var
|
|
1405
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1381
1406
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1382
1407
|
import_v48.z.object({
|
|
1383
1408
|
maxUses: import_v48.z.number().optional(),
|
|
1384
1409
|
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1385
1410
|
blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1386
|
-
|
|
1387
|
-
|
|
1411
|
+
userLocation: import_v48.z.object({
|
|
1412
|
+
type: import_v48.z.literal("approximate"),
|
|
1413
|
+
city: import_v48.z.string().optional(),
|
|
1414
|
+
region: import_v48.z.string().optional(),
|
|
1415
|
+
country: import_v48.z.string().optional(),
|
|
1416
|
+
timezone: import_v48.z.string().optional()
|
|
1417
|
+
}).optional()
|
|
1388
1418
|
})
|
|
1389
1419
|
)
|
|
1390
1420
|
);
|
|
1391
|
-
var
|
|
1421
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1392
1422
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1393
|
-
import_v48.z.
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
content: import_v48.z.object({
|
|
1397
|
-
type: import_v48.z.literal("document"),
|
|
1423
|
+
import_v48.z.array(
|
|
1424
|
+
import_v48.z.object({
|
|
1425
|
+
url: import_v48.z.string(),
|
|
1398
1426
|
title: import_v48.z.string().nullable(),
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
data: import_v48.z.string()
|
|
1405
|
-
}),
|
|
1406
|
-
import_v48.z.object({
|
|
1407
|
-
type: import_v48.z.literal("text"),
|
|
1408
|
-
mediaType: import_v48.z.literal("text/plain"),
|
|
1409
|
-
data: import_v48.z.string()
|
|
1410
|
-
})
|
|
1411
|
-
])
|
|
1412
|
-
}),
|
|
1413
|
-
retrievedAt: import_v48.z.string().nullable()
|
|
1414
|
-
})
|
|
1427
|
+
pageAge: import_v48.z.string().nullable(),
|
|
1428
|
+
encryptedContent: import_v48.z.string(),
|
|
1429
|
+
type: import_v48.z.literal("web_search_result")
|
|
1430
|
+
})
|
|
1431
|
+
)
|
|
1415
1432
|
)
|
|
1416
1433
|
);
|
|
1417
|
-
var
|
|
1434
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1418
1435
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1419
1436
|
import_v48.z.object({
|
|
1420
|
-
|
|
1437
|
+
query: import_v48.z.string()
|
|
1421
1438
|
})
|
|
1422
1439
|
)
|
|
1423
1440
|
);
|
|
1424
|
-
var
|
|
1425
|
-
id: "anthropic.
|
|
1426
|
-
inputSchema:
|
|
1427
|
-
outputSchema:
|
|
1441
|
+
var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1442
|
+
id: "anthropic.web_search_20250305",
|
|
1443
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1444
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1428
1445
|
supportsDeferredResults: true
|
|
1429
1446
|
});
|
|
1430
|
-
var
|
|
1431
|
-
return
|
|
1447
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1448
|
+
return factory4(args);
|
|
1432
1449
|
};
|
|
1433
1450
|
|
|
1434
|
-
// src/tool/web-fetch-
|
|
1451
|
+
// src/tool/web-fetch-20260209.ts
|
|
1435
1452
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1436
1453
|
var import_v49 = require("zod/v4");
|
|
1437
|
-
var
|
|
1454
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1438
1455
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1439
1456
|
import_v49.z.object({
|
|
1440
1457
|
maxUses: import_v49.z.number().optional(),
|
|
@@ -1445,7 +1462,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1445
1462
|
})
|
|
1446
1463
|
)
|
|
1447
1464
|
);
|
|
1448
|
-
var
|
|
1465
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1449
1466
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1450
1467
|
import_v49.z.object({
|
|
1451
1468
|
type: import_v49.z.literal("web_fetch_result"),
|
|
@@ -1471,14 +1488,71 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1471
1488
|
})
|
|
1472
1489
|
)
|
|
1473
1490
|
);
|
|
1474
|
-
var
|
|
1491
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1475
1492
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1476
1493
|
import_v49.z.object({
|
|
1477
1494
|
url: import_v49.z.string()
|
|
1478
1495
|
})
|
|
1479
1496
|
)
|
|
1480
1497
|
);
|
|
1481
|
-
var
|
|
1498
|
+
var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1499
|
+
id: "anthropic.web_fetch_20260209",
|
|
1500
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1501
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1502
|
+
supportsDeferredResults: true
|
|
1503
|
+
});
|
|
1504
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1505
|
+
return factory5(args);
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
// src/tool/web-fetch-20250910.ts
|
|
1509
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1510
|
+
var import_v410 = require("zod/v4");
|
|
1511
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1512
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1513
|
+
import_v410.z.object({
|
|
1514
|
+
maxUses: import_v410.z.number().optional(),
|
|
1515
|
+
allowedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
1516
|
+
blockedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
1517
|
+
citations: import_v410.z.object({ enabled: import_v410.z.boolean() }).optional(),
|
|
1518
|
+
maxContentTokens: import_v410.z.number().optional()
|
|
1519
|
+
})
|
|
1520
|
+
)
|
|
1521
|
+
);
|
|
1522
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1523
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1524
|
+
import_v410.z.object({
|
|
1525
|
+
type: import_v410.z.literal("web_fetch_result"),
|
|
1526
|
+
url: import_v410.z.string(),
|
|
1527
|
+
content: import_v410.z.object({
|
|
1528
|
+
type: import_v410.z.literal("document"),
|
|
1529
|
+
title: import_v410.z.string().nullable(),
|
|
1530
|
+
citations: import_v410.z.object({ enabled: import_v410.z.boolean() }).optional(),
|
|
1531
|
+
source: import_v410.z.union([
|
|
1532
|
+
import_v410.z.object({
|
|
1533
|
+
type: import_v410.z.literal("base64"),
|
|
1534
|
+
mediaType: import_v410.z.literal("application/pdf"),
|
|
1535
|
+
data: import_v410.z.string()
|
|
1536
|
+
}),
|
|
1537
|
+
import_v410.z.object({
|
|
1538
|
+
type: import_v410.z.literal("text"),
|
|
1539
|
+
mediaType: import_v410.z.literal("text/plain"),
|
|
1540
|
+
data: import_v410.z.string()
|
|
1541
|
+
})
|
|
1542
|
+
])
|
|
1543
|
+
}),
|
|
1544
|
+
retrievedAt: import_v410.z.string().nullable()
|
|
1545
|
+
})
|
|
1546
|
+
)
|
|
1547
|
+
);
|
|
1548
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1549
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1550
|
+
import_v410.z.object({
|
|
1551
|
+
url: import_v410.z.string()
|
|
1552
|
+
})
|
|
1553
|
+
)
|
|
1554
|
+
);
|
|
1555
|
+
var factory6 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1482
1556
|
id: "anthropic.web_fetch_20250910",
|
|
1483
1557
|
inputSchema: webFetch_20250910InputSchema,
|
|
1484
1558
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1489,7 +1563,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1489
1563
|
};
|
|
1490
1564
|
|
|
1491
1565
|
// src/anthropic-prepare-tools.ts
|
|
1492
|
-
var
|
|
1566
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1493
1567
|
async function prepareTools({
|
|
1494
1568
|
tools,
|
|
1495
1569
|
toolChoice,
|
|
@@ -1497,7 +1571,8 @@ async function prepareTools({
|
|
|
1497
1571
|
cacheControlValidator,
|
|
1498
1572
|
supportsStructuredOutput,
|
|
1499
1573
|
supportsStrictTools,
|
|
1500
|
-
defaultEagerInputStreaming = false
|
|
1574
|
+
defaultEagerInputStreaming = false,
|
|
1575
|
+
rejectsForcedToolUse = false
|
|
1501
1576
|
}) {
|
|
1502
1577
|
var _a, _b;
|
|
1503
1578
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1600,6 +1675,31 @@ async function prepareTools({
|
|
|
1600
1675
|
});
|
|
1601
1676
|
break;
|
|
1602
1677
|
}
|
|
1678
|
+
case "anthropic.computer_toolset_20260801": {
|
|
1679
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1680
|
+
value: tool.args,
|
|
1681
|
+
schema: computerToolset_20260801ArgsSchema
|
|
1682
|
+
});
|
|
1683
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
1684
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
1685
|
+
member,
|
|
1686
|
+
{
|
|
1687
|
+
...(config == null ? void 0 : config.enabled) != null && {
|
|
1688
|
+
enabled: config.enabled
|
|
1689
|
+
},
|
|
1690
|
+
...(config == null ? void 0 : config.deferLoading) != null && {
|
|
1691
|
+
defer_loading: config.deferLoading
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
])
|
|
1695
|
+
) : void 0;
|
|
1696
|
+
anthropicTools2.push({
|
|
1697
|
+
type: "computer_toolset_20260801",
|
|
1698
|
+
...configs != null && { configs },
|
|
1699
|
+
cache_control: void 0
|
|
1700
|
+
});
|
|
1701
|
+
break;
|
|
1702
|
+
}
|
|
1603
1703
|
case "anthropic.computer_20241022": {
|
|
1604
1704
|
betas.add("computer-use-2024-10-22");
|
|
1605
1705
|
anthropicTools2.push({
|
|
@@ -1640,7 +1740,7 @@ async function prepareTools({
|
|
|
1640
1740
|
break;
|
|
1641
1741
|
}
|
|
1642
1742
|
case "anthropic.text_editor_20250728": {
|
|
1643
|
-
const args = await (0,
|
|
1743
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1644
1744
|
value: tool.args,
|
|
1645
1745
|
schema: textEditor_20250728ArgsSchema
|
|
1646
1746
|
});
|
|
@@ -1680,7 +1780,7 @@ async function prepareTools({
|
|
|
1680
1780
|
}
|
|
1681
1781
|
case "anthropic.web_fetch_20250910": {
|
|
1682
1782
|
betas.add("web-fetch-2025-09-10");
|
|
1683
|
-
const args = await (0,
|
|
1783
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1684
1784
|
value: tool.args,
|
|
1685
1785
|
schema: webFetch_20250910ArgsSchema
|
|
1686
1786
|
});
|
|
@@ -1698,7 +1798,7 @@ async function prepareTools({
|
|
|
1698
1798
|
}
|
|
1699
1799
|
case "anthropic.web_fetch_20260209": {
|
|
1700
1800
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1701
|
-
const args = await (0,
|
|
1801
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1702
1802
|
value: tool.args,
|
|
1703
1803
|
schema: webFetch_20260209ArgsSchema
|
|
1704
1804
|
});
|
|
@@ -1715,7 +1815,7 @@ async function prepareTools({
|
|
|
1715
1815
|
break;
|
|
1716
1816
|
}
|
|
1717
1817
|
case "anthropic.web_search_20250305": {
|
|
1718
|
-
const args = await (0,
|
|
1818
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1719
1819
|
value: tool.args,
|
|
1720
1820
|
schema: webSearch_20250305ArgsSchema
|
|
1721
1821
|
});
|
|
@@ -1732,7 +1832,7 @@ async function prepareTools({
|
|
|
1732
1832
|
}
|
|
1733
1833
|
case "anthropic.web_search_20260209": {
|
|
1734
1834
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1735
|
-
const args = await (0,
|
|
1835
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1736
1836
|
value: tool.args,
|
|
1737
1837
|
schema: webSearch_20260209ArgsSchema
|
|
1738
1838
|
});
|
|
@@ -1763,7 +1863,7 @@ async function prepareTools({
|
|
|
1763
1863
|
}
|
|
1764
1864
|
case "anthropic.advisor_20260301": {
|
|
1765
1865
|
betas.add("advisor-tool-2026-03-01");
|
|
1766
|
-
const args = await (0,
|
|
1866
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1767
1867
|
value: tool.args,
|
|
1768
1868
|
schema: advisor_20260301ArgsSchema
|
|
1769
1869
|
});
|
|
@@ -1816,6 +1916,22 @@ async function prepareTools({
|
|
|
1816
1916
|
betas
|
|
1817
1917
|
};
|
|
1818
1918
|
case "required":
|
|
1919
|
+
if (rejectsForcedToolUse) {
|
|
1920
|
+
toolWarnings.push({
|
|
1921
|
+
type: "unsupported",
|
|
1922
|
+
feature: "toolChoice",
|
|
1923
|
+
details: `toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
|
|
1924
|
+
});
|
|
1925
|
+
return {
|
|
1926
|
+
tools: anthropicTools2,
|
|
1927
|
+
toolChoice: {
|
|
1928
|
+
type: "auto",
|
|
1929
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1930
|
+
},
|
|
1931
|
+
toolWarnings,
|
|
1932
|
+
betas
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1819
1935
|
return {
|
|
1820
1936
|
tools: anthropicTools2,
|
|
1821
1937
|
toolChoice: {
|
|
@@ -1828,6 +1944,24 @@ async function prepareTools({
|
|
|
1828
1944
|
case "none":
|
|
1829
1945
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1830
1946
|
case "tool":
|
|
1947
|
+
if (rejectsForcedToolUse) {
|
|
1948
|
+
toolWarnings.push({
|
|
1949
|
+
type: "unsupported",
|
|
1950
|
+
feature: "toolChoice",
|
|
1951
|
+
details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
|
|
1952
|
+
});
|
|
1953
|
+
return {
|
|
1954
|
+
tools: anthropicTools2.filter(
|
|
1955
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
1956
|
+
),
|
|
1957
|
+
toolChoice: {
|
|
1958
|
+
type: "auto",
|
|
1959
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1960
|
+
},
|
|
1961
|
+
toolWarnings,
|
|
1962
|
+
betas
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1831
1965
|
return {
|
|
1832
1966
|
tools: anthropicTools2,
|
|
1833
1967
|
toolChoice: {
|
|
@@ -1901,35 +2035,35 @@ function convertAnthropicMessagesUsage({
|
|
|
1901
2035
|
|
|
1902
2036
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1903
2037
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1904
|
-
var
|
|
2038
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1905
2039
|
|
|
1906
2040
|
// src/tool/code-execution_20250522.ts
|
|
1907
|
-
var
|
|
1908
|
-
var
|
|
1909
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1910
|
-
() => (0,
|
|
1911
|
-
|
|
1912
|
-
type:
|
|
1913
|
-
stdout:
|
|
1914
|
-
stderr:
|
|
1915
|
-
return_code:
|
|
1916
|
-
content:
|
|
1917
|
-
|
|
1918
|
-
type:
|
|
1919
|
-
file_id:
|
|
2041
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2042
|
+
var import_v411 = require("zod/v4");
|
|
2043
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
2044
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
2045
|
+
import_v411.z.object({
|
|
2046
|
+
type: import_v411.z.literal("code_execution_result"),
|
|
2047
|
+
stdout: import_v411.z.string(),
|
|
2048
|
+
stderr: import_v411.z.string(),
|
|
2049
|
+
return_code: import_v411.z.number(),
|
|
2050
|
+
content: import_v411.z.array(
|
|
2051
|
+
import_v411.z.object({
|
|
2052
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
2053
|
+
file_id: import_v411.z.string()
|
|
1920
2054
|
})
|
|
1921
2055
|
).optional().default([])
|
|
1922
2056
|
})
|
|
1923
2057
|
)
|
|
1924
2058
|
);
|
|
1925
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1926
|
-
() => (0,
|
|
1927
|
-
|
|
1928
|
-
code:
|
|
2059
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
2060
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
2061
|
+
import_v411.z.object({
|
|
2062
|
+
code: import_v411.z.string()
|
|
1929
2063
|
})
|
|
1930
2064
|
)
|
|
1931
2065
|
);
|
|
1932
|
-
var factory7 = (0,
|
|
2066
|
+
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1933
2067
|
id: "anthropic.code_execution_20250522",
|
|
1934
2068
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1935
2069
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1939,118 +2073,9 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1939
2073
|
};
|
|
1940
2074
|
|
|
1941
2075
|
// src/tool/code-execution_20250825.ts
|
|
1942
|
-
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1943
|
-
var import_v411 = require("zod/v4");
|
|
1944
|
-
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1945
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
1946
|
-
import_v411.z.discriminatedUnion("type", [
|
|
1947
|
-
import_v411.z.object({
|
|
1948
|
-
type: import_v411.z.literal("code_execution_result"),
|
|
1949
|
-
stdout: import_v411.z.string(),
|
|
1950
|
-
stderr: import_v411.z.string(),
|
|
1951
|
-
return_code: import_v411.z.number(),
|
|
1952
|
-
content: import_v411.z.array(
|
|
1953
|
-
import_v411.z.object({
|
|
1954
|
-
type: import_v411.z.literal("code_execution_output"),
|
|
1955
|
-
file_id: import_v411.z.string()
|
|
1956
|
-
})
|
|
1957
|
-
).optional().default([])
|
|
1958
|
-
}),
|
|
1959
|
-
import_v411.z.object({
|
|
1960
|
-
type: import_v411.z.literal("bash_code_execution_result"),
|
|
1961
|
-
content: import_v411.z.array(
|
|
1962
|
-
import_v411.z.object({
|
|
1963
|
-
type: import_v411.z.literal("bash_code_execution_output"),
|
|
1964
|
-
file_id: import_v411.z.string()
|
|
1965
|
-
})
|
|
1966
|
-
),
|
|
1967
|
-
stdout: import_v411.z.string(),
|
|
1968
|
-
stderr: import_v411.z.string(),
|
|
1969
|
-
return_code: import_v411.z.number()
|
|
1970
|
-
}),
|
|
1971
|
-
import_v411.z.object({
|
|
1972
|
-
type: import_v411.z.literal("bash_code_execution_tool_result_error"),
|
|
1973
|
-
error_code: import_v411.z.string()
|
|
1974
|
-
}),
|
|
1975
|
-
import_v411.z.object({
|
|
1976
|
-
type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1977
|
-
error_code: import_v411.z.string()
|
|
1978
|
-
}),
|
|
1979
|
-
import_v411.z.object({
|
|
1980
|
-
type: import_v411.z.literal("text_editor_code_execution_view_result"),
|
|
1981
|
-
content: import_v411.z.string(),
|
|
1982
|
-
file_type: import_v411.z.string(),
|
|
1983
|
-
num_lines: import_v411.z.number().nullable(),
|
|
1984
|
-
start_line: import_v411.z.number().nullable(),
|
|
1985
|
-
total_lines: import_v411.z.number().nullable()
|
|
1986
|
-
}),
|
|
1987
|
-
import_v411.z.object({
|
|
1988
|
-
type: import_v411.z.literal("text_editor_code_execution_create_result"),
|
|
1989
|
-
is_file_update: import_v411.z.boolean()
|
|
1990
|
-
}),
|
|
1991
|
-
import_v411.z.object({
|
|
1992
|
-
type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1993
|
-
lines: import_v411.z.array(import_v411.z.string()).nullable(),
|
|
1994
|
-
new_lines: import_v411.z.number().nullable(),
|
|
1995
|
-
new_start: import_v411.z.number().nullable(),
|
|
1996
|
-
old_lines: import_v411.z.number().nullable(),
|
|
1997
|
-
old_start: import_v411.z.number().nullable()
|
|
1998
|
-
})
|
|
1999
|
-
])
|
|
2000
|
-
)
|
|
2001
|
-
);
|
|
2002
|
-
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
2003
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
2004
|
-
import_v411.z.discriminatedUnion("type", [
|
|
2005
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2006
|
-
import_v411.z.object({
|
|
2007
|
-
type: import_v411.z.literal("programmatic-tool-call"),
|
|
2008
|
-
code: import_v411.z.string()
|
|
2009
|
-
}),
|
|
2010
|
-
import_v411.z.object({
|
|
2011
|
-
type: import_v411.z.literal("bash_code_execution"),
|
|
2012
|
-
command: import_v411.z.string()
|
|
2013
|
-
}),
|
|
2014
|
-
import_v411.z.discriminatedUnion("command", [
|
|
2015
|
-
import_v411.z.object({
|
|
2016
|
-
type: import_v411.z.literal("text_editor_code_execution"),
|
|
2017
|
-
command: import_v411.z.literal("view"),
|
|
2018
|
-
path: import_v411.z.string()
|
|
2019
|
-
}),
|
|
2020
|
-
import_v411.z.object({
|
|
2021
|
-
type: import_v411.z.literal("text_editor_code_execution"),
|
|
2022
|
-
command: import_v411.z.literal("create"),
|
|
2023
|
-
path: import_v411.z.string(),
|
|
2024
|
-
file_text: import_v411.z.string().nullish()
|
|
2025
|
-
}),
|
|
2026
|
-
import_v411.z.object({
|
|
2027
|
-
type: import_v411.z.literal("text_editor_code_execution"),
|
|
2028
|
-
command: import_v411.z.literal("str_replace"),
|
|
2029
|
-
path: import_v411.z.string(),
|
|
2030
|
-
old_str: import_v411.z.string(),
|
|
2031
|
-
new_str: import_v411.z.string()
|
|
2032
|
-
})
|
|
2033
|
-
])
|
|
2034
|
-
])
|
|
2035
|
-
)
|
|
2036
|
-
);
|
|
2037
|
-
var factory8 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
2038
|
-
id: "anthropic.code_execution_20250825",
|
|
2039
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
2040
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
2041
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
2042
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
2043
|
-
// resolved before the code execution result can be returned.
|
|
2044
|
-
supportsDeferredResults: true
|
|
2045
|
-
});
|
|
2046
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
2047
|
-
return factory8(args);
|
|
2048
|
-
};
|
|
2049
|
-
|
|
2050
|
-
// src/tool/code-execution_20260120.ts
|
|
2051
2076
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2052
2077
|
var import_v412 = require("zod/v4");
|
|
2053
|
-
var
|
|
2078
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2054
2079
|
() => (0, import_provider_utils12.zodSchema)(
|
|
2055
2080
|
import_v412.z.discriminatedUnion("type", [
|
|
2056
2081
|
import_v412.z.object({
|
|
@@ -2065,18 +2090,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2065
2090
|
})
|
|
2066
2091
|
).optional().default([])
|
|
2067
2092
|
}),
|
|
2068
|
-
import_v412.z.object({
|
|
2069
|
-
type: import_v412.z.literal("encrypted_code_execution_result"),
|
|
2070
|
-
encrypted_stdout: import_v412.z.string(),
|
|
2071
|
-
stderr: import_v412.z.string(),
|
|
2072
|
-
return_code: import_v412.z.number(),
|
|
2073
|
-
content: import_v412.z.array(
|
|
2074
|
-
import_v412.z.object({
|
|
2075
|
-
type: import_v412.z.literal("code_execution_output"),
|
|
2076
|
-
file_id: import_v412.z.string()
|
|
2077
|
-
})
|
|
2078
|
-
).optional().default([])
|
|
2079
|
-
}),
|
|
2080
2093
|
import_v412.z.object({
|
|
2081
2094
|
type: import_v412.z.literal("bash_code_execution_result"),
|
|
2082
2095
|
content: import_v412.z.array(
|
|
@@ -2120,9 +2133,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2120
2133
|
])
|
|
2121
2134
|
)
|
|
2122
2135
|
);
|
|
2123
|
-
var
|
|
2136
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2124
2137
|
() => (0, import_provider_utils12.zodSchema)(
|
|
2125
2138
|
import_v412.z.discriminatedUnion("type", [
|
|
2139
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2126
2140
|
import_v412.z.object({
|
|
2127
2141
|
type: import_v412.z.literal("programmatic-tool-call"),
|
|
2128
2142
|
code: import_v412.z.string()
|
|
@@ -2154,7 +2168,127 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2154
2168
|
])
|
|
2155
2169
|
)
|
|
2156
2170
|
);
|
|
2157
|
-
var
|
|
2171
|
+
var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2172
|
+
id: "anthropic.code_execution_20250825",
|
|
2173
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
2174
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
2175
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
2176
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
2177
|
+
// resolved before the code execution result can be returned.
|
|
2178
|
+
supportsDeferredResults: true
|
|
2179
|
+
});
|
|
2180
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
2181
|
+
return factory8(args);
|
|
2182
|
+
};
|
|
2183
|
+
|
|
2184
|
+
// src/tool/code-execution_20260120.ts
|
|
2185
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2186
|
+
var import_v413 = require("zod/v4");
|
|
2187
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2188
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2189
|
+
import_v413.z.discriminatedUnion("type", [
|
|
2190
|
+
import_v413.z.object({
|
|
2191
|
+
type: import_v413.z.literal("code_execution_result"),
|
|
2192
|
+
stdout: import_v413.z.string(),
|
|
2193
|
+
stderr: import_v413.z.string(),
|
|
2194
|
+
return_code: import_v413.z.number(),
|
|
2195
|
+
content: import_v413.z.array(
|
|
2196
|
+
import_v413.z.object({
|
|
2197
|
+
type: import_v413.z.literal("code_execution_output"),
|
|
2198
|
+
file_id: import_v413.z.string()
|
|
2199
|
+
})
|
|
2200
|
+
).optional().default([])
|
|
2201
|
+
}),
|
|
2202
|
+
import_v413.z.object({
|
|
2203
|
+
type: import_v413.z.literal("encrypted_code_execution_result"),
|
|
2204
|
+
encrypted_stdout: import_v413.z.string(),
|
|
2205
|
+
stderr: import_v413.z.string(),
|
|
2206
|
+
return_code: import_v413.z.number(),
|
|
2207
|
+
content: import_v413.z.array(
|
|
2208
|
+
import_v413.z.object({
|
|
2209
|
+
type: import_v413.z.literal("code_execution_output"),
|
|
2210
|
+
file_id: import_v413.z.string()
|
|
2211
|
+
})
|
|
2212
|
+
).optional().default([])
|
|
2213
|
+
}),
|
|
2214
|
+
import_v413.z.object({
|
|
2215
|
+
type: import_v413.z.literal("bash_code_execution_result"),
|
|
2216
|
+
content: import_v413.z.array(
|
|
2217
|
+
import_v413.z.object({
|
|
2218
|
+
type: import_v413.z.literal("bash_code_execution_output"),
|
|
2219
|
+
file_id: import_v413.z.string()
|
|
2220
|
+
})
|
|
2221
|
+
),
|
|
2222
|
+
stdout: import_v413.z.string(),
|
|
2223
|
+
stderr: import_v413.z.string(),
|
|
2224
|
+
return_code: import_v413.z.number()
|
|
2225
|
+
}),
|
|
2226
|
+
import_v413.z.object({
|
|
2227
|
+
type: import_v413.z.literal("bash_code_execution_tool_result_error"),
|
|
2228
|
+
error_code: import_v413.z.string()
|
|
2229
|
+
}),
|
|
2230
|
+
import_v413.z.object({
|
|
2231
|
+
type: import_v413.z.literal("text_editor_code_execution_tool_result_error"),
|
|
2232
|
+
error_code: import_v413.z.string()
|
|
2233
|
+
}),
|
|
2234
|
+
import_v413.z.object({
|
|
2235
|
+
type: import_v413.z.literal("text_editor_code_execution_view_result"),
|
|
2236
|
+
content: import_v413.z.string(),
|
|
2237
|
+
file_type: import_v413.z.string(),
|
|
2238
|
+
num_lines: import_v413.z.number().nullable(),
|
|
2239
|
+
start_line: import_v413.z.number().nullable(),
|
|
2240
|
+
total_lines: import_v413.z.number().nullable()
|
|
2241
|
+
}),
|
|
2242
|
+
import_v413.z.object({
|
|
2243
|
+
type: import_v413.z.literal("text_editor_code_execution_create_result"),
|
|
2244
|
+
is_file_update: import_v413.z.boolean()
|
|
2245
|
+
}),
|
|
2246
|
+
import_v413.z.object({
|
|
2247
|
+
type: import_v413.z.literal("text_editor_code_execution_str_replace_result"),
|
|
2248
|
+
lines: import_v413.z.array(import_v413.z.string()).nullable(),
|
|
2249
|
+
new_lines: import_v413.z.number().nullable(),
|
|
2250
|
+
new_start: import_v413.z.number().nullable(),
|
|
2251
|
+
old_lines: import_v413.z.number().nullable(),
|
|
2252
|
+
old_start: import_v413.z.number().nullable()
|
|
2253
|
+
})
|
|
2254
|
+
])
|
|
2255
|
+
)
|
|
2256
|
+
);
|
|
2257
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2258
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2259
|
+
import_v413.z.discriminatedUnion("type", [
|
|
2260
|
+
import_v413.z.object({
|
|
2261
|
+
type: import_v413.z.literal("programmatic-tool-call"),
|
|
2262
|
+
code: import_v413.z.string()
|
|
2263
|
+
}),
|
|
2264
|
+
import_v413.z.object({
|
|
2265
|
+
type: import_v413.z.literal("bash_code_execution"),
|
|
2266
|
+
command: import_v413.z.string()
|
|
2267
|
+
}),
|
|
2268
|
+
import_v413.z.discriminatedUnion("command", [
|
|
2269
|
+
import_v413.z.object({
|
|
2270
|
+
type: import_v413.z.literal("text_editor_code_execution"),
|
|
2271
|
+
command: import_v413.z.literal("view"),
|
|
2272
|
+
path: import_v413.z.string()
|
|
2273
|
+
}),
|
|
2274
|
+
import_v413.z.object({
|
|
2275
|
+
type: import_v413.z.literal("text_editor_code_execution"),
|
|
2276
|
+
command: import_v413.z.literal("create"),
|
|
2277
|
+
path: import_v413.z.string(),
|
|
2278
|
+
file_text: import_v413.z.string().nullish()
|
|
2279
|
+
}),
|
|
2280
|
+
import_v413.z.object({
|
|
2281
|
+
type: import_v413.z.literal("text_editor_code_execution"),
|
|
2282
|
+
command: import_v413.z.literal("str_replace"),
|
|
2283
|
+
path: import_v413.z.string(),
|
|
2284
|
+
old_str: import_v413.z.string(),
|
|
2285
|
+
new_str: import_v413.z.string()
|
|
2286
|
+
})
|
|
2287
|
+
])
|
|
2288
|
+
])
|
|
2289
|
+
)
|
|
2290
|
+
);
|
|
2291
|
+
var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2158
2292
|
id: "anthropic.code_execution_20260120",
|
|
2159
2293
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2160
2294
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2165,21 +2299,21 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2165
2299
|
};
|
|
2166
2300
|
|
|
2167
2301
|
// src/tool/tool-search-regex_20251119.ts
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2170
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
2171
|
-
() => (0,
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
type:
|
|
2175
|
-
toolName:
|
|
2302
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2303
|
+
var import_v414 = require("zod/v4");
|
|
2304
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2305
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2306
|
+
import_v414.z.array(
|
|
2307
|
+
import_v414.z.object({
|
|
2308
|
+
type: import_v414.z.literal("tool_reference"),
|
|
2309
|
+
toolName: import_v414.z.string()
|
|
2176
2310
|
})
|
|
2177
2311
|
)
|
|
2178
2312
|
)
|
|
2179
2313
|
);
|
|
2180
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
2181
|
-
() => (0,
|
|
2182
|
-
|
|
2314
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2315
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2316
|
+
import_v414.z.object({
|
|
2183
2317
|
/**
|
|
2184
2318
|
* A regex pattern to search for tools.
|
|
2185
2319
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -2190,15 +2324,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
|
|
|
2190
2324
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
2191
2325
|
* - "(?i)slack" - case-insensitive search
|
|
2192
2326
|
*/
|
|
2193
|
-
pattern:
|
|
2327
|
+
pattern: import_v414.z.string(),
|
|
2194
2328
|
/**
|
|
2195
2329
|
* Maximum number of tools to return. Optional.
|
|
2196
2330
|
*/
|
|
2197
|
-
limit:
|
|
2331
|
+
limit: import_v414.z.number().optional()
|
|
2198
2332
|
})
|
|
2199
2333
|
)
|
|
2200
2334
|
);
|
|
2201
|
-
var factory10 = (0,
|
|
2335
|
+
var factory10 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2202
2336
|
id: "anthropic.tool_search_regex_20251119",
|
|
2203
2337
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2204
2338
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2211,7 +2345,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2211
2345
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2212
2346
|
function convertToString(data) {
|
|
2213
2347
|
if (typeof data === "string") {
|
|
2214
|
-
return new TextDecoder().decode((0,
|
|
2348
|
+
return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
|
|
2215
2349
|
}
|
|
2216
2350
|
if (data instanceof Uint8Array) {
|
|
2217
2351
|
return new TextDecoder().decode(data);
|
|
@@ -2236,7 +2370,7 @@ function getUrlString(data) {
|
|
|
2236
2370
|
}
|
|
2237
2371
|
async function extractErrorValue(value) {
|
|
2238
2372
|
if (typeof value === "string") {
|
|
2239
|
-
const result = await (0,
|
|
2373
|
+
const result = await (0, import_provider_utils15.safeParseJSON)({ text: value });
|
|
2240
2374
|
if (result.success && typeof result.value === "object" && result.value !== null) {
|
|
2241
2375
|
return result.value;
|
|
2242
2376
|
}
|
|
@@ -2254,7 +2388,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2254
2388
|
sendReasoning,
|
|
2255
2389
|
warnings,
|
|
2256
2390
|
cacheControlValidator,
|
|
2257
|
-
toolNameMapping
|
|
2391
|
+
toolNameMapping,
|
|
2392
|
+
toolsetNames = {}
|
|
2258
2393
|
}) {
|
|
2259
2394
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
2260
2395
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2264,7 +2399,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2264
2399
|
const messages = [];
|
|
2265
2400
|
async function shouldEnableCitations(providerMetadata) {
|
|
2266
2401
|
var _a2, _b2;
|
|
2267
|
-
const anthropicOptions = await (0,
|
|
2402
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2268
2403
|
provider: "anthropic",
|
|
2269
2404
|
providerOptions: providerMetadata,
|
|
2270
2405
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2272,7 +2407,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2272
2407
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2273
2408
|
}
|
|
2274
2409
|
async function getDocumentMetadata(providerMetadata) {
|
|
2275
|
-
const anthropicOptions = await (0,
|
|
2410
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2276
2411
|
provider: "anthropic",
|
|
2277
2412
|
providerOptions: providerMetadata,
|
|
2278
2413
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2292,7 +2427,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2292
2427
|
let toolChangeCount = 0;
|
|
2293
2428
|
let hasMidConversationOptions = false;
|
|
2294
2429
|
for (const { content: text, providerOptions } of block.messages) {
|
|
2295
|
-
const systemMessageOptions = await (0,
|
|
2430
|
+
const systemMessageOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2296
2431
|
provider: "anthropic",
|
|
2297
2432
|
providerOptions,
|
|
2298
2433
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -2357,7 +2492,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2357
2492
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
2358
2493
|
}
|
|
2359
2494
|
if (systemMessages.some((message) => message.output_config != null)) {
|
|
2360
|
-
betas.add("mid-conversation-
|
|
2495
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
2361
2496
|
}
|
|
2362
2497
|
}
|
|
2363
2498
|
break;
|
|
@@ -2397,7 +2532,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2397
2532
|
} : {
|
|
2398
2533
|
type: "base64",
|
|
2399
2534
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2400
|
-
data: (0,
|
|
2535
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2401
2536
|
},
|
|
2402
2537
|
cache_control: cacheControl
|
|
2403
2538
|
});
|
|
@@ -2417,7 +2552,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2417
2552
|
} : {
|
|
2418
2553
|
type: "base64",
|
|
2419
2554
|
media_type: "application/pdf",
|
|
2420
|
-
data: (0,
|
|
2555
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2421
2556
|
},
|
|
2422
2557
|
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
2423
2558
|
...metadata.context && { context: metadata.context },
|
|
@@ -2561,7 +2696,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2561
2696
|
return void 0;
|
|
2562
2697
|
}
|
|
2563
2698
|
}
|
|
2564
|
-
}).filter(
|
|
2699
|
+
}).filter(import_provider_utils15.isNonNullable);
|
|
2565
2700
|
break;
|
|
2566
2701
|
case "text":
|
|
2567
2702
|
case "error-text":
|
|
@@ -2576,9 +2711,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2576
2711
|
contentValue = JSON.stringify(output.value);
|
|
2577
2712
|
break;
|
|
2578
2713
|
}
|
|
2714
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2715
|
+
toolName: part.toolName,
|
|
2716
|
+
providerOptions: part.providerOptions,
|
|
2717
|
+
toolsetNames
|
|
2718
|
+
});
|
|
2579
2719
|
anthropicContent.push({
|
|
2580
2720
|
type: "tool_result",
|
|
2581
2721
|
tool_use_id: part.toolCallId,
|
|
2722
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
2582
2723
|
content: contentValue,
|
|
2583
2724
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
2584
2725
|
cache_control: cacheControl
|
|
@@ -2640,7 +2781,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2640
2781
|
}
|
|
2641
2782
|
case "reasoning": {
|
|
2642
2783
|
if (sendReasoning) {
|
|
2643
|
-
const reasoningMetadata = await (0,
|
|
2784
|
+
const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2644
2785
|
provider: "anthropic",
|
|
2645
2786
|
providerOptions: part.providerOptions,
|
|
2646
2787
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2776,6 +2917,31 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2776
2917
|
}
|
|
2777
2918
|
break;
|
|
2778
2919
|
}
|
|
2920
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2921
|
+
toolName: part.toolName,
|
|
2922
|
+
providerOptions: part.providerOptions,
|
|
2923
|
+
toolsetNames
|
|
2924
|
+
});
|
|
2925
|
+
if (toolsetName != null) {
|
|
2926
|
+
const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
|
|
2927
|
+
if (typeof action !== "string") {
|
|
2928
|
+
warnings.push({
|
|
2929
|
+
type: "other",
|
|
2930
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
2931
|
+
});
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2934
|
+
anthropicContent.push({
|
|
2935
|
+
type: "tool_use",
|
|
2936
|
+
id: part.toolCallId,
|
|
2937
|
+
name: action,
|
|
2938
|
+
toolset_name: toolsetName,
|
|
2939
|
+
input: memberInput,
|
|
2940
|
+
...caller && { caller },
|
|
2941
|
+
cache_control: cacheControl
|
|
2942
|
+
});
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2779
2945
|
anthropicContent.push({
|
|
2780
2946
|
type: "tool_use",
|
|
2781
2947
|
id: part.toolCallId,
|
|
@@ -2813,7 +2979,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2813
2979
|
let errorInfo = {};
|
|
2814
2980
|
try {
|
|
2815
2981
|
if (typeof output.value === "string") {
|
|
2816
|
-
errorInfo = (0,
|
|
2982
|
+
errorInfo = (0, import_provider_utils15.secureJsonParse)(output.value);
|
|
2817
2983
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2818
2984
|
errorInfo = output.value;
|
|
2819
2985
|
}
|
|
@@ -2857,7 +3023,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2857
3023
|
break;
|
|
2858
3024
|
}
|
|
2859
3025
|
if (output.value.type === "code_execution_result") {
|
|
2860
|
-
const codeExecutionOutput = await (0,
|
|
3026
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2861
3027
|
value: output.value,
|
|
2862
3028
|
schema: codeExecution_20250522OutputSchema
|
|
2863
3029
|
});
|
|
@@ -2874,7 +3040,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2874
3040
|
cache_control: cacheControl
|
|
2875
3041
|
});
|
|
2876
3042
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2877
|
-
const codeExecutionOutput = await (0,
|
|
3043
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2878
3044
|
value: output.value,
|
|
2879
3045
|
schema: codeExecution_20260120OutputSchema
|
|
2880
3046
|
});
|
|
@@ -2893,7 +3059,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2893
3059
|
});
|
|
2894
3060
|
}
|
|
2895
3061
|
} else {
|
|
2896
|
-
const codeExecutionOutput = await (0,
|
|
3062
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2897
3063
|
value: output.value,
|
|
2898
3064
|
schema: codeExecution_20250825OutputSchema
|
|
2899
3065
|
});
|
|
@@ -2958,7 +3124,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2958
3124
|
});
|
|
2959
3125
|
break;
|
|
2960
3126
|
}
|
|
2961
|
-
const webFetchOutput = await (0,
|
|
3127
|
+
const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2962
3128
|
value: output.value,
|
|
2963
3129
|
schema: webFetch_20250910OutputSchema
|
|
2964
3130
|
});
|
|
@@ -3007,7 +3173,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3007
3173
|
});
|
|
3008
3174
|
break;
|
|
3009
3175
|
}
|
|
3010
|
-
const webSearchOutput = await (0,
|
|
3176
|
+
const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
3011
3177
|
value: output.value,
|
|
3012
3178
|
schema: webSearch_20250305OutputSchema
|
|
3013
3179
|
});
|
|
@@ -3035,7 +3201,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3035
3201
|
});
|
|
3036
3202
|
break;
|
|
3037
3203
|
}
|
|
3038
|
-
const toolSearchOutput = await (0,
|
|
3204
|
+
const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
3039
3205
|
value: output.value,
|
|
3040
3206
|
schema: toolSearchRegex_20251119OutputSchema
|
|
3041
3207
|
});
|
|
@@ -3063,7 +3229,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3063
3229
|
});
|
|
3064
3230
|
break;
|
|
3065
3231
|
}
|
|
3066
|
-
const advisorOutput = await (0,
|
|
3232
|
+
const advisorOutput = await (0, import_provider_utils15.validateTypes)({
|
|
3067
3233
|
value: output.value,
|
|
3068
3234
|
schema: advisor_20260301OutputSchema
|
|
3069
3235
|
});
|
|
@@ -3193,6 +3359,19 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
3193
3359
|
flushSegment();
|
|
3194
3360
|
return result;
|
|
3195
3361
|
}
|
|
3362
|
+
function getAnthropicToolsetName({
|
|
3363
|
+
toolName,
|
|
3364
|
+
providerOptions,
|
|
3365
|
+
toolsetNames
|
|
3366
|
+
}) {
|
|
3367
|
+
var _a;
|
|
3368
|
+
const fromTools = toolsetNames[toolName];
|
|
3369
|
+
if (fromTools != null) {
|
|
3370
|
+
return fromTools;
|
|
3371
|
+
}
|
|
3372
|
+
const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
|
|
3373
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
3374
|
+
}
|
|
3196
3375
|
function getAnthropicCaller(providerOptions) {
|
|
3197
3376
|
var _a;
|
|
3198
3377
|
const caller = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.caller;
|
|
@@ -3430,13 +3609,31 @@ function getAnthropicCallerMetadata(caller) {
|
|
|
3430
3609
|
const callerInfo = getAnthropicCallerInfo(caller);
|
|
3431
3610
|
return callerInfo == null ? {} : { providerMetadata: { anthropic: { caller: callerInfo } } };
|
|
3432
3611
|
}
|
|
3612
|
+
function getAnthropicToolsetNames(tools) {
|
|
3613
|
+
const toolsetNames = {};
|
|
3614
|
+
for (const tool of tools != null ? tools : []) {
|
|
3615
|
+
if (tool.type === "provider" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
3616
|
+
toolsetNames[tool.name] = "computer";
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
return toolsetNames;
|
|
3620
|
+
}
|
|
3621
|
+
function toToolsetMemberInput({
|
|
3622
|
+
memberName,
|
|
3623
|
+
input
|
|
3624
|
+
}) {
|
|
3625
|
+
return {
|
|
3626
|
+
action: memberName,
|
|
3627
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3433
3630
|
var AnthropicMessagesLanguageModel = class {
|
|
3434
3631
|
constructor(modelId, config) {
|
|
3435
3632
|
this.specificationVersion = "v3";
|
|
3436
3633
|
var _a;
|
|
3437
3634
|
this.modelId = modelId;
|
|
3438
3635
|
this.config = config;
|
|
3439
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3636
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
|
|
3440
3637
|
}
|
|
3441
3638
|
supportsUrl(url) {
|
|
3442
3639
|
return url.protocol === "https:";
|
|
@@ -3510,12 +3707,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3510
3707
|
}
|
|
3511
3708
|
}
|
|
3512
3709
|
const providerOptionsName = this.providerOptionsName;
|
|
3513
|
-
const canonicalOptions = await (0,
|
|
3710
|
+
const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
3514
3711
|
provider: "anthropic",
|
|
3515
3712
|
providerOptions,
|
|
3516
3713
|
schema: anthropicLanguageModelOptions
|
|
3517
3714
|
});
|
|
3518
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3715
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
|
|
3519
3716
|
provider: providerOptionsName,
|
|
3520
3717
|
providerOptions,
|
|
3521
3718
|
schema: anthropicLanguageModelOptions
|
|
@@ -3531,6 +3728,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3531
3728
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
3532
3729
|
rejectsSamplingParameters,
|
|
3533
3730
|
rejectsThinkingDisabledAboveHighEffort,
|
|
3731
|
+
rejectsThinkingDisabled,
|
|
3732
|
+
rejectsForcedToolUse,
|
|
3534
3733
|
isKnownModel
|
|
3535
3734
|
} = getModelCapabilities(this.modelId);
|
|
3536
3735
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -3570,7 +3769,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3570
3769
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
3571
3770
|
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3572
3771
|
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
3573
|
-
|
|
3772
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3773
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3774
|
+
warnings.push({
|
|
3775
|
+
type: "unsupported",
|
|
3776
|
+
feature: "providerOptions.anthropic.structuredOutputMode",
|
|
3777
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
3778
|
+
});
|
|
3779
|
+
useStructuredOutput = true;
|
|
3780
|
+
}
|
|
3574
3781
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
3575
3782
|
type: "function",
|
|
3576
3783
|
name: "json",
|
|
@@ -3586,7 +3793,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3586
3793
|
}
|
|
3587
3794
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3588
3795
|
const cacheControlValidator = new CacheControlValidator();
|
|
3589
|
-
const toolNameMapping = (0,
|
|
3796
|
+
const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
|
|
3590
3797
|
tools,
|
|
3591
3798
|
providerToolNames: {
|
|
3592
3799
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -3594,6 +3801,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3594
3801
|
"anthropic.code_execution_20260120": "code_execution",
|
|
3595
3802
|
"anthropic.computer_20241022": "computer",
|
|
3596
3803
|
"anthropic.computer_20250124": "computer",
|
|
3804
|
+
"anthropic.computer_20251124": "computer",
|
|
3805
|
+
"anthropic.computer_toolset_20260801": "computer",
|
|
3597
3806
|
"anthropic.text_editor_20241022": "str_replace_editor",
|
|
3598
3807
|
"anthropic.text_editor_20250124": "str_replace_editor",
|
|
3599
3808
|
"anthropic.text_editor_20250429": "str_replace_based_edit_tool",
|
|
@@ -3610,13 +3819,34 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3610
3819
|
"anthropic.advisor_20260301": "advisor"
|
|
3611
3820
|
}
|
|
3612
3821
|
});
|
|
3822
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3613
3823
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3614
3824
|
prompt,
|
|
3615
3825
|
sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
|
|
3616
3826
|
warnings,
|
|
3617
3827
|
cacheControlValidator,
|
|
3618
|
-
toolNameMapping
|
|
3828
|
+
toolNameMapping,
|
|
3829
|
+
toolsetNames
|
|
3619
3830
|
});
|
|
3831
|
+
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
3832
|
+
const requestedThinking = anthropicOptions.thinking;
|
|
3833
|
+
const requestedType = "type" in requestedThinking ? requestedThinking.type : void 0;
|
|
3834
|
+
if (requestedType === "disabled") {
|
|
3835
|
+
warnings.push({
|
|
3836
|
+
type: "unsupported",
|
|
3837
|
+
feature: "providerOptions.anthropic.thinking",
|
|
3838
|
+
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
3839
|
+
});
|
|
3840
|
+
anthropicOptions.thinking = void 0;
|
|
3841
|
+
} else if (requestedType === "enabled") {
|
|
3842
|
+
warnings.push({
|
|
3843
|
+
type: "unsupported",
|
|
3844
|
+
feature: "providerOptions.anthropic.thinking",
|
|
3845
|
+
details: `budget-based thinking is not supported by ${this.modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
|
|
3846
|
+
});
|
|
3847
|
+
anthropicOptions.thinking = { type: "adaptive" };
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3620
3850
|
const thinking = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
3621
3851
|
const thinkingType = thinking != null && "type" in thinking ? thinking.type : void 0;
|
|
3622
3852
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -3888,7 +4118,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3888
4118
|
cacheControlValidator,
|
|
3889
4119
|
supportsStructuredOutput: false,
|
|
3890
4120
|
supportsStrictTools,
|
|
3891
|
-
defaultEagerInputStreaming
|
|
4121
|
+
defaultEagerInputStreaming,
|
|
4122
|
+
rejectsForcedToolUse
|
|
3892
4123
|
} : {
|
|
3893
4124
|
tools: tools != null ? tools : [],
|
|
3894
4125
|
toolChoice,
|
|
@@ -3896,7 +4127,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3896
4127
|
cacheControlValidator,
|
|
3897
4128
|
supportsStructuredOutput,
|
|
3898
4129
|
supportsStrictTools,
|
|
3899
|
-
defaultEagerInputStreaming
|
|
4130
|
+
defaultEagerInputStreaming,
|
|
4131
|
+
rejectsForcedToolUse
|
|
3900
4132
|
}
|
|
3901
4133
|
);
|
|
3902
4134
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -3925,15 +4157,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3925
4157
|
betas,
|
|
3926
4158
|
headers
|
|
3927
4159
|
}) {
|
|
3928
|
-
return (0,
|
|
3929
|
-
await (0,
|
|
4160
|
+
return (0, import_provider_utils16.combineHeaders)(
|
|
4161
|
+
await (0, import_provider_utils16.resolve)(this.config.headers),
|
|
3930
4162
|
headers,
|
|
3931
4163
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3932
4164
|
);
|
|
3933
4165
|
}
|
|
3934
4166
|
async getBetasFromHeaders(requestHeaders) {
|
|
3935
4167
|
var _a, _b;
|
|
3936
|
-
const configHeaders = await (0,
|
|
4168
|
+
const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
|
|
3937
4169
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3938
4170
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3939
4171
|
return new Set(
|
|
@@ -3975,7 +4207,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3975
4207
|
});
|
|
3976
4208
|
}
|
|
3977
4209
|
async doGenerate(options) {
|
|
3978
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4210
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3979
4211
|
const {
|
|
3980
4212
|
args,
|
|
3981
4213
|
warnings,
|
|
@@ -3999,12 +4231,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3999
4231
|
responseHeaders,
|
|
4000
4232
|
value: response,
|
|
4001
4233
|
rawValue: rawResponse
|
|
4002
|
-
} = await (0,
|
|
4234
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
4003
4235
|
url: this.buildRequestUrl(false),
|
|
4004
4236
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4005
4237
|
body: this.transformRequestBody(args, betas),
|
|
4006
4238
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4007
|
-
successfulResponseHandler: (0,
|
|
4239
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
4008
4240
|
anthropicMessagesResponseSchema
|
|
4009
4241
|
),
|
|
4010
4242
|
abortSignal: options.abortSignal,
|
|
@@ -4091,6 +4323,24 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4091
4323
|
type: "text",
|
|
4092
4324
|
text: JSON.stringify(part.input)
|
|
4093
4325
|
});
|
|
4326
|
+
} else if (part.toolset_name != null) {
|
|
4327
|
+
content.push({
|
|
4328
|
+
type: "tool-call",
|
|
4329
|
+
toolCallId: part.id,
|
|
4330
|
+
toolName: toolNameMapping.toCustomToolName(part.toolset_name),
|
|
4331
|
+
input: JSON.stringify(
|
|
4332
|
+
toToolsetMemberInput({
|
|
4333
|
+
memberName: part.name,
|
|
4334
|
+
input: part.input
|
|
4335
|
+
})
|
|
4336
|
+
),
|
|
4337
|
+
providerMetadata: {
|
|
4338
|
+
anthropic: {
|
|
4339
|
+
toolsetName: part.toolset_name,
|
|
4340
|
+
...(_b = getAnthropicCallerMetadata(part.caller).providerMetadata) == null ? void 0 : _b.anthropic
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
});
|
|
4094
4344
|
} else {
|
|
4095
4345
|
content.push({
|
|
4096
4346
|
type: "tool-call",
|
|
@@ -4188,7 +4438,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4188
4438
|
case "web_fetch_tool_result": {
|
|
4189
4439
|
if (part.content.type === "web_fetch_result") {
|
|
4190
4440
|
citationDocuments.push({
|
|
4191
|
-
title: (
|
|
4441
|
+
title: (_c = part.content.content.title) != null ? _c : part.content.url,
|
|
4192
4442
|
mediaType: part.content.content.source.media_type
|
|
4193
4443
|
});
|
|
4194
4444
|
content.push({
|
|
@@ -4254,7 +4504,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4254
4504
|
title: result.title,
|
|
4255
4505
|
providerMetadata: {
|
|
4256
4506
|
anthropic: {
|
|
4257
|
-
pageAge: (
|
|
4507
|
+
pageAge: (_d = result.page_age) != null ? _d : null
|
|
4258
4508
|
}
|
|
4259
4509
|
}
|
|
4260
4510
|
});
|
|
@@ -4286,7 +4536,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4286
4536
|
stdout: part.content.stdout,
|
|
4287
4537
|
stderr: part.content.stderr,
|
|
4288
4538
|
return_code: part.content.return_code,
|
|
4289
|
-
content: (
|
|
4539
|
+
content: (_e = part.content.content) != null ? _e : []
|
|
4290
4540
|
}
|
|
4291
4541
|
});
|
|
4292
4542
|
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
@@ -4299,7 +4549,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4299
4549
|
encrypted_stdout: part.content.encrypted_stdout,
|
|
4300
4550
|
stderr: part.content.stderr,
|
|
4301
4551
|
return_code: part.content.return_code,
|
|
4302
|
-
content: (
|
|
4552
|
+
content: (_f = part.content.content) != null ? _f : []
|
|
4303
4553
|
}
|
|
4304
4554
|
});
|
|
4305
4555
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -4421,13 +4671,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4421
4671
|
finishReason: response.stop_reason,
|
|
4422
4672
|
isJsonResponseFromTool
|
|
4423
4673
|
}),
|
|
4424
|
-
raw: (
|
|
4674
|
+
raw: (_g = response.stop_reason) != null ? _g : void 0
|
|
4425
4675
|
},
|
|
4426
4676
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
4427
4677
|
request: { body: args },
|
|
4428
4678
|
response: {
|
|
4429
|
-
id: (
|
|
4430
|
-
modelId: (
|
|
4679
|
+
id: (_h = response.id) != null ? _h : void 0,
|
|
4680
|
+
modelId: (_i = response.model) != null ? _i : void 0,
|
|
4431
4681
|
headers: responseHeaders,
|
|
4432
4682
|
body: rawResponse
|
|
4433
4683
|
},
|
|
@@ -4500,12 +4750,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4500
4750
|
body.tools
|
|
4501
4751
|
);
|
|
4502
4752
|
const url = this.buildRequestUrl(true);
|
|
4503
|
-
const { responseHeaders, value: response } = await (0,
|
|
4753
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
4504
4754
|
url,
|
|
4505
4755
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4506
4756
|
body: this.transformRequestBody(body, betas),
|
|
4507
4757
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4508
|
-
successfulResponseHandler: (0,
|
|
4758
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
4509
4759
|
anthropicMessagesChunkSchema
|
|
4510
4760
|
),
|
|
4511
4761
|
abortSignal: options.abortSignal,
|
|
@@ -4631,6 +4881,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4631
4881
|
type: "text-start",
|
|
4632
4882
|
id: String(value.index)
|
|
4633
4883
|
});
|
|
4884
|
+
} else if (part.toolset_name != null) {
|
|
4885
|
+
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
4886
|
+
const customToolName = toolNameMapping.toCustomToolName(
|
|
4887
|
+
part.toolset_name
|
|
4888
|
+
);
|
|
4889
|
+
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
4890
|
+
contentBlocks[value.index] = {
|
|
4891
|
+
type: "tool-call",
|
|
4892
|
+
toolCallId: part.id,
|
|
4893
|
+
toolName: customToolName,
|
|
4894
|
+
input: hasNonEmptyInput ? JSON.stringify(part.input) : "",
|
|
4895
|
+
firstDelta: true,
|
|
4896
|
+
toolset: {
|
|
4897
|
+
name: part.toolset_name,
|
|
4898
|
+
memberName: part.name
|
|
4899
|
+
},
|
|
4900
|
+
...callerInfo && { caller: callerInfo }
|
|
4901
|
+
};
|
|
4902
|
+
controller.enqueue({
|
|
4903
|
+
type: "tool-input-start",
|
|
4904
|
+
id: part.id,
|
|
4905
|
+
toolName: customToolName
|
|
4906
|
+
});
|
|
4634
4907
|
} else {
|
|
4635
4908
|
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
4636
4909
|
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
@@ -5024,6 +5297,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5024
5297
|
case "tool-call":
|
|
5025
5298
|
const isJsonResponseTool = usesJsonResponseTool && contentBlock.toolName === "json";
|
|
5026
5299
|
if (!isJsonResponseTool) {
|
|
5300
|
+
if (contentBlock.toolset != null) {
|
|
5301
|
+
let memberInput = {};
|
|
5302
|
+
try {
|
|
5303
|
+
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils16.secureJsonParse)(contentBlock.input);
|
|
5304
|
+
} catch (e) {
|
|
5305
|
+
memberInput = void 0;
|
|
5306
|
+
}
|
|
5307
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
5308
|
+
toToolsetMemberInput({
|
|
5309
|
+
memberName: contentBlock.toolset.memberName,
|
|
5310
|
+
input: memberInput
|
|
5311
|
+
})
|
|
5312
|
+
);
|
|
5313
|
+
controller.enqueue({
|
|
5314
|
+
type: "tool-input-delta",
|
|
5315
|
+
id: contentBlock.toolCallId,
|
|
5316
|
+
delta: contentBlock.input
|
|
5317
|
+
});
|
|
5318
|
+
}
|
|
5027
5319
|
controller.enqueue({
|
|
5028
5320
|
type: "tool-input-end",
|
|
5029
5321
|
id: contentBlock.toolCallId
|
|
@@ -5031,7 +5323,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5031
5323
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
5032
5324
|
if (contentBlock.providerToolName === "code_execution") {
|
|
5033
5325
|
try {
|
|
5034
|
-
const parsed = (0,
|
|
5326
|
+
const parsed = (0, import_provider_utils16.secureJsonParse)(finalInput);
|
|
5035
5327
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
5036
5328
|
finalInput = JSON.stringify({
|
|
5037
5329
|
type: "programmatic-tool-call",
|
|
@@ -5052,10 +5344,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5052
5344
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
5053
5345
|
// tool as dynamic.
|
|
5054
5346
|
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
5055
|
-
...contentBlock.caller && {
|
|
5347
|
+
...(contentBlock.caller || contentBlock.toolset) && {
|
|
5056
5348
|
providerMetadata: {
|
|
5057
5349
|
anthropic: {
|
|
5058
|
-
|
|
5350
|
+
...contentBlock.toolset && {
|
|
5351
|
+
toolsetName: contentBlock.toolset.name
|
|
5352
|
+
},
|
|
5353
|
+
...contentBlock.caller && {
|
|
5354
|
+
caller: contentBlock.caller
|
|
5355
|
+
}
|
|
5059
5356
|
}
|
|
5060
5357
|
}
|
|
5061
5358
|
}
|
|
@@ -5134,6 +5431,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5134
5431
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
5135
5432
|
return;
|
|
5136
5433
|
}
|
|
5434
|
+
if (contentBlock.toolset != null) {
|
|
5435
|
+
contentBlock.input += delta;
|
|
5436
|
+
return;
|
|
5437
|
+
}
|
|
5137
5438
|
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
5138
5439
|
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
5139
5440
|
}
|
|
@@ -5392,20 +5693,54 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5392
5693
|
}
|
|
5393
5694
|
};
|
|
5394
5695
|
function getModelCapabilities(modelId) {
|
|
5395
|
-
if (modelId.includes("claude-opus-5")) {
|
|
5696
|
+
if (modelId.includes("claude-opus-5-5")) {
|
|
5697
|
+
return {
|
|
5698
|
+
maxOutputTokens: 128e3,
|
|
5699
|
+
supportsStructuredOutput: true,
|
|
5700
|
+
rejectsSamplingParameters: true,
|
|
5701
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5702
|
+
rejectsThinkingDisabled: true,
|
|
5703
|
+
rejectsForcedToolUse: true,
|
|
5704
|
+
isKnownModel: true
|
|
5705
|
+
};
|
|
5706
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
5396
5707
|
return {
|
|
5397
5708
|
maxOutputTokens: 128e3,
|
|
5398
5709
|
supportsStructuredOutput: true,
|
|
5399
5710
|
rejectsSamplingParameters: true,
|
|
5400
5711
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5712
|
+
rejectsThinkingDisabled: false,
|
|
5713
|
+
rejectsForcedToolUse: false,
|
|
5714
|
+
isKnownModel: true
|
|
5715
|
+
};
|
|
5716
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
5717
|
+
return {
|
|
5718
|
+
maxOutputTokens: 128e3,
|
|
5719
|
+
supportsStructuredOutput: true,
|
|
5720
|
+
rejectsSamplingParameters: true,
|
|
5721
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5722
|
+
rejectsThinkingDisabled: true,
|
|
5723
|
+
rejectsForcedToolUse: true,
|
|
5724
|
+
isKnownModel: true
|
|
5725
|
+
};
|
|
5726
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
5727
|
+
return {
|
|
5728
|
+
maxOutputTokens: 128e3,
|
|
5729
|
+
supportsStructuredOutput: true,
|
|
5730
|
+
rejectsSamplingParameters: true,
|
|
5731
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5732
|
+
rejectsThinkingDisabled: true,
|
|
5733
|
+
rejectsForcedToolUse: false,
|
|
5401
5734
|
isKnownModel: true
|
|
5402
5735
|
};
|
|
5403
|
-
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-
|
|
5736
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
5404
5737
|
return {
|
|
5405
5738
|
maxOutputTokens: 128e3,
|
|
5406
5739
|
supportsStructuredOutput: true,
|
|
5407
5740
|
rejectsSamplingParameters: true,
|
|
5408
5741
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5742
|
+
rejectsThinkingDisabled: false,
|
|
5743
|
+
rejectsForcedToolUse: false,
|
|
5409
5744
|
isKnownModel: true
|
|
5410
5745
|
};
|
|
5411
5746
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -5414,6 +5749,8 @@ function getModelCapabilities(modelId) {
|
|
|
5414
5749
|
supportsStructuredOutput: true,
|
|
5415
5750
|
rejectsSamplingParameters: false,
|
|
5416
5751
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5752
|
+
rejectsThinkingDisabled: false,
|
|
5753
|
+
rejectsForcedToolUse: false,
|
|
5417
5754
|
isKnownModel: true
|
|
5418
5755
|
};
|
|
5419
5756
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -5422,6 +5759,8 @@ function getModelCapabilities(modelId) {
|
|
|
5422
5759
|
supportsStructuredOutput: true,
|
|
5423
5760
|
rejectsSamplingParameters: false,
|
|
5424
5761
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5762
|
+
rejectsThinkingDisabled: false,
|
|
5763
|
+
rejectsForcedToolUse: false,
|
|
5425
5764
|
isKnownModel: true
|
|
5426
5765
|
};
|
|
5427
5766
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -5430,6 +5769,8 @@ function getModelCapabilities(modelId) {
|
|
|
5430
5769
|
supportsStructuredOutput: true,
|
|
5431
5770
|
rejectsSamplingParameters: false,
|
|
5432
5771
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5772
|
+
rejectsThinkingDisabled: false,
|
|
5773
|
+
rejectsForcedToolUse: false,
|
|
5433
5774
|
isKnownModel: true
|
|
5434
5775
|
};
|
|
5435
5776
|
} else if (modelId.includes("claude-sonnet-4-")) {
|
|
@@ -5438,6 +5779,8 @@ function getModelCapabilities(modelId) {
|
|
|
5438
5779
|
supportsStructuredOutput: false,
|
|
5439
5780
|
rejectsSamplingParameters: false,
|
|
5440
5781
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5782
|
+
rejectsThinkingDisabled: false,
|
|
5783
|
+
rejectsForcedToolUse: false,
|
|
5441
5784
|
isKnownModel: true
|
|
5442
5785
|
};
|
|
5443
5786
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -5446,6 +5789,8 @@ function getModelCapabilities(modelId) {
|
|
|
5446
5789
|
supportsStructuredOutput: false,
|
|
5447
5790
|
rejectsSamplingParameters: false,
|
|
5448
5791
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5792
|
+
rejectsThinkingDisabled: false,
|
|
5793
|
+
rejectsForcedToolUse: false,
|
|
5449
5794
|
isKnownModel: true
|
|
5450
5795
|
};
|
|
5451
5796
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -5454,6 +5799,8 @@ function getModelCapabilities(modelId) {
|
|
|
5454
5799
|
supportsStructuredOutput: false,
|
|
5455
5800
|
rejectsSamplingParameters: false,
|
|
5456
5801
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5802
|
+
rejectsThinkingDisabled: false,
|
|
5803
|
+
rejectsForcedToolUse: false,
|
|
5457
5804
|
isKnownModel: true
|
|
5458
5805
|
};
|
|
5459
5806
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -5462,6 +5809,8 @@ function getModelCapabilities(modelId) {
|
|
|
5462
5809
|
supportsStructuredOutput: false,
|
|
5463
5810
|
rejectsSamplingParameters: false,
|
|
5464
5811
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5812
|
+
rejectsThinkingDisabled: false,
|
|
5813
|
+
rejectsForcedToolUse: false,
|
|
5465
5814
|
isKnownModel: false
|
|
5466
5815
|
};
|
|
5467
5816
|
} else if (modelId.includes("claude-")) {
|
|
@@ -5470,6 +5819,8 @@ function getModelCapabilities(modelId) {
|
|
|
5470
5819
|
supportsStructuredOutput: true,
|
|
5471
5820
|
rejectsSamplingParameters: true,
|
|
5472
5821
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5822
|
+
rejectsThinkingDisabled: false,
|
|
5823
|
+
rejectsForcedToolUse: false,
|
|
5473
5824
|
isKnownModel: false
|
|
5474
5825
|
};
|
|
5475
5826
|
} else {
|
|
@@ -5478,6 +5829,8 @@ function getModelCapabilities(modelId) {
|
|
|
5478
5829
|
supportsStructuredOutput: false,
|
|
5479
5830
|
rejectsSamplingParameters: false,
|
|
5480
5831
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5832
|
+
rejectsThinkingDisabled: false,
|
|
5833
|
+
rejectsForcedToolUse: false,
|
|
5481
5834
|
isKnownModel: false
|
|
5482
5835
|
};
|
|
5483
5836
|
}
|
|
@@ -5493,7 +5846,7 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
5493
5846
|
hasWebTool20260209 = true;
|
|
5494
5847
|
continue;
|
|
5495
5848
|
}
|
|
5496
|
-
if (tool.name === "code_execution") {
|
|
5849
|
+
if ("name" in tool && tool.name === "code_execution") {
|
|
5497
5850
|
hasCodeExecutionTool = true;
|
|
5498
5851
|
break;
|
|
5499
5852
|
}
|
|
@@ -5538,44 +5891,44 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
5538
5891
|
}
|
|
5539
5892
|
|
|
5540
5893
|
// src/tool/bash_20241022.ts
|
|
5541
|
-
var
|
|
5542
|
-
var
|
|
5543
|
-
var bash_20241022InputSchema = (0,
|
|
5544
|
-
() => (0,
|
|
5545
|
-
|
|
5546
|
-
command:
|
|
5547
|
-
restart:
|
|
5894
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
5895
|
+
var import_v415 = require("zod/v4");
|
|
5896
|
+
var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
5897
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
5898
|
+
import_v415.z.object({
|
|
5899
|
+
command: import_v415.z.string(),
|
|
5900
|
+
restart: import_v415.z.boolean().optional()
|
|
5548
5901
|
})
|
|
5549
5902
|
)
|
|
5550
5903
|
);
|
|
5551
|
-
var bash_20241022 = (0,
|
|
5904
|
+
var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
5552
5905
|
id: "anthropic.bash_20241022",
|
|
5553
5906
|
inputSchema: bash_20241022InputSchema
|
|
5554
5907
|
});
|
|
5555
5908
|
|
|
5556
5909
|
// src/tool/bash_20250124.ts
|
|
5557
|
-
var
|
|
5558
|
-
var
|
|
5559
|
-
var bash_20250124InputSchema = (0,
|
|
5560
|
-
() => (0,
|
|
5561
|
-
|
|
5562
|
-
command:
|
|
5563
|
-
restart:
|
|
5910
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
5911
|
+
var import_v416 = require("zod/v4");
|
|
5912
|
+
var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
5913
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
5914
|
+
import_v416.z.object({
|
|
5915
|
+
command: import_v416.z.string(),
|
|
5916
|
+
restart: import_v416.z.boolean().optional()
|
|
5564
5917
|
})
|
|
5565
5918
|
)
|
|
5566
5919
|
);
|
|
5567
|
-
var bash_20250124 = (0,
|
|
5920
|
+
var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
5568
5921
|
id: "anthropic.bash_20250124",
|
|
5569
5922
|
inputSchema: bash_20250124InputSchema
|
|
5570
5923
|
});
|
|
5571
5924
|
|
|
5572
5925
|
// src/tool/computer_20241022.ts
|
|
5573
|
-
var
|
|
5574
|
-
var
|
|
5575
|
-
var computer_20241022InputSchema = (0,
|
|
5576
|
-
() => (0,
|
|
5577
|
-
|
|
5578
|
-
action:
|
|
5926
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
5927
|
+
var import_v417 = require("zod/v4");
|
|
5928
|
+
var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
5929
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
5930
|
+
import_v417.z.object({
|
|
5931
|
+
action: import_v417.z.enum([
|
|
5579
5932
|
"key",
|
|
5580
5933
|
"type",
|
|
5581
5934
|
"mouse_move",
|
|
@@ -5587,23 +5940,23 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
5587
5940
|
"screenshot",
|
|
5588
5941
|
"cursor_position"
|
|
5589
5942
|
]),
|
|
5590
|
-
coordinate:
|
|
5591
|
-
text:
|
|
5943
|
+
coordinate: import_v417.z.array(import_v417.z.number().int()).optional(),
|
|
5944
|
+
text: import_v417.z.string().optional()
|
|
5592
5945
|
})
|
|
5593
5946
|
)
|
|
5594
5947
|
);
|
|
5595
|
-
var computer_20241022 = (0,
|
|
5948
|
+
var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
5596
5949
|
id: "anthropic.computer_20241022",
|
|
5597
5950
|
inputSchema: computer_20241022InputSchema
|
|
5598
5951
|
});
|
|
5599
5952
|
|
|
5600
5953
|
// src/tool/computer_20250124.ts
|
|
5601
|
-
var
|
|
5602
|
-
var
|
|
5603
|
-
var computer_20250124InputSchema = (0,
|
|
5604
|
-
() => (0,
|
|
5605
|
-
|
|
5606
|
-
action:
|
|
5954
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
5955
|
+
var import_v418 = require("zod/v4");
|
|
5956
|
+
var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
5957
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
5958
|
+
import_v418.z.object({
|
|
5959
|
+
action: import_v418.z.enum([
|
|
5607
5960
|
"key",
|
|
5608
5961
|
"hold_key",
|
|
5609
5962
|
"type",
|
|
@@ -5621,27 +5974,27 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
5621
5974
|
"wait",
|
|
5622
5975
|
"screenshot"
|
|
5623
5976
|
]),
|
|
5624
|
-
coordinate:
|
|
5625
|
-
duration:
|
|
5626
|
-
scroll_amount:
|
|
5627
|
-
scroll_direction:
|
|
5628
|
-
start_coordinate:
|
|
5629
|
-
text:
|
|
5977
|
+
coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
5978
|
+
duration: import_v418.z.number().optional(),
|
|
5979
|
+
scroll_amount: import_v418.z.number().optional(),
|
|
5980
|
+
scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
|
|
5981
|
+
start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
5982
|
+
text: import_v418.z.string().optional()
|
|
5630
5983
|
})
|
|
5631
5984
|
)
|
|
5632
5985
|
);
|
|
5633
|
-
var computer_20250124 = (0,
|
|
5986
|
+
var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
5634
5987
|
id: "anthropic.computer_20250124",
|
|
5635
5988
|
inputSchema: computer_20250124InputSchema
|
|
5636
5989
|
});
|
|
5637
5990
|
|
|
5638
5991
|
// src/tool/computer_20251124.ts
|
|
5639
|
-
var
|
|
5640
|
-
var
|
|
5641
|
-
var computer_20251124InputSchema = (0,
|
|
5642
|
-
() => (0,
|
|
5643
|
-
|
|
5644
|
-
action:
|
|
5992
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
5993
|
+
var import_v419 = require("zod/v4");
|
|
5994
|
+
var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
5995
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
5996
|
+
import_v419.z.object({
|
|
5997
|
+
action: import_v419.z.enum([
|
|
5645
5998
|
"key",
|
|
5646
5999
|
"hold_key",
|
|
5647
6000
|
"type",
|
|
@@ -5660,97 +6013,75 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
5660
6013
|
"screenshot",
|
|
5661
6014
|
"zoom"
|
|
5662
6015
|
]),
|
|
5663
|
-
coordinate:
|
|
5664
|
-
duration:
|
|
5665
|
-
region:
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
6016
|
+
coordinate: import_v419.z.tuple([import_v419.z.number().int(), import_v419.z.number().int()]).optional(),
|
|
6017
|
+
duration: import_v419.z.number().optional(),
|
|
6018
|
+
region: import_v419.z.tuple([
|
|
6019
|
+
import_v419.z.number().int(),
|
|
6020
|
+
import_v419.z.number().int(),
|
|
6021
|
+
import_v419.z.number().int(),
|
|
6022
|
+
import_v419.z.number().int()
|
|
5670
6023
|
]).optional(),
|
|
5671
|
-
scroll_amount:
|
|
5672
|
-
scroll_direction:
|
|
5673
|
-
start_coordinate:
|
|
5674
|
-
text:
|
|
6024
|
+
scroll_amount: import_v419.z.number().optional(),
|
|
6025
|
+
scroll_direction: import_v419.z.enum(["up", "down", "left", "right"]).optional(),
|
|
6026
|
+
start_coordinate: import_v419.z.tuple([import_v419.z.number().int(), import_v419.z.number().int()]).optional(),
|
|
6027
|
+
text: import_v419.z.string().optional()
|
|
5675
6028
|
})
|
|
5676
6029
|
)
|
|
5677
6030
|
);
|
|
5678
|
-
var computer_20251124 = (0,
|
|
6031
|
+
var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
5679
6032
|
id: "anthropic.computer_20251124",
|
|
5680
6033
|
inputSchema: computer_20251124InputSchema
|
|
5681
6034
|
});
|
|
5682
6035
|
|
|
5683
6036
|
// src/tool/memory_20250818.ts
|
|
5684
|
-
var
|
|
5685
|
-
var
|
|
5686
|
-
var memory_20250818InputSchema = (0,
|
|
5687
|
-
() => (0,
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
command:
|
|
5691
|
-
path:
|
|
5692
|
-
view_range:
|
|
6037
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
6038
|
+
var import_v420 = require("zod/v4");
|
|
6039
|
+
var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
6040
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
6041
|
+
import_v420.z.discriminatedUnion("command", [
|
|
6042
|
+
import_v420.z.object({
|
|
6043
|
+
command: import_v420.z.literal("view"),
|
|
6044
|
+
path: import_v420.z.string(),
|
|
6045
|
+
view_range: import_v420.z.tuple([import_v420.z.number(), import_v420.z.number()]).optional()
|
|
5693
6046
|
}),
|
|
5694
|
-
|
|
5695
|
-
command:
|
|
5696
|
-
path:
|
|
5697
|
-
file_text:
|
|
6047
|
+
import_v420.z.object({
|
|
6048
|
+
command: import_v420.z.literal("create"),
|
|
6049
|
+
path: import_v420.z.string(),
|
|
6050
|
+
file_text: import_v420.z.string()
|
|
5698
6051
|
}),
|
|
5699
|
-
|
|
5700
|
-
command:
|
|
5701
|
-
path:
|
|
5702
|
-
old_str:
|
|
5703
|
-
new_str:
|
|
6052
|
+
import_v420.z.object({
|
|
6053
|
+
command: import_v420.z.literal("str_replace"),
|
|
6054
|
+
path: import_v420.z.string(),
|
|
6055
|
+
old_str: import_v420.z.string(),
|
|
6056
|
+
new_str: import_v420.z.string()
|
|
5704
6057
|
}),
|
|
5705
|
-
|
|
5706
|
-
command:
|
|
5707
|
-
path:
|
|
5708
|
-
insert_line:
|
|
5709
|
-
insert_text:
|
|
6058
|
+
import_v420.z.object({
|
|
6059
|
+
command: import_v420.z.literal("insert"),
|
|
6060
|
+
path: import_v420.z.string(),
|
|
6061
|
+
insert_line: import_v420.z.number(),
|
|
6062
|
+
insert_text: import_v420.z.string()
|
|
5710
6063
|
}),
|
|
5711
|
-
|
|
5712
|
-
command:
|
|
5713
|
-
path:
|
|
6064
|
+
import_v420.z.object({
|
|
6065
|
+
command: import_v420.z.literal("delete"),
|
|
6066
|
+
path: import_v420.z.string()
|
|
5714
6067
|
}),
|
|
5715
|
-
|
|
5716
|
-
command:
|
|
5717
|
-
old_path:
|
|
5718
|
-
new_path:
|
|
6068
|
+
import_v420.z.object({
|
|
6069
|
+
command: import_v420.z.literal("rename"),
|
|
6070
|
+
old_path: import_v420.z.string(),
|
|
6071
|
+
new_path: import_v420.z.string()
|
|
5719
6072
|
})
|
|
5720
6073
|
])
|
|
5721
6074
|
)
|
|
5722
6075
|
);
|
|
5723
|
-
var memory_20250818 = (0,
|
|
6076
|
+
var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
5724
6077
|
id: "anthropic.memory_20250818",
|
|
5725
6078
|
inputSchema: memory_20250818InputSchema
|
|
5726
6079
|
});
|
|
5727
6080
|
|
|
5728
6081
|
// src/tool/text-editor_20241022.ts
|
|
5729
|
-
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
5730
|
-
var import_v420 = require("zod/v4");
|
|
5731
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
5732
|
-
() => (0, import_provider_utils22.zodSchema)(
|
|
5733
|
-
import_v420.z.object({
|
|
5734
|
-
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5735
|
-
path: import_v420.z.string(),
|
|
5736
|
-
file_text: import_v420.z.string().optional(),
|
|
5737
|
-
insert_line: import_v420.z.number().int().optional(),
|
|
5738
|
-
new_str: import_v420.z.string().optional(),
|
|
5739
|
-
insert_text: import_v420.z.string().optional(),
|
|
5740
|
-
old_str: import_v420.z.string().optional(),
|
|
5741
|
-
view_range: import_v420.z.array(import_v420.z.number().int()).optional()
|
|
5742
|
-
})
|
|
5743
|
-
)
|
|
5744
|
-
);
|
|
5745
|
-
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
5746
|
-
id: "anthropic.text_editor_20241022",
|
|
5747
|
-
inputSchema: textEditor_20241022InputSchema
|
|
5748
|
-
});
|
|
5749
|
-
|
|
5750
|
-
// src/tool/text-editor_20250124.ts
|
|
5751
6082
|
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
5752
6083
|
var import_v421 = require("zod/v4");
|
|
5753
|
-
var
|
|
6084
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
5754
6085
|
() => (0, import_provider_utils23.zodSchema)(
|
|
5755
6086
|
import_v421.z.object({
|
|
5756
6087
|
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -5764,18 +6095,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
5764
6095
|
})
|
|
5765
6096
|
)
|
|
5766
6097
|
);
|
|
5767
|
-
var
|
|
5768
|
-
id: "anthropic.
|
|
5769
|
-
inputSchema:
|
|
6098
|
+
var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
6099
|
+
id: "anthropic.text_editor_20241022",
|
|
6100
|
+
inputSchema: textEditor_20241022InputSchema
|
|
5770
6101
|
});
|
|
5771
6102
|
|
|
5772
|
-
// src/tool/text-
|
|
6103
|
+
// src/tool/text-editor_20250124.ts
|
|
5773
6104
|
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
5774
6105
|
var import_v422 = require("zod/v4");
|
|
5775
|
-
var
|
|
6106
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
5776
6107
|
() => (0, import_provider_utils24.zodSchema)(
|
|
5777
6108
|
import_v422.z.object({
|
|
5778
|
-
command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6109
|
+
command: import_v422.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5779
6110
|
path: import_v422.z.string(),
|
|
5780
6111
|
file_text: import_v422.z.string().optional(),
|
|
5781
6112
|
insert_line: import_v422.z.number().int().optional(),
|
|
@@ -5786,40 +6117,62 @@ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
5786
6117
|
})
|
|
5787
6118
|
)
|
|
5788
6119
|
);
|
|
5789
|
-
var
|
|
5790
|
-
id: "anthropic.
|
|
5791
|
-
inputSchema:
|
|
6120
|
+
var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
6121
|
+
id: "anthropic.text_editor_20250124",
|
|
6122
|
+
inputSchema: textEditor_20250124InputSchema
|
|
5792
6123
|
});
|
|
5793
6124
|
|
|
5794
|
-
// src/tool/
|
|
6125
|
+
// src/tool/text-editor_20250429.ts
|
|
5795
6126
|
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
5796
6127
|
var import_v423 = require("zod/v4");
|
|
5797
|
-
var
|
|
6128
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
5798
6129
|
() => (0, import_provider_utils25.zodSchema)(
|
|
5799
|
-
import_v423.z.
|
|
5800
|
-
import_v423.z.
|
|
5801
|
-
|
|
5802
|
-
|
|
6130
|
+
import_v423.z.object({
|
|
6131
|
+
command: import_v423.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6132
|
+
path: import_v423.z.string(),
|
|
6133
|
+
file_text: import_v423.z.string().optional(),
|
|
6134
|
+
insert_line: import_v423.z.number().int().optional(),
|
|
6135
|
+
new_str: import_v423.z.string().optional(),
|
|
6136
|
+
insert_text: import_v423.z.string().optional(),
|
|
6137
|
+
old_str: import_v423.z.string().optional(),
|
|
6138
|
+
view_range: import_v423.z.array(import_v423.z.number().int()).optional()
|
|
6139
|
+
})
|
|
6140
|
+
)
|
|
6141
|
+
);
|
|
6142
|
+
var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
6143
|
+
id: "anthropic.text_editor_20250429",
|
|
6144
|
+
inputSchema: textEditor_20250429InputSchema
|
|
6145
|
+
});
|
|
6146
|
+
|
|
6147
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
6148
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
6149
|
+
var import_v424 = require("zod/v4");
|
|
6150
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6151
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6152
|
+
import_v424.z.array(
|
|
6153
|
+
import_v424.z.object({
|
|
6154
|
+
type: import_v424.z.literal("tool_reference"),
|
|
6155
|
+
toolName: import_v424.z.string()
|
|
5803
6156
|
})
|
|
5804
6157
|
)
|
|
5805
6158
|
)
|
|
5806
6159
|
);
|
|
5807
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
5808
|
-
() => (0,
|
|
5809
|
-
|
|
6160
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6161
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6162
|
+
import_v424.z.object({
|
|
5810
6163
|
/**
|
|
5811
6164
|
* A natural language query to search for tools.
|
|
5812
6165
|
* Claude will use BM25 text search to find relevant tools.
|
|
5813
6166
|
*/
|
|
5814
|
-
query:
|
|
6167
|
+
query: import_v424.z.string(),
|
|
5815
6168
|
/**
|
|
5816
6169
|
* Maximum number of tools to return. Optional.
|
|
5817
6170
|
*/
|
|
5818
|
-
limit:
|
|
6171
|
+
limit: import_v424.z.number().optional()
|
|
5819
6172
|
})
|
|
5820
6173
|
)
|
|
5821
6174
|
);
|
|
5822
|
-
var factory11 = (0,
|
|
6175
|
+
var factory11 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
5823
6176
|
id: "anthropic.tool_search_bm25_20251119",
|
|
5824
6177
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
5825
6178
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5945,6 +6298,29 @@ var anthropicTools = {
|
|
|
5945
6298
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
5946
6299
|
*/
|
|
5947
6300
|
computer_20251124,
|
|
6301
|
+
/**
|
|
6302
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
6303
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
6304
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
6305
|
+
*
|
|
6306
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
6307
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
6308
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
6309
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
6310
|
+
* in one turn.
|
|
6311
|
+
*
|
|
6312
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
6313
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
6314
|
+
*
|
|
6315
|
+
* Does not require a beta header.
|
|
6316
|
+
*
|
|
6317
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
6318
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
6319
|
+
*
|
|
6320
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
6321
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
6322
|
+
*/
|
|
6323
|
+
computerToolset_20260801,
|
|
5948
6324
|
/**
|
|
5949
6325
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
5950
6326
|
* Claude can create, read, update, and delete files that persist between sessions,
|