@anthropic-ai/sdk 0.104.2 → 0.105.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 (98) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/internal/message-stream-utils.d.mts +10 -0
  9. package/internal/message-stream-utils.d.mts.map +1 -0
  10. package/internal/message-stream-utils.d.ts +10 -0
  11. package/internal/message-stream-utils.d.ts.map +1 -0
  12. package/internal/message-stream-utils.js +34 -0
  13. package/internal/message-stream-utils.js.map +1 -0
  14. package/internal/message-stream-utils.mjs +30 -0
  15. package/internal/message-stream-utils.mjs.map +1 -0
  16. package/lib/BetaMessageStream.d.mts.map +1 -1
  17. package/lib/BetaMessageStream.d.ts.map +1 -1
  18. package/lib/BetaMessageStream.js +36 -27
  19. package/lib/BetaMessageStream.js.map +1 -1
  20. package/lib/BetaMessageStream.mjs +36 -27
  21. package/lib/BetaMessageStream.mjs.map +1 -1
  22. package/lib/MessageStream.d.mts.map +1 -1
  23. package/lib/MessageStream.d.ts.map +1 -1
  24. package/lib/MessageStream.js +18 -22
  25. package/lib/MessageStream.js.map +1 -1
  26. package/lib/MessageStream.mjs +15 -19
  27. package/lib/MessageStream.mjs.map +1 -1
  28. package/lib/middleware.d.mts.map +1 -1
  29. package/lib/middleware.d.ts.map +1 -1
  30. package/lib/middleware.js +7 -1
  31. package/lib/middleware.js.map +1 -1
  32. package/lib/middleware.mjs +7 -1
  33. package/lib/middleware.mjs.map +1 -1
  34. package/package.json +1 -1
  35. package/resources/beta/beta.d.mts +4 -4
  36. package/resources/beta/beta.d.mts.map +1 -1
  37. package/resources/beta/beta.d.ts +4 -4
  38. package/resources/beta/beta.d.ts.map +1 -1
  39. package/resources/beta/beta.js.map +1 -1
  40. package/resources/beta/beta.mjs.map +1 -1
  41. package/resources/beta/index.d.mts +2 -2
  42. package/resources/beta/index.d.mts.map +1 -1
  43. package/resources/beta/index.d.ts +2 -2
  44. package/resources/beta/index.d.ts.map +1 -1
  45. package/resources/beta/index.js.map +1 -1
  46. package/resources/beta/index.mjs.map +1 -1
  47. package/resources/beta/messages/index.d.mts +1 -1
  48. package/resources/beta/messages/index.d.mts.map +1 -1
  49. package/resources/beta/messages/index.d.ts +1 -1
  50. package/resources/beta/messages/index.d.ts.map +1 -1
  51. package/resources/beta/messages/index.js.map +1 -1
  52. package/resources/beta/messages/index.mjs.map +1 -1
  53. package/resources/beta/messages/messages.d.mts +84 -44
  54. package/resources/beta/messages/messages.d.mts.map +1 -1
  55. package/resources/beta/messages/messages.d.ts +84 -44
  56. package/resources/beta/messages/messages.d.ts.map +1 -1
  57. package/resources/beta/messages/messages.js.map +1 -1
  58. package/resources/beta/messages/messages.mjs.map +1 -1
  59. package/resources/beta/webhooks.d.mts +11 -2
  60. package/resources/beta/webhooks.d.mts.map +1 -1
  61. package/resources/beta/webhooks.d.ts +11 -2
  62. package/resources/beta/webhooks.d.ts.map +1 -1
  63. package/resources/index.d.mts +1 -1
  64. package/resources/index.d.mts.map +1 -1
  65. package/resources/index.d.ts +1 -1
  66. package/resources/index.d.ts.map +1 -1
  67. package/resources/index.js.map +1 -1
  68. package/resources/index.mjs.map +1 -1
  69. package/resources/messages/index.d.mts +1 -1
  70. package/resources/messages/index.d.mts.map +1 -1
  71. package/resources/messages/index.d.ts +1 -1
  72. package/resources/messages/index.d.ts.map +1 -1
  73. package/resources/messages/index.js.map +1 -1
  74. package/resources/messages/index.mjs.map +1 -1
  75. package/resources/messages/messages.d.mts +46 -22
  76. package/resources/messages/messages.d.mts.map +1 -1
  77. package/resources/messages/messages.d.ts +46 -22
  78. package/resources/messages/messages.d.ts.map +1 -1
  79. package/resources/messages/messages.js.map +1 -1
  80. package/resources/messages/messages.mjs.map +1 -1
  81. package/src/client.ts +2 -0
  82. package/src/internal/message-stream-utils.ts +30 -0
  83. package/src/lib/BetaMessageStream.ts +37 -30
  84. package/src/lib/MessageStream.ts +15 -22
  85. package/src/lib/middleware.ts +7 -1
  86. package/src/resources/beta/beta.ts +6 -0
  87. package/src/resources/beta/index.ts +3 -0
  88. package/src/resources/beta/messages/index.ts +2 -0
  89. package/src/resources/beta/messages/messages.ts +141 -41
  90. package/src/resources/beta/webhooks.ts +16 -1
  91. package/src/resources/index.ts +1 -0
  92. package/src/resources/messages/index.ts +1 -0
  93. package/src/resources/messages/messages.ts +86 -19
  94. package/src/version.ts +1 -1
  95. package/version.d.mts +1 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
  98. package/version.mjs +1 -1
