@ai-sdk/anthropic 3.0.119 → 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 +12 -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 +1 -1
- 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.mjs
CHANGED
|
@@ -126,7 +126,9 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
126
126
|
name: z2.string(),
|
|
127
127
|
input: z2.unknown(),
|
|
128
128
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
129
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
129
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
130
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
131
|
+
toolset_name: z2.string().nullish()
|
|
130
132
|
}),
|
|
131
133
|
z2.object({
|
|
132
134
|
type: z2.literal("server_tool_use"),
|
|
@@ -427,7 +429,8 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
427
429
|
id: z2.string(),
|
|
428
430
|
name: z2.string(),
|
|
429
431
|
input: z2.unknown(),
|
|
430
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
432
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
433
|
+
toolset_name: z2.string().nullish()
|
|
431
434
|
})
|
|
432
435
|
])
|
|
433
436
|
).nullish(),
|
|
@@ -458,7 +461,9 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
458
461
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
459
462
|
input: z2.record(z2.string(), z2.unknown()).optional(),
|
|
460
463
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
461
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
464
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
465
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
466
|
+
toolset_name: z2.string().nullish()
|
|
462
467
|
}),
|
|
463
468
|
z2.object({
|
|
464
469
|
type: z2.literal("redacted_thinking"),
|
|
@@ -869,7 +874,7 @@ var anthropicSystemMessageProviderOptions = z3.object({
|
|
|
869
874
|
* Overrides the effort level for the turn following this
|
|
870
875
|
* mid-conversation system message.
|
|
871
876
|
*
|
|
872
|
-
* Requires the `mid-conversation-
|
|
877
|
+
* Requires the `mid-conversation-output-config-2026-07-01` beta,
|
|
873
878
|
* which is added automatically.
|
|
874
879
|
*/
|
|
875
880
|
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
@@ -923,6 +928,11 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
923
928
|
*
|
|
924
929
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
925
930
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
931
|
+
*
|
|
932
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
933
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
934
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
935
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
926
936
|
*/
|
|
927
937
|
thinking: z3.union([
|
|
928
938
|
z3.discriminatedUnion("type", [
|
|
@@ -1029,7 +1039,11 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
1029
1039
|
*/
|
|
1030
1040
|
toolStreaming: z3.boolean().optional(),
|
|
1031
1041
|
/**
|
|
1032
|
-
*
|
|
1042
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1043
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1044
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1045
|
+
*
|
|
1046
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1033
1047
|
*/
|
|
1034
1048
|
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1035
1049
|
/**
|
|
@@ -1240,103 +1254,114 @@ var advisor_20260301 = (args) => {
|
|
|
1240
1254
|
return factory(args);
|
|
1241
1255
|
};
|
|
1242
1256
|
|
|
1243
|
-
// src/tool/
|
|
1257
|
+
// src/tool/computer-toolset_20260801.ts
|
|
1244
1258
|
import {
|
|
1245
1259
|
createProviderToolFactory,
|
|
1246
1260
|
lazySchema as lazySchema4,
|
|
1247
1261
|
zodSchema as zodSchema4
|
|
1248
1262
|
} from "@ai-sdk/provider-utils";
|
|
1249
1263
|
import { z as z5 } from "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 = lazySchema4(
|
|
1251
1284
|
() => zodSchema4(
|
|
1252
1285
|
z5.object({
|
|
1253
|
-
|
|
1286
|
+
action: z5.enum(computerToolset_20260801Members),
|
|
1287
|
+
coordinate: z5.tuple([z5.number().int(), z5.number().int()]).optional(),
|
|
1288
|
+
duration: z5.number().optional(),
|
|
1289
|
+
region: z5.tuple([
|
|
1290
|
+
z5.number().int(),
|
|
1291
|
+
z5.number().int(),
|
|
1292
|
+
z5.number().int(),
|
|
1293
|
+
z5.number().int()
|
|
1294
|
+
]).optional(),
|
|
1295
|
+
repeat: z5.number().int().optional(),
|
|
1296
|
+
scroll_amount: z5.number().optional(),
|
|
1297
|
+
scroll_direction: z5.enum(["up", "down", "left", "right"]).optional(),
|
|
1298
|
+
start_coordinate: z5.tuple([z5.number().int(), z5.number().int()]).optional(),
|
|
1299
|
+
text: z5.string().optional()
|
|
1254
1300
|
})
|
|
1255
1301
|
)
|
|
1256
1302
|
);
|
|
1257
|
-
var
|
|
1303
|
+
var computerToolset_20260801ArgsSchema = lazySchema4(
|
|
1258
1304
|
() => zodSchema4(
|
|
1259
1305
|
z5.object({
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
view_range: z5.array(z5.number().int()).optional()
|
|
1306
|
+
configs: z5.partialRecord(
|
|
1307
|
+
z5.enum(computerToolset_20260801Members),
|
|
1308
|
+
z5.object({
|
|
1309
|
+
enabled: z5.boolean().optional(),
|
|
1310
|
+
deferLoading: z5.boolean().optional()
|
|
1311
|
+
})
|
|
1312
|
+
).optional()
|
|
1268
1313
|
})
|
|
1269
1314
|
)
|
|
1270
1315
|
);
|
|
1271
|
-
var
|
|
1272
|
-
id: "anthropic.
|
|
1273
|
-
inputSchema:
|
|
1316
|
+
var computerToolset_20260801 = 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
|
import {
|
|
1281
|
-
|
|
1323
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
1282
1324
|
lazySchema as lazySchema5,
|
|
1283
1325
|
zodSchema as zodSchema5
|
|
1284
1326
|
} from "@ai-sdk/provider-utils";
|
|
1285
1327
|
import { z as z6 } from "zod/v4";
|
|
1286
|
-
var
|
|
1328
|
+
var textEditor_20250728ArgsSchema = lazySchema5(
|
|
1287
1329
|
() => zodSchema5(
|
|
1288
1330
|
z6.object({
|
|
1289
|
-
|
|
1290
|
-
allowedDomains: z6.array(z6.string()).optional(),
|
|
1291
|
-
blockedDomains: z6.array(z6.string()).optional(),
|
|
1292
|
-
userLocation: z6.object({
|
|
1293
|
-
type: z6.literal("approximate"),
|
|
1294
|
-
city: z6.string().optional(),
|
|
1295
|
-
region: z6.string().optional(),
|
|
1296
|
-
country: z6.string().optional(),
|
|
1297
|
-
timezone: z6.string().optional()
|
|
1298
|
-
}).optional()
|
|
1331
|
+
maxCharacters: z6.number().optional()
|
|
1299
1332
|
})
|
|
1300
1333
|
)
|
|
1301
1334
|
);
|
|
1302
|
-
var
|
|
1303
|
-
() => zodSchema5(
|
|
1304
|
-
z6.array(
|
|
1305
|
-
z6.object({
|
|
1306
|
-
url: z6.string(),
|
|
1307
|
-
title: z6.string().nullable(),
|
|
1308
|
-
pageAge: z6.string().nullable(),
|
|
1309
|
-
encryptedContent: z6.string(),
|
|
1310
|
-
type: z6.literal("web_search_result")
|
|
1311
|
-
})
|
|
1312
|
-
)
|
|
1313
|
-
)
|
|
1314
|
-
);
|
|
1315
|
-
var webSearch_20260209InputSchema = lazySchema5(
|
|
1335
|
+
var textEditor_20250728InputSchema = lazySchema5(
|
|
1316
1336
|
() => zodSchema5(
|
|
1317
1337
|
z6.object({
|
|
1318
|
-
|
|
1338
|
+
command: z6.enum(["view", "create", "str_replace", "insert"]),
|
|
1339
|
+
path: z6.string(),
|
|
1340
|
+
file_text: z6.string().optional(),
|
|
1341
|
+
insert_line: z6.number().int().optional(),
|
|
1342
|
+
new_str: z6.string().optional(),
|
|
1343
|
+
insert_text: z6.string().optional(),
|
|
1344
|
+
old_str: z6.string().optional(),
|
|
1345
|
+
view_range: z6.array(z6.number().int()).optional()
|
|
1319
1346
|
})
|
|
1320
1347
|
)
|
|
1321
1348
|
);
|
|
1322
|
-
var
|
|
1323
|
-
id: "anthropic.
|
|
1324
|
-
inputSchema:
|
|
1325
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1326
|
-
supportsDeferredResults: true
|
|
1349
|
+
var factory2 = createProviderToolFactory2({
|
|
1350
|
+
id: "anthropic.text_editor_20250728",
|
|
1351
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1327
1352
|
});
|
|
1328
|
-
var
|
|
1329
|
-
return
|
|
1353
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1354
|
+
return factory2(args);
|
|
1330
1355
|
};
|
|
1331
1356
|
|
|
1332
|
-
// src/tool/web-
|
|
1357
|
+
// src/tool/web-search_20260209.ts
|
|
1333
1358
|
import {
|
|
1334
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1359
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1335
1360
|
lazySchema as lazySchema6,
|
|
1336
1361
|
zodSchema as zodSchema6
|
|
1337
1362
|
} from "@ai-sdk/provider-utils";
|
|
1338
1363
|
import { z as z7 } from "zod/v4";
|
|
1339
|
-
var
|
|
1364
|
+
var webSearch_20260209ArgsSchema = lazySchema6(
|
|
1340
1365
|
() => zodSchema6(
|
|
1341
1366
|
z7.object({
|
|
1342
1367
|
maxUses: z7.number().optional(),
|
|
@@ -1352,7 +1377,7 @@ var webSearch_20250305ArgsSchema = lazySchema6(
|
|
|
1352
1377
|
})
|
|
1353
1378
|
)
|
|
1354
1379
|
);
|
|
1355
|
-
var
|
|
1380
|
+
var webSearch_20260209OutputSchema = lazySchema6(
|
|
1356
1381
|
() => zodSchema6(
|
|
1357
1382
|
z7.array(
|
|
1358
1383
|
z7.object({
|
|
@@ -1365,92 +1390,84 @@ var webSearch_20250305OutputSchema = lazySchema6(
|
|
|
1365
1390
|
)
|
|
1366
1391
|
)
|
|
1367
1392
|
);
|
|
1368
|
-
var
|
|
1393
|
+
var webSearch_20260209InputSchema = lazySchema6(
|
|
1369
1394
|
() => zodSchema6(
|
|
1370
1395
|
z7.object({
|
|
1371
1396
|
query: z7.string()
|
|
1372
1397
|
})
|
|
1373
1398
|
)
|
|
1374
1399
|
);
|
|
1375
|
-
var
|
|
1376
|
-
id: "anthropic.
|
|
1377
|
-
inputSchema:
|
|
1378
|
-
outputSchema:
|
|
1400
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1401
|
+
id: "anthropic.web_search_20260209",
|
|
1402
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1403
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1379
1404
|
supportsDeferredResults: true
|
|
1380
1405
|
});
|
|
1381
|
-
var
|
|
1382
|
-
return
|
|
1406
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1407
|
+
return factory3(args);
|
|
1383
1408
|
};
|
|
1384
1409
|
|
|
1385
|
-
// src/tool/web-
|
|
1410
|
+
// src/tool/web-search_20250305.ts
|
|
1386
1411
|
import {
|
|
1387
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1412
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1388
1413
|
lazySchema as lazySchema7,
|
|
1389
1414
|
zodSchema as zodSchema7
|
|
1390
1415
|
} from "@ai-sdk/provider-utils";
|
|
1391
1416
|
import { z as z8 } from "zod/v4";
|
|
1392
|
-
var
|
|
1417
|
+
var webSearch_20250305ArgsSchema = lazySchema7(
|
|
1393
1418
|
() => zodSchema7(
|
|
1394
1419
|
z8.object({
|
|
1395
1420
|
maxUses: z8.number().optional(),
|
|
1396
1421
|
allowedDomains: z8.array(z8.string()).optional(),
|
|
1397
1422
|
blockedDomains: z8.array(z8.string()).optional(),
|
|
1398
|
-
|
|
1399
|
-
|
|
1423
|
+
userLocation: z8.object({
|
|
1424
|
+
type: z8.literal("approximate"),
|
|
1425
|
+
city: z8.string().optional(),
|
|
1426
|
+
region: z8.string().optional(),
|
|
1427
|
+
country: z8.string().optional(),
|
|
1428
|
+
timezone: z8.string().optional()
|
|
1429
|
+
}).optional()
|
|
1400
1430
|
})
|
|
1401
1431
|
)
|
|
1402
1432
|
);
|
|
1403
|
-
var
|
|
1433
|
+
var webSearch_20250305OutputSchema = lazySchema7(
|
|
1404
1434
|
() => zodSchema7(
|
|
1405
|
-
z8.
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
content: z8.object({
|
|
1409
|
-
type: z8.literal("document"),
|
|
1435
|
+
z8.array(
|
|
1436
|
+
z8.object({
|
|
1437
|
+
url: z8.string(),
|
|
1410
1438
|
title: z8.string().nullable(),
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
data: z8.string()
|
|
1417
|
-
}),
|
|
1418
|
-
z8.object({
|
|
1419
|
-
type: z8.literal("text"),
|
|
1420
|
-
mediaType: z8.literal("text/plain"),
|
|
1421
|
-
data: z8.string()
|
|
1422
|
-
})
|
|
1423
|
-
])
|
|
1424
|
-
}),
|
|
1425
|
-
retrievedAt: z8.string().nullable()
|
|
1426
|
-
})
|
|
1439
|
+
pageAge: z8.string().nullable(),
|
|
1440
|
+
encryptedContent: z8.string(),
|
|
1441
|
+
type: z8.literal("web_search_result")
|
|
1442
|
+
})
|
|
1443
|
+
)
|
|
1427
1444
|
)
|
|
1428
1445
|
);
|
|
1429
|
-
var
|
|
1446
|
+
var webSearch_20250305InputSchema = lazySchema7(
|
|
1430
1447
|
() => zodSchema7(
|
|
1431
1448
|
z8.object({
|
|
1432
|
-
|
|
1449
|
+
query: z8.string()
|
|
1433
1450
|
})
|
|
1434
1451
|
)
|
|
1435
1452
|
);
|
|
1436
|
-
var
|
|
1437
|
-
id: "anthropic.
|
|
1438
|
-
inputSchema:
|
|
1439
|
-
outputSchema:
|
|
1453
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1454
|
+
id: "anthropic.web_search_20250305",
|
|
1455
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1456
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1440
1457
|
supportsDeferredResults: true
|
|
1441
1458
|
});
|
|
1442
|
-
var
|
|
1443
|
-
return
|
|
1459
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1460
|
+
return factory4(args);
|
|
1444
1461
|
};
|
|
1445
1462
|
|
|
1446
|
-
// src/tool/web-fetch-
|
|
1463
|
+
// src/tool/web-fetch-20260209.ts
|
|
1447
1464
|
import {
|
|
1448
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1465
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1449
1466
|
lazySchema as lazySchema8,
|
|
1450
1467
|
zodSchema as zodSchema8
|
|
1451
1468
|
} from "@ai-sdk/provider-utils";
|
|
1452
1469
|
import { z as z9 } from "zod/v4";
|
|
1453
|
-
var
|
|
1470
|
+
var webFetch_20260209ArgsSchema = lazySchema8(
|
|
1454
1471
|
() => zodSchema8(
|
|
1455
1472
|
z9.object({
|
|
1456
1473
|
maxUses: z9.number().optional(),
|
|
@@ -1461,7 +1478,7 @@ var webFetch_20250910ArgsSchema = lazySchema8(
|
|
|
1461
1478
|
})
|
|
1462
1479
|
)
|
|
1463
1480
|
);
|
|
1464
|
-
var
|
|
1481
|
+
var webFetch_20260209OutputSchema = lazySchema8(
|
|
1465
1482
|
() => zodSchema8(
|
|
1466
1483
|
z9.object({
|
|
1467
1484
|
type: z9.literal("web_fetch_result"),
|
|
@@ -1487,13 +1504,74 @@ var webFetch_20250910OutputSchema = lazySchema8(
|
|
|
1487
1504
|
})
|
|
1488
1505
|
)
|
|
1489
1506
|
);
|
|
1490
|
-
var
|
|
1507
|
+
var webFetch_20260209InputSchema = lazySchema8(
|
|
1491
1508
|
() => zodSchema8(
|
|
1492
1509
|
z9.object({
|
|
1493
1510
|
url: z9.string()
|
|
1494
1511
|
})
|
|
1495
1512
|
)
|
|
1496
1513
|
);
|
|
1514
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1515
|
+
id: "anthropic.web_fetch_20260209",
|
|
1516
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1517
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1518
|
+
supportsDeferredResults: true
|
|
1519
|
+
});
|
|
1520
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1521
|
+
return factory5(args);
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
// src/tool/web-fetch-20250910.ts
|
|
1525
|
+
import {
|
|
1526
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1527
|
+
lazySchema as lazySchema9,
|
|
1528
|
+
zodSchema as zodSchema9
|
|
1529
|
+
} from "@ai-sdk/provider-utils";
|
|
1530
|
+
import { z as z10 } from "zod/v4";
|
|
1531
|
+
var webFetch_20250910ArgsSchema = lazySchema9(
|
|
1532
|
+
() => zodSchema9(
|
|
1533
|
+
z10.object({
|
|
1534
|
+
maxUses: z10.number().optional(),
|
|
1535
|
+
allowedDomains: z10.array(z10.string()).optional(),
|
|
1536
|
+
blockedDomains: z10.array(z10.string()).optional(),
|
|
1537
|
+
citations: z10.object({ enabled: z10.boolean() }).optional(),
|
|
1538
|
+
maxContentTokens: z10.number().optional()
|
|
1539
|
+
})
|
|
1540
|
+
)
|
|
1541
|
+
);
|
|
1542
|
+
var webFetch_20250910OutputSchema = lazySchema9(
|
|
1543
|
+
() => zodSchema9(
|
|
1544
|
+
z10.object({
|
|
1545
|
+
type: z10.literal("web_fetch_result"),
|
|
1546
|
+
url: z10.string(),
|
|
1547
|
+
content: z10.object({
|
|
1548
|
+
type: z10.literal("document"),
|
|
1549
|
+
title: z10.string().nullable(),
|
|
1550
|
+
citations: z10.object({ enabled: z10.boolean() }).optional(),
|
|
1551
|
+
source: z10.union([
|
|
1552
|
+
z10.object({
|
|
1553
|
+
type: z10.literal("base64"),
|
|
1554
|
+
mediaType: z10.literal("application/pdf"),
|
|
1555
|
+
data: z10.string()
|
|
1556
|
+
}),
|
|
1557
|
+
z10.object({
|
|
1558
|
+
type: z10.literal("text"),
|
|
1559
|
+
mediaType: z10.literal("text/plain"),
|
|
1560
|
+
data: z10.string()
|
|
1561
|
+
})
|
|
1562
|
+
])
|
|
1563
|
+
}),
|
|
1564
|
+
retrievedAt: z10.string().nullable()
|
|
1565
|
+
})
|
|
1566
|
+
)
|
|
1567
|
+
);
|
|
1568
|
+
var webFetch_20250910InputSchema = lazySchema9(
|
|
1569
|
+
() => zodSchema9(
|
|
1570
|
+
z10.object({
|
|
1571
|
+
url: z10.string()
|
|
1572
|
+
})
|
|
1573
|
+
)
|
|
1574
|
+
);
|
|
1497
1575
|
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1498
1576
|
id: "anthropic.web_fetch_20250910",
|
|
1499
1577
|
inputSchema: webFetch_20250910InputSchema,
|
|
@@ -1513,7 +1591,8 @@ async function prepareTools({
|
|
|
1513
1591
|
cacheControlValidator,
|
|
1514
1592
|
supportsStructuredOutput,
|
|
1515
1593
|
supportsStrictTools,
|
|
1516
|
-
defaultEagerInputStreaming = false
|
|
1594
|
+
defaultEagerInputStreaming = false,
|
|
1595
|
+
rejectsForcedToolUse = false
|
|
1517
1596
|
}) {
|
|
1518
1597
|
var _a, _b;
|
|
1519
1598
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1616,6 +1695,31 @@ async function prepareTools({
|
|
|
1616
1695
|
});
|
|
1617
1696
|
break;
|
|
1618
1697
|
}
|
|
1698
|
+
case "anthropic.computer_toolset_20260801": {
|
|
1699
|
+
const args = await validateTypes({
|
|
1700
|
+
value: tool.args,
|
|
1701
|
+
schema: computerToolset_20260801ArgsSchema
|
|
1702
|
+
});
|
|
1703
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
1704
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
1705
|
+
member,
|
|
1706
|
+
{
|
|
1707
|
+
...(config == null ? void 0 : config.enabled) != null && {
|
|
1708
|
+
enabled: config.enabled
|
|
1709
|
+
},
|
|
1710
|
+
...(config == null ? void 0 : config.deferLoading) != null && {
|
|
1711
|
+
defer_loading: config.deferLoading
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
])
|
|
1715
|
+
) : void 0;
|
|
1716
|
+
anthropicTools2.push({
|
|
1717
|
+
type: "computer_toolset_20260801",
|
|
1718
|
+
...configs != null && { configs },
|
|
1719
|
+
cache_control: void 0
|
|
1720
|
+
});
|
|
1721
|
+
break;
|
|
1722
|
+
}
|
|
1619
1723
|
case "anthropic.computer_20241022": {
|
|
1620
1724
|
betas.add("computer-use-2024-10-22");
|
|
1621
1725
|
anthropicTools2.push({
|
|
@@ -1832,6 +1936,22 @@ async function prepareTools({
|
|
|
1832
1936
|
betas
|
|
1833
1937
|
};
|
|
1834
1938
|
case "required":
|
|
1939
|
+
if (rejectsForcedToolUse) {
|
|
1940
|
+
toolWarnings.push({
|
|
1941
|
+
type: "unsupported",
|
|
1942
|
+
feature: "toolChoice",
|
|
1943
|
+
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.`
|
|
1944
|
+
});
|
|
1945
|
+
return {
|
|
1946
|
+
tools: anthropicTools2,
|
|
1947
|
+
toolChoice: {
|
|
1948
|
+
type: "auto",
|
|
1949
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1950
|
+
},
|
|
1951
|
+
toolWarnings,
|
|
1952
|
+
betas
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1835
1955
|
return {
|
|
1836
1956
|
tools: anthropicTools2,
|
|
1837
1957
|
toolChoice: {
|
|
@@ -1844,6 +1964,24 @@ async function prepareTools({
|
|
|
1844
1964
|
case "none":
|
|
1845
1965
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1846
1966
|
case "tool":
|
|
1967
|
+
if (rejectsForcedToolUse) {
|
|
1968
|
+
toolWarnings.push({
|
|
1969
|
+
type: "unsupported",
|
|
1970
|
+
feature: "toolChoice",
|
|
1971
|
+
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.`
|
|
1972
|
+
});
|
|
1973
|
+
return {
|
|
1974
|
+
tools: anthropicTools2.filter(
|
|
1975
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
1976
|
+
),
|
|
1977
|
+
toolChoice: {
|
|
1978
|
+
type: "auto",
|
|
1979
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1980
|
+
},
|
|
1981
|
+
toolWarnings,
|
|
1982
|
+
betas
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1847
1985
|
return {
|
|
1848
1986
|
tools: anthropicTools2,
|
|
1849
1987
|
toolChoice: {
|
|
@@ -1932,30 +2070,30 @@ import {
|
|
|
1932
2070
|
// src/tool/code-execution_20250522.ts
|
|
1933
2071
|
import {
|
|
1934
2072
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1935
|
-
lazySchema as
|
|
1936
|
-
zodSchema as
|
|
2073
|
+
lazySchema as lazySchema10,
|
|
2074
|
+
zodSchema as zodSchema10
|
|
1937
2075
|
} from "@ai-sdk/provider-utils";
|
|
1938
|
-
import { z as
|
|
1939
|
-
var codeExecution_20250522OutputSchema =
|
|
1940
|
-
() =>
|
|
1941
|
-
|
|
1942
|
-
type:
|
|
1943
|
-
stdout:
|
|
1944
|
-
stderr:
|
|
1945
|
-
return_code:
|
|
1946
|
-
content:
|
|
1947
|
-
|
|
1948
|
-
type:
|
|
1949
|
-
file_id:
|
|
2076
|
+
import { z as z11 } from "zod/v4";
|
|
2077
|
+
var codeExecution_20250522OutputSchema = lazySchema10(
|
|
2078
|
+
() => zodSchema10(
|
|
2079
|
+
z11.object({
|
|
2080
|
+
type: z11.literal("code_execution_result"),
|
|
2081
|
+
stdout: z11.string(),
|
|
2082
|
+
stderr: z11.string(),
|
|
2083
|
+
return_code: z11.number(),
|
|
2084
|
+
content: z11.array(
|
|
2085
|
+
z11.object({
|
|
2086
|
+
type: z11.literal("code_execution_output"),
|
|
2087
|
+
file_id: z11.string()
|
|
1950
2088
|
})
|
|
1951
2089
|
).optional().default([])
|
|
1952
2090
|
})
|
|
1953
2091
|
)
|
|
1954
2092
|
);
|
|
1955
|
-
var codeExecution_20250522InputSchema =
|
|
1956
|
-
() =>
|
|
1957
|
-
|
|
1958
|
-
code:
|
|
2093
|
+
var codeExecution_20250522InputSchema = lazySchema10(
|
|
2094
|
+
() => zodSchema10(
|
|
2095
|
+
z11.object({
|
|
2096
|
+
code: z11.string()
|
|
1959
2097
|
})
|
|
1960
2098
|
)
|
|
1961
2099
|
);
|
|
@@ -1971,124 +2109,11 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1971
2109
|
// src/tool/code-execution_20250825.ts
|
|
1972
2110
|
import {
|
|
1973
2111
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1974
|
-
lazySchema as lazySchema10,
|
|
1975
|
-
zodSchema as zodSchema10
|
|
1976
|
-
} from "@ai-sdk/provider-utils";
|
|
1977
|
-
import { z as z11 } from "zod/v4";
|
|
1978
|
-
var codeExecution_20250825OutputSchema = lazySchema10(
|
|
1979
|
-
() => zodSchema10(
|
|
1980
|
-
z11.discriminatedUnion("type", [
|
|
1981
|
-
z11.object({
|
|
1982
|
-
type: z11.literal("code_execution_result"),
|
|
1983
|
-
stdout: z11.string(),
|
|
1984
|
-
stderr: z11.string(),
|
|
1985
|
-
return_code: z11.number(),
|
|
1986
|
-
content: z11.array(
|
|
1987
|
-
z11.object({
|
|
1988
|
-
type: z11.literal("code_execution_output"),
|
|
1989
|
-
file_id: z11.string()
|
|
1990
|
-
})
|
|
1991
|
-
).optional().default([])
|
|
1992
|
-
}),
|
|
1993
|
-
z11.object({
|
|
1994
|
-
type: z11.literal("bash_code_execution_result"),
|
|
1995
|
-
content: z11.array(
|
|
1996
|
-
z11.object({
|
|
1997
|
-
type: z11.literal("bash_code_execution_output"),
|
|
1998
|
-
file_id: z11.string()
|
|
1999
|
-
})
|
|
2000
|
-
),
|
|
2001
|
-
stdout: z11.string(),
|
|
2002
|
-
stderr: z11.string(),
|
|
2003
|
-
return_code: z11.number()
|
|
2004
|
-
}),
|
|
2005
|
-
z11.object({
|
|
2006
|
-
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
2007
|
-
error_code: z11.string()
|
|
2008
|
-
}),
|
|
2009
|
-
z11.object({
|
|
2010
|
-
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
2011
|
-
error_code: z11.string()
|
|
2012
|
-
}),
|
|
2013
|
-
z11.object({
|
|
2014
|
-
type: z11.literal("text_editor_code_execution_view_result"),
|
|
2015
|
-
content: z11.string(),
|
|
2016
|
-
file_type: z11.string(),
|
|
2017
|
-
num_lines: z11.number().nullable(),
|
|
2018
|
-
start_line: z11.number().nullable(),
|
|
2019
|
-
total_lines: z11.number().nullable()
|
|
2020
|
-
}),
|
|
2021
|
-
z11.object({
|
|
2022
|
-
type: z11.literal("text_editor_code_execution_create_result"),
|
|
2023
|
-
is_file_update: z11.boolean()
|
|
2024
|
-
}),
|
|
2025
|
-
z11.object({
|
|
2026
|
-
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
2027
|
-
lines: z11.array(z11.string()).nullable(),
|
|
2028
|
-
new_lines: z11.number().nullable(),
|
|
2029
|
-
new_start: z11.number().nullable(),
|
|
2030
|
-
old_lines: z11.number().nullable(),
|
|
2031
|
-
old_start: z11.number().nullable()
|
|
2032
|
-
})
|
|
2033
|
-
])
|
|
2034
|
-
)
|
|
2035
|
-
);
|
|
2036
|
-
var codeExecution_20250825InputSchema = lazySchema10(
|
|
2037
|
-
() => zodSchema10(
|
|
2038
|
-
z11.discriminatedUnion("type", [
|
|
2039
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2040
|
-
z11.object({
|
|
2041
|
-
type: z11.literal("programmatic-tool-call"),
|
|
2042
|
-
code: z11.string()
|
|
2043
|
-
}),
|
|
2044
|
-
z11.object({
|
|
2045
|
-
type: z11.literal("bash_code_execution"),
|
|
2046
|
-
command: z11.string()
|
|
2047
|
-
}),
|
|
2048
|
-
z11.discriminatedUnion("command", [
|
|
2049
|
-
z11.object({
|
|
2050
|
-
type: z11.literal("text_editor_code_execution"),
|
|
2051
|
-
command: z11.literal("view"),
|
|
2052
|
-
path: z11.string()
|
|
2053
|
-
}),
|
|
2054
|
-
z11.object({
|
|
2055
|
-
type: z11.literal("text_editor_code_execution"),
|
|
2056
|
-
command: z11.literal("create"),
|
|
2057
|
-
path: z11.string(),
|
|
2058
|
-
file_text: z11.string().nullish()
|
|
2059
|
-
}),
|
|
2060
|
-
z11.object({
|
|
2061
|
-
type: z11.literal("text_editor_code_execution"),
|
|
2062
|
-
command: z11.literal("str_replace"),
|
|
2063
|
-
path: z11.string(),
|
|
2064
|
-
old_str: z11.string(),
|
|
2065
|
-
new_str: z11.string()
|
|
2066
|
-
})
|
|
2067
|
-
])
|
|
2068
|
-
])
|
|
2069
|
-
)
|
|
2070
|
-
);
|
|
2071
|
-
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
2072
|
-
id: "anthropic.code_execution_20250825",
|
|
2073
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
2074
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
2075
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
2076
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
2077
|
-
// resolved before the code execution result can be returned.
|
|
2078
|
-
supportsDeferredResults: true
|
|
2079
|
-
});
|
|
2080
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
2081
|
-
return factory8(args);
|
|
2082
|
-
};
|
|
2083
|
-
|
|
2084
|
-
// src/tool/code-execution_20260120.ts
|
|
2085
|
-
import {
|
|
2086
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2087
2112
|
lazySchema as lazySchema11,
|
|
2088
2113
|
zodSchema as zodSchema11
|
|
2089
2114
|
} from "@ai-sdk/provider-utils";
|
|
2090
2115
|
import { z as z12 } from "zod/v4";
|
|
2091
|
-
var
|
|
2116
|
+
var codeExecution_20250825OutputSchema = lazySchema11(
|
|
2092
2117
|
() => zodSchema11(
|
|
2093
2118
|
z12.discriminatedUnion("type", [
|
|
2094
2119
|
z12.object({
|
|
@@ -2103,18 +2128,6 @@ var codeExecution_20260120OutputSchema = lazySchema11(
|
|
|
2103
2128
|
})
|
|
2104
2129
|
).optional().default([])
|
|
2105
2130
|
}),
|
|
2106
|
-
z12.object({
|
|
2107
|
-
type: z12.literal("encrypted_code_execution_result"),
|
|
2108
|
-
encrypted_stdout: z12.string(),
|
|
2109
|
-
stderr: z12.string(),
|
|
2110
|
-
return_code: z12.number(),
|
|
2111
|
-
content: z12.array(
|
|
2112
|
-
z12.object({
|
|
2113
|
-
type: z12.literal("code_execution_output"),
|
|
2114
|
-
file_id: z12.string()
|
|
2115
|
-
})
|
|
2116
|
-
).optional().default([])
|
|
2117
|
-
}),
|
|
2118
2131
|
z12.object({
|
|
2119
2132
|
type: z12.literal("bash_code_execution_result"),
|
|
2120
2133
|
content: z12.array(
|
|
@@ -2158,9 +2171,10 @@ var codeExecution_20260120OutputSchema = lazySchema11(
|
|
|
2158
2171
|
])
|
|
2159
2172
|
)
|
|
2160
2173
|
);
|
|
2161
|
-
var
|
|
2174
|
+
var codeExecution_20250825InputSchema = lazySchema11(
|
|
2162
2175
|
() => zodSchema11(
|
|
2163
2176
|
z12.discriminatedUnion("type", [
|
|
2177
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2164
2178
|
z12.object({
|
|
2165
2179
|
type: z12.literal("programmatic-tool-call"),
|
|
2166
2180
|
code: z12.string()
|
|
@@ -2175,18 +2189,142 @@ var codeExecution_20260120InputSchema = lazySchema11(
|
|
|
2175
2189
|
command: z12.literal("view"),
|
|
2176
2190
|
path: z12.string()
|
|
2177
2191
|
}),
|
|
2178
|
-
z12.object({
|
|
2179
|
-
type: z12.literal("text_editor_code_execution"),
|
|
2180
|
-
command: z12.literal("create"),
|
|
2181
|
-
path: z12.string(),
|
|
2182
|
-
file_text: z12.string().nullish()
|
|
2192
|
+
z12.object({
|
|
2193
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2194
|
+
command: z12.literal("create"),
|
|
2195
|
+
path: z12.string(),
|
|
2196
|
+
file_text: z12.string().nullish()
|
|
2197
|
+
}),
|
|
2198
|
+
z12.object({
|
|
2199
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2200
|
+
command: z12.literal("str_replace"),
|
|
2201
|
+
path: z12.string(),
|
|
2202
|
+
old_str: z12.string(),
|
|
2203
|
+
new_str: z12.string()
|
|
2204
|
+
})
|
|
2205
|
+
])
|
|
2206
|
+
])
|
|
2207
|
+
)
|
|
2208
|
+
);
|
|
2209
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
2210
|
+
id: "anthropic.code_execution_20250825",
|
|
2211
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
2212
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
2213
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
2214
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
2215
|
+
// resolved before the code execution result can be returned.
|
|
2216
|
+
supportsDeferredResults: true
|
|
2217
|
+
});
|
|
2218
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
2219
|
+
return factory8(args);
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
// src/tool/code-execution_20260120.ts
|
|
2223
|
+
import {
|
|
2224
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2225
|
+
lazySchema as lazySchema12,
|
|
2226
|
+
zodSchema as zodSchema12
|
|
2227
|
+
} from "@ai-sdk/provider-utils";
|
|
2228
|
+
import { z as z13 } from "zod/v4";
|
|
2229
|
+
var codeExecution_20260120OutputSchema = lazySchema12(
|
|
2230
|
+
() => zodSchema12(
|
|
2231
|
+
z13.discriminatedUnion("type", [
|
|
2232
|
+
z13.object({
|
|
2233
|
+
type: z13.literal("code_execution_result"),
|
|
2234
|
+
stdout: z13.string(),
|
|
2235
|
+
stderr: z13.string(),
|
|
2236
|
+
return_code: z13.number(),
|
|
2237
|
+
content: z13.array(
|
|
2238
|
+
z13.object({
|
|
2239
|
+
type: z13.literal("code_execution_output"),
|
|
2240
|
+
file_id: z13.string()
|
|
2241
|
+
})
|
|
2242
|
+
).optional().default([])
|
|
2243
|
+
}),
|
|
2244
|
+
z13.object({
|
|
2245
|
+
type: z13.literal("encrypted_code_execution_result"),
|
|
2246
|
+
encrypted_stdout: z13.string(),
|
|
2247
|
+
stderr: z13.string(),
|
|
2248
|
+
return_code: z13.number(),
|
|
2249
|
+
content: z13.array(
|
|
2250
|
+
z13.object({
|
|
2251
|
+
type: z13.literal("code_execution_output"),
|
|
2252
|
+
file_id: z13.string()
|
|
2253
|
+
})
|
|
2254
|
+
).optional().default([])
|
|
2255
|
+
}),
|
|
2256
|
+
z13.object({
|
|
2257
|
+
type: z13.literal("bash_code_execution_result"),
|
|
2258
|
+
content: z13.array(
|
|
2259
|
+
z13.object({
|
|
2260
|
+
type: z13.literal("bash_code_execution_output"),
|
|
2261
|
+
file_id: z13.string()
|
|
2262
|
+
})
|
|
2263
|
+
),
|
|
2264
|
+
stdout: z13.string(),
|
|
2265
|
+
stderr: z13.string(),
|
|
2266
|
+
return_code: z13.number()
|
|
2267
|
+
}),
|
|
2268
|
+
z13.object({
|
|
2269
|
+
type: z13.literal("bash_code_execution_tool_result_error"),
|
|
2270
|
+
error_code: z13.string()
|
|
2271
|
+
}),
|
|
2272
|
+
z13.object({
|
|
2273
|
+
type: z13.literal("text_editor_code_execution_tool_result_error"),
|
|
2274
|
+
error_code: z13.string()
|
|
2275
|
+
}),
|
|
2276
|
+
z13.object({
|
|
2277
|
+
type: z13.literal("text_editor_code_execution_view_result"),
|
|
2278
|
+
content: z13.string(),
|
|
2279
|
+
file_type: z13.string(),
|
|
2280
|
+
num_lines: z13.number().nullable(),
|
|
2281
|
+
start_line: z13.number().nullable(),
|
|
2282
|
+
total_lines: z13.number().nullable()
|
|
2283
|
+
}),
|
|
2284
|
+
z13.object({
|
|
2285
|
+
type: z13.literal("text_editor_code_execution_create_result"),
|
|
2286
|
+
is_file_update: z13.boolean()
|
|
2287
|
+
}),
|
|
2288
|
+
z13.object({
|
|
2289
|
+
type: z13.literal("text_editor_code_execution_str_replace_result"),
|
|
2290
|
+
lines: z13.array(z13.string()).nullable(),
|
|
2291
|
+
new_lines: z13.number().nullable(),
|
|
2292
|
+
new_start: z13.number().nullable(),
|
|
2293
|
+
old_lines: z13.number().nullable(),
|
|
2294
|
+
old_start: z13.number().nullable()
|
|
2295
|
+
})
|
|
2296
|
+
])
|
|
2297
|
+
)
|
|
2298
|
+
);
|
|
2299
|
+
var codeExecution_20260120InputSchema = lazySchema12(
|
|
2300
|
+
() => zodSchema12(
|
|
2301
|
+
z13.discriminatedUnion("type", [
|
|
2302
|
+
z13.object({
|
|
2303
|
+
type: z13.literal("programmatic-tool-call"),
|
|
2304
|
+
code: z13.string()
|
|
2305
|
+
}),
|
|
2306
|
+
z13.object({
|
|
2307
|
+
type: z13.literal("bash_code_execution"),
|
|
2308
|
+
command: z13.string()
|
|
2309
|
+
}),
|
|
2310
|
+
z13.discriminatedUnion("command", [
|
|
2311
|
+
z13.object({
|
|
2312
|
+
type: z13.literal("text_editor_code_execution"),
|
|
2313
|
+
command: z13.literal("view"),
|
|
2314
|
+
path: z13.string()
|
|
2315
|
+
}),
|
|
2316
|
+
z13.object({
|
|
2317
|
+
type: z13.literal("text_editor_code_execution"),
|
|
2318
|
+
command: z13.literal("create"),
|
|
2319
|
+
path: z13.string(),
|
|
2320
|
+
file_text: z13.string().nullish()
|
|
2183
2321
|
}),
|
|
2184
|
-
|
|
2185
|
-
type:
|
|
2186
|
-
command:
|
|
2187
|
-
path:
|
|
2188
|
-
old_str:
|
|
2189
|
-
new_str:
|
|
2322
|
+
z13.object({
|
|
2323
|
+
type: z13.literal("text_editor_code_execution"),
|
|
2324
|
+
command: z13.literal("str_replace"),
|
|
2325
|
+
path: z13.string(),
|
|
2326
|
+
old_str: z13.string(),
|
|
2327
|
+
new_str: z13.string()
|
|
2190
2328
|
})
|
|
2191
2329
|
])
|
|
2192
2330
|
])
|
|
@@ -2205,23 +2343,23 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2205
2343
|
// src/tool/tool-search-regex_20251119.ts
|
|
2206
2344
|
import {
|
|
2207
2345
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2208
|
-
lazySchema as
|
|
2209
|
-
zodSchema as
|
|
2346
|
+
lazySchema as lazySchema13,
|
|
2347
|
+
zodSchema as zodSchema13
|
|
2210
2348
|
} from "@ai-sdk/provider-utils";
|
|
2211
|
-
import { z as
|
|
2212
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
2213
|
-
() =>
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
type:
|
|
2217
|
-
toolName:
|
|
2349
|
+
import { z as z14 } from "zod/v4";
|
|
2350
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema13(
|
|
2351
|
+
() => zodSchema13(
|
|
2352
|
+
z14.array(
|
|
2353
|
+
z14.object({
|
|
2354
|
+
type: z14.literal("tool_reference"),
|
|
2355
|
+
toolName: z14.string()
|
|
2218
2356
|
})
|
|
2219
2357
|
)
|
|
2220
2358
|
)
|
|
2221
2359
|
);
|
|
2222
|
-
var toolSearchRegex_20251119InputSchema =
|
|
2223
|
-
() =>
|
|
2224
|
-
|
|
2360
|
+
var toolSearchRegex_20251119InputSchema = lazySchema13(
|
|
2361
|
+
() => zodSchema13(
|
|
2362
|
+
z14.object({
|
|
2225
2363
|
/**
|
|
2226
2364
|
* A regex pattern to search for tools.
|
|
2227
2365
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -2232,11 +2370,11 @@ var toolSearchRegex_20251119InputSchema = lazySchema12(
|
|
|
2232
2370
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
2233
2371
|
* - "(?i)slack" - case-insensitive search
|
|
2234
2372
|
*/
|
|
2235
|
-
pattern:
|
|
2373
|
+
pattern: z14.string(),
|
|
2236
2374
|
/**
|
|
2237
2375
|
* Maximum number of tools to return. Optional.
|
|
2238
2376
|
*/
|
|
2239
|
-
limit:
|
|
2377
|
+
limit: z14.number().optional()
|
|
2240
2378
|
})
|
|
2241
2379
|
)
|
|
2242
2380
|
);
|
|
@@ -2296,7 +2434,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2296
2434
|
sendReasoning,
|
|
2297
2435
|
warnings,
|
|
2298
2436
|
cacheControlValidator,
|
|
2299
|
-
toolNameMapping
|
|
2437
|
+
toolNameMapping,
|
|
2438
|
+
toolsetNames = {}
|
|
2300
2439
|
}) {
|
|
2301
2440
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
2302
2441
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2399,7 +2538,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2399
2538
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
2400
2539
|
}
|
|
2401
2540
|
if (systemMessages.some((message) => message.output_config != null)) {
|
|
2402
|
-
betas.add("mid-conversation-
|
|
2541
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
2403
2542
|
}
|
|
2404
2543
|
}
|
|
2405
2544
|
break;
|
|
@@ -2618,9 +2757,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2618
2757
|
contentValue = JSON.stringify(output.value);
|
|
2619
2758
|
break;
|
|
2620
2759
|
}
|
|
2760
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2761
|
+
toolName: part.toolName,
|
|
2762
|
+
providerOptions: part.providerOptions,
|
|
2763
|
+
toolsetNames
|
|
2764
|
+
});
|
|
2621
2765
|
anthropicContent.push({
|
|
2622
2766
|
type: "tool_result",
|
|
2623
2767
|
tool_use_id: part.toolCallId,
|
|
2768
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
2624
2769
|
content: contentValue,
|
|
2625
2770
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
2626
2771
|
cache_control: cacheControl
|
|
@@ -2818,6 +2963,31 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2818
2963
|
}
|
|
2819
2964
|
break;
|
|
2820
2965
|
}
|
|
2966
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2967
|
+
toolName: part.toolName,
|
|
2968
|
+
providerOptions: part.providerOptions,
|
|
2969
|
+
toolsetNames
|
|
2970
|
+
});
|
|
2971
|
+
if (toolsetName != null) {
|
|
2972
|
+
const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
|
|
2973
|
+
if (typeof action !== "string") {
|
|
2974
|
+
warnings.push({
|
|
2975
|
+
type: "other",
|
|
2976
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
2977
|
+
});
|
|
2978
|
+
break;
|
|
2979
|
+
}
|
|
2980
|
+
anthropicContent.push({
|
|
2981
|
+
type: "tool_use",
|
|
2982
|
+
id: part.toolCallId,
|
|
2983
|
+
name: action,
|
|
2984
|
+
toolset_name: toolsetName,
|
|
2985
|
+
input: memberInput,
|
|
2986
|
+
...caller && { caller },
|
|
2987
|
+
cache_control: cacheControl
|
|
2988
|
+
});
|
|
2989
|
+
break;
|
|
2990
|
+
}
|
|
2821
2991
|
anthropicContent.push({
|
|
2822
2992
|
type: "tool_use",
|
|
2823
2993
|
id: part.toolCallId,
|
|
@@ -3235,6 +3405,19 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
3235
3405
|
flushSegment();
|
|
3236
3406
|
return result;
|
|
3237
3407
|
}
|
|
3408
|
+
function getAnthropicToolsetName({
|
|
3409
|
+
toolName,
|
|
3410
|
+
providerOptions,
|
|
3411
|
+
toolsetNames
|
|
3412
|
+
}) {
|
|
3413
|
+
var _a;
|
|
3414
|
+
const fromTools = toolsetNames[toolName];
|
|
3415
|
+
if (fromTools != null) {
|
|
3416
|
+
return fromTools;
|
|
3417
|
+
}
|
|
3418
|
+
const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
|
|
3419
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
3420
|
+
}
|
|
3238
3421
|
function getAnthropicCaller(providerOptions) {
|
|
3239
3422
|
var _a;
|
|
3240
3423
|
const caller = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.caller;
|
|
@@ -3472,6 +3655,24 @@ function getAnthropicCallerMetadata(caller) {
|
|
|
3472
3655
|
const callerInfo = getAnthropicCallerInfo(caller);
|
|
3473
3656
|
return callerInfo == null ? {} : { providerMetadata: { anthropic: { caller: callerInfo } } };
|
|
3474
3657
|
}
|
|
3658
|
+
function getAnthropicToolsetNames(tools) {
|
|
3659
|
+
const toolsetNames = {};
|
|
3660
|
+
for (const tool of tools != null ? tools : []) {
|
|
3661
|
+
if (tool.type === "provider" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
3662
|
+
toolsetNames[tool.name] = "computer";
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
return toolsetNames;
|
|
3666
|
+
}
|
|
3667
|
+
function toToolsetMemberInput({
|
|
3668
|
+
memberName,
|
|
3669
|
+
input
|
|
3670
|
+
}) {
|
|
3671
|
+
return {
|
|
3672
|
+
action: memberName,
|
|
3673
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3475
3676
|
var AnthropicMessagesLanguageModel = class {
|
|
3476
3677
|
constructor(modelId, config) {
|
|
3477
3678
|
this.specificationVersion = "v3";
|
|
@@ -3573,6 +3774,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3573
3774
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
3574
3775
|
rejectsSamplingParameters,
|
|
3575
3776
|
rejectsThinkingDisabledAboveHighEffort,
|
|
3777
|
+
rejectsThinkingDisabled,
|
|
3778
|
+
rejectsForcedToolUse,
|
|
3576
3779
|
isKnownModel
|
|
3577
3780
|
} = getModelCapabilities(this.modelId);
|
|
3578
3781
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -3612,7 +3815,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3612
3815
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
3613
3816
|
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3614
3817
|
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
3615
|
-
|
|
3818
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3819
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3820
|
+
warnings.push({
|
|
3821
|
+
type: "unsupported",
|
|
3822
|
+
feature: "providerOptions.anthropic.structuredOutputMode",
|
|
3823
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
3824
|
+
});
|
|
3825
|
+
useStructuredOutput = true;
|
|
3826
|
+
}
|
|
3616
3827
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
3617
3828
|
type: "function",
|
|
3618
3829
|
name: "json",
|
|
@@ -3636,6 +3847,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3636
3847
|
"anthropic.code_execution_20260120": "code_execution",
|
|
3637
3848
|
"anthropic.computer_20241022": "computer",
|
|
3638
3849
|
"anthropic.computer_20250124": "computer",
|
|
3850
|
+
"anthropic.computer_20251124": "computer",
|
|
3851
|
+
"anthropic.computer_toolset_20260801": "computer",
|
|
3639
3852
|
"anthropic.text_editor_20241022": "str_replace_editor",
|
|
3640
3853
|
"anthropic.text_editor_20250124": "str_replace_editor",
|
|
3641
3854
|
"anthropic.text_editor_20250429": "str_replace_based_edit_tool",
|
|
@@ -3652,13 +3865,34 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3652
3865
|
"anthropic.advisor_20260301": "advisor"
|
|
3653
3866
|
}
|
|
3654
3867
|
});
|
|
3868
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3655
3869
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3656
3870
|
prompt,
|
|
3657
3871
|
sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
|
|
3658
3872
|
warnings,
|
|
3659
3873
|
cacheControlValidator,
|
|
3660
|
-
toolNameMapping
|
|
3874
|
+
toolNameMapping,
|
|
3875
|
+
toolsetNames
|
|
3661
3876
|
});
|
|
3877
|
+
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
3878
|
+
const requestedThinking = anthropicOptions.thinking;
|
|
3879
|
+
const requestedType = "type" in requestedThinking ? requestedThinking.type : void 0;
|
|
3880
|
+
if (requestedType === "disabled") {
|
|
3881
|
+
warnings.push({
|
|
3882
|
+
type: "unsupported",
|
|
3883
|
+
feature: "providerOptions.anthropic.thinking",
|
|
3884
|
+
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
3885
|
+
});
|
|
3886
|
+
anthropicOptions.thinking = void 0;
|
|
3887
|
+
} else if (requestedType === "enabled") {
|
|
3888
|
+
warnings.push({
|
|
3889
|
+
type: "unsupported",
|
|
3890
|
+
feature: "providerOptions.anthropic.thinking",
|
|
3891
|
+
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.`
|
|
3892
|
+
});
|
|
3893
|
+
anthropicOptions.thinking = { type: "adaptive" };
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3662
3896
|
const thinking = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
3663
3897
|
const thinkingType = thinking != null && "type" in thinking ? thinking.type : void 0;
|
|
3664
3898
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -3930,7 +4164,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3930
4164
|
cacheControlValidator,
|
|
3931
4165
|
supportsStructuredOutput: false,
|
|
3932
4166
|
supportsStrictTools,
|
|
3933
|
-
defaultEagerInputStreaming
|
|
4167
|
+
defaultEagerInputStreaming,
|
|
4168
|
+
rejectsForcedToolUse
|
|
3934
4169
|
} : {
|
|
3935
4170
|
tools: tools != null ? tools : [],
|
|
3936
4171
|
toolChoice,
|
|
@@ -3938,7 +4173,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3938
4173
|
cacheControlValidator,
|
|
3939
4174
|
supportsStructuredOutput,
|
|
3940
4175
|
supportsStrictTools,
|
|
3941
|
-
defaultEagerInputStreaming
|
|
4176
|
+
defaultEagerInputStreaming,
|
|
4177
|
+
rejectsForcedToolUse
|
|
3942
4178
|
}
|
|
3943
4179
|
);
|
|
3944
4180
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -4017,7 +4253,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4017
4253
|
});
|
|
4018
4254
|
}
|
|
4019
4255
|
async doGenerate(options) {
|
|
4020
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4256
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4021
4257
|
const {
|
|
4022
4258
|
args,
|
|
4023
4259
|
warnings,
|
|
@@ -4133,6 +4369,24 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4133
4369
|
type: "text",
|
|
4134
4370
|
text: JSON.stringify(part.input)
|
|
4135
4371
|
});
|
|
4372
|
+
} else if (part.toolset_name != null) {
|
|
4373
|
+
content.push({
|
|
4374
|
+
type: "tool-call",
|
|
4375
|
+
toolCallId: part.id,
|
|
4376
|
+
toolName: toolNameMapping.toCustomToolName(part.toolset_name),
|
|
4377
|
+
input: JSON.stringify(
|
|
4378
|
+
toToolsetMemberInput({
|
|
4379
|
+
memberName: part.name,
|
|
4380
|
+
input: part.input
|
|
4381
|
+
})
|
|
4382
|
+
),
|
|
4383
|
+
providerMetadata: {
|
|
4384
|
+
anthropic: {
|
|
4385
|
+
toolsetName: part.toolset_name,
|
|
4386
|
+
...(_b = getAnthropicCallerMetadata(part.caller).providerMetadata) == null ? void 0 : _b.anthropic
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
});
|
|
4136
4390
|
} else {
|
|
4137
4391
|
content.push({
|
|
4138
4392
|
type: "tool-call",
|
|
@@ -4230,7 +4484,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4230
4484
|
case "web_fetch_tool_result": {
|
|
4231
4485
|
if (part.content.type === "web_fetch_result") {
|
|
4232
4486
|
citationDocuments.push({
|
|
4233
|
-
title: (
|
|
4487
|
+
title: (_c = part.content.content.title) != null ? _c : part.content.url,
|
|
4234
4488
|
mediaType: part.content.content.source.media_type
|
|
4235
4489
|
});
|
|
4236
4490
|
content.push({
|
|
@@ -4296,7 +4550,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4296
4550
|
title: result.title,
|
|
4297
4551
|
providerMetadata: {
|
|
4298
4552
|
anthropic: {
|
|
4299
|
-
pageAge: (
|
|
4553
|
+
pageAge: (_d = result.page_age) != null ? _d : null
|
|
4300
4554
|
}
|
|
4301
4555
|
}
|
|
4302
4556
|
});
|
|
@@ -4328,7 +4582,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4328
4582
|
stdout: part.content.stdout,
|
|
4329
4583
|
stderr: part.content.stderr,
|
|
4330
4584
|
return_code: part.content.return_code,
|
|
4331
|
-
content: (
|
|
4585
|
+
content: (_e = part.content.content) != null ? _e : []
|
|
4332
4586
|
}
|
|
4333
4587
|
});
|
|
4334
4588
|
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
@@ -4341,7 +4595,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4341
4595
|
encrypted_stdout: part.content.encrypted_stdout,
|
|
4342
4596
|
stderr: part.content.stderr,
|
|
4343
4597
|
return_code: part.content.return_code,
|
|
4344
|
-
content: (
|
|
4598
|
+
content: (_f = part.content.content) != null ? _f : []
|
|
4345
4599
|
}
|
|
4346
4600
|
});
|
|
4347
4601
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -4463,13 +4717,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4463
4717
|
finishReason: response.stop_reason,
|
|
4464
4718
|
isJsonResponseFromTool
|
|
4465
4719
|
}),
|
|
4466
|
-
raw: (
|
|
4720
|
+
raw: (_g = response.stop_reason) != null ? _g : void 0
|
|
4467
4721
|
},
|
|
4468
4722
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
4469
4723
|
request: { body: args },
|
|
4470
4724
|
response: {
|
|
4471
|
-
id: (
|
|
4472
|
-
modelId: (
|
|
4725
|
+
id: (_h = response.id) != null ? _h : void 0,
|
|
4726
|
+
modelId: (_i = response.model) != null ? _i : void 0,
|
|
4473
4727
|
headers: responseHeaders,
|
|
4474
4728
|
body: rawResponse
|
|
4475
4729
|
},
|
|
@@ -4673,6 +4927,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4673
4927
|
type: "text-start",
|
|
4674
4928
|
id: String(value.index)
|
|
4675
4929
|
});
|
|
4930
|
+
} else if (part.toolset_name != null) {
|
|
4931
|
+
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
4932
|
+
const customToolName = toolNameMapping.toCustomToolName(
|
|
4933
|
+
part.toolset_name
|
|
4934
|
+
);
|
|
4935
|
+
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
4936
|
+
contentBlocks[value.index] = {
|
|
4937
|
+
type: "tool-call",
|
|
4938
|
+
toolCallId: part.id,
|
|
4939
|
+
toolName: customToolName,
|
|
4940
|
+
input: hasNonEmptyInput ? JSON.stringify(part.input) : "",
|
|
4941
|
+
firstDelta: true,
|
|
4942
|
+
toolset: {
|
|
4943
|
+
name: part.toolset_name,
|
|
4944
|
+
memberName: part.name
|
|
4945
|
+
},
|
|
4946
|
+
...callerInfo && { caller: callerInfo }
|
|
4947
|
+
};
|
|
4948
|
+
controller.enqueue({
|
|
4949
|
+
type: "tool-input-start",
|
|
4950
|
+
id: part.id,
|
|
4951
|
+
toolName: customToolName
|
|
4952
|
+
});
|
|
4676
4953
|
} else {
|
|
4677
4954
|
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
4678
4955
|
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
@@ -5066,6 +5343,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5066
5343
|
case "tool-call":
|
|
5067
5344
|
const isJsonResponseTool = usesJsonResponseTool && contentBlock.toolName === "json";
|
|
5068
5345
|
if (!isJsonResponseTool) {
|
|
5346
|
+
if (contentBlock.toolset != null) {
|
|
5347
|
+
let memberInput = {};
|
|
5348
|
+
try {
|
|
5349
|
+
memberInput = contentBlock.input === "" ? {} : secureJsonParse2(contentBlock.input);
|
|
5350
|
+
} catch (e) {
|
|
5351
|
+
memberInput = void 0;
|
|
5352
|
+
}
|
|
5353
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
5354
|
+
toToolsetMemberInput({
|
|
5355
|
+
memberName: contentBlock.toolset.memberName,
|
|
5356
|
+
input: memberInput
|
|
5357
|
+
})
|
|
5358
|
+
);
|
|
5359
|
+
controller.enqueue({
|
|
5360
|
+
type: "tool-input-delta",
|
|
5361
|
+
id: contentBlock.toolCallId,
|
|
5362
|
+
delta: contentBlock.input
|
|
5363
|
+
});
|
|
5364
|
+
}
|
|
5069
5365
|
controller.enqueue({
|
|
5070
5366
|
type: "tool-input-end",
|
|
5071
5367
|
id: contentBlock.toolCallId
|
|
@@ -5094,10 +5390,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5094
5390
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
5095
5391
|
// tool as dynamic.
|
|
5096
5392
|
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
5097
|
-
...contentBlock.caller && {
|
|
5393
|
+
...(contentBlock.caller || contentBlock.toolset) && {
|
|
5098
5394
|
providerMetadata: {
|
|
5099
5395
|
anthropic: {
|
|
5100
|
-
|
|
5396
|
+
...contentBlock.toolset && {
|
|
5397
|
+
toolsetName: contentBlock.toolset.name
|
|
5398
|
+
},
|
|
5399
|
+
...contentBlock.caller && {
|
|
5400
|
+
caller: contentBlock.caller
|
|
5401
|
+
}
|
|
5101
5402
|
}
|
|
5102
5403
|
}
|
|
5103
5404
|
}
|
|
@@ -5176,6 +5477,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5176
5477
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
5177
5478
|
return;
|
|
5178
5479
|
}
|
|
5480
|
+
if (contentBlock.toolset != null) {
|
|
5481
|
+
contentBlock.input += delta;
|
|
5482
|
+
return;
|
|
5483
|
+
}
|
|
5179
5484
|
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
5180
5485
|
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
5181
5486
|
}
|
|
@@ -5434,20 +5739,54 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5434
5739
|
}
|
|
5435
5740
|
};
|
|
5436
5741
|
function getModelCapabilities(modelId) {
|
|
5437
|
-
if (modelId.includes("claude-opus-5")) {
|
|
5742
|
+
if (modelId.includes("claude-opus-5-5")) {
|
|
5743
|
+
return {
|
|
5744
|
+
maxOutputTokens: 128e3,
|
|
5745
|
+
supportsStructuredOutput: true,
|
|
5746
|
+
rejectsSamplingParameters: true,
|
|
5747
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5748
|
+
rejectsThinkingDisabled: true,
|
|
5749
|
+
rejectsForcedToolUse: true,
|
|
5750
|
+
isKnownModel: true
|
|
5751
|
+
};
|
|
5752
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
5438
5753
|
return {
|
|
5439
5754
|
maxOutputTokens: 128e3,
|
|
5440
5755
|
supportsStructuredOutput: true,
|
|
5441
5756
|
rejectsSamplingParameters: true,
|
|
5442
5757
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5758
|
+
rejectsThinkingDisabled: false,
|
|
5759
|
+
rejectsForcedToolUse: false,
|
|
5760
|
+
isKnownModel: true
|
|
5761
|
+
};
|
|
5762
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
5763
|
+
return {
|
|
5764
|
+
maxOutputTokens: 128e3,
|
|
5765
|
+
supportsStructuredOutput: true,
|
|
5766
|
+
rejectsSamplingParameters: true,
|
|
5767
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5768
|
+
rejectsThinkingDisabled: true,
|
|
5769
|
+
rejectsForcedToolUse: true,
|
|
5770
|
+
isKnownModel: true
|
|
5771
|
+
};
|
|
5772
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
5773
|
+
return {
|
|
5774
|
+
maxOutputTokens: 128e3,
|
|
5775
|
+
supportsStructuredOutput: true,
|
|
5776
|
+
rejectsSamplingParameters: true,
|
|
5777
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5778
|
+
rejectsThinkingDisabled: true,
|
|
5779
|
+
rejectsForcedToolUse: false,
|
|
5443
5780
|
isKnownModel: true
|
|
5444
5781
|
};
|
|
5445
|
-
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-
|
|
5782
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
5446
5783
|
return {
|
|
5447
5784
|
maxOutputTokens: 128e3,
|
|
5448
5785
|
supportsStructuredOutput: true,
|
|
5449
5786
|
rejectsSamplingParameters: true,
|
|
5450
5787
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5788
|
+
rejectsThinkingDisabled: false,
|
|
5789
|
+
rejectsForcedToolUse: false,
|
|
5451
5790
|
isKnownModel: true
|
|
5452
5791
|
};
|
|
5453
5792
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -5456,6 +5795,8 @@ function getModelCapabilities(modelId) {
|
|
|
5456
5795
|
supportsStructuredOutput: true,
|
|
5457
5796
|
rejectsSamplingParameters: false,
|
|
5458
5797
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5798
|
+
rejectsThinkingDisabled: false,
|
|
5799
|
+
rejectsForcedToolUse: false,
|
|
5459
5800
|
isKnownModel: true
|
|
5460
5801
|
};
|
|
5461
5802
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -5464,6 +5805,8 @@ function getModelCapabilities(modelId) {
|
|
|
5464
5805
|
supportsStructuredOutput: true,
|
|
5465
5806
|
rejectsSamplingParameters: false,
|
|
5466
5807
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5808
|
+
rejectsThinkingDisabled: false,
|
|
5809
|
+
rejectsForcedToolUse: false,
|
|
5467
5810
|
isKnownModel: true
|
|
5468
5811
|
};
|
|
5469
5812
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -5472,6 +5815,8 @@ function getModelCapabilities(modelId) {
|
|
|
5472
5815
|
supportsStructuredOutput: true,
|
|
5473
5816
|
rejectsSamplingParameters: false,
|
|
5474
5817
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5818
|
+
rejectsThinkingDisabled: false,
|
|
5819
|
+
rejectsForcedToolUse: false,
|
|
5475
5820
|
isKnownModel: true
|
|
5476
5821
|
};
|
|
5477
5822
|
} else if (modelId.includes("claude-sonnet-4-")) {
|
|
@@ -5480,6 +5825,8 @@ function getModelCapabilities(modelId) {
|
|
|
5480
5825
|
supportsStructuredOutput: false,
|
|
5481
5826
|
rejectsSamplingParameters: false,
|
|
5482
5827
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5828
|
+
rejectsThinkingDisabled: false,
|
|
5829
|
+
rejectsForcedToolUse: false,
|
|
5483
5830
|
isKnownModel: true
|
|
5484
5831
|
};
|
|
5485
5832
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -5488,6 +5835,8 @@ function getModelCapabilities(modelId) {
|
|
|
5488
5835
|
supportsStructuredOutput: false,
|
|
5489
5836
|
rejectsSamplingParameters: false,
|
|
5490
5837
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5838
|
+
rejectsThinkingDisabled: false,
|
|
5839
|
+
rejectsForcedToolUse: false,
|
|
5491
5840
|
isKnownModel: true
|
|
5492
5841
|
};
|
|
5493
5842
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -5496,6 +5845,8 @@ function getModelCapabilities(modelId) {
|
|
|
5496
5845
|
supportsStructuredOutput: false,
|
|
5497
5846
|
rejectsSamplingParameters: false,
|
|
5498
5847
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5848
|
+
rejectsThinkingDisabled: false,
|
|
5849
|
+
rejectsForcedToolUse: false,
|
|
5499
5850
|
isKnownModel: true
|
|
5500
5851
|
};
|
|
5501
5852
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -5504,6 +5855,8 @@ function getModelCapabilities(modelId) {
|
|
|
5504
5855
|
supportsStructuredOutput: false,
|
|
5505
5856
|
rejectsSamplingParameters: false,
|
|
5506
5857
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5858
|
+
rejectsThinkingDisabled: false,
|
|
5859
|
+
rejectsForcedToolUse: false,
|
|
5507
5860
|
isKnownModel: false
|
|
5508
5861
|
};
|
|
5509
5862
|
} else if (modelId.includes("claude-")) {
|
|
@@ -5512,6 +5865,8 @@ function getModelCapabilities(modelId) {
|
|
|
5512
5865
|
supportsStructuredOutput: true,
|
|
5513
5866
|
rejectsSamplingParameters: true,
|
|
5514
5867
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5868
|
+
rejectsThinkingDisabled: false,
|
|
5869
|
+
rejectsForcedToolUse: false,
|
|
5515
5870
|
isKnownModel: false
|
|
5516
5871
|
};
|
|
5517
5872
|
} else {
|
|
@@ -5520,6 +5875,8 @@ function getModelCapabilities(modelId) {
|
|
|
5520
5875
|
supportsStructuredOutput: false,
|
|
5521
5876
|
rejectsSamplingParameters: false,
|
|
5522
5877
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5878
|
+
rejectsThinkingDisabled: false,
|
|
5879
|
+
rejectsForcedToolUse: false,
|
|
5523
5880
|
isKnownModel: false
|
|
5524
5881
|
};
|
|
5525
5882
|
}
|
|
@@ -5535,7 +5892,7 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
5535
5892
|
hasWebTool20260209 = true;
|
|
5536
5893
|
continue;
|
|
5537
5894
|
}
|
|
5538
|
-
if (tool.name === "code_execution") {
|
|
5895
|
+
if ("name" in tool && tool.name === "code_execution") {
|
|
5539
5896
|
hasCodeExecutionTool = true;
|
|
5540
5897
|
break;
|
|
5541
5898
|
}
|
|
@@ -5580,33 +5937,13 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
5580
5937
|
}
|
|
5581
5938
|
|
|
5582
5939
|
// src/tool/bash_20241022.ts
|
|
5583
|
-
import {
|
|
5584
|
-
createProviderToolFactory as createProviderToolFactory2,
|
|
5585
|
-
lazySchema as lazySchema13,
|
|
5586
|
-
zodSchema as zodSchema13
|
|
5587
|
-
} from "@ai-sdk/provider-utils";
|
|
5588
|
-
import { z as z14 } from "zod/v4";
|
|
5589
|
-
var bash_20241022InputSchema = lazySchema13(
|
|
5590
|
-
() => zodSchema13(
|
|
5591
|
-
z14.object({
|
|
5592
|
-
command: z14.string(),
|
|
5593
|
-
restart: z14.boolean().optional()
|
|
5594
|
-
})
|
|
5595
|
-
)
|
|
5596
|
-
);
|
|
5597
|
-
var bash_20241022 = createProviderToolFactory2({
|
|
5598
|
-
id: "anthropic.bash_20241022",
|
|
5599
|
-
inputSchema: bash_20241022InputSchema
|
|
5600
|
-
});
|
|
5601
|
-
|
|
5602
|
-
// src/tool/bash_20250124.ts
|
|
5603
5940
|
import {
|
|
5604
5941
|
createProviderToolFactory as createProviderToolFactory3,
|
|
5605
5942
|
lazySchema as lazySchema14,
|
|
5606
5943
|
zodSchema as zodSchema14
|
|
5607
5944
|
} from "@ai-sdk/provider-utils";
|
|
5608
5945
|
import { z as z15 } from "zod/v4";
|
|
5609
|
-
var
|
|
5946
|
+
var bash_20241022InputSchema = lazySchema14(
|
|
5610
5947
|
() => zodSchema14(
|
|
5611
5948
|
z15.object({
|
|
5612
5949
|
command: z15.string(),
|
|
@@ -5614,22 +5951,42 @@ var bash_20250124InputSchema = lazySchema14(
|
|
|
5614
5951
|
})
|
|
5615
5952
|
)
|
|
5616
5953
|
);
|
|
5617
|
-
var
|
|
5618
|
-
id: "anthropic.
|
|
5619
|
-
inputSchema:
|
|
5954
|
+
var bash_20241022 = createProviderToolFactory3({
|
|
5955
|
+
id: "anthropic.bash_20241022",
|
|
5956
|
+
inputSchema: bash_20241022InputSchema
|
|
5620
5957
|
});
|
|
5621
5958
|
|
|
5622
|
-
// src/tool/
|
|
5959
|
+
// src/tool/bash_20250124.ts
|
|
5623
5960
|
import {
|
|
5624
5961
|
createProviderToolFactory as createProviderToolFactory4,
|
|
5625
5962
|
lazySchema as lazySchema15,
|
|
5626
5963
|
zodSchema as zodSchema15
|
|
5627
5964
|
} from "@ai-sdk/provider-utils";
|
|
5628
5965
|
import { z as z16 } from "zod/v4";
|
|
5629
|
-
var
|
|
5966
|
+
var bash_20250124InputSchema = lazySchema15(
|
|
5630
5967
|
() => zodSchema15(
|
|
5631
5968
|
z16.object({
|
|
5632
|
-
|
|
5969
|
+
command: z16.string(),
|
|
5970
|
+
restart: z16.boolean().optional()
|
|
5971
|
+
})
|
|
5972
|
+
)
|
|
5973
|
+
);
|
|
5974
|
+
var bash_20250124 = createProviderToolFactory4({
|
|
5975
|
+
id: "anthropic.bash_20250124",
|
|
5976
|
+
inputSchema: bash_20250124InputSchema
|
|
5977
|
+
});
|
|
5978
|
+
|
|
5979
|
+
// src/tool/computer_20241022.ts
|
|
5980
|
+
import {
|
|
5981
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
5982
|
+
lazySchema as lazySchema16,
|
|
5983
|
+
zodSchema as zodSchema16
|
|
5984
|
+
} from "@ai-sdk/provider-utils";
|
|
5985
|
+
import { z as z17 } from "zod/v4";
|
|
5986
|
+
var computer_20241022InputSchema = lazySchema16(
|
|
5987
|
+
() => zodSchema16(
|
|
5988
|
+
z17.object({
|
|
5989
|
+
action: z17.enum([
|
|
5633
5990
|
"key",
|
|
5634
5991
|
"type",
|
|
5635
5992
|
"mouse_move",
|
|
@@ -5641,27 +5998,27 @@ var computer_20241022InputSchema = lazySchema15(
|
|
|
5641
5998
|
"screenshot",
|
|
5642
5999
|
"cursor_position"
|
|
5643
6000
|
]),
|
|
5644
|
-
coordinate:
|
|
5645
|
-
text:
|
|
6001
|
+
coordinate: z17.array(z17.number().int()).optional(),
|
|
6002
|
+
text: z17.string().optional()
|
|
5646
6003
|
})
|
|
5647
6004
|
)
|
|
5648
6005
|
);
|
|
5649
|
-
var computer_20241022 =
|
|
6006
|
+
var computer_20241022 = createProviderToolFactory5({
|
|
5650
6007
|
id: "anthropic.computer_20241022",
|
|
5651
6008
|
inputSchema: computer_20241022InputSchema
|
|
5652
6009
|
});
|
|
5653
6010
|
|
|
5654
6011
|
// src/tool/computer_20250124.ts
|
|
5655
6012
|
import {
|
|
5656
|
-
createProviderToolFactory as
|
|
5657
|
-
lazySchema as
|
|
5658
|
-
zodSchema as
|
|
6013
|
+
createProviderToolFactory as createProviderToolFactory6,
|
|
6014
|
+
lazySchema as lazySchema17,
|
|
6015
|
+
zodSchema as zodSchema17
|
|
5659
6016
|
} from "@ai-sdk/provider-utils";
|
|
5660
|
-
import { z as
|
|
5661
|
-
var computer_20250124InputSchema =
|
|
5662
|
-
() =>
|
|
5663
|
-
|
|
5664
|
-
action:
|
|
6017
|
+
import { z as z18 } from "zod/v4";
|
|
6018
|
+
var computer_20250124InputSchema = lazySchema17(
|
|
6019
|
+
() => zodSchema17(
|
|
6020
|
+
z18.object({
|
|
6021
|
+
action: z18.enum([
|
|
5665
6022
|
"key",
|
|
5666
6023
|
"hold_key",
|
|
5667
6024
|
"type",
|
|
@@ -5679,31 +6036,31 @@ var computer_20250124InputSchema = lazySchema16(
|
|
|
5679
6036
|
"wait",
|
|
5680
6037
|
"screenshot"
|
|
5681
6038
|
]),
|
|
5682
|
-
coordinate:
|
|
5683
|
-
duration:
|
|
5684
|
-
scroll_amount:
|
|
5685
|
-
scroll_direction:
|
|
5686
|
-
start_coordinate:
|
|
5687
|
-
text:
|
|
6039
|
+
coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
6040
|
+
duration: z18.number().optional(),
|
|
6041
|
+
scroll_amount: z18.number().optional(),
|
|
6042
|
+
scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
|
|
6043
|
+
start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
6044
|
+
text: z18.string().optional()
|
|
5688
6045
|
})
|
|
5689
6046
|
)
|
|
5690
6047
|
);
|
|
5691
|
-
var computer_20250124 =
|
|
6048
|
+
var computer_20250124 = createProviderToolFactory6({
|
|
5692
6049
|
id: "anthropic.computer_20250124",
|
|
5693
6050
|
inputSchema: computer_20250124InputSchema
|
|
5694
6051
|
});
|
|
5695
6052
|
|
|
5696
6053
|
// src/tool/computer_20251124.ts
|
|
5697
6054
|
import {
|
|
5698
|
-
createProviderToolFactory as
|
|
5699
|
-
lazySchema as
|
|
5700
|
-
zodSchema as
|
|
6055
|
+
createProviderToolFactory as createProviderToolFactory7,
|
|
6056
|
+
lazySchema as lazySchema18,
|
|
6057
|
+
zodSchema as zodSchema18
|
|
5701
6058
|
} from "@ai-sdk/provider-utils";
|
|
5702
|
-
import { z as
|
|
5703
|
-
var computer_20251124InputSchema =
|
|
5704
|
-
() =>
|
|
5705
|
-
|
|
5706
|
-
action:
|
|
6059
|
+
import { z as z19 } from "zod/v4";
|
|
6060
|
+
var computer_20251124InputSchema = lazySchema18(
|
|
6061
|
+
() => zodSchema18(
|
|
6062
|
+
z19.object({
|
|
6063
|
+
action: z19.enum([
|
|
5707
6064
|
"key",
|
|
5708
6065
|
"hold_key",
|
|
5709
6066
|
"type",
|
|
@@ -5722,109 +6079,83 @@ var computer_20251124InputSchema = lazySchema17(
|
|
|
5722
6079
|
"screenshot",
|
|
5723
6080
|
"zoom"
|
|
5724
6081
|
]),
|
|
5725
|
-
coordinate:
|
|
5726
|
-
duration:
|
|
5727
|
-
region:
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
6082
|
+
coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
|
|
6083
|
+
duration: z19.number().optional(),
|
|
6084
|
+
region: z19.tuple([
|
|
6085
|
+
z19.number().int(),
|
|
6086
|
+
z19.number().int(),
|
|
6087
|
+
z19.number().int(),
|
|
6088
|
+
z19.number().int()
|
|
5732
6089
|
]).optional(),
|
|
5733
|
-
scroll_amount:
|
|
5734
|
-
scroll_direction:
|
|
5735
|
-
start_coordinate:
|
|
5736
|
-
text:
|
|
6090
|
+
scroll_amount: z19.number().optional(),
|
|
6091
|
+
scroll_direction: z19.enum(["up", "down", "left", "right"]).optional(),
|
|
6092
|
+
start_coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
|
|
6093
|
+
text: z19.string().optional()
|
|
5737
6094
|
})
|
|
5738
6095
|
)
|
|
5739
6096
|
);
|
|
5740
|
-
var computer_20251124 =
|
|
6097
|
+
var computer_20251124 = createProviderToolFactory7({
|
|
5741
6098
|
id: "anthropic.computer_20251124",
|
|
5742
6099
|
inputSchema: computer_20251124InputSchema
|
|
5743
6100
|
});
|
|
5744
6101
|
|
|
5745
6102
|
// src/tool/memory_20250818.ts
|
|
5746
6103
|
import {
|
|
5747
|
-
createProviderToolFactory as
|
|
5748
|
-
lazySchema as
|
|
5749
|
-
zodSchema as
|
|
6104
|
+
createProviderToolFactory as createProviderToolFactory8,
|
|
6105
|
+
lazySchema as lazySchema19,
|
|
6106
|
+
zodSchema as zodSchema19
|
|
5750
6107
|
} from "@ai-sdk/provider-utils";
|
|
5751
|
-
import { z as
|
|
5752
|
-
var memory_20250818InputSchema =
|
|
5753
|
-
() =>
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
command:
|
|
5757
|
-
path:
|
|
5758
|
-
view_range:
|
|
6108
|
+
import { z as z20 } from "zod/v4";
|
|
6109
|
+
var memory_20250818InputSchema = lazySchema19(
|
|
6110
|
+
() => zodSchema19(
|
|
6111
|
+
z20.discriminatedUnion("command", [
|
|
6112
|
+
z20.object({
|
|
6113
|
+
command: z20.literal("view"),
|
|
6114
|
+
path: z20.string(),
|
|
6115
|
+
view_range: z20.tuple([z20.number(), z20.number()]).optional()
|
|
5759
6116
|
}),
|
|
5760
|
-
|
|
5761
|
-
command:
|
|
5762
|
-
path:
|
|
5763
|
-
file_text:
|
|
6117
|
+
z20.object({
|
|
6118
|
+
command: z20.literal("create"),
|
|
6119
|
+
path: z20.string(),
|
|
6120
|
+
file_text: z20.string()
|
|
5764
6121
|
}),
|
|
5765
|
-
|
|
5766
|
-
command:
|
|
5767
|
-
path:
|
|
5768
|
-
old_str:
|
|
5769
|
-
new_str:
|
|
6122
|
+
z20.object({
|
|
6123
|
+
command: z20.literal("str_replace"),
|
|
6124
|
+
path: z20.string(),
|
|
6125
|
+
old_str: z20.string(),
|
|
6126
|
+
new_str: z20.string()
|
|
5770
6127
|
}),
|
|
5771
|
-
|
|
5772
|
-
command:
|
|
5773
|
-
path:
|
|
5774
|
-
insert_line:
|
|
5775
|
-
insert_text:
|
|
6128
|
+
z20.object({
|
|
6129
|
+
command: z20.literal("insert"),
|
|
6130
|
+
path: z20.string(),
|
|
6131
|
+
insert_line: z20.number(),
|
|
6132
|
+
insert_text: z20.string()
|
|
5776
6133
|
}),
|
|
5777
|
-
|
|
5778
|
-
command:
|
|
5779
|
-
path:
|
|
6134
|
+
z20.object({
|
|
6135
|
+
command: z20.literal("delete"),
|
|
6136
|
+
path: z20.string()
|
|
5780
6137
|
}),
|
|
5781
|
-
|
|
5782
|
-
command:
|
|
5783
|
-
old_path:
|
|
5784
|
-
new_path:
|
|
6138
|
+
z20.object({
|
|
6139
|
+
command: z20.literal("rename"),
|
|
6140
|
+
old_path: z20.string(),
|
|
6141
|
+
new_path: z20.string()
|
|
5785
6142
|
})
|
|
5786
6143
|
])
|
|
5787
6144
|
)
|
|
5788
6145
|
);
|
|
5789
|
-
var memory_20250818 =
|
|
6146
|
+
var memory_20250818 = createProviderToolFactory8({
|
|
5790
6147
|
id: "anthropic.memory_20250818",
|
|
5791
6148
|
inputSchema: memory_20250818InputSchema
|
|
5792
6149
|
});
|
|
5793
6150
|
|
|
5794
6151
|
// src/tool/text-editor_20241022.ts
|
|
5795
|
-
import {
|
|
5796
|
-
createProviderToolFactory as createProviderToolFactory8,
|
|
5797
|
-
lazySchema as lazySchema19,
|
|
5798
|
-
zodSchema as zodSchema19
|
|
5799
|
-
} from "@ai-sdk/provider-utils";
|
|
5800
|
-
import { z as z20 } from "zod/v4";
|
|
5801
|
-
var textEditor_20241022InputSchema = lazySchema19(
|
|
5802
|
-
() => zodSchema19(
|
|
5803
|
-
z20.object({
|
|
5804
|
-
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5805
|
-
path: z20.string(),
|
|
5806
|
-
file_text: z20.string().optional(),
|
|
5807
|
-
insert_line: z20.number().int().optional(),
|
|
5808
|
-
new_str: z20.string().optional(),
|
|
5809
|
-
insert_text: z20.string().optional(),
|
|
5810
|
-
old_str: z20.string().optional(),
|
|
5811
|
-
view_range: z20.array(z20.number().int()).optional()
|
|
5812
|
-
})
|
|
5813
|
-
)
|
|
5814
|
-
);
|
|
5815
|
-
var textEditor_20241022 = createProviderToolFactory8({
|
|
5816
|
-
id: "anthropic.text_editor_20241022",
|
|
5817
|
-
inputSchema: textEditor_20241022InputSchema
|
|
5818
|
-
});
|
|
5819
|
-
|
|
5820
|
-
// src/tool/text-editor_20250124.ts
|
|
5821
6152
|
import {
|
|
5822
6153
|
createProviderToolFactory as createProviderToolFactory9,
|
|
5823
6154
|
lazySchema as lazySchema20,
|
|
5824
6155
|
zodSchema as zodSchema20
|
|
5825
6156
|
} from "@ai-sdk/provider-utils";
|
|
5826
6157
|
import { z as z21 } from "zod/v4";
|
|
5827
|
-
var
|
|
6158
|
+
var textEditor_20241022InputSchema = lazySchema20(
|
|
5828
6159
|
() => zodSchema20(
|
|
5829
6160
|
z21.object({
|
|
5830
6161
|
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -5838,22 +6169,22 @@ var textEditor_20250124InputSchema = lazySchema20(
|
|
|
5838
6169
|
})
|
|
5839
6170
|
)
|
|
5840
6171
|
);
|
|
5841
|
-
var
|
|
5842
|
-
id: "anthropic.
|
|
5843
|
-
inputSchema:
|
|
6172
|
+
var textEditor_20241022 = createProviderToolFactory9({
|
|
6173
|
+
id: "anthropic.text_editor_20241022",
|
|
6174
|
+
inputSchema: textEditor_20241022InputSchema
|
|
5844
6175
|
});
|
|
5845
6176
|
|
|
5846
|
-
// src/tool/text-
|
|
6177
|
+
// src/tool/text-editor_20250124.ts
|
|
5847
6178
|
import {
|
|
5848
6179
|
createProviderToolFactory as createProviderToolFactory10,
|
|
5849
6180
|
lazySchema as lazySchema21,
|
|
5850
6181
|
zodSchema as zodSchema21
|
|
5851
6182
|
} from "@ai-sdk/provider-utils";
|
|
5852
6183
|
import { z as z22 } from "zod/v4";
|
|
5853
|
-
var
|
|
6184
|
+
var textEditor_20250124InputSchema = lazySchema21(
|
|
5854
6185
|
() => zodSchema21(
|
|
5855
6186
|
z22.object({
|
|
5856
|
-
command: z22.enum(["view", "create", "str_replace", "insert"]),
|
|
6187
|
+
command: z22.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5857
6188
|
path: z22.string(),
|
|
5858
6189
|
file_text: z22.string().optional(),
|
|
5859
6190
|
insert_line: z22.number().int().optional(),
|
|
@@ -5864,40 +6195,66 @@ var textEditor_20250429InputSchema = lazySchema21(
|
|
|
5864
6195
|
})
|
|
5865
6196
|
)
|
|
5866
6197
|
);
|
|
5867
|
-
var
|
|
5868
|
-
id: "anthropic.
|
|
5869
|
-
inputSchema:
|
|
6198
|
+
var textEditor_20250124 = createProviderToolFactory10({
|
|
6199
|
+
id: "anthropic.text_editor_20250124",
|
|
6200
|
+
inputSchema: textEditor_20250124InputSchema
|
|
5870
6201
|
});
|
|
5871
6202
|
|
|
5872
|
-
// src/tool/
|
|
6203
|
+
// src/tool/text-editor_20250429.ts
|
|
5873
6204
|
import {
|
|
5874
|
-
|
|
6205
|
+
createProviderToolFactory as createProviderToolFactory11,
|
|
5875
6206
|
lazySchema as lazySchema22,
|
|
5876
6207
|
zodSchema as zodSchema22
|
|
5877
6208
|
} from "@ai-sdk/provider-utils";
|
|
5878
6209
|
import { z as z23 } from "zod/v4";
|
|
5879
|
-
var
|
|
6210
|
+
var textEditor_20250429InputSchema = lazySchema22(
|
|
5880
6211
|
() => zodSchema22(
|
|
5881
|
-
z23.
|
|
5882
|
-
z23.
|
|
5883
|
-
|
|
5884
|
-
|
|
6212
|
+
z23.object({
|
|
6213
|
+
command: z23.enum(["view", "create", "str_replace", "insert"]),
|
|
6214
|
+
path: z23.string(),
|
|
6215
|
+
file_text: z23.string().optional(),
|
|
6216
|
+
insert_line: z23.number().int().optional(),
|
|
6217
|
+
new_str: z23.string().optional(),
|
|
6218
|
+
insert_text: z23.string().optional(),
|
|
6219
|
+
old_str: z23.string().optional(),
|
|
6220
|
+
view_range: z23.array(z23.number().int()).optional()
|
|
6221
|
+
})
|
|
6222
|
+
)
|
|
6223
|
+
);
|
|
6224
|
+
var textEditor_20250429 = createProviderToolFactory11({
|
|
6225
|
+
id: "anthropic.text_editor_20250429",
|
|
6226
|
+
inputSchema: textEditor_20250429InputSchema
|
|
6227
|
+
});
|
|
6228
|
+
|
|
6229
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
6230
|
+
import {
|
|
6231
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
6232
|
+
lazySchema as lazySchema23,
|
|
6233
|
+
zodSchema as zodSchema23
|
|
6234
|
+
} from "@ai-sdk/provider-utils";
|
|
6235
|
+
import { z as z24 } from "zod/v4";
|
|
6236
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema23(
|
|
6237
|
+
() => zodSchema23(
|
|
6238
|
+
z24.array(
|
|
6239
|
+
z24.object({
|
|
6240
|
+
type: z24.literal("tool_reference"),
|
|
6241
|
+
toolName: z24.string()
|
|
5885
6242
|
})
|
|
5886
6243
|
)
|
|
5887
6244
|
)
|
|
5888
6245
|
);
|
|
5889
|
-
var toolSearchBm25_20251119InputSchema =
|
|
5890
|
-
() =>
|
|
5891
|
-
|
|
6246
|
+
var toolSearchBm25_20251119InputSchema = lazySchema23(
|
|
6247
|
+
() => zodSchema23(
|
|
6248
|
+
z24.object({
|
|
5892
6249
|
/**
|
|
5893
6250
|
* A natural language query to search for tools.
|
|
5894
6251
|
* Claude will use BM25 text search to find relevant tools.
|
|
5895
6252
|
*/
|
|
5896
|
-
query:
|
|
6253
|
+
query: z24.string(),
|
|
5897
6254
|
/**
|
|
5898
6255
|
* Maximum number of tools to return. Optional.
|
|
5899
6256
|
*/
|
|
5900
|
-
limit:
|
|
6257
|
+
limit: z24.number().optional()
|
|
5901
6258
|
})
|
|
5902
6259
|
)
|
|
5903
6260
|
);
|
|
@@ -6027,6 +6384,29 @@ var anthropicTools = {
|
|
|
6027
6384
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
6028
6385
|
*/
|
|
6029
6386
|
computer_20251124,
|
|
6387
|
+
/**
|
|
6388
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
6389
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
6390
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
6391
|
+
*
|
|
6392
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
6393
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
6394
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
6395
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
6396
|
+
* in one turn.
|
|
6397
|
+
*
|
|
6398
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
6399
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
6400
|
+
*
|
|
6401
|
+
* Does not require a beta header.
|
|
6402
|
+
*
|
|
6403
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
6404
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
6405
|
+
*
|
|
6406
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
6407
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
6408
|
+
*/
|
|
6409
|
+
computerToolset_20260801,
|
|
6030
6410
|
/**
|
|
6031
6411
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
6032
6412
|
* Claude can create, read, update, and delete files that persist between sessions,
|