@anthropic-ai/sdk 0.61.0 → 0.62.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +1 -1
  3. package/resources/beta/beta.d.mts +2 -2
  4. package/resources/beta/beta.d.mts.map +1 -1
  5. package/resources/beta/beta.d.ts +2 -2
  6. package/resources/beta/beta.d.ts.map +1 -1
  7. package/resources/beta/beta.js.map +1 -1
  8. package/resources/beta/beta.mjs.map +1 -1
  9. package/resources/beta/index.d.mts +1 -1
  10. package/resources/beta/index.d.mts.map +1 -1
  11. package/resources/beta/index.d.ts +1 -1
  12. package/resources/beta/index.d.ts.map +1 -1
  13. package/resources/beta/index.js.map +1 -1
  14. package/resources/beta/index.mjs.map +1 -1
  15. package/resources/beta/messages/index.d.mts +1 -1
  16. package/resources/beta/messages/index.d.mts.map +1 -1
  17. package/resources/beta/messages/index.d.ts +1 -1
  18. package/resources/beta/messages/index.d.ts.map +1 -1
  19. package/resources/beta/messages/index.js.map +1 -1
  20. package/resources/beta/messages/index.mjs.map +1 -1
  21. package/resources/beta/messages/messages.d.mts +111 -10
  22. package/resources/beta/messages/messages.d.mts.map +1 -1
  23. package/resources/beta/messages/messages.d.ts +111 -10
  24. package/resources/beta/messages/messages.d.ts.map +1 -1
  25. package/resources/beta/messages/messages.js.map +1 -1
  26. package/resources/beta/messages/messages.mjs.map +1 -1
  27. package/resources/messages/messages.d.mts +2 -2
  28. package/resources/messages/messages.d.mts.map +1 -1
  29. package/resources/messages/messages.d.ts +2 -2
  30. package/resources/messages/messages.d.ts.map +1 -1
  31. package/src/resources/beta/beta.ts +20 -0
  32. package/src/resources/beta/index.ts +10 -0
  33. package/src/resources/beta/messages/index.ts +10 -0
  34. package/src/resources/beta/messages/messages.ts +165 -5
  35. package/src/resources/messages/messages.ts +2 -2
  36. package/src/version.ts +1 -1
  37. package/version.d.mts +1 -1
  38. package/version.d.ts +1 -1
  39. package/version.js +1 -1
  40. package/version.mjs +1 -1
@@ -305,6 +305,10 @@ export interface BetaCitationCharLocationParam {
305
305
  type: 'char_location';
306
306
  }
307
307
 
