@fairyhunter13/ai-anthropic 3.0.58-fork.2 → 3.0.58-fork.21

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.
@@ -18,17 +18,18 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/internal/index.ts
21
- var internal_exports = {};
22
- __export(internal_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
24
24
  anthropicTools: () => anthropicTools,
25
+ getModelCapabilities: () => getModelCapabilities,
25
26
  prepareTools: () => prepareTools
26
27
  });
27
- module.exports = __toCommonJS(internal_exports);
28
+ module.exports = __toCommonJS(index_exports);
28
29
 
29
30
  // src/anthropic-messages-language-model.ts
30
31
  var import_provider3 = require("@ai-sdk/provider");
31
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
32
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
32
33
 
33
34
  // src/anthropic-error.ts
34
35
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -873,6 +874,20 @@ var anthropicLanguageModelOptions = import_v43.z.object({
873
874
  type: import_v43.z.literal("ephemeral"),
874
875
  ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
875
876
  }).optional(),
877
+ /**
878
+ * Metadata to include with the request.
879
+ *
880
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
881
+ */
882
+ metadata: import_v43.z.object({
883
+ /**
884
+ * An external identifier for the user associated with the request.
885
+ *
886
+ * Should be a UUID, hash value, or other opaque identifier.
887
+ * Must not contain PII (name, email, phone number, etc.).
888
+ */
889
+ userId: import_v43.z.string().optional()
890
+ }).optional(),
876
891
  /**
877
892
  * MCP servers to be utilized in this request.
878
893
  */
@@ -934,6 +949,12 @@ var anthropicLanguageModelOptions = import_v43.z.object({
934
949
  * Example: Setting prefill to '{"' will make the model start its response with '{"'
935
950
  */
936
951
  prefill: import_v43.z.string().optional(),
952
+ /**
953
+ * Service tier selection.
954
+ * - 'auto': Allow Anthropic to pick standard or priority based on availability.
955
+ * See https://docs.anthropic.com/en/api/messages
956
+ */
957
+ serviceTier: import_v43.z.enum(["auto"]).optional(),
937
958
  contextManagement: import_v43.z.object({
938
959
  edits: import_v43.z.array(
939
960
  import_v43.z.discriminatedUnion("type", [
@@ -1077,7 +1098,14 @@ var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
1077
1098
  region: import_v45.z.string().optional(),
1078
1099
  country: import_v45.z.string().optional(),
1079
1100
  timezone: import_v45.z.string().optional()
1080
- }).optional()
1101
+ }).optional(),
1102
+ allowedCallers: import_v45.z.array(
1103
+ import_v45.z.enum([
1104
+ "direct",
1105
+ "code_execution_20250825",
1106
+ "code_execution_20260120"
1107
+ ])
1108
+ ).optional()
1081
1109
  })
1082
1110
  )
1083
1111
  );
@@ -1160,21 +1188,31 @@ var webSearch_20250305 = (args = {}) => {
1160
1188
  return factory3(args);
1161
1189
  };
1162
1190
 
1163
- // src/tool/web-fetch-20260209.ts
1191
+ // src/tool/web-fetch-20260309.ts
1164
1192
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1165
1193
  var import_v47 = require("zod/v4");
1166
- var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
1194
+ var webFetch_20260309ArgsSchema = (0, import_provider_utils7.lazySchema)(
1167
1195
  () => (0, import_provider_utils7.zodSchema)(
1168
1196
  import_v47.z.object({
1169
1197
  maxUses: import_v47.z.number().optional(),
1170
1198
  allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1171
1199
  blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1172
1200
  citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1173
- maxContentTokens: import_v47.z.number().optional()
1201
+ maxContentTokens: import_v47.z.number().optional(),
1202
+ allowedCallers: import_v47.z.array(
1203
+ import_v47.z.enum([
1204
+ "direct",
1205
+ "code_execution_20250825",
1206
+ "code_execution_20260120"
1207
+ ])
1208
+ ).optional(),
1209
+ useCache: import_v47.z.boolean().optional(),
1210
+ deferLoading: import_v47.z.boolean().optional(),
1211
+ strict: import_v47.z.boolean().optional()
1174
1212
  })
1175
1213
  )
1176
1214
  );
1177
- var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1215
+ var webFetch_20260309OutputSchema = (0, import_provider_utils7.lazySchema)(
1178
1216
  () => (0, import_provider_utils7.zodSchema)(
1179
1217
  import_v47.z.object({
1180
1218
  type: import_v47.z.literal("web_fetch_result"),
@@ -1200,7 +1238,7 @@ var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1200
1238
  })
1201
1239
  )
1202
1240
  );
1203
- var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1241
+ var webFetch_20260309InputSchema = (0, import_provider_utils7.lazySchema)(
1204
1242
  () => (0, import_provider_utils7.zodSchema)(
1205
1243
  import_v47.z.object({
1206
1244
  url: import_v47.z.string()
@@ -1208,19 +1246,19 @@ var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1208
1246
  )
1209
1247
  );
1210
1248
  var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1211
- id: "anthropic.web_fetch_20260209",
1212
- inputSchema: webFetch_20260209InputSchema,
1213
- outputSchema: webFetch_20260209OutputSchema,
1249
+ id: "anthropic.web_fetch_20260309",
1250
+ inputSchema: webFetch_20260309InputSchema,
1251
+ outputSchema: webFetch_20260309OutputSchema,
1214
1252
  supportsDeferredResults: true
1215
1253
  });
1216
- var webFetch_20260209 = (args = {}) => {
1254
+ var webFetch_20260309 = (args = {}) => {
1217
1255
  return factory4(args);
1218
1256
  };
1219
1257
 
1220
- // src/tool/web-fetch-20250910.ts
1258
+ // src/tool/web-fetch-20260209.ts
1221
1259
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1222
1260
  var import_v48 = require("zod/v4");
1223
- var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1261
+ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
1224
1262
  () => (0, import_provider_utils8.zodSchema)(
1225
1263
  import_v48.z.object({
1226
1264
  maxUses: import_v48.z.number().optional(),
@@ -1231,7 +1269,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1231
1269
  })
1232
1270
  )
1233
1271
  );
1234
- var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1272
+ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
1235
1273
  () => (0, import_provider_utils8.zodSchema)(
1236
1274
  import_v48.z.object({
1237
1275
  type: import_v48.z.literal("web_fetch_result"),
@@ -1257,7 +1295,7 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1257
1295
  })
1258
1296
  )
1259
1297
  );
1260
- var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1298
+ var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
1261
1299
  () => (0, import_provider_utils8.zodSchema)(
1262
1300
  import_v48.z.object({
1263
1301
  url: import_v48.z.string()
@@ -1265,23 +1303,81 @@ var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1265
1303
  )
1266
1304
  );
1267
1305
  var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1306
+ id: "anthropic.web_fetch_20260209",
1307
+ inputSchema: webFetch_20260209InputSchema,
1308
+ outputSchema: webFetch_20260209OutputSchema,
1309
+ supportsDeferredResults: true
1310
+ });
1311
+ var webFetch_20260209 = (args = {}) => {
1312
+ return factory5(args);
1313
+ };
1314
+
1315
+ // src/tool/web-fetch-20250910.ts
1316
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1317
+ var import_v49 = require("zod/v4");
1318
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
1319
+ () => (0, import_provider_utils9.zodSchema)(
1320
+ import_v49.z.object({
1321
+ maxUses: import_v49.z.number().optional(),
1322
+ allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1323
+ blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1324
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1325
+ maxContentTokens: import_v49.z.number().optional()
1326
+ })
1327
+ )
1328
+ );
1329
+ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
1330
+ () => (0, import_provider_utils9.zodSchema)(
1331
+ import_v49.z.object({
1332
+ type: import_v49.z.literal("web_fetch_result"),
1333
+ url: import_v49.z.string(),
1334
+ content: import_v49.z.object({
1335
+ type: import_v49.z.literal("document"),
1336
+ title: import_v49.z.string().nullable(),
1337
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1338
+ source: import_v49.z.union([
1339
+ import_v49.z.object({
1340
+ type: import_v49.z.literal("base64"),
1341
+ mediaType: import_v49.z.literal("application/pdf"),
1342
+ data: import_v49.z.string()
1343
+ }),
1344
+ import_v49.z.object({
1345
+ type: import_v49.z.literal("text"),
1346
+ mediaType: import_v49.z.literal("text/plain"),
1347
+ data: import_v49.z.string()
1348
+ })
1349
+ ])
1350
+ }),
1351
+ retrievedAt: import_v49.z.string().nullable()
1352
+ })
1353
+ )
1354
+ );
1355
+ var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
1356
+ () => (0, import_provider_utils9.zodSchema)(
1357
+ import_v49.z.object({
1358
+ url: import_v49.z.string()
1359
+ })
1360
+ )
1361
+ );
1362
+ var factory6 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1268
1363
  id: "anthropic.web_fetch_20250910",
1269
1364
  inputSchema: webFetch_20250910InputSchema,
1270
1365
  outputSchema: webFetch_20250910OutputSchema,
1271
1366
  supportsDeferredResults: true
1272
1367
  });
1273
1368
  var webFetch_20250910 = (args = {}) => {
1274
- return factory5(args);
1369
+ return factory6(args);
1275
1370
  };
1276
1371
 
1277
1372
  // src/anthropic-prepare-tools.ts
