@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.
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
14
  // src/version.ts
15
- var VERSION = true ? "3.0.58-fork.1" : "0.0.0-test";
15
+ var VERSION = true ? "4.0.0-beta.12" : "0.0.0-test";
16
16
 
17
17
  // src/anthropic-messages-language-model.ts
18
18
  import {
@@ -876,6 +876,20 @@ var anthropicLanguageModelOptions = z3.object({
876
876
  type: z3.literal("ephemeral"),
877
877
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
878
878
  }).optional(),
879
+ /**
880
+ * Metadata to include with the request.
881
+ *
882
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
883
+ */
884
+ metadata: z3.object({
885
+ /**
886
+ * An external identifier for the user associated with the request.
887
+ *
888
+ * Should be a UUID, hash value, or other opaque identifier.
889
+ * Must not contain PII (name, email, phone number, etc.).
890
+ */
891
+ userId: z3.string().optional()
892
+ }).optional(),
879
893
  /**
880
894
  * MCP servers to be utilized in this request.
881
895
  */
@@ -937,6 +951,12 @@ var anthropicLanguageModelOptions = z3.object({
937
951
  * Example: Setting prefill to '{"' will make the model start its response with '{"'
938
952
  */
939
953
  prefill: z3.string().optional(),
954
+ /**
955
+ * Service tier selection.
956
+ * - 'auto': Allow Anthropic to pick standard or priority based on availability.
957
+ * See https://docs.anthropic.com/en/api/messages
958
+ */
959
+ serviceTier: z3.enum(["auto"]).optional(),
940
960
  contextManagement: z3.object({
941
961
  edits: z3.array(
942
962
  z3.discriminatedUnion("type", [
@@ -1086,7 +1106,14 @@ var webSearch_20260209ArgsSchema = lazySchema4(
1086
1106
  region: z5.string().optional(),
1087
1107
  country: z5.string().optional(),
1088
1108
  timezone: z5.string().optional()
1089
- }).optional()
1109
+ }).optional(),
1110
+ allowedCallers: z5.array(
1111
+ z5.enum([
1112
+ "direct",
1113
+ "code_execution_20250825",
1114
+ "code_execution_20260120"
1115
+ ])
1116
+ ).optional()
1090
1117
  })
1091
1118
  )
1092
1119
  );
@@ -1173,25 +1200,35 @@ var webSearch_20250305 = (args = {}) => {
1173
1200
  return factory3(args);
1174
1201
  };
1175
1202
 
1176
- // src/tool/web-fetch-20260209.ts
1203
+ // src/tool/web-fetch-20260309.ts
1177
1204
  import {
1178
1205
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1179
1206
  lazySchema as lazySchema6,
1180
1207
  zodSchema as zodSchema6
1181
1208
  } from "@ai-sdk/provider-utils";
1182
1209
  import { z as z7 } from "zod/v4";
1183
- var webFetch_20260209ArgsSchema = lazySchema6(
1210
+ var webFetch_20260309ArgsSchema = lazySchema6(
1184
1211
  () => zodSchema6(
1185
1212
  z7.object({
1186
1213
  maxUses: z7.number().optional(),
1187
1214
  allowedDomains: z7.array(z7.string()).optional(),
1188
1215
  blockedDomains: z7.array(z7.string()).optional(),
1189
1216
  citations: z7.object({ enabled: z7.boolean() }).optional(),
1190
- maxContentTokens: z7.number().optional()
1217
+ maxContentTokens: z7.number().optional(),
1218
+ allowedCallers: z7.array(
1219
+ z7.enum([
1220
+ "direct",
1221
+ "code_execution_20250825",
1222
+ "code_execution_20260120"
1223
+ ])
1224
+ ).optional(),
1225
+ useCache: z7.boolean().optional(),
1226
+ deferLoading: z7.boolean().optional(),
1227
+ strict: z7.boolean().optional()
1191
1228
  })
1192
1229
  )
1193
1230
  );
1194
- var webFetch_20260209OutputSchema = lazySchema6(
1231
+ var webFetch_20260309OutputSchema = lazySchema6(
1195
1232
  () => zodSchema6(
1196
1233
  z7.object({
1197
1234
  type: z7.literal("web_fetch_result"),
@@ -1217,7 +1254,7 @@ var webFetch_20260209OutputSchema = lazySchema6(
1217
1254
  })
1218
1255
  )
1219
1256
  );
1220
- var webFetch_20260209InputSchema = lazySchema6(
1257
+ var webFetch_20260309InputSchema = lazySchema6(
1221
1258
  () => zodSchema6(
1222
1259
  z7.object({
1223
1260
  url: z7.string()
@@ -1225,23 +1262,23 @@ var webFetch_20260209InputSchema = lazySchema6(
1225
1262
  )
1226
1263
  );
1227
1264
  var factory4 = createProviderToolFactoryWithOutputSchema3({
1228
- id: "anthropic.web_fetch_20260209",
1229
- inputSchema: webFetch_20260209InputSchema,
1230
- outputSchema: webFetch_20260209OutputSchema,
1265
+ id: "anthropic.web_fetch_20260309",
1266
+ inputSchema: webFetch_20260309InputSchema,
1267
+ outputSchema: webFetch_20260309OutputSchema,
1231
1268
  supportsDeferredResults: true
1232
1269
  });
1233
- var webFetch_20260209 = (args = {}) => {
1270
+ var webFetch_20260309 = (args = {}) => {
1234
1271
  return factory4(args);
1235
1272
  };
1236
1273
 
1237
- // src/tool/web-fetch-20250910.ts
1274
+ // src/tool/web-fetch-20260209.ts
1238
1275
  import {
1239
1276
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1240
1277
  lazySchema as lazySchema7,
1241
1278
  zodSchema as zodSchema7
1242
1279
  } from "@ai-sdk/provider-utils";
1243
1280
  import { z as z8 } from "zod/v4";
1244
- var webFetch_20250910ArgsSchema = lazySchema7(
1281
+ var webFetch_20260209ArgsSchema = lazySchema7(
1245
1282
  () => zodSchema7(
1246
1283
  z8.object({
1247
1284
  maxUses: z8.number().optional(),
@@ -1252,7 +1289,7 @@ var webFetch_20250910ArgsSchema = lazySchema7(
1252
1289
  })
1253
1290
  )
1254
1291
  );
1255
- var webFetch_20250910OutputSchema = lazySchema7(
1292
+ var webFetch_20260209OutputSchema = lazySchema7(
1256
1293
  () => zodSchema7(
1257
1294
  z8.object({
1258
1295
  type: z8.literal("web_fetch_result"),
@@ -1278,7 +1315,7 @@ var webFetch_20250910OutputSchema = lazySchema7(
1278
1315
  })
1279
1316
  )
1280
1317
  );
1281
- var webFetch_20250910InputSchema = lazySchema7(
1318
+ var webFetch_20260209InputSchema = lazySchema7(
1282
1319
  () => zodSchema7(
1283
1320
  z8.object({
1284
1321
  url: z8.string()
@@ -1286,13 +1323,74 @@ var webFetch_20250910InputSchema = lazySchema7(
1286
1323
  )
1287
1324
  );
1288
1325
  var factory5 = createProviderToolFactoryWithOutputSchema4({
1326
+ id: "anthropic.web_fetch_20260209",
1327
+ inputSchema: webFetch_20260209InputSchema,
1328
+ outputSchema: webFetch_20260209OutputSchema,
1329
+ supportsDeferredResults: true
1330
+ });
1331
+ var webFetch_20260209 = (args = {}) => {
1332
+ return factory5(args);
1333
+ };
1334
+
1335
+ // src/tool/web-fetch-20250910.ts
1336
+ import {
1337
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1338
+ lazySchema as lazySchema8,
1339
+ zodSchema as zodSchema8
1340
+ } from "@ai-sdk/provider-utils";
1341
+ import { z as z9 } from "zod/v4";
1342
+ var webFetch_20250910ArgsSchema = lazySchema8(
1343
+ () => zodSchema8(
1344
+ z9.object({
1345
+ maxUses: z9.number().optional(),
1346
+ allowedDomains: z9.array(z9.string()).optional(),
1347
+ blockedDomains: z9.array(z9.string()).optional(),
1348
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1349
+ maxContentTokens: z9.number().optional()
1350
+ })
1351
+ )
1352
+ );
1353
+ var webFetch_20250910OutputSchema = lazySchema8(
1354
+ () => zodSchema8(
1355
+ z9.object({
1356
+ type: z9.literal("web_fetch_result"),
1357
+ url: z9.string(),
1358
+ content: z9.object({
1359
+ type: z9.literal("document"),
1360
+ title: z9.string().nullable(),
1361
+ citations: z9.object({ enabled: z9.boolean() }).optional(),
1362
+ source: z9.union([
1363
+ z9.object({
1364
+ type: z9.literal("base64"),
1365
+ mediaType: z9.literal("application/pdf"),
1366
+ data: z9.string()
1367
+ }),
1368
+ z9.object({
1369
+ type: z9.literal("text"),
1370
+ mediaType: z9.literal("text/plain"),
1371
+ data: z9.string()
1372
+ })
1373
+ ])
1374
+ }),
1375
+ retrievedAt: z9.string().nullable()
1376
+ })
1377
+ )
1378
+ );
1379
+ var webFetch_20250910InputSchema = lazySchema8(
1380
+ () => zodSchema8(
1381
+ z9.object({
1382
+ url: z9.string()
1383
+ })
1384
+ )
1385
+ );
1386
+ var factory6 = createProviderToolFactoryWithOutputSchema5({
1289
1387
  id: "anthropic.web_fetch_20250910",
1290
1388
  inputSchema: webFetch_20250910InputSchema,
1291
1389
  outputSchema: webFetch_20250910OutputSchema,
1292
1390
  supportsDeferredResults: true
1293
1391
  });
1294
1392
  var webFetch_20250910 = (args = {}) => {
1295
- return factory5(args);
1393
+ return factory6(args);
1296
1394
  };
1297
1395
 
1298
1396
  // src/anthropic-prepare-tools.ts
@@ -1302,7 +1400,8 @@ async function prepareTools({
1302
1400
  toolChoice,
1303
1401
  disableParallelToolUse,
1304
1402
  cacheControlValidator,
1305
- supportsStructuredOutput
1403
+ supportsStructuredOutput,
1404
+ supportsStrictTools
1306
1405
  }) {
1307
1406
  var _a;
1308
1407
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1324,13 +1423,20 @@ async function prepareTools({
1324
1423
  const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1325
1424
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1326
1425
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1426
+ if (!supportsStrictTools && tool.strict != null) {
1427
+ toolWarnings.push({
1428
+ type: "unsupported",
1429
+ feature: "strict",
1430
+ details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
1431
+ });
1432
+ }
1327
1433
  anthropicTools2.push({
1328
1434
  name: tool.name,
1329
1435
  description: tool.description,
1330
1436
  input_schema: tool.inputSchema,
1331
1437
  cache_control: cacheControl,
1332
1438
  ...eagerInputStreaming ? { eager_input_streaming: true } : {},
1333
- ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1439
+ ...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
1334
1440
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
1335
1441
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1336
1442
  ...tool.inputExamples != null ? {
@@ -1359,7 +1465,6 @@ async function prepareTools({
1359
1465
  break;
1360
1466
  }
1361
1467
  case "anthropic.code_execution_20250825": {
1362
- betas.add("code-execution-2025-08-25");
1363
1468
  anthropicTools2.push({
1364
1469
  type: "code_execution_20250825",
1365
1470
  name: "code_execution"
@@ -1477,7 +1582,6 @@ async function prepareTools({
1477
1582
  break;
1478
1583
  }
1479
1584
  case "anthropic.web_fetch_20250910": {
1480
- betas.add("web-fetch-2025-09-10");
1481
1585
  const args = await validateTypes({
1482
1586
  value: tool.args,
1483
1587
  schema: webFetch_20250910ArgsSchema
@@ -1495,7 +1599,6 @@ async function prepareTools({
1495
1599
  break;
1496
1600
  }
1497
1601
  case "anthropic.web_fetch_20260209": {
1498
- betas.add("code-execution-web-tools-2026-02-09");
1499
1602
  const args = await validateTypes({
1500
1603
  value: tool.args,
1501
1604
  schema: webFetch_20260209ArgsSchema
@@ -1512,6 +1615,27 @@ async function prepareTools({
1512
1615
  });
1513
1616
  break;
1514
1617
  }
1618
+ case "anthropic.web_fetch_20260309": {
1619
+ const args = await validateTypes({
1620
+ value: tool.args,
1621
+ schema: webFetch_20260309ArgsSchema
1622
+ });
1623
+ anthropicTools2.push({
1624
+ type: "web_fetch_20260309",
1625
+ name: "web_fetch",
1626
+ max_uses: args.maxUses,
1627
+ allowed_domains: args.allowedDomains,
1628
+ blocked_domains: args.blockedDomains,
1629
+ citations: args.citations,
1630
+ max_content_tokens: args.maxContentTokens,
1631
+ allowed_callers: args.allowedCallers,
1632
+ use_cache: args.useCache,
1633
+ defer_loading: args.deferLoading,
1634
+ strict: args.strict,
1635
+ cache_control: void 0
1636
+ });
1637
+ break;
1638
+ }
1515
1639
  case "anthropic.web_search_20250305": {
1516
1640
  const args = await validateTypes({
1517
1641
  value: tool.args,
@@ -1529,7 +1653,6 @@ async function prepareTools({
1529
1653
  break;
1530
1654
  }
1531
1655
  case "anthropic.web_search_20260209": {
1532
- betas.add("code-execution-web-tools-2026-02-09");
1533
1656
  const args = await validateTypes({
1534
1657
  value: tool.args,
1535
1658
  schema: webSearch_20260209ArgsSchema
@@ -1541,12 +1664,12 @@ async function prepareTools({
1541
1664
  allowed_domains: args.allowedDomains,
1542
1665
  blocked_domains: args.blockedDomains,
1543
1666
  user_location: args.userLocation,
1667
+ allowed_callers: args.allowedCallers,
1544
1668
  cache_control: void 0
1545
1669
  });
1546
1670
  break;
1547
1671
  }
1548
1672
  case "anthropic.tool_search_regex_20251119": {
1549
- betas.add("advanced-tool-use-2025-11-20");
1550
1673
  anthropicTools2.push({
1551
1674
  type: "tool_search_tool_regex_20251119",
1552
1675
  name: "tool_search_tool_regex"
@@ -1554,7 +1677,6 @@ async function prepareTools({
1554
1677
  break;
1555
1678
  }
1556
1679
  case "anthropic.tool_search_bm25_20251119": {
1557
- betas.add("advanced-tool-use-2025-11-20");
1558
1680
  anthropicTools2.push({
1559
1681
  type: "tool_search_tool_bm25_20251119",
1560
1682
  name: "tool_search_tool_bm25"
@@ -1686,164 +1808,51 @@ import {
1686
1808
 
1687
1809
  // src/tool/code-execution_20250522.ts
1688
1810
  import {
1689
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1690
- lazySchema as lazySchema8,
1691
- zodSchema as zodSchema8
1811
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1812
+ lazySchema as lazySchema9,
1813
+ zodSchema as zodSchema9
1692
1814
  } from "@ai-sdk/provider-utils";
1693
- import { z as z9 } from "zod/v4";
1694
- var codeExecution_20250522OutputSchema = lazySchema8(
1695
- () => zodSchema8(
1696
- z9.object({
1697
- type: z9.literal("code_execution_result"),
1698
- stdout: z9.string(),
1699
- stderr: z9.string(),
1700
- return_code: z9.number(),
1701
- content: z9.array(
1702
- z9.object({
1703
- type: z9.literal("code_execution_output"),
1704
- file_id: z9.string()
1815
+ import { z as z10 } from "zod/v4";
1816
+ var codeExecution_20250522OutputSchema = lazySchema9(
1817
+ () => zodSchema9(
1818
+ z10.object({
1819
+ type: z10.literal("code_execution_result"),
1820
+ stdout: z10.string(),
1821
+ stderr: z10.string(),
1822
+ return_code: z10.number(),
1823
+ content: z10.array(
1824
+ z10.object({
1825
+ type: z10.literal("code_execution_output"),
1826
+ file_id: z10.string()
1705
1827
  })
1706
1828
  ).optional().default([])
1707
1829
  })
1708
1830
  )
1709
1831
  );
1710
- var codeExecution_20250522InputSchema = lazySchema8(
1711
- () => zodSchema8(
1712
- z9.object({
1713
- code: z9.string()
1832
+ var codeExecution_20250522InputSchema = lazySchema9(
1833
+ () => zodSchema9(
1834
+ z10.object({
1835
+ code: z10.string()
1714
1836
  })
1715
1837
  )
1716
1838
  );
1717
- var factory6 = createProviderToolFactoryWithOutputSchema5({
1839
+ var factory7 = createProviderToolFactoryWithOutputSchema6({
1718
1840
  id: "anthropic.code_execution_20250522",
1719
1841
  inputSchema: codeExecution_20250522InputSchema,
1720
1842
  outputSchema: codeExecution_20250522OutputSchema
1721
1843
  });
1722
1844
  var codeExecution_20250522 = (args = {}) => {
1723
- return factory6(args);
1724
- };
1725
-
1726
- // src/tool/code-execution_20250825.ts
1727
- import {
1728
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
1729
- lazySchema as lazySchema9,
1730
- zodSchema as zodSchema9
1731
- } from "@ai-sdk/provider-utils";
1732
- import { z as z10 } from "zod/v4";
1733
- var codeExecution_20250825OutputSchema = lazySchema9(
1734
- () => zodSchema9(
1735
- z10.discriminatedUnion("type", [
1736
- z10.object({
1737
- type: z10.literal("code_execution_result"),
1738
- stdout: z10.string(),
1739
- stderr: z10.string(),
1740
- return_code: z10.number(),
1741
- content: z10.array(
1742
- z10.object({
1743
- type: z10.literal("code_execution_output"),
1744
- file_id: z10.string()
1745
- })
1746
- ).optional().default([])
1747
- }),
1748
- z10.object({
1749
- type: z10.literal("bash_code_execution_result"),
1750
- content: z10.array(
1751
- z10.object({
1752
- type: z10.literal("bash_code_execution_output"),
1753
- file_id: z10.string()
1754
- })
1755
- ),
1756
- stdout: z10.string(),
1757
- stderr: z10.string(),
1758
- return_code: z10.number()
1759
- }),
1760
- z10.object({
1761
- type: z10.literal("bash_code_execution_tool_result_error"),
1762
- error_code: z10.string()
1763
- }),
1764
- z10.object({
1765
- type: z10.literal("text_editor_code_execution_tool_result_error"),
1766
- error_code: z10.string()
1767
- }),
1768
- z10.object({
1769
- type: z10.literal("text_editor_code_execution_view_result"),
1770
- content: z10.string(),
1771
- file_type: z10.string(),
1772
- num_lines: z10.number().nullable(),
1773
- start_line: z10.number().nullable(),
1774
- total_lines: z10.number().nullable()
1775
- }),
1776
- z10.object({
1777
- type: z10.literal("text_editor_code_execution_create_result"),
1778
- is_file_update: z10.boolean()
1779
- }),
1780
- z10.object({
1781
- type: z10.literal("text_editor_code_execution_str_replace_result"),
1782
- lines: z10.array(z10.string()).nullable(),
1783
- new_lines: z10.number().nullable(),
1784
- new_start: z10.number().nullable(),
1785
- old_lines: z10.number().nullable(),
1786
- old_start: z10.number().nullable()
1787
- })
1788
- ])
1789
- )
1790
- );
1791
- var codeExecution_20250825InputSchema = lazySchema9(
1792
- () => zodSchema9(
1793
- z10.discriminatedUnion("type", [
1794
- // Programmatic tool calling format (mapped from { code } by AI SDK)
1795
- z10.object({
1796
- type: z10.literal("programmatic-tool-call"),
1797
- code: z10.string()
1798
- }),
1799
- z10.object({
1800
- type: z10.literal("bash_code_execution"),
1801
- command: z10.string()
1802
- }),
1803
- z10.discriminatedUnion("command", [
1804
- z10.object({
1805
- type: z10.literal("text_editor_code_execution"),
1806
- command: z10.literal("view"),
1807
- path: z10.string()
1808
- }),
1809
- z10.object({
1810
- type: z10.literal("text_editor_code_execution"),
1811
- command: z10.literal("create"),
1812
- path: z10.string(),
1813
- file_text: z10.string().nullish()
1814
- }),
1815
- z10.object({
1816
- type: z10.literal("text_editor_code_execution"),
1817
- command: z10.literal("str_replace"),
1818
- path: z10.string(),
1819
- old_str: z10.string(),
1820
- new_str: z10.string()
1821
- })
1822
- ])
1823
- ])
1824
- )
1825
- );
1826
- var factory7 = createProviderToolFactoryWithOutputSchema6({
1827
- id: "anthropic.code_execution_20250825",
1828
- inputSchema: codeExecution_20250825InputSchema,
1829
- outputSchema: codeExecution_20250825OutputSchema,
1830
- // Programmatic tool calling: tool results may be deferred to a later turn
1831
- // when code execution triggers a client-executed tool that needs to be
1832
- // resolved before the code execution result can be returned.
1833
- supportsDeferredResults: true
1834
- });
1835
- var codeExecution_20250825 = (args = {}) => {
1836
1845
  return factory7(args);
1837
1846
  };
1838
1847
 
1839
- // src/tool/code-execution_20260120.ts
1848
+ // src/tool/code-execution_20250825.ts
1840
1849
  import {
1841
1850
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
1842
1851
  lazySchema as lazySchema10,
1843
1852
  zodSchema as zodSchema10
1844
1853
  } from "@ai-sdk/provider-utils";
1845
1854
  import { z as z11 } from "zod/v4";
1846
- var codeExecution_20260120OutputSchema = lazySchema10(
1855
+ var codeExecution_20250825OutputSchema = lazySchema10(
1847
1856
  () => zodSchema10(
1848
1857
  z11.discriminatedUnion("type", [
1849
1858
  z11.object({
@@ -1858,18 +1867,6 @@ var codeExecution_20260120OutputSchema = lazySchema10(
1858
1867
  })
1859
1868
  ).optional().default([])
1860
1869
  }),
1861
- z11.object({
1862
- type: z11.literal("encrypted_code_execution_result"),
1863
- encrypted_stdout: z11.string(),
1864
- stderr: z11.string(),
1865
- return_code: z11.number(),
1866
- content: z11.array(
1867
- z11.object({
1868
- type: z11.literal("code_execution_output"),
1869
- file_id: z11.string()
1870
- })
1871
- ).optional().default([])
1872
- }),
1873
1870
  z11.object({
1874
1871
  type: z11.literal("bash_code_execution_result"),
1875
1872
  content: z11.array(
@@ -1913,9 +1910,10 @@ var codeExecution_20260120OutputSchema = lazySchema10(
1913
1910
  ])
1914
1911
  )
1915
1912
  );
1916
- var codeExecution_20260120InputSchema = lazySchema10(
1913
+ var codeExecution_20250825InputSchema = lazySchema10(
1917
1914
  () => zodSchema10(
1918
1915
  z11.discriminatedUnion("type", [
1916
+ // Programmatic tool calling format (mapped from { code } by AI SDK)
1919
1917
  z11.object({
1920
1918
  type: z11.literal("programmatic-tool-call"),
1921
1919
  code: z11.string()
@@ -1948,35 +1946,159 @@ var codeExecution_20260120InputSchema = lazySchema10(
1948
1946
  )
1949
1947
  );
1950
1948
  var factory8 = createProviderToolFactoryWithOutputSchema7({
1951
- id: "anthropic.code_execution_20260120",
1952
- inputSchema: codeExecution_20260120InputSchema,
1953
- outputSchema: codeExecution_20260120OutputSchema,
1949
+ id: "anthropic.code_execution_20250825",
1950
+ inputSchema: codeExecution_20250825InputSchema,
1951
+ outputSchema: codeExecution_20250825OutputSchema,
1952
+ // Programmatic tool calling: tool results may be deferred to a later turn
1953
+ // when code execution triggers a client-executed tool that needs to be
1954
+ // resolved before the code execution result can be returned.
1954
1955
  supportsDeferredResults: true
1955
1956
  });
1956
- var codeExecution_20260120 = (args = {}) => {
1957
+ var codeExecution_20250825 = (args = {}) => {
1957
1958
  return factory8(args);
1958
1959
  };
1959
1960
 
1960
- // src/tool/tool-search-regex_20251119.ts
1961
+ // src/tool/code-execution_20260120.ts
1961
1962
  import {
1962
1963
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
1963
1964
  lazySchema as lazySchema11,
1964
1965
  zodSchema as zodSchema11
1965
1966
  } from "@ai-sdk/provider-utils";
1966
1967
  import { z as z12 } from "zod/v4";
1967
- var toolSearchRegex_20251119OutputSchema = lazySchema11(
1968
+ var codeExecution_20260120OutputSchema = lazySchema11(
1969
+ () => zodSchema11(
1970
+ z12.discriminatedUnion("type", [
1971
+ z12.object({
1972
+ type: z12.literal("code_execution_result"),
1973
+ stdout: z12.string(),
1974
+ stderr: z12.string(),
1975
+ return_code: z12.number(),
1976
+ content: z12.array(
1977
+ z12.object({
1978
+ type: z12.literal("code_execution_output"),
1979
+ file_id: z12.string()
1980
+ })
1981
+ ).optional().default([])
1982
+ }),
1983
+ z12.object({
1984
+ type: z12.literal("encrypted_code_execution_result"),
1985
+ encrypted_stdout: z12.string(),
1986
+ stderr: z12.string(),
1987
+ return_code: z12.number(),
1988
+ content: z12.array(
1989
+ z12.object({
1990
+ type: z12.literal("code_execution_output"),
1991
+ file_id: z12.string()
1992
+ })
1993
+ ).optional().default([])
1994
+ }),
1995
+ z12.object({
1996
+ type: z12.literal("bash_code_execution_result"),
1997
+ content: z12.array(
1998
+ z12.object({
1999
+ type: z12.literal("bash_code_execution_output"),
2000
+ file_id: z12.string()
2001
+ })
2002
+ ),
2003
+ stdout: z12.string(),
2004
+ stderr: z12.string(),
2005
+ return_code: z12.number()
2006
+ }),
2007
+ z12.object({
2008
+ type: z12.literal("bash_code_execution_tool_result_error"),
2009
+ error_code: z12.string()
2010
+ }),
2011
+ z12.object({
2012
+ type: z12.literal("text_editor_code_execution_tool_result_error"),
2013
+ error_code: z12.string()
2014
+ }),
2015
+ z12.object({
2016
+ type: z12.literal("text_editor_code_execution_view_result"),
2017
+ content: z12.string(),
2018
+ file_type: z12.string(),
2019
+ num_lines: z12.number().nullable(),
2020
+ start_line: z12.number().nullable(),
2021
+ total_lines: z12.number().nullable()
2022
+ }),
2023
+ z12.object({
2024
+ type: z12.literal("text_editor_code_execution_create_result"),
2025
+ is_file_update: z12.boolean()
2026
+ }),
2027
+ z12.object({
2028
+ type: z12.literal("text_editor_code_execution_str_replace_result"),
2029
+ lines: z12.array(z12.string()).nullable(),
2030
+ new_lines: z12.number().nullable(),
2031
+ new_start: z12.number().nullable(),
2032
+ old_lines: z12.number().nullable(),
2033
+ old_start: z12.number().nullable()
2034
+ })
2035
+ ])
2036
+ )
2037
+ );
2038
+ var codeExecution_20260120InputSchema = lazySchema11(
1968
2039
  () => zodSchema11(
1969
- z12.array(
2040
+ z12.discriminatedUnion("type", [
1970
2041
  z12.object({
1971
- type: z12.literal("tool_reference"),
1972
- toolName: z12.string()
2042
+ type: z12.literal("programmatic-tool-call"),
2043
+ code: z12.string()
2044
+ }),
2045
+ z12.object({
2046
+ type: z12.literal("bash_code_execution"),
2047
+ command: z12.string()
2048
+ }),
2049
+ z12.discriminatedUnion("command", [
2050
+ z12.object({
2051
+ type: z12.literal("text_editor_code_execution"),
2052
+ command: z12.literal("view"),
2053
+ path: z12.string()
2054
+ }),
2055
+ z12.object({
2056
+ type: z12.literal("text_editor_code_execution"),
2057
+ command: z12.literal("create"),
2058
+ path: z12.string(),
2059
+ file_text: z12.string().nullish()
2060
+ }),
2061
+ z12.object({
2062
+ type: z12.literal("text_editor_code_execution"),
2063
+ command: z12.literal("str_replace"),
2064
+ path: z12.string(),
2065
+ old_str: z12.string(),
2066
+ new_str: z12.string()
2067
+ })
2068
+ ])
2069
+ ])
2070
+ )
2071
+ );
2072
+ var factory9 = createProviderToolFactoryWithOutputSchema8({
2073
+ id: "anthropic.code_execution_20260120",
2074
+ inputSchema: codeExecution_20260120InputSchema,
2075
+ outputSchema: codeExecution_20260120OutputSchema,
2076
+ supportsDeferredResults: true
2077
+ });
2078
+ var codeExecution_20260120 = (args = {}) => {
2079
+ return factory9(args);
2080
+ };
2081
+
2082
+ // src/tool/tool-search-regex_20251119.ts
2083
+ import {
2084
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2085
+ lazySchema as lazySchema12,
2086
+ zodSchema as zodSchema12
2087
+ } from "@ai-sdk/provider-utils";
2088
+ import { z as z13 } from "zod/v4";
2089
+ var toolSearchRegex_20251119OutputSchema = lazySchema12(
2090
+ () => zodSchema12(
2091
+ z13.array(
2092
+ z13.object({
2093
+ type: z13.literal("tool_reference"),
2094
+ toolName: z13.string()
1973
2095
  })
1974
2096
  )
1975
2097
  )
1976
2098
  );
1977
- var toolSearchRegex_20251119InputSchema = lazySchema11(
1978
- () => zodSchema11(
1979
- z12.object({
2099
+ var toolSearchRegex_20251119InputSchema = lazySchema12(
2100
+ () => zodSchema12(
2101
+ z13.object({
1980
2102
  /**
1981
2103
  * A regex pattern to search for tools.
1982
2104
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1987,22 +2109,22 @@ var toolSearchRegex_20251119InputSchema = lazySchema11(
1987
2109
  * - "database.*query|query.*database" - OR patterns for flexibility
1988
2110
  * - "(?i)slack" - case-insensitive search
1989
2111
  */
1990
- pattern: z12.string(),
2112
+ pattern: z13.string(),
1991
2113
  /**
1992
2114
  * Maximum number of tools to return. Optional.
1993
2115
  */
1994
- limit: z12.number().optional()
2116
+ limit: z13.number().optional()
1995
2117
  })
1996
2118
  )
1997
2119
  );
1998
- var factory9 = createProviderToolFactoryWithOutputSchema8({
2120
+ var factory10 = createProviderToolFactoryWithOutputSchema9({
1999
2121
  id: "anthropic.tool_search_regex_20251119",
2000
2122
  inputSchema: toolSearchRegex_20251119InputSchema,
2001
2123
  outputSchema: toolSearchRegex_20251119OutputSchema,
2002
2124
  supportsDeferredResults: true
2003
2125
  });
2004
2126
  var toolSearchRegex_20251119 = (args = {}) => {
2005
- return factory9(args);
2127
+ return factory10(args);
2006
2128
  };
2007
2129
 
2008
2130
  // src/convert-to-anthropic-messages-prompt.ts
@@ -2081,14 +2203,17 @@ async function convertToAnthropicMessagesPrompt({
2081
2203
  functionality: "Multiple system messages that are separated by user/assistant messages"
2082
2204
  });
2083
2205
  }
2084
- system = block.messages.map(({ content, providerOptions }) => ({
2085
- type: "text",
2086
- text: content,
2087
- cache_control: validator.getCacheControl(providerOptions, {
2206
+ system = block.messages.map(({ content, providerOptions }) => {
2207
+ const cc = validator.getCacheControl(providerOptions, {
2088
2208
  type: "system message",
2089
2209
  canCache: true
2090
- })
2091
- }));
2210
+ });
2211
+ return {
2212
+ type: "text",
2213
+ text: content,
2214
+ cache_control: cc
2215
+ };
2216
+ });
2092
2217
  break;
2093
2218
  }
2094
2219
  case "user": {
@@ -2665,7 +2790,7 @@ async function convertToAnthropicMessagesPrompt({
2665
2790
  } catch (e) {
2666
2791
  const extractedErrorCode = (_s = output.value) == null ? void 0 : _s.errorCode;
2667
2792
  errorValue = {
2668
- errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
2793
+ errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unavailable"
2669
2794
  };
2670
2795
  }
2671
2796
  anthropicContent.push({
@@ -2673,7 +2798,7 @@ async function convertToAnthropicMessagesPrompt({
2673
2798
  tool_use_id: part.toolCallId,
2674
2799
  content: {
2675
2800
  type: "web_fetch_tool_result_error",
2676
- error_code: (_t = errorValue.errorCode) != null ? _t : "unknown"
2801
+ error_code: (_t = errorValue.errorCode) != null ? _t : "unavailable"
2677
2802
  },
2678
2803
  cache_control: cacheControl
2679
2804
  });
@@ -2741,6 +2866,18 @@ async function convertToAnthropicMessagesPrompt({
2741
2866
  }
2742
2867
  if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
2743
2868
  const output = part.output;
2869
+ if (output.type === "error-text" || output.type === "error-json") {
2870
+ anthropicContent.push({
2871
+ type: "tool_search_tool_result",
2872
+ tool_use_id: part.toolCallId,
2873
+ content: {
2874
+ type: "tool_search_tool_result_error",
2875
+ error_code: "unavailable"
2876
+ },
2877
+ cache_control: cacheControl
2878
+ });
2879
+ break;
2880
+ }
2744
2881
  if (output.type !== "json") {
2745
2882
  warnings.push({
2746
2883
  type: "other",
@@ -2862,6 +2999,61 @@ function mapAnthropicStopReason({
2862
2999
  }
2863
3000
 
2864
3001
  // src/anthropic-messages-language-model.ts
3002
+ function isCustomReasoning(reasoning) {
3003
+ return reasoning !== void 0 && reasoning !== "provider-default";
3004
+ }
3005
+ function mapReasoningToProviderEffort({
3006
+ reasoning,
3007
+ effortMap,
3008
+ warnings
3009
+ }) {
3010
+ const mapped = effortMap[reasoning];
3011
+ if (mapped == null) {
3012
+ warnings.push({
3013
+ type: "unsupported",
3014
+ feature: "reasoning",
3015
+ details: `reasoning "${reasoning}" is not supported by this model.`
3016
+ });
3017
+ return void 0;
3018
+ }
3019
+ if (mapped !== reasoning) {
3020
+ warnings.push({
3021
+ type: "compatibility",
3022
+ feature: "reasoning",
3023
+ details: `reasoning "${reasoning}" is not directly supported by this model. mapped to effort "${mapped}".`
3024
+ });
3025
+ }
3026
+ return mapped;
3027
+ }
3028
+ var DEFAULT_REASONING_BUDGET_PERCENTAGES = {
3029
+ minimal: 0.02,
3030
+ low: 0.1,
3031
+ medium: 0.3,
3032
+ high: 0.6,
3033
+ xhigh: 0.9
3034
+ };
3035
+ function mapReasoningToProviderBudget({
3036
+ reasoning,
3037
+ maxOutputTokens,
3038
+ maxReasoningBudget,
3039
+ minReasoningBudget = 1024,
3040
+ budgetPercentages = DEFAULT_REASONING_BUDGET_PERCENTAGES,
3041
+ warnings
3042
+ }) {
3043
+ const pct = budgetPercentages[reasoning];
3044
+ if (pct == null) {
3045
+ warnings.push({
3046
+ type: "unsupported",
3047
+ feature: "reasoning",
3048
+ details: `reasoning "${reasoning}" is not supported by this model.`
3049
+ });
3050
+ return void 0;
3051
+ }
3052
+ return Math.min(
3053
+ maxReasoningBudget,
3054
+ Math.max(minReasoningBudget, Math.round(maxOutputTokens * pct))
3055
+ );
3056
+ }
2865
3057
  function createCitationSource(citation, citationDocuments, generateId3) {
2866
3058
  var _a;
2867
3059
  if (citation.type === "web_search_result_location") {
@@ -2908,7 +3100,7 @@ function createCitationSource(citation, citationDocuments, generateId3) {
2908
3100
  }
2909
3101
  var AnthropicMessagesLanguageModel = class {
2910
3102
  constructor(modelId, config) {
2911
- this.specificationVersion = "v3";
3103
+ this.specificationVersion = "v4";
2912
3104
  var _a;
2913
3105
  this.modelId = modelId;
2914
3106
  this.config = config;
@@ -2947,10 +3139,11 @@ var AnthropicMessagesLanguageModel = class {
2947
3139
  seed,
2948
3140
  tools,
2949
3141
  toolChoice,
3142
+ reasoning,
2950
3143
  providerOptions,
2951
3144
  stream
2952
3145
  }) {
2953
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2954
3147
  const warnings = [];
2955
3148
  if (frequencyPenalty != null) {
2956
3149
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -3005,10 +3198,12 @@ var AnthropicMessagesLanguageModel = class {
3005
3198
  const {
3006
3199
  maxOutputTokens: maxOutputTokensForModel,
3007
3200
  supportsStructuredOutput: modelSupportsStructuredOutput,
3201
+ supportsAdaptiveThinking,
3008
3202
  isKnownModel
3009
3203
  } = getModelCapabilities(this.modelId);
3010
3204
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
3011
- const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
3205
+ const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3206
+ const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
3012
3207
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
3013
3208
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
3014
3209
  type: "function",
@@ -3036,6 +3231,7 @@ var AnthropicMessagesLanguageModel = class {
3036
3231
  "anthropic.web_search_20250305": "web_search",
3037
3232
  "anthropic.web_search_20260209": "web_search",
3038
3233
  "anthropic.web_fetch_20250910": "web_fetch",
3234
+ "anthropic.web_fetch_20260309": "web_fetch",
3039
3235
  "anthropic.web_fetch_20260209": "web_fetch",
3040
3236
  "anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
3041
3237
  "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
@@ -3043,11 +3239,25 @@ var AnthropicMessagesLanguageModel = class {
3043
3239
  });
3044
3240
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
3045
3241
  prompt,
3046
- sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
3242
+ sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
3047
3243
  warnings,
3048
3244
  cacheControlValidator,
3049
3245
  toolNameMapping
3050
3246
  });
3247
+ if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
3248
+ const reasoningConfig = resolveAnthropicReasoningConfig({
3249
+ reasoning,
3250
+ supportsAdaptiveThinking,
3251
+ maxOutputTokensForModel,
3252
+ warnings
3253
+ });
3254
+ if (reasoningConfig != null) {
3255
+ anthropicOptions.thinking = reasoningConfig.thinking;
3256
+ if (reasoningConfig.effort != null) {
3257
+ anthropicOptions.effort = reasoningConfig.effort;
3258
+ }
3259
+ }
3260
+ }
3051
3261
  if (anthropicOptions == null ? void 0 : anthropicOptions.prefill) {
3052
3262
  const lastMessage = messagesPrompt.messages[messagesPrompt.messages.length - 1];
3053
3263
  if ((lastMessage == null ? void 0 : lastMessage.role) === "assistant") {
@@ -3069,9 +3279,9 @@ var AnthropicMessagesLanguageModel = class {
3069
3279
  });
3070
3280
  }
3071
3281
  }
3072
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
3282
+ const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
3073
3283
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
3074
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
3284
+ let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
3075
3285
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
3076
3286
  const baseArgs = {
3077
3287
  // model id:
@@ -3087,7 +3297,7 @@ var AnthropicMessagesLanguageModel = class {
3087
3297
  thinking: {
3088
3298
  type: thinkingType,
3089
3299
  ...thinkingBudget != null && { budget_tokens: thinkingBudget },
3090
- ...((_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) && {
3300
+ ...((_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) && {
3091
3301
  display: anthropicOptions.thinking.display
3092
3302
  }
3093
3303
  }
@@ -3108,9 +3318,22 @@ var AnthropicMessagesLanguageModel = class {
3108
3318
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
3109
3319
  speed: anthropicOptions.speed
3110
3320
  },
3321
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.metadata) && {
3322
+ metadata: {
3323
+ ...anthropicOptions.metadata.userId && {
3324
+ user_id: anthropicOptions.metadata.userId
3325
+ }
3326
+ }
3327
+ },
3328
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.serviceTier) && {
3329
+ service_tier: anthropicOptions.serviceTier
3330
+ },
3111
3331
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3112
3332
  cache_control: anthropicOptions.cacheControl
3113
3333
  },
3334
+ ...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
3335
+ metadata: { user_id: anthropicOptions.metadata.userId }
3336
+ },
3114
3337
  // mcp servers:
3115
3338
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3116
3339
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3263,7 +3486,6 @@ var AnthropicMessagesLanguageModel = class {
3263
3486
  }
3264
3487
  }
3265
3488
  if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
3266
- betas.add("code-execution-2025-08-25");
3267
3489
  betas.add("skills-2025-10-02");
3268
3490
  betas.add("files-api-2025-04-14");
3269
3491
  if (!(tools == null ? void 0 : tools.some(
@@ -3281,7 +3503,7 @@ var AnthropicMessagesLanguageModel = class {
3281
3503
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3282
3504
  betas.add("fast-mode-2026-02-01");
3283
3505
  }
3284
- if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
3506
+ if (stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true)) {
3285
3507
  betas.add("fine-grained-tool-streaming-2025-05-14");
3286
3508
  }
3287
3509
  const {
@@ -3295,13 +3517,15 @@ var AnthropicMessagesLanguageModel = class {
3295
3517
  toolChoice: { type: "required" },
3296
3518
  disableParallelToolUse: true,
3297
3519
  cacheControlValidator,
3298
- supportsStructuredOutput: false
3520
+ supportsStructuredOutput: false,
3521
+ supportsStrictTools
3299
3522
  } : {
3300
3523
  tools: tools != null ? tools : [],
3301
3524
  toolChoice,
3302
3525
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3303
3526
  cacheControlValidator,
3304
- supportsStructuredOutput
3527
+ supportsStructuredOutput,
3528
+ supportsStrictTools
3305
3529
  }
3306
3530
  );
3307
3531
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3318,7 +3542,7 @@ var AnthropicMessagesLanguageModel = class {
3318
3542
  ...betas,
3319
3543
  ...toolsBetas,
3320
3544
  ...userSuppliedBetas,
3321
- ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
3545
+ ...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
3322
3546
  ]),
3323
3547
  usesJsonResponseTool: jsonResponseTool != null,
3324
3548
  toolNameMapping,
@@ -3655,6 +3879,16 @@ var AnthropicMessagesLanguageModel = class {
3655
3879
  }
3656
3880
  // code execution 20250522:
3657
3881
  case "code_execution_tool_result": {
3882
+ if (markCodeExecutionDynamic) {
3883
+ content.push({
3884
+ type: "tool-result",
3885
+ toolCallId: part.tool_use_id,
3886
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3887
+ isError: true,
3888
+ 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."
3889
+ });
3890
+ break;
3891
+ }
3658
3892
  if (part.content.type === "code_execution_result") {
3659
3893
  content.push({
3660
3894
  type: "tool-result",
@@ -3698,6 +3932,16 @@ var AnthropicMessagesLanguageModel = class {
3698
3932
  // code execution 20250825:
3699
3933
  case "bash_code_execution_tool_result":
3700
3934
  case "text_editor_code_execution_tool_result": {
3935
+ if (markCodeExecutionDynamic) {
3936
+ content.push({
3937
+ type: "tool-result",
3938
+ toolCallId: part.tool_use_id,
3939
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3940
+ isError: true,
3941
+ 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."
3942
+ });
3943
+ break;
3944
+ }
3701
3945
  content.push({
3702
3946
  type: "tool-result",
3703
3947
  toolCallId: part.tool_use_id,
@@ -4100,6 +4344,16 @@ var AnthropicMessagesLanguageModel = class {
4100
4344
  }
4101
4345
  // code execution 20250522:
4102
4346
  case "code_execution_tool_result": {
4347
+ if (markCodeExecutionDynamic) {
4348
+ controller.enqueue({
4349
+ type: "tool-result",
4350
+ toolCallId: part.tool_use_id,
4351
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
4352
+ isError: true,
4353
+ 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."
4354
+ });
4355
+ return;
4356
+ }
4103
4357
  if (part.content.type === "code_execution_result") {
4104
4358
  controller.enqueue({
4105
4359
  type: "tool-result",
@@ -4143,6 +4397,16 @@ var AnthropicMessagesLanguageModel = class {
4143
4397
  // code execution 20250825:
4144
4398
  case "bash_code_execution_tool_result":
4145
4399
  case "text_editor_code_execution_tool_result": {
4400
+ if (markCodeExecutionDynamic) {
4401
+ controller.enqueue({
4402
+ type: "tool-result",
4403
+ toolCallId: part.tool_use_id,
4404
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
4405
+ isError: true,
4406
+ 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."
4407
+ });
4408
+ return;
4409
+ }
4146
4410
  controller.enqueue({
4147
4411
  type: "tool-result",
4148
4412
  toolCallId: part.tool_use_id,
@@ -4581,42 +4845,49 @@ function getModelCapabilities(modelId) {
4581
4845
  return {
4582
4846
  maxOutputTokens: 128e3,
4583
4847
  supportsStructuredOutput: true,
4848
+ supportsAdaptiveThinking: true,
4584
4849
  isKnownModel: true
4585
4850
  };
4586
4851
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
4587
4852
  return {
4588
4853
  maxOutputTokens: 64e3,
4589
4854
  supportsStructuredOutput: true,
4855
+ supportsAdaptiveThinking: false,
4590
4856
  isKnownModel: true
4591
4857
  };
4592
4858
  } else if (modelId.includes("claude-opus-4-1")) {
4593
4859
  return {
4594
4860
  maxOutputTokens: 32e3,
4595
4861
  supportsStructuredOutput: true,
4862
+ supportsAdaptiveThinking: false,
4596
4863
  isKnownModel: true
4597
4864
  };
4598
4865
  } else if (modelId.includes("claude-sonnet-4-")) {
4599
4866
  return {
4600
4867
  maxOutputTokens: 64e3,
4601
4868
  supportsStructuredOutput: false,
4869
+ supportsAdaptiveThinking: false,
4602
4870
  isKnownModel: true
4603
4871
  };
4604
4872
  } else if (modelId.includes("claude-opus-4-")) {
4605
4873
  return {
4606
4874
  maxOutputTokens: 32e3,
4607
4875
  supportsStructuredOutput: false,
4876
+ supportsAdaptiveThinking: false,
4608
4877
  isKnownModel: true
4609
4878
  };
4610
4879
  } else if (modelId.includes("claude-3-haiku")) {
4611
4880
  return {
4612
4881
  maxOutputTokens: 4096,
4613
4882
  supportsStructuredOutput: false,
4883
+ supportsAdaptiveThinking: false,
4614
4884
  isKnownModel: true
4615
4885
  };
4616
4886
  } else {
4617
4887
  return {
4618
4888
  maxOutputTokens: 4096,
4619
4889
  supportsStructuredOutput: false,
4890
+ supportsAdaptiveThinking: false,
4620
4891
  isKnownModel: false
4621
4892
  };
4622
4893
  }
@@ -4639,6 +4910,43 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
4639
4910
  }
4640
4911
  return hasWebTool20260209 && !hasCodeExecutionTool;
4641
4912
  }
4913
+ function resolveAnthropicReasoningConfig({
4914
+ reasoning,
4915
+ supportsAdaptiveThinking,
4916
+ maxOutputTokensForModel,
4917
+ warnings
4918
+ }) {
4919
+ if (!isCustomReasoning(reasoning)) {
4920
+ return void 0;
4921
+ }
4922
+ if (reasoning === "none") {
4923
+ return { thinking: { type: "disabled" } };
4924
+ }
4925
+ if (supportsAdaptiveThinking) {
4926
+ const effort = mapReasoningToProviderEffort({
4927
+ reasoning,
4928
+ effortMap: {
4929
+ minimal: "low",
4930
+ low: "low",
4931
+ medium: "medium",
4932
+ high: "high",
4933
+ xhigh: "max"
4934
+ },
4935
+ warnings
4936
+ });
4937
+ return { thinking: { type: "adaptive" }, effort };
4938
+ }
4939
+ const budgetTokens = mapReasoningToProviderBudget({
4940
+ reasoning,
4941
+ maxOutputTokens: maxOutputTokensForModel,
4942
+ maxReasoningBudget: maxOutputTokensForModel,
4943
+ warnings
4944
+ });
4945
+ if (budgetTokens == null) {
4946
+ return void 0;
4947
+ }
4948
+ return { thinking: { type: "enabled", budgetTokens } };
4949
+ }
4642
4950
  function mapAnthropicResponseContextManagement(contextManagement) {
4643
4951
  return contextManagement ? {
4644
4952
  appliedEdits: contextManagement.applied_edits.map((edit) => {
@@ -4668,15 +4976,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4668
4976
  // src/tool/bash_20241022.ts
4669
4977
  import {
4670
4978
  createProviderToolFactory as createProviderToolFactory2,
4671
- lazySchema as lazySchema12,
4672
- zodSchema as zodSchema12
4979
+ lazySchema as lazySchema13,
4980
+ zodSchema as zodSchema13
4673
4981
  } from "@ai-sdk/provider-utils";
4674
- import { z as z13 } from "zod/v4";
4675
- var bash_20241022InputSchema = lazySchema12(
4676
- () => zodSchema12(
4677
- z13.object({
4678
- command: z13.string(),
4679
- restart: z13.boolean().optional()
4982
+ import { z as z14 } from "zod/v4";
4983
+ var bash_20241022InputSchema = lazySchema13(
4984
+ () => zodSchema13(
4985
+ z14.object({
4986
+ command: z14.string(),
4987
+ restart: z14.boolean().optional()
4680
4988
  })
4681
4989
  )
4682
4990
  );
@@ -4688,15 +4996,15 @@ var bash_20241022 = createProviderToolFactory2({
4688
4996
  // src/tool/bash_20250124.ts
4689
4997
  import {
4690
4998
  createProviderToolFactory as createProviderToolFactory3,
4691
- lazySchema as lazySchema13,
4692
- zodSchema as zodSchema13
4999
+ lazySchema as lazySchema14,
5000
+ zodSchema as zodSchema14
4693
5001
  } from "@ai-sdk/provider-utils";
4694
- import { z as z14 } from "zod/v4";
4695
- var bash_20250124InputSchema = lazySchema13(
4696
- () => zodSchema13(
4697
- z14.object({
4698
- command: z14.string(),
4699
- restart: z14.boolean().optional()
5002
+ import { z as z15 } from "zod/v4";
5003
+ var bash_20250124InputSchema = lazySchema14(
5004
+ () => zodSchema14(
5005
+ z15.object({
5006
+ command: z15.string(),
5007
+ restart: z15.boolean().optional()
4700
5008
  })
4701
5009
  )
4702
5010
  );
@@ -4708,14 +5016,14 @@ var bash_20250124 = createProviderToolFactory3({
4708
5016
  // src/tool/computer_20241022.ts
4709
5017
  import {
4710
5018
  createProviderToolFactory as createProviderToolFactory4,
4711
- lazySchema as lazySchema14,
4712
- zodSchema as zodSchema14
5019
+ lazySchema as lazySchema15,
5020
+ zodSchema as zodSchema15
4713
5021
  } from "@ai-sdk/provider-utils";
4714
- import { z as z15 } from "zod/v4";
4715
- var computer_20241022InputSchema = lazySchema14(
4716
- () => zodSchema14(
4717
- z15.object({
4718
- action: z15.enum([
5022
+ import { z as z16 } from "zod/v4";
5023
+ var computer_20241022InputSchema = lazySchema15(
5024
+ () => zodSchema15(
5025
+ z16.object({
5026
+ action: z16.enum([
4719
5027
  "key",
4720
5028
  "type",
4721
5029
  "mouse_move",
@@ -4727,8 +5035,8 @@ var computer_20241022InputSchema = lazySchema14(
4727
5035
  "screenshot",
4728
5036
  "cursor_position"
4729
5037
  ]),
4730
- coordinate: z15.array(z15.number().int()).optional(),
4731
- text: z15.string().optional()
5038
+ coordinate: z16.array(z16.number().int()).optional(),
5039
+ text: z16.string().optional()
4732
5040
  })
4733
5041
  )
4734
5042
  );
@@ -4740,14 +5048,14 @@ var computer_20241022 = createProviderToolFactory4({
4740
5048
  // src/tool/computer_20250124.ts
4741
5049
  import {
4742
5050
  createProviderToolFactory as createProviderToolFactory5,
4743
- lazySchema as lazySchema15,
4744
- zodSchema as zodSchema15
5051
+ lazySchema as lazySchema16,
5052
+ zodSchema as zodSchema16
4745
5053
  } from "@ai-sdk/provider-utils";
4746
- import { z as z16 } from "zod/v4";
4747
- var computer_20250124InputSchema = lazySchema15(
4748
- () => zodSchema15(
4749
- z16.object({
4750
- action: z16.enum([
5054
+ import { z as z17 } from "zod/v4";
5055
+ var computer_20250124InputSchema = lazySchema16(
5056
+ () => zodSchema16(
5057
+ z17.object({
5058
+ action: z17.enum([
4751
5059
  "key",
4752
5060
  "hold_key",
4753
5061
  "type",
@@ -4765,12 +5073,12 @@ var computer_20250124InputSchema = lazySchema15(
4765
5073
  "wait",
4766
5074
  "screenshot"
4767
5075
  ]),
4768
- coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4769
- duration: z16.number().optional(),
4770
- scroll_amount: z16.number().optional(),
4771
- scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
4772
- start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
4773
- text: z16.string().optional()
5076
+ coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
5077
+ duration: z17.number().optional(),
5078
+ scroll_amount: z17.number().optional(),
5079
+ scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
5080
+ start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
5081
+ text: z17.string().optional()
4774
5082
  })
4775
5083
  )
4776
5084
  );
@@ -4782,14 +5090,14 @@ var computer_20250124 = createProviderToolFactory5({
4782
5090
  // src/tool/computer_20251124.ts
4783
5091
  import {
4784
5092
  createProviderToolFactory as createProviderToolFactory6,
4785
- lazySchema as lazySchema16,
4786
- zodSchema as zodSchema16
5093
+ lazySchema as lazySchema17,
5094
+ zodSchema as zodSchema17
4787
5095
  } from "@ai-sdk/provider-utils";
4788
- import { z as z17 } from "zod/v4";
4789
- var computer_20251124InputSchema = lazySchema16(
4790
- () => zodSchema16(
4791
- z17.object({
4792
- action: z17.enum([
5096
+ import { z as z18 } from "zod/v4";
5097
+ var computer_20251124InputSchema = lazySchema17(
5098
+ () => zodSchema17(
5099
+ z18.object({
5100
+ action: z18.enum([
4793
5101
  "key",
4794
5102
  "hold_key",
4795
5103
  "type",
@@ -4808,18 +5116,18 @@ var computer_20251124InputSchema = lazySchema16(
4808
5116
  "screenshot",
4809
5117
  "zoom"
4810
5118
  ]),
4811
- coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4812
- duration: z17.number().optional(),
4813
- region: z17.tuple([
4814
- z17.number().int(),
4815
- z17.number().int(),
4816
- z17.number().int(),
4817
- z17.number().int()
5119
+ coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5120
+ duration: z18.number().optional(),
5121
+ region: z18.tuple([
5122
+ z18.number().int(),
5123
+ z18.number().int(),
5124
+ z18.number().int(),
5125
+ z18.number().int()
4818
5126
  ]).optional(),
4819
- scroll_amount: z17.number().optional(),
4820
- scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
4821
- start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
4822
- text: z17.string().optional()
5127
+ scroll_amount: z18.number().optional(),
5128
+ scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
5129
+ start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5130
+ text: z18.string().optional()
4823
5131
  })
4824
5132
  )
4825
5133
  );
@@ -4831,43 +5139,43 @@ var computer_20251124 = createProviderToolFactory6({
4831
5139
  // src/tool/memory_20250818.ts
4832
5140
  import {
4833
5141
  createProviderToolFactory as createProviderToolFactory7,
4834
- lazySchema as lazySchema17,
4835
- zodSchema as zodSchema17
5142
+ lazySchema as lazySchema18,
5143
+ zodSchema as zodSchema18
4836
5144
  } from "@ai-sdk/provider-utils";
4837
- import { z as z18 } from "zod/v4";
4838
- var memory_20250818InputSchema = lazySchema17(
4839
- () => zodSchema17(
4840
- z18.discriminatedUnion("command", [
4841
- z18.object({
4842
- command: z18.literal("view"),
4843
- path: z18.string(),
4844
- view_range: z18.tuple([z18.number(), z18.number()]).optional()
5145
+ import { z as z19 } from "zod/v4";
5146
+ var memory_20250818InputSchema = lazySchema18(
5147
+ () => zodSchema18(
5148
+ z19.discriminatedUnion("command", [
5149
+ z19.object({
5150
+ command: z19.literal("view"),
5151
+ path: z19.string(),
5152
+ view_range: z19.tuple([z19.number(), z19.number()]).optional()
4845
5153
  }),
4846
- z18.object({
4847
- command: z18.literal("create"),
4848
- path: z18.string(),
4849
- file_text: z18.string()
5154
+ z19.object({
5155
+ command: z19.literal("create"),
5156
+ path: z19.string(),
5157
+ file_text: z19.string()
4850
5158
  }),
4851
- z18.object({
4852
- command: z18.literal("str_replace"),
4853
- path: z18.string(),
4854
- old_str: z18.string(),
4855
- new_str: z18.string()
5159
+ z19.object({
5160
+ command: z19.literal("str_replace"),
5161
+ path: z19.string(),
5162
+ old_str: z19.string(),
5163
+ new_str: z19.string()
4856
5164
  }),
4857
- z18.object({
4858
- command: z18.literal("insert"),
4859
- path: z18.string(),
4860
- insert_line: z18.number(),
4861
- insert_text: z18.string()
5165
+ z19.object({
5166
+ command: z19.literal("insert"),
5167
+ path: z19.string(),
5168
+ insert_line: z19.number(),
5169
+ insert_text: z19.string()
4862
5170
  }),
4863
- z18.object({
4864
- command: z18.literal("delete"),
4865
- path: z18.string()
5171
+ z19.object({
5172
+ command: z19.literal("delete"),
5173
+ path: z19.string()
4866
5174
  }),
4867
- z18.object({
4868
- command: z18.literal("rename"),
4869
- old_path: z18.string(),
4870
- new_path: z18.string()
5175
+ z19.object({
5176
+ command: z19.literal("rename"),
5177
+ old_path: z19.string(),
5178
+ new_path: z19.string()
4871
5179
  })
4872
5180
  ])
4873
5181
  )
@@ -4880,37 +5188,11 @@ var memory_20250818 = createProviderToolFactory7({
4880
5188
  // src/tool/text-editor_20241022.ts
4881
5189
  import {
4882
5190
  createProviderToolFactory as createProviderToolFactory8,
4883
- lazySchema as lazySchema18,
4884
- zodSchema as zodSchema18
4885
- } from "@ai-sdk/provider-utils";
4886
- import { z as z19 } from "zod/v4";
4887
- var textEditor_20241022InputSchema = lazySchema18(
4888
- () => zodSchema18(
4889
- z19.object({
4890
- command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4891
- path: z19.string(),
4892
- file_text: z19.string().optional(),
4893
- insert_line: z19.number().int().optional(),
4894
- new_str: z19.string().optional(),
4895
- insert_text: z19.string().optional(),
4896
- old_str: z19.string().optional(),
4897
- view_range: z19.array(z19.number().int()).optional()
4898
- })
4899
- )
4900
- );
4901
- var textEditor_20241022 = createProviderToolFactory8({
4902
- id: "anthropic.text_editor_20241022",
4903
- inputSchema: textEditor_20241022InputSchema
4904
- });
4905
-
4906
- // src/tool/text-editor_20250124.ts
4907
- import {
4908
- createProviderToolFactory as createProviderToolFactory9,
4909
5191
  lazySchema as lazySchema19,
4910
5192
  zodSchema as zodSchema19
4911
5193
  } from "@ai-sdk/provider-utils";
4912
5194
  import { z as z20 } from "zod/v4";
4913
- var textEditor_20250124InputSchema = lazySchema19(
5195
+ var textEditor_20241022InputSchema = lazySchema19(
4914
5196
  () => zodSchema19(
4915
5197
  z20.object({
4916
5198
  command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -4924,22 +5206,22 @@ var textEditor_20250124InputSchema = lazySchema19(
4924
5206
  })
4925
5207
  )
4926
5208
  );
4927
- var textEditor_20250124 = createProviderToolFactory9({
4928
- id: "anthropic.text_editor_20250124",
4929
- inputSchema: textEditor_20250124InputSchema
5209
+ var textEditor_20241022 = createProviderToolFactory8({
5210
+ id: "anthropic.text_editor_20241022",
5211
+ inputSchema: textEditor_20241022InputSchema
4930
5212
  });
4931
5213
 
4932
- // src/tool/text-editor_20250429.ts
5214
+ // src/tool/text-editor_20250124.ts
4933
5215
  import {
4934
- createProviderToolFactory as createProviderToolFactory10,
5216
+ createProviderToolFactory as createProviderToolFactory9,
4935
5217
  lazySchema as lazySchema20,
4936
5218
  zodSchema as zodSchema20
4937
5219
  } from "@ai-sdk/provider-utils";
4938
5220
  import { z as z21 } from "zod/v4";
4939
- var textEditor_20250429InputSchema = lazySchema20(
5221
+ var textEditor_20250124InputSchema = lazySchema20(
4940
5222
  () => zodSchema20(
4941
5223
  z21.object({
4942
- command: z21.enum(["view", "create", "str_replace", "insert"]),
5224
+ command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4943
5225
  path: z21.string(),
4944
5226
  file_text: z21.string().optional(),
4945
5227
  insert_line: z21.number().int().optional(),
@@ -4950,51 +5232,77 @@ var textEditor_20250429InputSchema = lazySchema20(
4950
5232
  })
4951
5233
  )
4952
5234
  );
4953
- var textEditor_20250429 = createProviderToolFactory10({
4954
- id: "anthropic.text_editor_20250429",
4955
- inputSchema: textEditor_20250429InputSchema
5235
+ var textEditor_20250124 = createProviderToolFactory9({
5236
+ id: "anthropic.text_editor_20250124",
5237
+ inputSchema: textEditor_20250124InputSchema
4956
5238
  });
4957
5239
 
4958
- // src/tool/tool-search-bm25_20251119.ts
5240
+ // src/tool/text-editor_20250429.ts
4959
5241
  import {
4960
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5242
+ createProviderToolFactory as createProviderToolFactory10,
4961
5243
  lazySchema as lazySchema21,
4962
5244
  zodSchema as zodSchema21
4963
5245
  } from "@ai-sdk/provider-utils";
4964
5246
  import { z as z22 } from "zod/v4";
4965
- var toolSearchBm25_20251119OutputSchema = lazySchema21(
5247
+ var textEditor_20250429InputSchema = lazySchema21(
4966
5248
  () => zodSchema21(
4967
- z22.array(
4968
- z22.object({
4969
- type: z22.literal("tool_reference"),
4970
- toolName: z22.string()
5249
+ z22.object({
5250
+ command: z22.enum(["view", "create", "str_replace", "insert"]),
5251
+ path: z22.string(),
5252
+ file_text: z22.string().optional(),
5253
+ insert_line: z22.number().int().optional(),
5254
+ new_str: z22.string().optional(),
5255
+ insert_text: z22.string().optional(),
5256
+ old_str: z22.string().optional(),
5257
+ view_range: z22.array(z22.number().int()).optional()
5258
+ })
5259
+ )
5260
+ );
5261
+ var textEditor_20250429 = createProviderToolFactory10({
5262
+ id: "anthropic.text_editor_20250429",
5263
+ inputSchema: textEditor_20250429InputSchema
5264
+ });
5265
+
5266
+ // src/tool/tool-search-bm25_20251119.ts
5267
+ import {
5268
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
5269
+ lazySchema as lazySchema22,
5270
+ zodSchema as zodSchema22
5271
+ } from "@ai-sdk/provider-utils";
5272
+ import { z as z23 } from "zod/v4";
5273
+ var toolSearchBm25_20251119OutputSchema = lazySchema22(
5274
+ () => zodSchema22(
5275
+ z23.array(
5276
+ z23.object({
5277
+ type: z23.literal("tool_reference"),
5278
+ toolName: z23.string()
4971
5279
  })
4972
5280
  )
4973
5281
  )
4974
5282
  );
4975
- var toolSearchBm25_20251119InputSchema = lazySchema21(
4976
- () => zodSchema21(
4977
- z22.object({
5283
+ var toolSearchBm25_20251119InputSchema = lazySchema22(
5284
+ () => zodSchema22(
5285
+ z23.object({
4978
5286
  /**
4979
5287
  * A natural language query to search for tools.
4980
5288
  * Claude will use BM25 text search to find relevant tools.
4981
5289
  */
4982
- query: z22.string(),
5290
+ query: z23.string(),
4983
5291
  /**
4984
5292
  * Maximum number of tools to return. Optional.
4985
5293
  */
4986
- limit: z22.number().optional()
5294
+ limit: z23.number().optional()
4987
5295
  })
4988
5296
  )
4989
5297
  );
4990
- var factory10 = createProviderToolFactoryWithOutputSchema9({
5298
+ var factory11 = createProviderToolFactoryWithOutputSchema10({
4991
5299
  id: "anthropic.tool_search_bm25_20251119",
4992
5300
  inputSchema: toolSearchBm25_20251119InputSchema,
4993
5301
  outputSchema: toolSearchBm25_20251119OutputSchema,
4994
5302
  supportsDeferredResults: true
4995
5303
  });
4996
5304
  var toolSearchBm25_20251119 = (args = {}) => {
4997
- return factory10(args);
5305
+ return factory11(args);
4998
5306
  };
4999
5307
 
5000
5308
  // src/anthropic-tools.ts
@@ -5151,6 +5459,22 @@ var anthropicTools = {
5151
5459
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
5152
5460
  */
5153
5461
  webFetch_20260209,
5462
+ /**
5463
+ * Creates a web fetch tool that gives Claude direct access to real-time web content.
5464
+ * GA version (no beta header required). Includes caller restrictions, cache control,
5465
+ * deferred loading, and strict mode.
5466
+ *
5467
+ * @param maxUses - The max_uses parameter limits the number of web fetches performed
5468
+ * @param allowedDomains - Only fetch from these domains
5469
+ * @param blockedDomains - Never fetch from these domains
5470
+ * @param citations - Citations configuration for fetched documents
5471
+ * @param maxContentTokens - Max content tokens included in context
5472
+ * @param allowedCallers - Restrict callers (e.g. ["direct"] to prevent code_execution usage)
5473
+ * @param useCache - Whether to use cached content (set false for fresh content)
5474
+ * @param deferLoading - Defer loading until tool_search discovers it
5475
+ * @param strict - Enable strict schema validation
5476
+ */
5477
+ webFetch_20260309,
5154
5478
  /**
5155
5479
  * Creates a web search tool that gives Claude direct access to real-time web content.
5156
5480
  *
@@ -5254,7 +5578,7 @@ function createAnthropic(options = {}) {
5254
5578
  }
5255
5579
  return createChatModel(modelId);
5256
5580
  };
5257
- provider.specificationVersion = "v3";
5581
+ provider.specificationVersion = "v4";
5258
5582
  provider.languageModel = createChatModel;
5259
5583
  provider.chat = createChatModel;
5260
5584
  provider.messages = createChatModel;