308
+ export interface BetaCitationConfig {
309
+ enabled: boolean;
310
+ }
311
+
308
312
  export interface BetaCitationContentBlockLocation {
309
313
  cited_text: string;
310
314
 
@@ -601,6 +605,7 @@ export type BetaContentBlock =
601
605
  | BetaToolUseBlock
602
606
  | BetaServerToolUseBlock
603
607
  | BetaWebSearchToolResultBlock
608
+ | BetaWebFetchToolResultBlock
604
609
  | BetaCodeExecutionToolResultBlock
605
610
  | BetaBashCodeExecutionToolResultBlock
606
611
  | BetaTextEditorCodeExecutionToolResultBlock
@@ -622,6 +627,7 @@ export type BetaContentBlockParam =
622
627
  | BetaToolResultBlockParam
623
628
  | BetaServerToolUseBlockParam
624
629
  | BetaWebSearchToolResultBlockParam
630
+ | BetaWebFetchToolResultBlockParam
625
631
  | BetaCodeExecutionToolResultBlockParam
626
632
  | BetaBashCodeExecutionToolResultBlockParam
627
633
  | BetaTextEditorCodeExecutionToolResultBlockParam
@@ -637,6 +643,22 @@ export interface BetaContentBlockSource {
637
643
 
638
644
  export type BetaContentBlockSourceContent = BetaTextBlockParam | BetaImageBlockParam;
639
645
 
646
+ export interface BetaDocumentBlock {
647
+ /**
648
+ * Citation configuration for the document
649
+ */
650
+ citations: BetaCitationConfig | null;
651
+
652
+ source: BetaBase64PDFSource | BetaPlainTextSource;
653
+
654
+ /**
655
+ * The title of the document
656
+ */
657
+ title: string | null;
658
+
659
+ type: 'document';
660
+ }
661
+
640
662
  export interface BetaFileDocumentSource {
641
663
  file_id: string;
642
664
 
@@ -918,6 +940,7 @@ export interface BetaRawContentBlockStartEvent {
918
940
  | BetaToolUseBlock
919
941
  | BetaServerToolUseBlock
920
942
  | BetaWebSearchToolResultBlock
943
+ | BetaWebFetchToolResultBlock
921
944
  | BetaCodeExecutionToolResultBlock
922
945
  | BetaBashCodeExecutionToolResultBlock
923
946
  | BetaTextEditorCodeExecutionToolResultBlock
@@ -1020,7 +1043,7 @@ export interface BetaRequestDocumentBlock {
1020
1043
  */
1021
1044
  cache_control?: BetaCacheControlEphemeral | null;
1022
1045
 
1023
- citations?: BetaCitationsConfigParam;
1046
+ citations?: BetaCitationsConfigParam | null;
1024
1047
 
1025
1048
  context?: string | null;
1026
1049
 
@@ -1078,6 +1101,11 @@ export interface BetaSearchResultBlockParam {
1078
1101
  }
1079
1102
 
1080
1103
  export interface BetaServerToolUsage {
1104
+ /**
1105
+ * The number of web fetch tool requests.
1106
+ */
1107
+ web_fetch_requests: number;
1108
+
1081
1109
  /**
1082
1110
  * The number of web search tool requests.
1083
1111
  */
@@ -1089,7 +1117,7 @@ export interface BetaServerToolUseBlock {
1089
1117
 
1090
1118
  input: unknown;
1091
1119
 
1092
- name: 'web_search' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1120
+ name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1093
1121
 
1094
1122
  type: 'server_tool_use';
1095
1123
  }
@@ -1099,7 +1127,7 @@ export interface BetaServerToolUseBlockParam {
1099
1127
 
1100
1128
  input: unknown;
1101
1129
 
1102
- name: 'web_search' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1130
+ name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1103
1131
 
1104
1132
  type: 'server_tool_use';
1105
1133
 
@@ -1569,7 +1597,9 @@ export interface BetaToolResultBlockParam {
1569
1597
  */
1570
1598
  cache_control?: BetaCacheControlEphemeral | null;
1571
1599
 
1572
- content?: string | Array<BetaTextBlockParam | BetaImageBlockParam | BetaSearchResultBlockParam>;
1600
+ content?:
1601
+ | string
1602
+ | Array<BetaTextBlockParam | BetaImageBlockParam | BetaSearchResultBlockParam | BetaRequestDocumentBlock>;
1573
1603
 
1574
1604
  is_error?: boolean;
1575
1605
  }
@@ -1656,7 +1686,8 @@ export type BetaToolUnion =
1656
1686
  | BetaToolTextEditor20250124
1657
1687
  | BetaToolTextEditor20250429
1658
1688
  | BetaToolTextEditor20250728
1659
- | BetaWebSearchTool20250305;
1689
+ | BetaWebSearchTool20250305
1690
+ | BetaWebFetchTool20250910;
1660
1691
 
1661
1692
  export interface BetaToolUseBlock {
1662
1693
  id: string;
@@ -1732,6 +1763,124 @@ export interface BetaUsage {
1732
1763
  service_tier: 'standard' | 'priority' | 'batch' | null;
1733
1764
  }
1734
1765
 
1766
+ export interface BetaWebFetchBlock {
1767
+ content: BetaDocumentBlock;
1768
+
1769
+ /**
1770
+ * ISO 8601 timestamp when the content was retrieved
1771
+ */
1772
+ retrieved_at: string | null;
1773
+
1774
+ type: 'web_fetch_result';
1775
+
1776
+ /**
1777
+ * Fetched content URL
1778
+ */
1779
+ url: string;
1780
+ }
1781
+
1782
+ export interface BetaWebFetchBlockParam {
1783
+ content: BetaRequestDocumentBlock;
1784
+
1785
+ type: 'web_fetch_result';
1786
+
1787
+ /**
1788
+ * Fetched content URL
1789
+ */
1790
+ url: string;
1791
+
1792
+ /**
1793
+ * ISO 8601 timestamp when the content was retrieved
1794
+ */
1795
+ retrieved_at?: string | null;
1796
+ }
1797
+
1798
+ export interface BetaWebFetchTool20250910 {
1799
+ /**
1800
+ * Name of the tool.
1801
+ *
1802
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1803
+ */
1804
+ name: 'web_fetch';
1805
+
1806
+ type: 'web_fetch_20250910';
1807
+
1808
+ /**
1809
+ * List of domains to allow fetching from
1810
+ */
1811
+ allowed_domains?: Array<string> | null;
1812
+
1813
+ /**
1814
+ * List of domains to block fetching from
1815
+ */
1816
+ blocked_domains?: Array<string> | null;
1817
+
1818
+ /**
1819
+ * Create a cache control breakpoint at this content block.
1820
+ */
1821
+ cache_control?: BetaCacheControlEphemeral | null;
1822
+
1823
+ /**
1824
+ * Citations configuration for fetched documents. Citations are disabled by
1825
+ * default.
1826
+ */
1827
+ citations?: BetaCitationsConfigParam | null;
1828
+
1829
+ /**
1830
+ * Maximum number of tokens used by including web page text content in the context.
1831
+ * The limit is approximate and does not apply to binary content such as PDFs.
1832
+ */
1833
+ max_content_tokens?: number | null;
1834
+
1835
+ /**
1836
+ * Maximum number of times the tool can be used in the API request.
1837
+ */
1838
+ max_uses?: number | null;
1839
+ }
1840
+
1841
+ export interface BetaWebFetchToolResultBlock {
1842
+ content: BetaWebFetchToolResultErrorBlock | BetaWebFetchBlock;
1843
+
1844
+ tool_use_id: string;
1845
+
1846
+ type: 'web_fetch_tool_result';
1847
+ }
1848
+
1849
+ export interface BetaWebFetchToolResultBlockParam {
1850
+ content: BetaWebFetchToolResultErrorBlockParam | BetaWebFetchBlockParam;
1851
+
1852
+ tool_use_id: string;
1853
+
1854
+ type: 'web_fetch_tool_result';
1855
+
1856
+ /**
1857
+ * Create a cache control breakpoint at this content block.
1858
+ */
1859
+ cache_control?: BetaCacheControlEphemeral | null;
1860
+ }
1861
+
1862
+ export interface BetaWebFetchToolResultErrorBlock {
1863
+ error_code: BetaWebFetchToolResultErrorCode;
1864
+
1865
+ type: 'web_fetch_tool_result_error';
1866
+ }
1867
+
1868
+ export interface BetaWebFetchToolResultErrorBlockParam {
1869
+ error_code: BetaWebFetchToolResultErrorCode;
1870
+
1871
+ type: 'web_fetch_tool_result_error';
1872
+ }
1873
+
1874
+ export type BetaWebFetchToolResultErrorCode =
1875
+ | 'invalid_tool_input'
1876
+ | 'url_too_long'
1877
+ | 'url_not_allowed'
1878
+ | 'url_not_accessible'
1879
+ | 'unsupported_content_type'
1880
+ | 'too_many_requests'
1881
+ | 'max_uses_exceeded'
1882
+ | 'unavailable';
1883
+
1735
1884
  export interface BetaWebSearchResultBlock {
1736
1885
  encrypted_content: string;
1737
1886
 
@@ -2392,6 +2541,7 @@ export interface MessageCountTokensParams {
2392
2541
  | BetaToolTextEditor20250429
2393
2542
  | BetaToolTextEditor20250728
2394
2543
  | BetaWebSearchTool20250305
2544
+ | BetaWebFetchTool20250910
2395
2545
  >;
2396
2546
 
2397
2547
  /**
@@ -2418,6 +2568,7 @@ export declare namespace Messages {
2418
2568
  type BetaCacheCreation as BetaCacheCreation,
2419
2569
  type BetaCitationCharLocation as BetaCitationCharLocation,
2420
2570
  type BetaCitationCharLocationParam as BetaCitationCharLocationParam,
2571
+ type BetaCitationConfig as BetaCitationConfig,
2421
2572
  type BetaCitationContentBlockLocation as BetaCitationContentBlockLocation,
2422
2573
  type BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam,
2423
2574
  type BetaCitationPageLocation as BetaCitationPageLocation,
@@ -2448,6 +2599,7 @@ export declare namespace Messages {
2448
2599
  type BetaContentBlockParam as BetaContentBlockParam,
2449
2600
  type BetaContentBlockSource as BetaContentBlockSource,
2450
2601
  type BetaContentBlockSourceContent as BetaContentBlockSourceContent,
2602
+ type BetaDocumentBlock as BetaDocumentBlock,
2451
2603
  type BetaFileDocumentSource as BetaFileDocumentSource,
2452
2604
  type BetaFileImageSource as BetaFileImageSource,
2453
2605
  type BetaImageBlockParam as BetaImageBlockParam,
@@ -2523,6 +2675,14 @@ export declare namespace Messages {
2523
2675
  type BetaURLImageSource as BetaURLImageSource,
2524
2676
  type BetaURLPDFSource as BetaURLPDFSource,
2525
2677
  type BetaUsage as BetaUsage,
2678
+ type BetaWebFetchBlock as BetaWebFetchBlock,
2679
+ type BetaWebFetchBlockParam as BetaWebFetchBlockParam,
2680
+ type BetaWebFetchTool20250910 as BetaWebFetchTool20250910,
2681
+ type BetaWebFetchToolResultBlock as BetaWebFetchToolResultBlock,
2682
+ type BetaWebFetchToolResultBlockParam as BetaWebFetchToolResultBlockParam,
2683
+ type BetaWebFetchToolResultErrorBlock as BetaWebFetchToolResultErrorBlock,
2684
+ type BetaWebFetchToolResultErrorBlockParam as BetaWebFetchToolResultErrorBlockParam,
2685
+ type BetaWebFetchToolResultErrorCode as BetaWebFetchToolResultErrorCode,
2526
2686
  type BetaWebSearchResultBlock as BetaWebSearchResultBlock,
2527
2687
  type BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam,
2528
2688
  type BetaWebSearchTool20250305 as BetaWebSearchTool20250305,
@@ -355,7 +355,7 @@ export interface DocumentBlockParam {
355
355
  */
356
356
  cache_control?: CacheControlEphemeral | null;
357
357
 
358
- citations?: CitationsConfigParam;
358
+ citations?: CitationsConfigParam | null;
359
359
 
360
360
  context?: string | null;
361
361
 
@@ -1000,7 +1000,7 @@ export interface ToolResultBlockParam {
1000
1000
  */
1001
1001
  cache_control?: CacheControlEphemeral | null;
1002
1002
 
1003
- content?: string | Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam>;
1003
+ content?: string | Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam | DocumentBlockParam>;
1004
1004
 
1005
1005
  is_error?: boolean;
1006
1006
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.61.0'; // x-release-please-version
1
+ export const VERSION = '0.62.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.61.0";
1
+ export declare const VERSION = "0.62.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.61.0";
1
+ export declare const VERSION = "0.62.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.61.0'; // x-release-please-version
4
+ exports.VERSION = '0.62.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.61.0'; // x-release-please-version
1
+ export const VERSION = '0.62.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map