1278
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1373
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1279
1374
  async function prepareTools({
1280
1375
  tools,
1281
1376
  toolChoice,
1282
1377
  disableParallelToolUse,
1283
1378
  cacheControlValidator,
1284
- supportsStructuredOutput
1379
+ supportsStructuredOutput,
1380
+ supportsStrictTools
1285
1381
  }) {
1286
1382
  var _a;
1287
1383
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1303,13 +1399,20 @@ async function prepareTools({
1303
1399
  const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1304
1400
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1305
1401
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1402
+ if (!supportsStrictTools && tool.strict != null) {
1403
+ toolWarnings.push({
1404
+ type: "unsupported",
1405
+ feature: "strict",
1406
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1407
+ });
1408
+ }
1306
1409
  anthropicTools2.push({
1307
1410
  name: tool.name,
1308
1411
  description: tool.description,
1309
1412
  input_schema: tool.inputSchema,
1310
1413
  cache_control: cacheControl,
1311
1414
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1312
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1415
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1313
1416
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1314
1417
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1315
1418
  ...tool.inputExamples != null ? {
@@ -1338,7 +1441,6 @@ async function prepareTools({
1338
1441
  break;
1339
1442
  }
1340
1443
  case "anthropic.code_execution_20250825": {
1341
- betas.add("code-execution-2025-08-25");
1342
1444
  anthropicTools2.push({
1343
1445
  type: "code_execution_20250825",
1344
1446
  name: "code_execution"
@@ -1417,7 +1519,7 @@ async function prepareTools({
1417
1519
  break;
1418
1520
  }
1419
1521
  case "anthropic.text_editor_20250728": {
1420
- const args = await (0, import_provider_utils9.validateTypes)({
1522
+ const args = await (0, import_provider_utils10.validateTypes)({
1421
1523
  value: tool.args,
1422
1524
  schema: textEditor_20250728ArgsSchema
1423
1525
  });
@@ -1456,8 +1558,7 @@ async function prepareTools({
1456
1558
  break;
1457
1559
  }
1458
1560
  case "anthropic.web_fetch_20250910": {
1459
- betas.add("web-fetch-2025-09-10");
1460
- const args = await (0, import_provider_utils9.validateTypes)({
1561
+ const args = await (0, import_provider_utils10.validateTypes)({
1461
1562
  value: tool.args,
1462
1563
  schema: webFetch_20250910ArgsSchema
1463
1564
  });
@@ -1474,8 +1575,7 @@ async function prepareTools({
1474
1575
  break;
1475
1576
  }
1476
1577
  case "anthropic.web_fetch_20260209": {
1477
- betas.add("code-execution-web-tools-2026-02-09");
1478
- const args = await (0, import_provider_utils9.validateTypes)({
1578
+ const args = await (0, import_provider_utils10.validateTypes)({
1479
1579
  value: tool.args,
1480
1580
  schema: webFetch_20260209ArgsSchema
1481
1581
  });
@@ -1491,8 +1591,29 @@ async function prepareTools({
1491
1591
  });
1492
1592
  break;
1493
1593
  }
1594
+ case "anthropic.web_fetch_20260309": {
1595
+ const args = await (0, import_provider_utils10.validateTypes)({
1596
+ value: tool.args,
1597
+ schema: webFetch_20260309ArgsSchema
1598
+ });
1599
+ anthropicTools2.push({
1600
+ type: "web_fetch_20260309",
1601
+ name: "web_fetch",
1602
+ max_uses: args.maxUses,
1603
+ allowed_domains: args.allowedDomains,
1604
+ blocked_domains: args.blockedDomains,
1605
+ citations: args.citations,
1606
+ max_content_tokens: args.maxContentTokens,
1607
+ allowed_callers: args.allowedCallers,
1608
+ use_cache: args.useCache,
1609
+ defer_loading: args.deferLoading,
1610
+ strict: args.strict,
1611
+ cache_control: void 0
1612
+ });
1613
+ break;
1614
+ }
1494
1615
  case "anthropic.web_search_20250305": {
1495
- const args = await (0, import_provider_utils9.validateTypes)({
1616
+ const args = await (0, import_provider_utils10.validateTypes)({
1496
1617
  value: tool.args,
1497
1618
  schema: webSearch_20250305ArgsSchema
1498
1619
  });
@@ -1508,8 +1629,7 @@ async function prepareTools({
1508
1629
  break;
1509
1630
  }
1510
1631
  case "anthropic.web_search_20260209": {
1511
- betas.add("code-execution-web-tools-2026-02-09");
1512
- const args = await (0, import_provider_utils9.validateTypes)({
1632
+ const args = await (0, import_provider_utils10.validateTypes)({
1513
1633
  value: tool.args,
1514
1634
  schema: webSearch_20260209ArgsSchema
1515
1635
  });
@@ -1520,12 +1640,12 @@ async function prepareTools({
1520
1640
  allowed_domains: args.allowedDomains,
1521
1641
  blocked_domains: args.blockedDomains,
1522
1642
  user_location: args.userLocation,
1643
+ allowed_callers: args.allowedCallers,
1523
1644
  cache_control: void 0
1524
1645
  });
1525
1646
  break;
1526
1647
  }
1527
1648
  case "anthropic.tool_search_regex_20251119": {
1528
- betas.add("advanced-tool-use-2025-11-20");
1529
1649
  anthropicTools2.push({
1530
1650
  type: "tool_search_tool_regex_20251119",
1531
1651
  name: "tool_search_tool_regex"
@@ -1533,7 +1653,6 @@ async function prepareTools({
1533
1653
  break;
1534
1654
  }
1535
1655
  case "anthropic.tool_search_bm25_20251119": {
1536
- betas.add("advanced-tool-use-2025-11-20");
1537
1656
  anthropicTools2.push({
1538
1657
  type: "tool_search_tool_bm25_20251119",
1539
1658
  name: "tool_search_tool_bm25"
@@ -1653,156 +1772,47 @@ function convertAnthropicMessagesUsage({
1653
1772
 
1654
1773
  // src/convert-to-anthropic-messages-prompt.ts
1655
1774
  var import_provider2 = require("@ai-sdk/provider");
1656
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
1775
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
1657
1776
 
1658
1777
  // src/tool/code-execution_20250522.ts
1659
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1660
- var import_v49 = require("zod/v4");
1661
- var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
1662
- () => (0, import_provider_utils10.zodSchema)(
1663
- import_v49.z.object({
1664
- type: import_v49.z.literal("code_execution_result"),
1665
- stdout: import_v49.z.string(),
1666
- stderr: import_v49.z.string(),
1667
- return_code: import_v49.z.number(),
1668
- content: import_v49.z.array(
1669
- import_v49.z.object({
1670
- type: import_v49.z.literal("code_execution_output"),
1671
- file_id: import_v49.z.string()
1778
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1779
+ var import_v410 = require("zod/v4");
1780
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
1781
+ () => (0, import_provider_utils11.zodSchema)(
1782
+ import_v410.z.object({
1783
+ type: import_v410.z.literal("code_execution_result"),
1784
+ stdout: import_v410.z.string(),
1785
+ stderr: import_v410.z.string(),
1786
+ return_code: import_v410.z.number(),
1787
+ content: import_v410.z.array(
1788
+ import_v410.z.object({
1789
+ type: import_v410.z.literal("code_execution_output"),
1790
+ file_id: import_v410.z.string()
1672
1791
  })
1673
1792
  ).optional().default([])
1674
1793
  })
1675
1794
  )
1676
1795
  );
1677
- var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
1678
- () => (0, import_provider_utils10.zodSchema)(
1679
- import_v49.z.object({
1680
- code: import_v49.z.string()
1796
+ var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
1797
+ () => (0, import_provider_utils11.zodSchema)(
1798
+ import_v410.z.object({
1799
+ code: import_v410.z.string()
1681
1800
  })
1682
1801
  )
1683
1802
  );
1684
- var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1803
+ var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1685
1804
  id: "anthropic.code_execution_20250522",
1686
1805
  inputSchema: codeExecution_20250522InputSchema,
1687
1806
  outputSchema: codeExecution_20250522OutputSchema
1688
1807
  });
1689
1808
  var codeExecution_20250522 = (args = {}) => {
1690
- return factory6(args);
1691
- };
1692
-
1693
- // src/tool/code-execution_20250825.ts
1694
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1695
- var import_v410 = require("zod/v4");
1696
- var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
1697
- () => (0, import_provider_utils11.zodSchema)(
1698
- import_v410.z.discriminatedUnion("type", [
1699
- import_v410.z.object({
1700
- type: import_v410.z.literal("code_execution_result"),
1701
- stdout: import_v410.z.string(),
1702
- stderr: import_v410.z.string(),
1703
- return_code: import_v410.z.number(),
1704
- content: import_v410.z.array(
1705
- import_v410.z.object({
1706
- type: import_v410.z.literal("code_execution_output"),
1707
- file_id: import_v410.z.string()
1708
- })
1709
- ).optional().default([])
1710
- }),
1711
- import_v410.z.object({
1712
- type: import_v410.z.literal("bash_code_execution_result"),
1713
- content: import_v410.z.array(
1714
- import_v410.z.object({
1715
- type: import_v410.z.literal("bash_code_execution_output"),
1716
- file_id: import_v410.z.string()
1717
- })
1718
- ),
1719
- stdout: import_v410.z.string(),
1720
- stderr: import_v410.z.string(),
1721
- return_code: import_v410.z.number()
1722
- }),
1723
- import_v410.z.object({
1724
- type: import_v410.z.literal("bash_code_execution_tool_result_error"),
1725
- error_code: import_v410.z.string()
1726
- }),
1727
- import_v410.z.object({
1728
- type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
1729
- error_code: import_v410.z.string()
1730
- }),
1731
- import_v410.z.object({
1732
- type: import_v410.z.literal("text_editor_code_execution_view_result"),
1733
- content: import_v410.z.string(),
1734
- file_type: import_v410.z.string(),
1735
- num_lines: import_v410.z.number().nullable(),
1736
- start_line: import_v410.z.number().nullable(),
1737
- total_lines: import_v410.z.number().nullable()
1738
- }),
1739
- import_v410.z.object({
1740
- type: import_v410.z.literal("text_editor_code_execution_create_result"),
1741
- is_file_update: import_v410.z.boolean()
1742
- }),
1743
- import_v410.z.object({
1744
- type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
1745
- lines: import_v410.z.array(import_v410.z.string()).nullable(),
1746
- new_lines: import_v410.z.number().nullable(),
1747
- new_start: import_v410.z.number().nullable(),
1748
- old_lines: import_v410.z.number().nullable(),
1749
- old_start: import_v410.z.number().nullable()
1750
- })
1751
- ])
1752
- )
1753
- );
1754
- var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
1755
- () => (0, import_provider_utils11.zodSchema)(
1756
- import_v410.z.discriminatedUnion("type", [
1757
- // Programmatic tool calling format (mapped from { code } by AI SDK)
1758
- import_v410.z.object({
1759
- type: import_v410.z.literal("programmatic-tool-call"),
1760
- code: import_v410.z.string()
1761
- }),
1762
- import_v410.z.object({
1763
- type: import_v410.z.literal("bash_code_execution"),
1764
- command: import_v410.z.string()
1765
- }),
1766
- import_v410.z.discriminatedUnion("command", [
1767
- import_v410.z.object({
1768
- type: import_v410.z.literal("text_editor_code_execution"),
1769
- command: import_v410.z.literal("view"),
1770
- path: import_v410.z.string()
1771
- }),
1772
- import_v410.z.object({
1773
- type: import_v410.z.literal("text_editor_code_execution"),
1774
- command: import_v410.z.literal("create"),
1775
- path: import_v410.z.string(),
1776
- file_text: import_v410.z.string().nullish()
1777
- }),
1778
- import_v410.z.object({
1779
- type: import_v410.z.literal("text_editor_code_execution"),
1780
- command: import_v410.z.literal("str_replace"),
1781
- path: import_v410.z.string(),
1782
- old_str: import_v410.z.string(),
1783
- new_str: import_v410.z.string()
1784
- })
1785
- ])
1786
- ])
1787
- )
1788
- );
1789
- var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1790
- id: "anthropic.code_execution_20250825",
1791
- inputSchema: codeExecution_20250825InputSchema,
1792
- outputSchema: codeExecution_20250825OutputSchema,
1793
- // Programmatic tool calling: tool results may be deferred to a later turn
1794
- // when code execution triggers a client-executed tool that needs to be
1795
- // resolved before the code execution result can be returned.
1796
- supportsDeferredResults: true
1797
- });
1798
- var codeExecution_20250825 = (args = {}) => {
1799
1809
  return factory7(args);
1800
1810
  };
1801
1811
 
1802
- // src/tool/code-execution_20260120.ts
1812
+ // src/tool/code-execution_20250825.ts
1803
1813
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
1804
1814
  var import_v411 = require("zod/v4");
1805
- var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
1815
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
1806
1816
  () => (0, import_provider_utils12.zodSchema)(
1807
1817
  import_v411.z.discriminatedUnion("type", [
1808
1818
  import_v411.z.object({
@@ -1817,18 +1827,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
1817
1827
  })
1818
1828
  ).optional().default([])
1819
1829
  }),
1820
- import_v411.z.object({
1821
- type: import_v411.z.literal("encrypted_code_execution_result"),
1822
- encrypted_stdout: import_v411.z.string(),
1823
- stderr: import_v411.z.string(),
1824
- return_code: import_v411.z.number(),
1825
- content: import_v411.z.array(
1826
- import_v411.z.object({
1827
- type: import_v411.z.literal("code_execution_output"),
1828
- file_id: import_v411.z.string()
1829
- })
1830
- ).optional().default([])
1831
- }),
1832
1830
  import_v411.z.object({
1833
1831
  type: import_v411.z.literal("bash_code_execution_result"),
1834
1832
  content: import_v411.z.array(
@@ -1872,9 +1870,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
1872
1870
  ])
1873
1871
  )
1874
1872
  );
1875
- var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1873
+ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
1876
1874
  () => (0, import_provider_utils12.zodSchema)(
1877
1875
  import_v411.z.discriminatedUnion("type", [
1876
+ // Programmatic tool calling format (mapped from { code } by AI SDK)
1878
1877
  import_v411.z.object({
1879
1878
  type: import_v411.z.literal("programmatic-tool-call"),
1880
1879
  code: import_v411.z.string()
@@ -1907,31 +1906,151 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1907
1906
  )
1908
1907
  );
1909
1908
  var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1910
- id: "anthropic.code_execution_20260120",
1911
- inputSchema: codeExecution_20260120InputSchema,
1912
- outputSchema: codeExecution_20260120OutputSchema,
1909
+ id: "anthropic.code_execution_20250825",
1910
+ inputSchema: codeExecution_20250825InputSchema,
1911
+ outputSchema: codeExecution_20250825OutputSchema,
1912
+ // Programmatic tool calling: tool results may be deferred to a later turn
1913
+ // when code execution triggers a client-executed tool that needs to be
1914
+ // resolved before the code execution result can be returned.
1913
1915
  supportsDeferredResults: true
1914
1916
  });
1915
- var codeExecution_20260120 = (args = {}) => {
1917
+ var codeExecution_20250825 = (args = {}) => {
1916
1918
  return factory8(args);
1917
1919
  };
1918
1920
 
1919
- // src/tool/tool-search-regex_20251119.ts
1921
+ // src/tool/code-execution_20260120.ts
1920
1922
  var import_provider_utils13 = require("@ai-sdk/provider-utils");
1921
1923
  var import_v412 = require("zod/v4");
1922
- var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
1924
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
1923
1925
  () => (0, import_provider_utils13.zodSchema)(
1924
- import_v412.z.array(
1926
+ import_v412.z.discriminatedUnion("type", [
1927
+ import_v412.z.object({
1928
+ type: import_v412.z.literal("code_execution_result"),
1929
+ stdout: import_v412.z.string(),
1930
+ stderr: import_v412.z.string(),
1931
+ return_code: import_v412.z.number(),
1932
+ content: import_v412.z.array(
1933
+ import_v412.z.object({
1934
+ type: import_v412.z.literal("code_execution_output"),
1935
+ file_id: import_v412.z.string()
1936
+ })
1937
+ ).optional().default([])
1938
+ }),
1925
1939
  import_v412.z.object({
1926
- type: import_v412.z.literal("tool_reference"),
1927
- toolName: import_v412.z.string()
1940
+ type: import_v412.z.literal("encrypted_code_execution_result"),
1941
+ encrypted_stdout: import_v412.z.string(),
1942
+ stderr: import_v412.z.string(),
1943
+ return_code: import_v412.z.number(),
1944
+ content: import_v412.z.array(
1945
+ import_v412.z.object({
1946
+ type: import_v412.z.literal("code_execution_output"),
1947
+ file_id: import_v412.z.string()
1948
+ })
1949
+ ).optional().default([])
1950
+ }),
1951
+ import_v412.z.object({
1952
+ type: import_v412.z.literal("bash_code_execution_result"),
1953
+ content: import_v412.z.array(
1954
+ import_v412.z.object({
1955
+ type: import_v412.z.literal("bash_code_execution_output"),
1956
+ file_id: import_v412.z.string()
1957
+ })
1958
+ ),
1959
+ stdout: import_v412.z.string(),
1960
+ stderr: import_v412.z.string(),
1961
+ return_code: import_v412.z.number()
1962
+ }),
1963
+ import_v412.z.object({
1964
+ type: import_v412.z.literal("bash_code_execution_tool_result_error"),
1965
+ error_code: import_v412.z.string()
1966
+ }),
1967
+ import_v412.z.object({
1968
+ type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
1969
+ error_code: import_v412.z.string()
1970
+ }),
1971
+ import_v412.z.object({
1972
+ type: import_v412.z.literal("text_editor_code_execution_view_result"),
1973
+ content: import_v412.z.string(),
1974
+ file_type: import_v412.z.string(),
1975
+ num_lines: import_v412.z.number().nullable(),
1976
+ start_line: import_v412.z.number().nullable(),
1977
+ total_lines: import_v412.z.number().nullable()
1978
+ }),
1979
+ import_v412.z.object({
1980
+ type: import_v412.z.literal("text_editor_code_execution_create_result"),
1981
+ is_file_update: import_v412.z.boolean()
1982
+ }),
1983
+ import_v412.z.object({
1984
+ type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
1985
+ lines: import_v412.z.array(import_v412.z.string()).nullable(),
1986
+ new_lines: import_v412.z.number().nullable(),
1987
+ new_start: import_v412.z.number().nullable(),
1988
+ old_lines: import_v412.z.number().nullable(),
1989
+ old_start: import_v412.z.number().nullable()
1928
1990
  })
1929
- )
1991
+ ])
1930
1992
  )
1931
1993
  );
1932
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
1994
+ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
1933
1995
  () => (0, import_provider_utils13.zodSchema)(
1934
- import_v412.z.object({
1996
+ import_v412.z.discriminatedUnion("type", [
1997
+ import_v412.z.object({
1998
+ type: import_v412.z.literal("programmatic-tool-call"),
1999
+ code: import_v412.z.string()
2000
+ }),
2001
+ import_v412.z.object({
2002
+ type: import_v412.z.literal("bash_code_execution"),
2003
+ command: import_v412.z.string()
2004
+ }),
2005
+ import_v412.z.discriminatedUnion("command", [
2006
+ import_v412.z.object({
2007
+ type: import_v412.z.literal("text_editor_code_execution"),
2008
+ command: import_v412.z.literal("view"),
2009
+ path: import_v412.z.string()
2010
+ }),
2011
+ import_v412.z.object({
2012
+ type: import_v412.z.literal("text_editor_code_execution"),
2013
+ command: import_v412.z.literal("create"),
2014
+ path: import_v412.z.string(),
2015
+ file_text: import_v412.z.string().nullish()
2016
+ }),
2017
+ import_v412.z.object({
2018
+ type: import_v412.z.literal("text_editor_code_execution"),
2019
+ command: import_v412.z.literal("str_replace"),
2020
+ path: import_v412.z.string(),
2021
+ old_str: import_v412.z.string(),
2022
+ new_str: import_v412.z.string()
2023
+ })
2024
+ ])
2025
+ ])
2026
+ )
2027
+ );
2028
+ var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2029
+ id: "anthropic.code_execution_20260120",
2030
+ inputSchema: codeExecution_20260120InputSchema,
2031
+ outputSchema: codeExecution_20260120OutputSchema,
2032
+ supportsDeferredResults: true
2033
+ });
2034
+ var codeExecution_20260120 = (args = {}) => {
2035
+ return factory9(args);
2036
+ };
2037
+
2038
+ // src/tool/tool-search-regex_20251119.ts
2039
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2040
+ var import_v413 = require("zod/v4");
2041
+ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
2042
+ () => (0, import_provider_utils14.zodSchema)(
2043
+ import_v413.z.array(
2044
+ import_v413.z.object({
2045
+ type: import_v413.z.literal("tool_reference"),
2046
+ toolName: import_v413.z.string()
2047
+ })
2048
+ )
2049
+ )
2050
+ );
2051
+ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
2052
+ () => (0, import_provider_utils14.zodSchema)(
2053
+ import_v413.z.object({
1935
2054
  /**
1936
2055
  * A regex pattern to search for tools.
1937
2056
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1942,28 +2061,28 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
1942
2061
  * - "database.*query|query.*database" - OR patterns for flexibility
1943
2062
  * - "(?i)slack" - case-insensitive search
1944
2063
  */
1945
- pattern: import_v412.z.string(),
2064
+ pattern: import_v413.z.string(),
1946
2065
  /**
1947
2066
  * Maximum number of tools to return. Optional.
1948
2067
  */
1949
- limit: import_v412.z.number().optional()
2068
+ limit: import_v413.z.number().optional()
1950
2069
  })
1951
2070
  )
1952
2071
  );
1953
- var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
2072
+ var factory10 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
1954
2073
  id: "anthropic.tool_search_regex_20251119",
1955
2074
  inputSchema: toolSearchRegex_20251119InputSchema,
1956
2075
  outputSchema: toolSearchRegex_20251119OutputSchema,
1957
2076
  supportsDeferredResults: true
1958
2077
  });
1959
2078
  var toolSearchRegex_20251119 = (args = {}) => {
1960
- return factory9(args);
2079
+ return factory10(args);
1961
2080
  };
1962
2081
 
1963
2082
  // src/convert-to-anthropic-messages-prompt.ts
1964
2083
  function convertToString(data) {
1965
2084
  if (typeof data === "string") {
1966
- return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
2085
+ return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
1967
2086
  }
1968
2087
  if (data instanceof Uint8Array) {
1969
2088
  return new TextDecoder().decode(data);
@@ -2007,7 +2126,7 @@ async function convertToAnthropicMessagesPrompt({
2007
2126
  const messages = [];
2008
2127
  async function shouldEnableCitations(providerMetadata) {
2009
2128
  var _a2, _b2;
2010
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2129
+ const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
2011
2130
  provider: "anthropic",
2012
2131
  providerOptions: providerMetadata,
2013
2132
  schema: anthropicFilePartProviderOptions
@@ -2015,7 +2134,7 @@ async function convertToAnthropicMessagesPrompt({
2015
2134
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
2016
2135
  }
2017
2136
  async function getDocumentMetadata(providerMetadata) {
2018
- const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2137
+ const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
2019
2138
  provider: "anthropic",
2020
2139
  providerOptions: providerMetadata,
2021
2140
  schema: anthropicFilePartProviderOptions
@@ -2036,14 +2155,17 @@ async function convertToAnthropicMessagesPrompt({
2036
2155
  functionality: "Multiple system messages that are separated by user/assistant messages"
2037
2156
  });
2038
2157
  }
2039
- system = block.messages.map(({ content, providerOptions }) => ({
2040
- type: "text",
2041
- text: content,
2042
- cache_control: validator.getCacheControl(providerOptions, {
2158
+ system = block.messages.map(({ content, providerOptions }) => {
2159
+ const cc = validator.getCacheControl(providerOptions, {
2043
2160
  type: "system message",
2044
2161
  canCache: true
2045
- })
2046
- }));
2162
+ });
2163
+ return {
2164
+ type: "text",
2165
+ text: content,
2166
+ cache_control: cc
2167
+ };
2168
+ });
2047
2169
  break;
2048
2170
  }
2049
2171
  case "user": {
@@ -2096,7 +2218,7 @@ async function convertToAnthropicMessagesPrompt({
2096
2218
  } : {
2097
2219
  type: "base64",
2098
2220
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2099
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2221
+ data: (0, import_provider_utils15.convertToBase64)(part.data)
2100
2222
  },
2101
2223
  cache_control: cacheControl
2102
2224
  });
@@ -2116,7 +2238,7 @@ async function convertToAnthropicMessagesPrompt({
2116
2238
  } : {
2117
2239
  type: "base64",
2118
2240
  media_type: "application/pdf",
2119
- data: (0, import_provider_utils14.convertToBase64)(part.data)
2241
+ data: (0, import_provider_utils15.convertToBase64)(part.data)
2120
2242
  },
2121
2243
  title: (_c = metadata.title) != null ? _c : part.filename,
2122
2244
  ...metadata.context && { context: metadata.context },
@@ -2254,7 +2376,7 @@ async function convertToAnthropicMessagesPrompt({
2254
2376
  return void 0;
2255
2377
  }
2256
2378
  }
2257
- }).filter(import_provider_utils14.isNonNullable);
2379
+ }).filter(import_provider_utils15.isNonNullable);
2258
2380
  break;
2259
2381
  case "text":
2260
2382
  case "error-text":
@@ -2330,7 +2452,7 @@ async function convertToAnthropicMessagesPrompt({
2330
2452
  }
2331
2453
  case "reasoning": {
2332
2454
  if (sendReasoning) {
2333
- const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
2455
+ const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
2334
2456
  provider: "anthropic",
2335
2457
  providerOptions: part.providerOptions,
2336
2458
  schema: anthropicReasoningMetadataSchema
@@ -2536,7 +2658,7 @@ async function convertToAnthropicMessagesPrompt({
2536
2658
  break;
2537
2659
  }
2538
2660
  if (output.value.type === "code_execution_result") {
2539
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2661
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2540
2662
  value: output.value,
2541
2663
  schema: codeExecution_20250522OutputSchema
2542
2664
  });
@@ -2553,7 +2675,7 @@ async function convertToAnthropicMessagesPrompt({
2553
2675
  cache_control: cacheControl
2554
2676
  });
2555
2677
  } else if (output.value.type === "encrypted_code_execution_result") {
2556
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2678
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2557
2679
  value: output.value,
2558
2680
  schema: codeExecution_20260120OutputSchema
2559
2681
  });
@@ -2572,7 +2694,7 @@ async function convertToAnthropicMessagesPrompt({
2572
2694
  });
2573
2695
  }
2574
2696
  } else {
2575
- const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2697
+ const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
2576
2698
  value: output.value,
2577
2699
  schema: codeExecution_20250825OutputSchema
2578
2700
  });
@@ -2620,7 +2742,7 @@ async function convertToAnthropicMessagesPrompt({
2620
2742
  } catch (e) {
2621
2743
  const extractedErrorCode = (_s = output.value) == null ? void 0 : _s.errorCode;
2622
2744
  errorValue = {
2623
- errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
2745
+ errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unavailable"
2624
2746
  };
2625
2747
  }
2626
2748
  anthropicContent.push({
@@ -2628,7 +2750,7 @@ async function convertToAnthropicMessagesPrompt({
2628
2750
  tool_use_id: part.toolCallId,
2629
2751
  content: {
2630
2752
  type: "web_fetch_tool_result_error",
2631
- error_code: (_t = errorValue.errorCode) != null ? _t : "unknown"
2753
+ error_code: (_t = errorValue.errorCode) != null ? _t : "unavailable"
2632
2754
  },
2633
2755
  cache_control: cacheControl
2634
2756
  });
@@ -2641,7 +2763,7 @@ async function convertToAnthropicMessagesPrompt({
2641
2763
  });
2642
2764
  break;
2643
2765
  }
2644
- const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
2766
+ const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
2645
2767
  value: output.value,
2646
2768
  schema: webFetch_20250910OutputSchema
2647
2769
  });
@@ -2676,7 +2798,7 @@ async function convertToAnthropicMessagesPrompt({
2676
2798
  });
2677
2799
  break;
2678
2800
  }
2679
- const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
2801
+ const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
2680
2802
  value: output.value,
2681
2803
  schema: webSearch_20250305OutputSchema
2682
2804
  });
@@ -2696,6 +2818,18 @@ async function convertToAnthropicMessagesPrompt({
2696
2818
  }
2697
2819
  if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
2698
2820
  const output = part.output;
2821
+ if (output.type === "error-text" || output.type === "error-json") {
2822
+ anthropicContent.push({
2823
+ type: "tool_search_tool_result",
2824
+ tool_use_id: part.toolCallId,
2825
+ content: {
2826
+ type: "tool_search_tool_result_error",
2827
+ error_code: "unavailable"
2828
+ },
2829
+ cache_control: cacheControl
2830
+ });
2831
+ break;
2832
+ }
2699
2833
  if (output.type !== "json") {
2700
2834
  warnings.push({
2701
2835
  type: "other",
@@ -2703,7 +2837,7 @@ async function convertToAnthropicMessagesPrompt({
2703
2837
  });
2704
2838
  break;
2705
2839
  }
2706
- const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
2840
+ const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
2707
2841
  value: output.value,
2708
2842
  schema: toolSearchRegex_20251119OutputSchema
2709
2843
  });
@@ -2817,6 +2951,61 @@ function mapAnthropicStopReason({
2817
2951
  }
2818
2952
 
2819
2953
  // src/anthropic-messages-language-model.ts
2954
+ function isCustomReasoning(reasoning) {
2955
+ return reasoning !== void 0 && reasoning !== "provider-default";
2956
+ }
2957
+ function mapReasoningToProviderEffort({
2958
+ reasoning,
2959
+ effortMap,
2960
+ warnings
2961
+ }) {
2962
+ const mapped = effortMap[reasoning];
2963
+ if (mapped == null) {
2964
+ warnings.push({
2965
+ type: "unsupported",
2966
+ feature: "reasoning",
2967
+ details: `reasoning "${reasoning}" is not supported by this model.`
2968
+ });
2969
+ return void 0;
2970
+ }
2971
+ if (mapped !== reasoning) {
2972
+ warnings.push({
2973
+ type: "compatibility",
2974
+ feature: "reasoning",
2975
+ details: `reasoning "${reasoning}" is not directly supported by this model. mapped to effort "${mapped}".`
2976
+ });
2977
+ }
2978
+ return mapped;
2979
+ }
2980
+ var DEFAULT_REASONING_BUDGET_PERCENTAGES = {
2981
+ minimal: 0.02,
2982
+ low: 0.1,
2983
+ medium: 0.3,
2984
+ high: 0.6,
2985
+ xhigh: 0.9
2986
+ };
2987
+ function mapReasoningToProviderBudget({
2988
+ reasoning,
2989
+ maxOutputTokens,
2990
+ maxReasoningBudget,
2991
+ minReasoningBudget = 1024,
2992
+ budgetPercentages = DEFAULT_REASONING_BUDGET_PERCENTAGES,
2993
+ warnings
2994
+ }) {
2995
+ const pct = budgetPercentages[reasoning];
2996
+ if (pct == null) {
2997
+ warnings.push({
2998
+ type: "unsupported",
2999
+ feature: "reasoning",
3000
+ details: `reasoning "${reasoning}" is not supported by this model.`
3001
+ });
3002
+ return void 0;
3003
+ }
3004
+ return Math.min(
3005
+ maxReasoningBudget,
3006
+ Math.max(minReasoningBudget, Math.round(maxOutputTokens * pct))
3007
+ );
3008
+ }
2820
3009
  function createCitationSource(citation, citationDocuments, generateId2) {
2821
3010
  var _a;
2822
3011
  if (citation.type === "web_search_result_location") {
@@ -2863,11 +3052,11 @@ function createCitationSource(citation, citationDocuments, generateId2) {
2863
3052
  }
2864
3053
  var AnthropicMessagesLanguageModel = class {
2865
3054
  constructor(modelId, config) {
2866
- this.specificationVersion = "v3";
3055
+ this.specificationVersion = "v4";
2867
3056
  var _a;
2868
3057
  this.modelId = modelId;
2869
3058
  this.config = config;
2870
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
3059
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
2871
3060
  }
2872
3061
  supportsUrl(url) {
2873
3062
  return url.protocol === "https:";
@@ -2902,10 +3091,11 @@ var AnthropicMessagesLanguageModel = class {
2902
3091
  seed,
2903
3092
  tools,
2904
3093
  toolChoice,
3094
+ reasoning,
2905
3095
  providerOptions,
2906
3096
  stream
2907
3097
  }) {
2908
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3098
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2909
3099
  const warnings = [];
2910
3100
  if (frequencyPenalty != null) {
2911
3101
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2941,12 +3131,12 @@ var AnthropicMessagesLanguageModel = class {
2941
3131
  }
2942
3132
  }
2943
3133
  const providerOptionsName = this.providerOptionsName;
2944
- const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
3134
+ const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
2945
3135
  provider: "anthropic",
2946
3136
  providerOptions,
2947
3137
  schema: anthropicLanguageModelOptions
2948
3138
  });
2949
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
3139
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
2950
3140
  provider: providerOptionsName,
2951
3141
  providerOptions,
2952
3142
  schema: anthropicLanguageModelOptions
@@ -2960,10 +3150,12 @@ var AnthropicMessagesLanguageModel = class {
2960
3150
  const {
2961
3151
  maxOutputTokens: maxOutputTokensForModel,
2962
3152
  supportsStructuredOutput: modelSupportsStructuredOutput,
3153
+ supportsAdaptiveThinking,
2963
3154
  isKnownModel
2964
3155
  } = getModelCapabilities(this.modelId);
2965
3156
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2966
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3157
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3158
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
2967
3159
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2968
3160
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2969
3161
  type: "function",
@@ -2973,7 +3165,7 @@ var AnthropicMessagesLanguageModel = class {
2973
3165
  } : void 0;
2974
3166
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
2975
3167
  const cacheControlValidator = new CacheControlValidator();
2976
- const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
3168
+ const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
2977
3169
  tools,
2978
3170
  providerToolNames: {
2979
3171
  "anthropic.code_execution_20250522": "code_execution",
@@ -2991,6 +3183,7 @@ var AnthropicMessagesLanguageModel = class {
2991
3183
  "anthropic.web_search_20250305": "web_search",
2992
3184
  "anthropic.web_search_20260209": "web_search",
2993
3185
  "anthropic.web_fetch_20250910": "web_fetch",
3186
+ "anthropic.web_fetch_20260309": "web_fetch",
2994
3187
  "anthropic.web_fetch_20260209": "web_fetch",
2995
3188
  "anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
2996
3189
  "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
@@ -2998,11 +3191,25 @@ var AnthropicMessagesLanguageModel = class {
2998
3191
  });
2999
3192
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
3000
3193
  prompt,
3001
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3194
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
3002
3195
  warnings,
3003
3196
  cacheControlValidator,
3004
3197
  toolNameMapping
3005
3198
  });
3199
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3200
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3201
+ reasoning,
3202
+ supportsAdaptiveThinking,
3203
+ maxOutputTokensForModel,
3204
+ warnings
3205
+ });
3206
+ if (reasoningConfig != null) {
3207
+ anthropicOptions.thinking = reasoningConfig.thinking;
3208
+ if (reasoningConfig.effort != null) {
3209
+ anthropicOptions.effort = reasoningConfig.effort;
3210
+ }
3211
+ }
3212
+ }
3006
3213
  if (anthropicOptions == null ? void 0 : anthropicOptions.prefill) {
3007
3214
  const lastMessage = messagesPrompt.messages[messagesPrompt.messages.length - 1];
3008
3215
  if ((lastMessage == null ? void 0 : lastMessage.role) === "assistant") {
@@ -3024,9 +3231,9 @@ var AnthropicMessagesLanguageModel = class {
3024
3231
  });
3025
3232
  }
3026
3233
  }
3027
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3234
+ const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
3028
3235
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
3029
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
3236
+ let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
3030
3237
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
3031
3238
  const baseArgs = {
3032
3239
  // model id:
@@ -3042,7 +3249,7 @@ var AnthropicMessagesLanguageModel = class {
3042
3249
  thinking: {
3043
3250
  type: thinkingType,
3044
3251
  ...thinkingBudget != null && { budget_tokens: thinkingBudget },
3045
- ...((_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type) !== "disabled" && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.display) && {
3252
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.type) !== "disabled" && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display) && {
3046
3253
  display: anthropicOptions.thinking.display
3047
3254
  }
3048
3255
  }
@@ -3063,9 +3270,22 @@ var AnthropicMessagesLanguageModel = class {
3063
3270
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
3064
3271
  speed: anthropicOptions.speed
3065
3272
  },
3273
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.metadata) && {
3274
+ metadata: {
3275
+ ...anthropicOptions.metadata.userId && {
3276
+ user_id: anthropicOptions.metadata.userId
3277
+ }
3278
+ }
3279
+ },
3280
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.serviceTier) && {
3281
+ service_tier: anthropicOptions.serviceTier
3282
+ },
3066
3283
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3067
3284
  cache_control: anthropicOptions.cacheControl
3068
3285
  },
3286
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3287
+ metadata: { user_id: anthropicOptions.metadata.userId }
3288
+ },
3069
3289
  // mcp servers:
3070
3290
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3071
3291
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3218,7 +3438,6 @@ var AnthropicMessagesLanguageModel = class {
3218
3438
  }
3219
3439
  }
3220
3440
  if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
3221
- betas.add("code-execution-2025-08-25");
3222
3441
  betas.add("skills-2025-10-02");
3223
3442
  betas.add("files-api-2025-04-14");
3224
3443
  if (!(tools == null ? void 0 : tools.some(
@@ -3236,7 +3455,7 @@ var AnthropicMessagesLanguageModel = class {
3236
3455
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3237
3456
  betas.add("fast-mode-2026-02-01");
3238
3457
  }
3239
- if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
3458
+ if (stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true)) {
3240
3459
  betas.add("fine-grained-tool-streaming-2025-05-14");
3241
3460
  }
3242
3461
  const {
@@ -3250,13 +3469,15 @@ var AnthropicMessagesLanguageModel = class {
3250
3469
  toolChoice: { type: "required" },
3251
3470
  disableParallelToolUse: true,
3252
3471
  cacheControlValidator,
3253
- supportsStructuredOutput: false
3472
+ supportsStructuredOutput: false,
3473
+ supportsStrictTools
3254
3474
  } : {
3255
3475
  tools: tools != null ? tools : [],
3256
3476
  toolChoice,
3257
3477
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3258
3478
  cacheControlValidator,
3259
- supportsStructuredOutput
3479
+ supportsStructuredOutput,
3480
+ supportsStrictTools
3260
3481
  }
3261
3482
  );
3262
3483
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3273,7 +3494,7 @@ var AnthropicMessagesLanguageModel = class {
3273
3494
  ...betas,
3274
3495
  ...toolsBetas,
3275
3496
  ...userSuppliedBetas,
3276
- ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
3497
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3277
3498
  ]),
3278
3499
  usesJsonResponseTool: jsonResponseTool != null,
3279
3500
  toolNameMapping,
@@ -3285,15 +3506,15 @@ var AnthropicMessagesLanguageModel = class {
3285
3506
  betas,
3286
3507
  headers
3287
3508
  }) {
3288
- return (0, import_provider_utils15.combineHeaders)(
3289
- await (0, import_provider_utils15.resolve)(this.config.headers),
3509
+ return (0, import_provider_utils16.combineHeaders)(
3510
+ await (0, import_provider_utils16.resolve)(this.config.headers),
3290
3511
  headers,
3291
3512
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3292
3513
  );
3293
3514
  }
3294
3515
  async getBetasFromHeaders(requestHeaders) {
3295
3516
  var _a, _b;
3296
- const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3517
+ const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3297
3518
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3298
3519
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3299
3520
  return new Set(
@@ -3359,12 +3580,12 @@ var AnthropicMessagesLanguageModel = class {
3359
3580
  responseHeaders,
3360
3581
  value: response,
3361
3582
  rawValue: rawResponse
3362
- } = await (0, import_provider_utils15.postJsonToApi)({
3583
+ } = await (0, import_provider_utils16.postJsonToApi)({
3363
3584
  url: this.buildRequestUrl(false),
3364
3585
  headers: await this.getHeaders({ betas, headers: options.headers }),
3365
3586
  body: this.transformRequestBody(args, betas),
3366
3587
  failedResponseHandler: anthropicFailedResponseHandler,
3367
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3588
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3368
3589
  anthropicMessagesResponseSchema
3369
3590
  ),
3370
3591
  abortSignal: options.abortSignal,
@@ -3610,6 +3831,16 @@ var AnthropicMessagesLanguageModel = class {
3610
3831
  }
3611
3832
  // code execution 20250522:
3612
3833
  case "code_execution_tool_result": {
3834
+ if (markCodeExecutionDynamic) {
3835
+ content.push({
3836
+ type: "tool-result",
3837
+ toolCallId: part.tool_use_id,
3838
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3839
+ isError: true,
3840
+ result: "STOP: code_execution is disabled. Do NOT wrap web_search or web_fetch in Python code. Call web_search and web_fetch as DIRECT tool calls \u2014 they are standalone tools, not Python functions."
3841
+ });
3842
+ break;
3843
+ }
3613
3844
  if (part.content.type === "code_execution_result") {
3614
3845
  content.push({
3615
3846
  type: "tool-result",
@@ -3653,6 +3884,16 @@ var AnthropicMessagesLanguageModel = class {
3653
3884
  // code execution 20250825:
3654
3885
  case "bash_code_execution_tool_result":
3655
3886
  case "text_editor_code_execution_tool_result": {
3887
+ if (markCodeExecutionDynamic) {
3888
+ content.push({
3889
+ type: "tool-result",
3890
+ toolCallId: part.tool_use_id,
3891
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3892
+ isError: true,
3893
+ result: "STOP: code_execution is disabled. Do NOT wrap web_search or web_fetch in Python code. Call web_search and web_fetch as DIRECT tool calls \u2014 they are standalone tools, not Python functions."
3894
+ });
3895
+ break;
3896
+ }
3656
3897
  content.push({
3657
3898
  type: "tool-result",
3658
3899
  toolCallId: part.tool_use_id,
@@ -3779,12 +4020,12 @@ var AnthropicMessagesLanguageModel = class {
3779
4020
  body.tools
3780
4021
  );
3781
4022
  const url = this.buildRequestUrl(true);
3782
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
4023
+ const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
3783
4024
  url,
3784
4025
  headers: await this.getHeaders({ betas, headers: options.headers }),
3785
4026
  body: this.transformRequestBody(body, betas),
3786
4027
  failedResponseHandler: anthropicFailedResponseHandler,
3787
- successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
4028
+ successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
3788
4029
  anthropicMessagesChunkSchema
3789
4030
  ),
3790
4031
  abortSignal: options.abortSignal,
@@ -4055,6 +4296,16 @@ var AnthropicMessagesLanguageModel = class {
4055
4296
  }
4056
4297
  // code execution 20250522:
4057
4298
  case "code_execution_tool_result": {
4299
+ if (markCodeExecutionDynamic) {
4300
+ controller.enqueue({
4301
+ type: "tool-result",
4302
+ toolCallId: part.tool_use_id,
4303
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
4304
+ isError: true,
4305
+ result: "STOP: code_execution is disabled. Do NOT wrap web_search or web_fetch in Python code. Call web_search and web_fetch as DIRECT tool calls \u2014 they are standalone tools, not Python functions."
4306
+ });
4307
+ return;
4308
+ }
4058
4309
  if (part.content.type === "code_execution_result") {
4059
4310
  controller.enqueue({
4060
4311
  type: "tool-result",
@@ -4098,6 +4349,16 @@ var AnthropicMessagesLanguageModel = class {
4098
4349
  // code execution 20250825:
4099
4350
  case "bash_code_execution_tool_result":
4100
4351
  case "text_editor_code_execution_tool_result": {
4352
+ if (markCodeExecutionDynamic) {
4353
+ controller.enqueue({
4354
+ type: "tool-result",
4355
+ toolCallId: part.tool_use_id,
4356
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
4357
+ isError: true,
4358
+ result: "STOP: code_execution is disabled. Do NOT wrap web_search or web_fetch in Python code. Call web_search and web_fetch as DIRECT tool calls \u2014 they are standalone tools, not Python functions."
4359
+ });
4360
+ return;
4361
+ }
4101
4362
  controller.enqueue({
4102
4363
  type: "tool-result",
4103
4364
  toolCallId: part.tool_use_id,
@@ -4536,42 +4797,49 @@ function getModelCapabilities(modelId) {
4536
4797
  return {
4537
4798
  maxOutputTokens: 128e3,
4538
4799
  supportsStructuredOutput: true,
4800
+ supportsAdaptiveThinking: true,
4539
4801
  isKnownModel: true
4540
4802
  };
4541
4803
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4542
4804
  return {
4543
4805
  maxOutputTokens: 64e3,
4544
4806
  supportsStructuredOutput: true,
4807
+ supportsAdaptiveThinking: false,
4545
4808
  isKnownModel: true
4546
4809
  };
4547
4810
  } else if (modelId.includes("claude-opus-4-1")) {
4548
4811
  return {
4549
4812
  maxOutputTokens: 32e3,
4550
4813
  supportsStructuredOutput: true,
4814
+ supportsAdaptiveThinking: false,
4551
4815
  isKnownModel: true
4552
4816
  };
4553
4817
  } else if (modelId.includes("claude-sonnet-4-")) {
4554
4818
  return {
4555
4819
  maxOutputTokens: 64e3,
4556
4820
  supportsStructuredOutput: false,
4821
+ supportsAdaptiveThinking: false,
4557
4822
  isKnownModel: true
4558
4823
  };
4559
4824
  } else if (modelId.includes("claude-opus-4-")) {
4560
4825
  return {
4561
4826
  maxOutputTokens: 32e3,
4562
4827
  supportsStructuredOutput: false,
4828
+ supportsAdaptiveThinking: false,
4563
4829
  isKnownModel: true
4564
4830
  };
4565
4831
  } else if (modelId.includes("claude-3-haiku")) {
4566
4832
  return {
4567
4833
  maxOutputTokens: 4096,
4568
4834
  supportsStructuredOutput: false,
4835
+ supportsAdaptiveThinking: false,
4569
4836
  isKnownModel: true
4570
4837
  };
4571
4838
  } else {
4572
4839
  return {
4573
4840
  maxOutputTokens: 4096,
4574
4841
  supportsStructuredOutput: false,
4842
+ supportsAdaptiveThinking: false,
4575
4843
  isKnownModel: false
4576
4844
  };
4577
4845
  }
@@ -4594,6 +4862,43 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4594
4862
  }
4595
4863
  return hasWebTool20260209 && !hasCodeExecutionTool;
4596
4864
  }
4865
+ function resolveAnthropicReasoningConfig({
4866
+ reasoning,
4867
+ supportsAdaptiveThinking,
4868
+ maxOutputTokensForModel,
4869
+ warnings
4870
+ }) {
4871
+ if (!isCustomReasoning(reasoning)) {
4872
+ return void 0;
4873
+ }
4874
+ if (reasoning === "none") {
4875
+ return { thinking: { type: "disabled" } };
4876
+ }
4877
+ if (supportsAdaptiveThinking) {
4878
+ const effort = mapReasoningToProviderEffort({
4879
+ reasoning,
4880
+ effortMap: {
4881
+ minimal: "low",
4882
+ low: "low",
4883
+ medium: "medium",
4884
+ high: "high",
4885
+ xhigh: "max"
4886
+ },
4887
+ warnings
4888
+ });
4889
+ return { thinking: { type: "adaptive" }, effort };
4890
+ }
4891
+ const budgetTokens = mapReasoningToProviderBudget({
4892
+ reasoning,
4893
+ maxOutputTokens: maxOutputTokensForModel,
4894
+ maxReasoningBudget: maxOutputTokensForModel,
4895
+ warnings
4896
+ });
4897
+ if (budgetTokens == null) {
4898
+ return void 0;
4899
+ }
4900
+ return { thinking: { type: "enabled", budgetTokens } };
4901
+ }
4597
4902
  function mapAnthropicResponseContextManagement(contextManagement) {
4598
4903
  return contextManagement ? {
4599
4904
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4621,44 +4926,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4621
4926
  }
4622
4927
 
4623
4928
  // src/tool/bash_20241022.ts
4624
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4625
- var import_v413 = require("zod/v4");
4626
- var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
4627
- () => (0, import_provider_utils16.zodSchema)(
4628
- import_v413.z.object({
4629
- command: import_v413.z.string(),
4630
- restart: import_v413.z.boolean().optional()
4929
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4930
+ var import_v414 = require("zod/v4");
4931
+ var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4932
+ () => (0, import_provider_utils17.zodSchema)(
4933
+ import_v414.z.object({
4934
+ command: import_v414.z.string(),
4935
+ restart: import_v414.z.boolean().optional()
4631
4936
  })
4632
4937
  )
4633
4938
  );
4634
- var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
4939
+ var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
4635
4940
  id: "anthropic.bash_20241022",
4636
4941
  inputSchema: bash_20241022InputSchema
4637
4942
  });
4638
4943
 
4639
4944
  // src/tool/bash_20250124.ts
4640
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4641
- var import_v414 = require("zod/v4");
4642
- var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
4643
- () => (0, import_provider_utils17.zodSchema)(
4644
- import_v414.z.object({
4645
- command: import_v414.z.string(),
4646
- restart: import_v414.z.boolean().optional()
4945
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4946
+ var import_v415 = require("zod/v4");
4947
+ var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4948
+ () => (0, import_provider_utils18.zodSchema)(
4949
+ import_v415.z.object({
4950
+ command: import_v415.z.string(),
4951
+ restart: import_v415.z.boolean().optional()
4647
4952
  })
4648
4953
  )
4649
4954
  );
4650
- var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
4955
+ var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
4651
4956
  id: "anthropic.bash_20250124",
4652
4957
  inputSchema: bash_20250124InputSchema
4653
4958
  });
4654
4959
 
4655
4960
  // src/tool/computer_20241022.ts
4656
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4657
- var import_v415 = require("zod/v4");
4658
- var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4659
- () => (0, import_provider_utils18.zodSchema)(
4660
- import_v415.z.object({
4661
- action: import_v415.z.enum([
4961
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
4962
+ var import_v416 = require("zod/v4");
4963
+ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4964
+ () => (0, import_provider_utils19.zodSchema)(
4965
+ import_v416.z.object({
4966
+ action: import_v416.z.enum([
4662
4967
  "key",
4663
4968
  "type",
4664
4969
  "mouse_move",
@@ -4670,23 +4975,23 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4670
4975
  "screenshot",
4671
4976
  "cursor_position"
4672
4977
  ]),
4673
- coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
4674
- text: import_v415.z.string().optional()
4978
+ coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
4979
+ text: import_v416.z.string().optional()
4675
4980
  })
4676
4981
  )
4677
4982
  );
4678
- var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
4983
+ var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
4679
4984
  id: "anthropic.computer_20241022",
4680
4985
  inputSchema: computer_20241022InputSchema
4681
4986
  });
4682
4987
 
4683
4988
  // src/tool/computer_20250124.ts
4684
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4685
- var import_v416 = require("zod/v4");
4686
- var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4687
- () => (0, import_provider_utils19.zodSchema)(
4688
- import_v416.z.object({
4689
- action: import_v416.z.enum([
4989
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
4990
+ var import_v417 = require("zod/v4");
4991
+ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4992
+ () => (0, import_provider_utils20.zodSchema)(
4993
+ import_v417.z.object({
4994
+ action: import_v417.z.enum([
4690
4995
  "key",
4691
4996
  "hold_key",
4692
4997
  "type",
@@ -4704,27 +5009,27 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4704
5009
  "wait",
4705
5010
  "screenshot"
4706
5011
  ]),
4707
- coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4708
- duration: import_v416.z.number().optional(),
4709
- scroll_amount: import_v416.z.number().optional(),
4710
- scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
4711
- start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4712
- text: import_v416.z.string().optional()
5012
+ coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
5013
+ duration: import_v417.z.number().optional(),
5014
+ scroll_amount: import_v417.z.number().optional(),
5015
+ scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
5016
+ start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
5017
+ text: import_v417.z.string().optional()
4713
5018
  })
4714
5019
  )
4715
5020
  );
4716
- var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
5021
+ var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
4717
5022
  id: "anthropic.computer_20250124",
4718
5023
  inputSchema: computer_20250124InputSchema
4719
5024
  });
4720
5025
 
4721
5026
  // src/tool/computer_20251124.ts
4722
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4723
- var import_v417 = require("zod/v4");
4724
- var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4725
- () => (0, import_provider_utils20.zodSchema)(
4726
- import_v417.z.object({
4727
- action: import_v417.z.enum([
5027
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
5028
+ var import_v418 = require("zod/v4");
5029
+ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
5030
+ () => (0, import_provider_utils21.zodSchema)(
5031
+ import_v418.z.object({
5032
+ action: import_v418.z.enum([
4728
5033
  "key",
4729
5034
  "hold_key",
4730
5035
  "type",
@@ -4743,97 +5048,75 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
4743
5048
  "screenshot",
4744
5049
  "zoom"
4745
5050
  ]),
4746
- coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4747
- duration: import_v417.z.number().optional(),
4748
- region: import_v417.z.tuple([
4749
- import_v417.z.number().int(),
4750
- import_v417.z.number().int(),
4751
- import_v417.z.number().int(),
4752
- import_v417.z.number().int()
5051
+ coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
5052
+ duration: import_v418.z.number().optional(),
5053
+ region: import_v418.z.tuple([
5054
+ import_v418.z.number().int(),
5055
+ import_v418.z.number().int(),
5056
+ import_v418.z.number().int(),
5057
+ import_v418.z.number().int()
4753
5058
  ]).optional(),
4754
- scroll_amount: import_v417.z.number().optional(),
4755
- scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4756
- start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4757
- text: import_v417.z.string().optional()
5059
+ scroll_amount: import_v418.z.number().optional(),
5060
+ scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
5061
+ start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
5062
+ text: import_v418.z.string().optional()
4758
5063
  })
4759
5064
  )
4760
5065
  );
4761
- var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
5066
+ var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
4762
5067
  id: "anthropic.computer_20251124",
4763
5068
  inputSchema: computer_20251124InputSchema
4764
5069
  });
4765
5070
 
4766
5071
  // src/tool/memory_20250818.ts
4767
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
4768
- var import_v418 = require("zod/v4");
4769
- var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
4770
- () => (0, import_provider_utils21.zodSchema)(
4771
- import_v418.z.discriminatedUnion("command", [
4772
- import_v418.z.object({
4773
- command: import_v418.z.literal("view"),
4774
- path: import_v418.z.string(),
4775
- view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
5072
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
5073
+ var import_v419 = require("zod/v4");
5074
+ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
5075
+ () => (0, import_provider_utils22.zodSchema)(
5076
+ import_v419.z.discriminatedUnion("command", [
5077
+ import_v419.z.object({
5078
+ command: import_v419.z.literal("view"),
5079
+ path: import_v419.z.string(),
5080
+ view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
4776
5081
  }),
4777
- import_v418.z.object({
4778
- command: import_v418.z.literal("create"),
4779
- path: import_v418.z.string(),
4780
- file_text: import_v418.z.string()
5082
+ import_v419.z.object({
5083
+ command: import_v419.z.literal("create"),
5084
+ path: import_v419.z.string(),
5085
+ file_text: import_v419.z.string()
4781
5086
  }),
4782
- import_v418.z.object({
4783
- command: import_v418.z.literal("str_replace"),
4784
- path: import_v418.z.string(),
4785
- old_str: import_v418.z.string(),
4786
- new_str: import_v418.z.string()
5087
+ import_v419.z.object({
5088
+ command: import_v419.z.literal("str_replace"),
5089
+ path: import_v419.z.string(),
5090
+ old_str: import_v419.z.string(),
5091
+ new_str: import_v419.z.string()
4787
5092
  }),
4788
- import_v418.z.object({
4789
- command: import_v418.z.literal("insert"),
4790
- path: import_v418.z.string(),
4791
- insert_line: import_v418.z.number(),
4792
- insert_text: import_v418.z.string()
5093
+ import_v419.z.object({
5094
+ command: import_v419.z.literal("insert"),
5095
+ path: import_v419.z.string(),
5096
+ insert_line: import_v419.z.number(),
5097
+ insert_text: import_v419.z.string()
4793
5098
  }),
4794
- import_v418.z.object({
4795
- command: import_v418.z.literal("delete"),
4796
- path: import_v418.z.string()
5099
+ import_v419.z.object({
5100
+ command: import_v419.z.literal("delete"),
5101
+ path: import_v419.z.string()
4797
5102
  }),
4798
- import_v418.z.object({
4799
- command: import_v418.z.literal("rename"),
4800
- old_path: import_v418.z.string(),
4801
- new_path: import_v418.z.string()
5103
+ import_v419.z.object({
5104
+ command: import_v419.z.literal("rename"),
5105
+ old_path: import_v419.z.string(),
5106
+ new_path: import_v419.z.string()
4802
5107
  })
4803
5108
  ])
4804
5109
  )
4805
5110
  );
4806
- var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
5111
+ var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
4807
5112
  id: "anthropic.memory_20250818",
4808
5113
  inputSchema: memory_20250818InputSchema
4809
5114
  });
4810
5115
 
4811
5116
  // src/tool/text-editor_20241022.ts
4812
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
4813
- var import_v419 = require("zod/v4");
4814
- var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
4815
- () => (0, import_provider_utils22.zodSchema)(
4816
- import_v419.z.object({
4817
- command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4818
- path: import_v419.z.string(),
4819
- file_text: import_v419.z.string().optional(),
4820
- insert_line: import_v419.z.number().int().optional(),
4821
- new_str: import_v419.z.string().optional(),
4822
- insert_text: import_v419.z.string().optional(),
4823
- old_str: import_v419.z.string().optional(),
4824
- view_range: import_v419.z.array(import_v419.z.number().int()).optional()
4825
- })
4826
- )
4827
- );
4828
- var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
4829
- id: "anthropic.text_editor_20241022",
4830
- inputSchema: textEditor_20241022InputSchema
4831
- });
4832
-
4833
- // src/tool/text-editor_20250124.ts
4834
5117
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
4835
5118
  var import_v420 = require("zod/v4");
4836
- var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
5119
+ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
4837
5120
  () => (0, import_provider_utils23.zodSchema)(
4838
5121
  import_v420.z.object({
4839
5122
  command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -4847,18 +5130,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
4847
5130
  })
4848
5131
  )
4849
5132
  );
4850
- var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
4851
- id: "anthropic.text_editor_20250124",
4852
- inputSchema: textEditor_20250124InputSchema
5133
+ var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
5134
+ id: "anthropic.text_editor_20241022",
5135
+ inputSchema: textEditor_20241022InputSchema
4853
5136
  });
4854
5137
 
4855
- // src/tool/text-editor_20250429.ts
5138
+ // src/tool/text-editor_20250124.ts
4856
5139
  var import_provider_utils24 = require("@ai-sdk/provider-utils");
4857
5140
  var import_v421 = require("zod/v4");
4858
- var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
5141
+ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
4859
5142
  () => (0, import_provider_utils24.zodSchema)(
4860
5143
  import_v421.z.object({
4861
- command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
5144
+ command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4862
5145
  path: import_v421.z.string(),
4863
5146
  file_text: import_v421.z.string().optional(),
4864
5147
  insert_line: import_v421.z.number().int().optional(),
@@ -4869,47 +5152,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
4869
5152
  })
4870
5153
  )
4871
5154
  );
4872
- var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
4873
- id: "anthropic.text_editor_20250429",
4874
- inputSchema: textEditor_20250429InputSchema
5155
+ var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
5156
+ id: "anthropic.text_editor_20250124",
5157
+ inputSchema: textEditor_20250124InputSchema
4875
5158
  });
4876
5159
 
4877
- // src/tool/tool-search-bm25_20251119.ts
5160
+ // src/tool/text-editor_20250429.ts
4878
5161
  var import_provider_utils25 = require("@ai-sdk/provider-utils");
4879
5162
  var import_v422 = require("zod/v4");
4880
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
5163
+ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
4881
5164
  () => (0, import_provider_utils25.zodSchema)(
4882
- import_v422.z.array(
4883
- import_v422.z.object({
4884
- type: import_v422.z.literal("tool_reference"),
4885
- toolName: import_v422.z.string()
5165
+ import_v422.z.object({
5166
+ command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
5167
+ path: import_v422.z.string(),
5168
+ file_text: import_v422.z.string().optional(),
5169
+ insert_line: import_v422.z.number().int().optional(),
5170
+ new_str: import_v422.z.string().optional(),
5171
+ insert_text: import_v422.z.string().optional(),
5172
+ old_str: import_v422.z.string().optional(),
5173
+ view_range: import_v422.z.array(import_v422.z.number().int()).optional()
5174
+ })
5175
+ )
5176
+ );
5177
+ var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
5178
+ id: "anthropic.text_editor_20250429",
5179
+ inputSchema: textEditor_20250429InputSchema
5180
+ });
5181
+
5182
+ // src/tool/tool-search-bm25_20251119.ts
5183
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
5184
+ var import_v423 = require("zod/v4");
5185
+ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
5186
+ () => (0, import_provider_utils26.zodSchema)(
5187
+ import_v423.z.array(
5188
+ import_v423.z.object({
5189
+ type: import_v423.z.literal("tool_reference"),
5190
+ toolName: import_v423.z.string()
4886
5191
  })
4887
5192
  )
4888
5193
  )
4889
5194
  );
4890
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
4891
- () => (0, import_provider_utils25.zodSchema)(
4892
- import_v422.z.object({
5195
+ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
5196
+ () => (0, import_provider_utils26.zodSchema)(
5197
+ import_v423.z.object({
4893
5198
  /**
4894
5199
  * A natural language query to search for tools.
4895
5200
  * Claude will use BM25 text search to find relevant tools.
4896
5201
  */
4897
- query: import_v422.z.string(),
5202
+ query: import_v423.z.string(),
4898
5203
  /**
4899
5204
  * Maximum number of tools to return. Optional.
4900
5205
  */
4901
- limit: import_v422.z.number().optional()
5206
+ limit: import_v423.z.number().optional()
4902
5207
  })
4903
5208
  )
4904
5209
  );
4905
- var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
5210
+ var factory11 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
4906
5211
  id: "anthropic.tool_search_bm25_20251119",
4907
5212
  inputSchema: toolSearchBm25_20251119InputSchema,
4908
5213
  outputSchema: toolSearchBm25_20251119OutputSchema,
4909
5214
  supportsDeferredResults: true
4910
5215
  });
4911
5216
  var toolSearchBm25_20251119 = (args = {}) => {
4912
- return factory10(args);
5217
+ return factory11(args);
4913
5218
  };
4914
5219
 
4915
5220
  // src/anthropic-tools.ts
@@ -5066,6 +5371,22 @@ var anthropicTools = {
5066
5371
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
5067
5372
  */
5068
5373
  webFetch_20260209,
5374
+ /**
5375
+ * Creates a web fetch tool that gives Claude direct access to real-time web content.
5376
+ * GA version (no beta header required). Includes caller restrictions, cache control,
5377
+ * deferred loading, and strict mode.
5378
+ *
5379
+ * @param maxUses - The max_uses parameter limits the number of web fetches performed
5380
+ * @param allowedDomains - Only fetch from these domains
5381
+ * @param blockedDomains - Never fetch from these domains
5382
+ * @param citations - Citations configuration for fetched documents
5383
+ * @param maxContentTokens - Max content tokens included in context
5384
+ * @param allowedCallers - Restrict callers (e.g. ["direct"] to prevent code_execution usage)
5385
+ * @param useCache - Whether to use cached content (set false for fresh content)
5386
+ * @param deferLoading - Defer loading until tool_search discovers it
5387
+ * @param strict - Enable strict schema validation
5388
+ */
5389
+ webFetch_20260309,
5069
5390
  /**
5070
5391
  * Creates a web search tool that gives Claude direct access to real-time web content.
5071
5392
  *
@@ -5117,6 +5438,7 @@ var anthropicTools = {
5117
5438
  0 && (module.exports = {
5118
5439
  AnthropicMessagesLanguageModel,
5119
5440
  anthropicTools,
5441
+ getModelCapabilities,
5120
5442
  prepareTools
5121
5443
  });
5122
5444
  //# sourceMappingURL=index.js.map