@@ -605,7 +605,9 @@ export interface CodeExecutionTool20250522 {
605
605
 
606
606
  type: 'code_execution_20250522';
607
607
 
608
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
608
+ allowed_callers?: Array<
609
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
610
+ >;
609
611
 
610
612
  /**
611
613
  * Create a cache control breakpoint at this content block.
@@ -634,7 +636,9 @@ export interface CodeExecutionTool20250825 {
634
636
 
635
637
  type: 'code_execution_20250825';
636
638
 
637
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
639
+ allowed_callers?: Array<
640
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
641
+ >;
638
642
 
639
643
  /**
640
644
  * Create a cache control breakpoint at this content block.
@@ -667,7 +671,43 @@ export interface CodeExecutionTool20260120 {
667
671
 
668
672
  type: 'code_execution_20260120';
669
673
 
670
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
674
+ allowed_callers?: Array<
675
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
676
+ >;
677
+
678
+ /**
679
+ * Create a cache control breakpoint at this content block.
680
+ */
681
+ cache_control?: CacheControlEphemeral | null;
682
+
683
+ /**
684
+ * If true, tool will not be included in initial system prompt. Only loaded when
685
+ * returned via tool_reference from tool search.
686
+ */
687
+ defer_loading?: boolean;
688
+
689
+ /**
690
+ * When true, guarantees schema validation on tool names and inputs
691
+ */
692
+ strict?: boolean;
693
+ }
694
+
695
+ /**
696
+ * Code execution tool with REPL state persistence.
697
+ */
698
+ export interface CodeExecutionTool20260521 {
699
+ /**
700
+ * Name of the tool.
701
+ *
702
+ * This is how the tool will be called by the model and in `tool_use` blocks.
703
+ */
704
+ name: 'code_execution';
705
+
706
+ type: 'code_execution_20260521';
707
+
708
+ allowed_callers?: Array<
709
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
710
+ >;
671
711
 
672
712
  /**
673
713
  * Create a cache control breakpoint at this content block.
@@ -940,7 +980,9 @@ export interface MemoryTool20250818 {
940
980
 
941
981
  type: 'memory_20250818';
942
982
 
943
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
983
+ allowed_callers?: Array<
984
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
985
+ >;
944
986
 
945
987
  /**
946
988
  * Create a cache control breakpoint at this content block.
@@ -1095,6 +1137,7 @@ export type MessageCountTokensTool =
1095
1137
  | CodeExecutionTool20250522
1096
1138
  | CodeExecutionTool20250825
1097
1139
  | CodeExecutionTool20260120
1140
+ | CodeExecutionTool20260521
1098
1141
  | MemoryTool20250818
1099
1142
  | ToolTextEditor20250124
1100
1143
  | ToolTextEditor20250429
@@ -1398,9 +1441,7 @@ export interface RedactedThinkingBlockParam {
1398
1441
  */
1399
1442
  export interface RefusalStopDetails {
1400
1443
  /**
1401
- * The policy category that triggered the refusal.
1402
- *
1403
- * `null` when the refusal doesn't map to a named category.
1444
+ * The policy category that triggered a refusal.
1404
1445
  */
1405
1446
  category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | null;
1406
1447
 
@@ -1776,7 +1817,9 @@ export interface Tool {
1776
1817
  */
1777
1818
  name: string;
1778
1819
 
1779
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1820
+ allowed_callers?: Array<
1821
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
1822
+ >;
1780
1823
 
1781
1824
  /**
1782
1825
  * Create a cache control breakpoint at this content block.
@@ -1846,7 +1889,9 @@ export interface ToolBash20250124 {
1846
1889
 
1847
1890
  type: 'bash_20250124';
1848
1891
 
1849
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1892
+ allowed_callers?: Array<
1893
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
1894
+ >;
1850
1895
 
1851
1896
  /**
1852
1897
  * Create a cache control breakpoint at this content block.
@@ -1983,7 +2028,9 @@ export interface ToolSearchToolBm25_20251119 {
1983
2028
 
1984
2029
  type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
1985
2030
 
1986
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2031
+ allowed_callers?: Array<
2032
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2033
+ >;
1987
2034
 
1988
2035
  /**
1989
2036
  * Create a cache control breakpoint at this content block.
@@ -2012,7 +2059,9 @@ export interface ToolSearchToolRegex20251119 {
2012
2059
 
2013
2060
  type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
2014
2061
 
2015
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2062
+ allowed_callers?: Array<
2063
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2064
+ >;
2016
2065
 
2017
2066
  /**
2018
2067
  * Create a cache control breakpoint at this content block.
@@ -2096,7 +2145,9 @@ export interface ToolTextEditor20250124 {
2096
2145
 
2097
2146
  type: 'text_editor_20250124';
2098
2147
 
2099
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2148
+ allowed_callers?: Array<
2149
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2150
+ >;
2100
2151
 
2101
2152
  /**
2102
2153
  * Create a cache control breakpoint at this content block.
@@ -2127,7 +2178,9 @@ export interface ToolTextEditor20250429 {
2127
2178
 
2128
2179
  type: 'text_editor_20250429';
2129
2180
 
2130
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2181
+ allowed_callers?: Array<
2182
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2183
+ >;
2131
2184
 
2132
2185
  /**
2133
2186
  * Create a cache control breakpoint at this content block.
@@ -2158,7 +2211,9 @@ export interface ToolTextEditor20250728 {
2158
2211
 
2159
2212
  type: 'text_editor_20250728';
2160
2213
 
2161
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2214
+ allowed_callers?: Array<
2215
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2216
+ >;
2162
2217
 
2163
2218
  /**
2164
2219
  * Create a cache control breakpoint at this content block.
@@ -2195,6 +2250,7 @@ export type ToolUnion =
2195
2250
  | CodeExecutionTool20250522
2196
2251
  | CodeExecutionTool20250825
2197
2252
  | CodeExecutionTool20260120
2253
+ | CodeExecutionTool20260521
2198
2254
  | MemoryTool20250818
2199
2255
  | ToolTextEditor20250124
2200
2256
  | ToolTextEditor20250429
@@ -2374,7 +2430,9 @@ export interface WebFetchTool20250910 {
2374
2430
 
2375
2431
  type: 'web_fetch_20250910';
2376
2432
 
2377
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2433
+ allowed_callers?: Array<
2434
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2435
+ >;
2378
2436
 
2379
2437
  /**
2380
2438
  * List of domains to allow fetching from
@@ -2430,7 +2488,9 @@ export interface WebFetchTool20260209 {
2430
2488
 
2431
2489
  type: 'web_fetch_20260209';
2432
2490
 
2433
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2491
+ allowed_callers?: Array<
2492
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2493
+ >;
2434
2494
 
2435
2495
  /**
2436
2496
  * List of domains to allow fetching from
@@ -2489,7 +2549,9 @@ export interface WebFetchTool20260309 {
2489
2549
 
2490
2550
  type: 'web_fetch_20260309';
2491
2551
 
2492
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2552
+ allowed_callers?: Array<
2553
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2554
+ >;
2493
2555
 
2494
2556
  /**
2495
2557
  * List of domains to allow fetching from
@@ -2630,7 +2692,9 @@ export interface WebSearchTool20250305 {
2630
2692
 
2631
2693
  type: 'web_search_20250305';
2632
2694
 
2633
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2695
+ allowed_callers?: Array<
2696
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2697
+ >;
2634
2698
 
2635
2699
  /**
2636
2700
  * If provided, only these domains will be included in results. Cannot be used
@@ -2691,7 +2755,9 @@ export interface WebSearchTool20260209 {
2691
2755
 
2692
2756
  type: 'web_search_20260209';
2693
2757
 
2694
- allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
2758
+ allowed_callers?: Array<
2759
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2760
+ >;
2695
2761
 
2696
2762
  /**
2697
2763
  * If provided, only these domains will be included in results. Cannot be used
@@ -3351,6 +3417,7 @@ export declare namespace Messages {
3351
3417
  type CodeExecutionTool20250522 as CodeExecutionTool20250522,
3352
3418
  type CodeExecutionTool20250825 as CodeExecutionTool20250825,
3353
3419
  type CodeExecutionTool20260120 as CodeExecutionTool20260120,
3420
+ type CodeExecutionTool20260521 as CodeExecutionTool20260521,
3354
3421
  type CodeExecutionToolResultBlock as CodeExecutionToolResultBlock,
3355
3422
  type CodeExecutionToolResultBlockContent as CodeExecutionToolResultBlockContent,
3356
3423
  type CodeExecutionToolResultBlockParam as CodeExecutionToolResultBlockParam,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.104.2'; // x-release-please-version
1
+ export const VERSION = '0.105.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.104.2";
1
+ export declare const VERSION = "0.105.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.104.2";
1
+ export declare const VERSION = "0.105.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.104.2'; // x-release-please-version
4
+ exports.VERSION = '0.105.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.104.2'; // x-release-please-version
1
+ export const VERSION = '0.105.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map