@ai-sdk/anthropic 2.0.3 → 2.0.4

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.
@@ -11,7 +11,7 @@ import {
11
11
  postJsonToApi,
12
12
  resolve
13
13
  } from "@ai-sdk/provider-utils";
14
- import { z as z4 } from "zod/v4";
14
+ import { z as z5 } from "zod/v4";
15
15
 
16
16
  // src/anthropic-error.ts
17
17
  import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
@@ -227,6 +227,14 @@ function prepareTools({
227
227
  });
228
228
  break;
229
229
  }
230
+ case "anthropic.code_execution_20250522": {
231
+ betas.add("code-execution-2025-05-22");
232
+ anthropicTools2.push({
233
+ type: "code_execution_20250522",
234
+ name: "code_execution"
235
+ });
236
+ break;
237
+ }
230
238
  default:
231
239
  toolWarnings.push({ type: "unsupported-tool", tool });
232
240
  break;
@@ -294,6 +302,29 @@ import {
294
302
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
295
303
  } from "@ai-sdk/provider";
296
304
  import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
305
+
306
+ // src/tool/code-execution_20250522.ts
307
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
308
+ import { z as z4 } from "zod/v4";
309
+ var codeExecution_20250522OutputSchema = z4.object({
310
+ type: z4.literal("code_execution_result"),
311
+ stdout: z4.string(),
312
+ stderr: z4.string(),
313
+ return_code: z4.number()
314
+ });
315
+ var factory2 = createProviderDefinedToolFactoryWithOutputSchema2({
316
+ id: "anthropic.code_execution_20250522",
317
+ name: "code_execution",
318
+ inputSchema: z4.object({
319
+ code: z4.string()
320
+ }),
321
+ outputSchema: codeExecution_20250522OutputSchema
322
+ });
323
+ var codeExecution_20250522 = (args = {}) => {
324
+ return factory2(args);
325
+ };
326
+
327
+ // src/convert-to-anthropic-messages-prompt.ts
297
328
  function convertToString(data) {
298
329
  if (typeof data === "string") {
299
330
  return Buffer.from(data, "base64").toString("utf-8");
@@ -593,6 +624,16 @@ async function convertToAnthropicMessagesPrompt({
593
624
  });
594
625
  break;
595
626
  }
627
+ if (part.toolName === "code_execution") {
628
+ anthropicContent.push({
629
+ type: "server_tool_use",
630
+ id: part.toolCallId,
631
+ name: "code_execution",
632
+ input: part.input,
633
+ cache_control: cacheControl
634
+ });
635
+ break;
636
+ }
596
637
  warnings.push({
597
638
  type: "other",
598
639
  message: `provider executed tool call for tool ${part.toolName} is not supported`
@@ -635,6 +676,29 @@ async function convertToAnthropicMessagesPrompt({
635
676
  });
636
677
  break;
637
678
  }
679
+ if (part.toolName === "code_execution") {
680
+ const output = part.output;
681
+ if (output.type !== "json") {
682
+ warnings.push({
683
+ type: "other",
684
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
685
+ });
686
+ break;
687
+ }
688
+ const codeExecutionOutput = codeExecution_20250522OutputSchema.parse(output.value);
689
+ anthropicContent.push({
690
+ type: "code_execution_tool_result",
691
+ tool_use_id: part.toolCallId,
692
+ content: {
693
+ type: codeExecutionOutput.type,
694
+ stdout: codeExecutionOutput.stdout,
695
+ stderr: codeExecutionOutput.stderr,
696
+ return_code: codeExecutionOutput.return_code
697
+ },
698
+ cache_control: cacheControl
699
+ });
700
+ break;
701
+ }
638
702
  warnings.push({
639
703
  type: "other",
640
704
  message: `provider executed tool result for tool ${part.toolName} is not supported`
@@ -725,36 +789,36 @@ function mapAnthropicStopReason({
725
789
 
726
790
  // src/anthropic-messages-language-model.ts
727
791
  var citationSchemas = {
728
- webSearchResult: z4.object({
729
- type: z4.literal("web_search_result_location"),
730
- cited_text: z4.string(),
731
- url: z4.string(),
732
- title: z4.string(),
733
- encrypted_index: z4.string()
792
+ webSearchResult: z5.object({
793
+ type: z5.literal("web_search_result_location"),
794
+ cited_text: z5.string(),
795
+ url: z5.string(),
796
+ title: z5.string(),
797
+ encrypted_index: z5.string()
734
798
  }),
735
- pageLocation: z4.object({
736
- type: z4.literal("page_location"),
737
- cited_text: z4.string(),
738
- document_index: z4.number(),
739
- document_title: z4.string().nullable(),
740
- start_page_number: z4.number(),
741
- end_page_number: z4.number()
799
+ pageLocation: z5.object({
800
+ type: z5.literal("page_location"),
801
+ cited_text: z5.string(),
802
+ document_index: z5.number(),
803
+ document_title: z5.string().nullable(),
804
+ start_page_number: z5.number(),
805
+ end_page_number: z5.number()
742
806
  }),
743
- charLocation: z4.object({
744
- type: z4.literal("char_location"),
745
- cited_text: z4.string(),
746
- document_index: z4.number(),
747
- document_title: z4.string().nullable(),
748
- start_char_index: z4.number(),
749
- end_char_index: z4.number()
807
+ charLocation: z5.object({
808
+ type: z5.literal("char_location"),
809
+ cited_text: z5.string(),
810
+ document_index: z5.number(),
811
+ document_title: z5.string().nullable(),
812
+ start_char_index: z5.number(),
813
+ end_char_index: z5.number()
750
814
  })
751
815
  };
752
- var citationSchema = z4.discriminatedUnion("type", [
816
+ var citationSchema = z5.discriminatedUnion("type", [
753
817
  citationSchemas.webSearchResult,
754
818
  citationSchemas.pageLocation,
755
819
  citationSchemas.charLocation
756
820
  ]);
757
- var documentCitationSchema = z4.discriminatedUnion("type", [
821
+ var documentCitationSchema = z5.discriminatedUnion("type", [
758
822
  citationSchemas.pageLocation,
759
823
  citationSchemas.charLocation
760
824
  ]);
@@ -1079,7 +1143,7 @@ var AnthropicMessagesLanguageModel = class {
1079
1143
  break;
1080
1144
  }
1081
1145
  case "server_tool_use": {
1082
- if (part.name === "web_search") {
1146
+ if (part.name === "web_search" || part.name === "code_execution") {
1083
1147
  content.push({
1084
1148
  type: "tool-call",
1085
1149
  toolCallId: part.id,
@@ -1137,6 +1201,35 @@ var AnthropicMessagesLanguageModel = class {
1137
1201
  }
1138
1202
  break;
1139
1203
  }
1204
+ case "code_execution_tool_result": {
1205
+ if (part.content.type === "code_execution_result") {
1206
+ content.push({
1207
+ type: "tool-result",
1208
+ toolCallId: part.tool_use_id,
1209
+ toolName: "code_execution",
1210
+ result: {
1211
+ type: part.content.type,
1212
+ stdout: part.content.stdout,
1213
+ stderr: part.content.stderr,
1214
+ return_code: part.content.return_code
1215
+ },
1216
+ providerExecuted: true
1217
+ });
1218
+ } else if (part.content.type === "code_execution_tool_result_error") {
1219
+ content.push({
1220
+ type: "tool-result",
1221
+ toolCallId: part.tool_use_id,
1222
+ toolName: "code_execution",
1223
+ isError: true,
1224
+ result: {
1225
+ type: "code_execution_tool_result_error",
1226
+ errorCode: part.content.error_code
1227
+ },
1228
+ providerExecuted: true
1229
+ });
1230
+ }
1231
+ break;
1232
+ }
1140
1233
  }
1141
1234
  }
1142
1235
  return {
@@ -1262,7 +1355,7 @@ var AnthropicMessagesLanguageModel = class {
1262
1355
  return;
1263
1356
  }
1264
1357
  case "server_tool_use": {
1265
- if (value.content_block.name === "web_search") {
1358
+ if (value.content_block.name === "web_search" || value.content_block.name === "code_execution") {
1266
1359
  contentBlocks[value.index] = {
1267
1360
  type: "tool-call",
1268
1361
  toolCallId: value.content_block.id,
@@ -1327,6 +1420,36 @@ var AnthropicMessagesLanguageModel = class {
1327
1420
  }
1328
1421
  return;
1329
1422
  }
1423
+ case "code_execution_tool_result": {
1424
+ const part = value.content_block;
1425
+ if (part.content.type === "code_execution_result") {
1426
+ controller.enqueue({
1427
+ type: "tool-result",
1428
+ toolCallId: part.tool_use_id,
1429
+ toolName: "code_execution",
1430
+ result: {
1431
+ type: part.content.type,
1432
+ stdout: part.content.stdout,
1433
+ stderr: part.content.stderr,
1434
+ return_code: part.content.return_code
1435
+ },
1436
+ providerExecuted: true
1437
+ });
1438
+ } else if (part.content.type === "code_execution_tool_result_error") {
1439
+ controller.enqueue({
1440
+ type: "tool-result",
1441
+ toolCallId: part.tool_use_id,
1442
+ toolName: "code_execution",
1443
+ isError: true,
1444
+ result: {
1445
+ type: "code_execution_tool_result_error",
1446
+ errorCode: part.content.error_code
1447
+ },
1448
+ providerExecuted: true
1449
+ });
1450
+ }
1451
+ return;
1452
+ }
1330
1453
  default: {
1331
1454
  const _exhaustiveCheck = contentBlockType;
1332
1455
  throw new Error(
@@ -1499,215 +1622,247 @@ var AnthropicMessagesLanguageModel = class {
1499
1622
  };
1500
1623
  }
1501
1624
  };
1502
- var anthropicMessagesResponseSchema = z4.object({
1503
- type: z4.literal("message"),
1504
- id: z4.string().nullish(),
1505
- model: z4.string().nullish(),
1506
- content: z4.array(
1507
- z4.discriminatedUnion("type", [
1508
- z4.object({
1509
- type: z4.literal("text"),
1510
- text: z4.string(),
1511
- citations: z4.array(citationSchema).optional()
1625
+ var anthropicMessagesResponseSchema = z5.object({
1626
+ type: z5.literal("message"),
1627
+ id: z5.string().nullish(),
1628
+ model: z5.string().nullish(),
1629
+ content: z5.array(
1630
+ z5.discriminatedUnion("type", [
1631
+ z5.object({
1632
+ type: z5.literal("text"),
1633
+ text: z5.string(),
1634
+ citations: z5.array(citationSchema).optional()
1512
1635
  }),
1513
- z4.object({
1514
- type: z4.literal("thinking"),
1515
- thinking: z4.string(),
1516
- signature: z4.string()
1636
+ z5.object({
1637
+ type: z5.literal("thinking"),
1638
+ thinking: z5.string(),
1639
+ signature: z5.string()
1517
1640
  }),
1518
- z4.object({
1519
- type: z4.literal("redacted_thinking"),
1520
- data: z4.string()
1641
+ z5.object({
1642
+ type: z5.literal("redacted_thinking"),
1643
+ data: z5.string()
1521
1644
  }),
1522
- z4.object({
1523
- type: z4.literal("tool_use"),
1524
- id: z4.string(),
1525
- name: z4.string(),
1526
- input: z4.unknown()
1645
+ z5.object({
1646
+ type: z5.literal("tool_use"),
1647
+ id: z5.string(),
1648
+ name: z5.string(),
1649
+ input: z5.unknown()
1527
1650
  }),
1528
- z4.object({
1529
- type: z4.literal("server_tool_use"),
1530
- id: z4.string(),
1531
- name: z4.string(),
1532
- input: z4.record(z4.string(), z4.unknown()).nullish()
1651
+ z5.object({
1652
+ type: z5.literal("server_tool_use"),
1653
+ id: z5.string(),
1654
+ name: z5.string(),
1655
+ input: z5.record(z5.string(), z5.unknown()).nullish()
1533
1656
  }),
1534
- z4.object({
1535
- type: z4.literal("web_search_tool_result"),
1536
- tool_use_id: z4.string(),
1537
- content: z4.union([
1538
- z4.array(
1539
- z4.object({
1540
- type: z4.literal("web_search_result"),
1541
- url: z4.string(),
1542
- title: z4.string(),
1543
- encrypted_content: z4.string(),
1544
- page_age: z4.string().nullish()
1657
+ z5.object({
1658
+ type: z5.literal("web_search_tool_result"),
1659
+ tool_use_id: z5.string(),
1660
+ content: z5.union([
1661
+ z5.array(
1662
+ z5.object({
1663
+ type: z5.literal("web_search_result"),
1664
+ url: z5.string(),
1665
+ title: z5.string(),
1666
+ encrypted_content: z5.string(),
1667
+ page_age: z5.string().nullish()
1545
1668
  })
1546
1669
  ),
1547
- z4.object({
1548
- type: z4.literal("web_search_tool_result_error"),
1549
- error_code: z4.string()
1670
+ z5.object({
1671
+ type: z5.literal("web_search_tool_result_error"),
1672
+ error_code: z5.string()
1673
+ })
1674
+ ])
1675
+ }),
1676
+ z5.object({
1677
+ type: z5.literal("code_execution_tool_result"),
1678
+ tool_use_id: z5.string(),
1679
+ content: z5.union([
1680
+ z5.object({
1681
+ type: z5.literal("code_execution_result"),
1682
+ stdout: z5.string(),
1683
+ stderr: z5.string(),
1684
+ return_code: z5.number()
1685
+ }),
1686
+ z5.object({
1687
+ type: z5.literal("code_execution_tool_result_error"),
1688
+ error_code: z5.string()
1550
1689
  })
1551
1690
  ])
1552
1691
  })
1553
1692
  ])
1554
1693
  ),
1555
- stop_reason: z4.string().nullish(),
1556
- usage: z4.looseObject({
1557
- input_tokens: z4.number(),
1558
- output_tokens: z4.number(),
1559
- cache_creation_input_tokens: z4.number().nullish(),
1560
- cache_read_input_tokens: z4.number().nullish()
1694
+ stop_reason: z5.string().nullish(),
1695
+ usage: z5.looseObject({
1696
+ input_tokens: z5.number(),
1697
+ output_tokens: z5.number(),
1698
+ cache_creation_input_tokens: z5.number().nullish(),
1699
+ cache_read_input_tokens: z5.number().nullish()
1561
1700
  })
1562
1701
  });
1563
- var anthropicMessagesChunkSchema = z4.discriminatedUnion("type", [
1564
- z4.object({
1565
- type: z4.literal("message_start"),
1566
- message: z4.object({
1567
- id: z4.string().nullish(),
1568
- model: z4.string().nullish(),
1569
- usage: z4.looseObject({
1570
- input_tokens: z4.number(),
1571
- output_tokens: z4.number(),
1572
- cache_creation_input_tokens: z4.number().nullish(),
1573
- cache_read_input_tokens: z4.number().nullish()
1702
+ var anthropicMessagesChunkSchema = z5.discriminatedUnion("type", [
1703
+ z5.object({
1704
+ type: z5.literal("message_start"),
1705
+ message: z5.object({
1706
+ id: z5.string().nullish(),
1707
+ model: z5.string().nullish(),
1708
+ usage: z5.looseObject({
1709
+ input_tokens: z5.number(),
1710
+ output_tokens: z5.number(),
1711
+ cache_creation_input_tokens: z5.number().nullish(),
1712
+ cache_read_input_tokens: z5.number().nullish()
1574
1713
  })
1575
1714
  })
1576
1715
  }),
1577
- z4.object({
1578
- type: z4.literal("content_block_start"),
1579
- index: z4.number(),
1580
- content_block: z4.discriminatedUnion("type", [
1581
- z4.object({
1582
- type: z4.literal("text"),
1583
- text: z4.string()
1716
+ z5.object({
1717
+ type: z5.literal("content_block_start"),
1718
+ index: z5.number(),
1719
+ content_block: z5.discriminatedUnion("type", [
1720
+ z5.object({
1721
+ type: z5.literal("text"),
1722
+ text: z5.string()
1584
1723
  }),
1585
- z4.object({
1586
- type: z4.literal("thinking"),
1587
- thinking: z4.string()
1724
+ z5.object({
1725
+ type: z5.literal("thinking"),
1726
+ thinking: z5.string()
1588
1727
  }),
1589
- z4.object({
1590
- type: z4.literal("tool_use"),
1591
- id: z4.string(),
1592
- name: z4.string()
1728
+ z5.object({
1729
+ type: z5.literal("tool_use"),
1730
+ id: z5.string(),
1731
+ name: z5.string()
1593
1732
  }),
1594
- z4.object({
1595
- type: z4.literal("redacted_thinking"),
1596
- data: z4.string()
1733
+ z5.object({
1734
+ type: z5.literal("redacted_thinking"),
1735
+ data: z5.string()
1597
1736
  }),
1598
- z4.object({
1599
- type: z4.literal("server_tool_use"),
1600
- id: z4.string(),
1601
- name: z4.string(),
1602
- input: z4.record(z4.string(), z4.unknown()).nullish()
1737
+ z5.object({
1738
+ type: z5.literal("server_tool_use"),
1739
+ id: z5.string(),
1740
+ name: z5.string(),
1741
+ input: z5.record(z5.string(), z5.unknown()).nullish()
1603
1742
  }),
1604
- z4.object({
1605
- type: z4.literal("web_search_tool_result"),
1606
- tool_use_id: z4.string(),
1607
- content: z4.union([
1608
- z4.array(
1609
- z4.object({
1610
- type: z4.literal("web_search_result"),
1611
- url: z4.string(),
1612
- title: z4.string(),
1613
- encrypted_content: z4.string(),
1614
- page_age: z4.string().nullish()
1743
+ z5.object({
1744
+ type: z5.literal("web_search_tool_result"),
1745
+ tool_use_id: z5.string(),
1746
+ content: z5.union([
1747
+ z5.array(
1748
+ z5.object({
1749
+ type: z5.literal("web_search_result"),
1750
+ url: z5.string(),
1751
+ title: z5.string(),
1752
+ encrypted_content: z5.string(),
1753
+ page_age: z5.string().nullish()
1615
1754
  })
1616
1755
  ),
1617
- z4.object({
1618
- type: z4.literal("web_search_tool_result_error"),
1619
- error_code: z4.string()
1756
+ z5.object({
1757
+ type: z5.literal("web_search_tool_result_error"),
1758
+ error_code: z5.string()
1759
+ })
1760
+ ])
1761
+ }),
1762
+ z5.object({
1763
+ type: z5.literal("code_execution_tool_result"),
1764
+ tool_use_id: z5.string(),
1765
+ content: z5.union([
1766
+ z5.object({
1767
+ type: z5.literal("code_execution_result"),
1768
+ stdout: z5.string(),
1769
+ stderr: z5.string(),
1770
+ return_code: z5.number()
1771
+ }),
1772
+ z5.object({
1773
+ type: z5.literal("code_execution_tool_result_error"),
1774
+ error_code: z5.string()
1620
1775
  })
1621
1776
  ])
1622
1777
  })
1623
1778
  ])
1624
1779
  }),
1625
- z4.object({
1626
- type: z4.literal("content_block_delta"),
1627
- index: z4.number(),
1628
- delta: z4.discriminatedUnion("type", [
1629
- z4.object({
1630
- type: z4.literal("input_json_delta"),
1631
- partial_json: z4.string()
1780
+ z5.object({
1781
+ type: z5.literal("content_block_delta"),
1782
+ index: z5.number(),
1783
+ delta: z5.discriminatedUnion("type", [
1784
+ z5.object({
1785
+ type: z5.literal("input_json_delta"),
1786
+ partial_json: z5.string()
1632
1787
  }),
1633
- z4.object({
1634
- type: z4.literal("text_delta"),
1635
- text: z4.string()
1788
+ z5.object({
1789
+ type: z5.literal("text_delta"),
1790
+ text: z5.string()
1636
1791
  }),
1637
- z4.object({
1638
- type: z4.literal("thinking_delta"),
1639
- thinking: z4.string()
1792
+ z5.object({
1793
+ type: z5.literal("thinking_delta"),
1794
+ thinking: z5.string()
1640
1795
  }),
1641
- z4.object({
1642
- type: z4.literal("signature_delta"),
1643
- signature: z4.string()
1796
+ z5.object({
1797
+ type: z5.literal("signature_delta"),
1798
+ signature: z5.string()
1644
1799
  }),
1645
- z4.object({
1646
- type: z4.literal("citations_delta"),
1800
+ z5.object({
1801
+ type: z5.literal("citations_delta"),
1647
1802
  citation: citationSchema
1648
1803
  })
1649
1804
  ])
1650
1805
  }),
1651
- z4.object({
1652
- type: z4.literal("content_block_stop"),
1653
- index: z4.number()
1806
+ z5.object({
1807
+ type: z5.literal("content_block_stop"),
1808
+ index: z5.number()
1654
1809
  }),
1655
- z4.object({
1656
- type: z4.literal("error"),
1657
- error: z4.object({
1658
- type: z4.string(),
1659
- message: z4.string()
1810
+ z5.object({
1811
+ type: z5.literal("error"),
1812
+ error: z5.object({
1813
+ type: z5.string(),
1814
+ message: z5.string()
1660
1815
  })
1661
1816
  }),
1662
- z4.object({
1663
- type: z4.literal("message_delta"),
1664
- delta: z4.object({ stop_reason: z4.string().nullish() }),
1665
- usage: z4.object({ output_tokens: z4.number() })
1817
+ z5.object({
1818
+ type: z5.literal("message_delta"),
1819
+ delta: z5.object({ stop_reason: z5.string().nullish() }),
1820
+ usage: z5.object({ output_tokens: z5.number() })
1666
1821
  }),
1667
- z4.object({
1668
- type: z4.literal("message_stop")
1822
+ z5.object({
1823
+ type: z5.literal("message_stop")
1669
1824
  }),
1670
- z4.object({
1671
- type: z4.literal("ping")
1825
+ z5.object({
1826
+ type: z5.literal("ping")
1672
1827
  })
1673
1828
  ]);
1674
- var anthropicReasoningMetadataSchema = z4.object({
1675
- signature: z4.string().optional(),
1676
- redactedData: z4.string().optional()
1829
+ var anthropicReasoningMetadataSchema = z5.object({
1830
+ signature: z5.string().optional(),
1831
+ redactedData: z5.string().optional()
1677
1832
  });
1678
1833
 
1679
1834
  // src/tool/bash_20241022.ts
1680
1835
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
1681
- import z5 from "zod/v4";
1836
+ import z6 from "zod/v4";
1682
1837
  var bash_20241022 = createProviderDefinedToolFactory({
1683
1838
  id: "anthropic.bash_20241022",
1684
1839
  name: "bash",
1685
- inputSchema: z5.object({
1686
- command: z5.string(),
1687
- restart: z5.boolean().optional()
1840
+ inputSchema: z6.object({
1841
+ command: z6.string(),
1842
+ restart: z6.boolean().optional()
1688
1843
  })
1689
1844
  });
1690
1845
 
1691
1846
  // src/tool/bash_20250124.ts
1692
1847
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
1693
- import z6 from "zod/v4";
1848
+ import z7 from "zod/v4";
1694
1849
  var bash_20250124 = createProviderDefinedToolFactory2({
1695
1850
  id: "anthropic.bash_20250124",
1696
1851
  name: "bash",
1697
- inputSchema: z6.object({
1698
- command: z6.string(),
1699
- restart: z6.boolean().optional()
1852
+ inputSchema: z7.object({
1853
+ command: z7.string(),
1854
+ restart: z7.boolean().optional()
1700
1855
  })
1701
1856
  });
1702
1857
 
1703
1858
  // src/tool/computer_20241022.ts
1704
1859
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
1705
- import { z as z7 } from "zod/v4";
1860
+ import { z as z8 } from "zod/v4";
1706
1861
  var computer_20241022 = createProviderDefinedToolFactory3({
1707
1862
  id: "anthropic.computer_20241022",
1708
1863
  name: "computer",
1709
- inputSchema: z7.object({
1710
- action: z7.enum([
1864
+ inputSchema: z8.object({
1865
+ action: z8.enum([
1711
1866
  "key",
1712
1867
  "type",
1713
1868
  "mouse_move",
@@ -1719,19 +1874,19 @@ var computer_20241022 = createProviderDefinedToolFactory3({
1719
1874
  "screenshot",
1720
1875
  "cursor_position"
1721
1876
  ]),
1722
- coordinate: z7.array(z7.number().int()).optional(),
1723
- text: z7.string().optional()
1877
+ coordinate: z8.array(z8.number().int()).optional(),
1878
+ text: z8.string().optional()
1724
1879
  })
1725
1880
  });
1726
1881
 
1727
1882
  // src/tool/computer_20250124.ts
1728
1883
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory4 } from "@ai-sdk/provider-utils";
1729
- import { z as z8 } from "zod/v4";
1884
+ import { z as z9 } from "zod/v4";
1730
1885
  var computer_20250124 = createProviderDefinedToolFactory4({
1731
1886
  id: "anthropic.computer_20250124",
1732
1887
  name: "computer",
1733
- inputSchema: z8.object({
1734
- action: z8.enum([
1888
+ inputSchema: z9.object({
1889
+ action: z9.enum([
1735
1890
  "key",
1736
1891
  "hold_key",
1737
1892
  "type",
@@ -1749,38 +1904,21 @@ var computer_20250124 = createProviderDefinedToolFactory4({
1749
1904
  "wait",
1750
1905
  "screenshot"
1751
1906
  ]),
1752
- coordinate: z8.tuple([z8.number().int(), z8.number().int()]).optional(),
1753
- duration: z8.number().optional(),
1754
- scroll_amount: z8.number().optional(),
1755
- scroll_direction: z8.enum(["up", "down", "left", "right"]).optional(),
1756
- start_coordinate: z8.tuple([z8.number().int(), z8.number().int()]).optional(),
1757
- text: z8.string().optional()
1907
+ coordinate: z9.tuple([z9.number().int(), z9.number().int()]).optional(),
1908
+ duration: z9.number().optional(),
1909
+ scroll_amount: z9.number().optional(),
1910
+ scroll_direction: z9.enum(["up", "down", "left", "right"]).optional(),
1911
+ start_coordinate: z9.tuple([z9.number().int(), z9.number().int()]).optional(),
1912
+ text: z9.string().optional()
1758
1913
  })
1759
1914
  });
1760
1915
 
1761
1916
  // src/tool/text-editor_20241022.ts
1762
1917
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory5 } from "@ai-sdk/provider-utils";
1763
- import { z as z9 } from "zod/v4";
1918
+ import { z as z10 } from "zod/v4";
1764
1919
  var textEditor_20241022 = createProviderDefinedToolFactory5({
1765
1920
  id: "anthropic.text_editor_20241022",
1766
1921
  name: "str_replace_editor",
1767
- inputSchema: z9.object({
1768
- command: z9.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1769
- path: z9.string(),
1770
- file_text: z9.string().optional(),
1771
- insert_line: z9.number().int().optional(),
1772
- new_str: z9.string().optional(),
1773
- old_str: z9.string().optional(),
1774
- view_range: z9.array(z9.number().int()).optional()
1775
- })
1776
- });
1777
-
1778
- // src/tool/text-editor_20250124.ts
1779
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
1780
- import { z as z10 } from "zod/v4";
1781
- var textEditor_20250124 = createProviderDefinedToolFactory6({
1782
- id: "anthropic.text_editor_20250124",
1783
- name: "str_replace_editor",
1784
1922
  inputSchema: z10.object({
1785
1923
  command: z10.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1786
1924
  path: z10.string(),
@@ -1792,14 +1930,14 @@ var textEditor_20250124 = createProviderDefinedToolFactory6({
1792
1930
  })
1793
1931
  });
1794
1932
 
1795
- // src/tool/text-editor_20250429.ts
1796
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory7 } from "@ai-sdk/provider-utils";
1933
+ // src/tool/text-editor_20250124.ts
1934
+ import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
1797
1935
  import { z as z11 } from "zod/v4";
1798
- var textEditor_20250429 = createProviderDefinedToolFactory7({
1799
- id: "anthropic.text_editor_20250429",
1800
- name: "str_replace_based_edit_tool",
1936
+ var textEditor_20250124 = createProviderDefinedToolFactory6({
1937
+ id: "anthropic.text_editor_20250124",
1938
+ name: "str_replace_editor",
1801
1939
  inputSchema: z11.object({
1802
- command: z11.enum(["view", "create", "str_replace", "insert"]),
1940
+ command: z11.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1803
1941
  path: z11.string(),
1804
1942
  file_text: z11.string().optional(),
1805
1943
  insert_line: z11.number().int().optional(),
@@ -1809,6 +1947,23 @@ var textEditor_20250429 = createProviderDefinedToolFactory7({
1809
1947
  })
1810
1948
  });
1811
1949
 
1950
+ // src/tool/text-editor_20250429.ts
1951
+ import { createProviderDefinedToolFactory as createProviderDefinedToolFactory7 } from "@ai-sdk/provider-utils";
1952
+ import { z as z12 } from "zod/v4";
1953
+ var textEditor_20250429 = createProviderDefinedToolFactory7({
1954
+ id: "anthropic.text_editor_20250429",
1955
+ name: "str_replace_based_edit_tool",
1956
+ inputSchema: z12.object({
1957
+ command: z12.enum(["view", "create", "str_replace", "insert"]),
1958
+ path: z12.string(),
1959
+ file_text: z12.string().optional(),
1960
+ insert_line: z12.number().int().optional(),
1961
+ new_str: z12.string().optional(),
1962
+ old_str: z12.string().optional(),
1963
+ view_range: z12.array(z12.number().int()).optional()
1964
+ })
1965
+ });
1966
+
1812
1967
  // src/anthropic-tools.ts
1813
1968
  var anthropicTools = {
1814
1969
  /**
@@ -1870,7 +2025,11 @@ var anthropicTools = {
1870
2025
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
1871
2026
  * @param userLocation - Optional user location information to provide geographically relevant search results.
1872
2027
  */
1873
- webSearch_20250305
2028
+ webSearch_20250305,
2029
+ /**
2030
+ * Creates a tool for executing Python code. Must have name "code_execution".
2031
+ */
2032
+ codeExecution_20250522
1874
2033
  };
1875
2034
  export {
1876
2035
  AnthropicMessagesLanguageModel,