@anthropic-ai/sdk 0.104.2 → 0.106.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.
- package/CHANGELOG.md +35 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +2 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +2 -1
- package/core/streaming.mjs.map +1 -1
- package/helpers/beta/mcp.d.mts +1 -1
- package/helpers/beta/mcp.d.mts.map +1 -1
- package/helpers/beta/mcp.d.ts +1 -1
- package/helpers/beta/mcp.d.ts.map +1 -1
- package/helpers/beta/mcp.js +1 -1
- package/helpers/beta/mcp.js.map +1 -1
- package/helpers/beta/mcp.mjs +1 -1
- package/helpers/beta/mcp.mjs.map +1 -1
- package/internal/headers.d.mts +7 -0
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts +7 -0
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +45 -4
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +43 -3
- package/internal/headers.mjs.map +1 -1
- package/internal/message-stream-utils.d.mts +10 -0
- package/internal/message-stream-utils.d.mts.map +1 -0
- package/internal/message-stream-utils.d.ts +10 -0
- package/internal/message-stream-utils.d.ts.map +1 -0
- package/internal/message-stream-utils.js +34 -0
- package/internal/message-stream-utils.js.map +1 -0
- package/internal/message-stream-utils.mjs +30 -0
- package/internal/message-stream-utils.mjs.map +1 -0
- package/internal/stainless-helper-header.d.mts +60 -0
- package/internal/stainless-helper-header.d.mts.map +1 -0
- package/internal/stainless-helper-header.d.ts +60 -0
- package/internal/stainless-helper-header.d.ts.map +1 -0
- package/{lib → internal}/stainless-helper-header.js +27 -6
- package/internal/stainless-helper-header.js.map +1 -0
- package/{lib → internal}/stainless-helper-header.mjs +25 -5
- package/internal/stainless-helper-header.mjs.map +1 -0
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.js +38 -28
- package/lib/BetaMessageStream.js.map +1 -1
- package/lib/BetaMessageStream.mjs +38 -28
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/MessageStream.d.mts.map +1 -1
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.js +20 -23
- package/lib/MessageStream.js.map +1 -1
- package/lib/MessageStream.mjs +17 -20
- package/lib/MessageStream.mjs.map +1 -1
- package/lib/helper-client.d.mts +2 -20
- package/lib/helper-client.d.mts.map +1 -1
- package/lib/helper-client.d.ts +2 -20
- package/lib/helper-client.d.ts.map +1 -1
- package/lib/helper-client.js +2 -1
- package/lib/helper-client.js.map +1 -1
- package/lib/helper-client.mjs +2 -1
- package/lib/helper-client.mjs.map +1 -1
- package/lib/middleware.d.mts.map +1 -1
- package/lib/middleware.d.ts.map +1 -1
- package/lib/middleware.js +14 -6
- package/lib/middleware.js.map +1 -1
- package/lib/middleware.mjs +14 -6
- package/lib/middleware.mjs.map +1 -1
- package/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/lib/tools/BetaToolRunner.js +11 -5
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +11 -5
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/lib/tools/SessionToolRunner.d.mts.map +1 -1
- package/lib/tools/SessionToolRunner.d.ts.map +1 -1
- package/lib/tools/SessionToolRunner.js +2 -3
- package/lib/tools/SessionToolRunner.js.map +1 -1
- package/lib/tools/SessionToolRunner.mjs +2 -3
- package/lib/tools/SessionToolRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/agents/agents.d.mts +7 -2
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +7 -2
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/files.js +1 -1
- package/resources/beta/files.js.map +1 -1
- package/resources/beta/files.mjs +1 -1
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/batches.d.mts +8 -5
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +8 -5
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +5 -2
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +5 -2
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.mts +1 -1
- package/resources/beta/messages/index.d.mts.map +1 -1
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +94 -51
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +94 -51
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +6 -3
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +6 -3
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/webhooks.d.mts +11 -2
- package/resources/beta/webhooks.d.mts.map +1 -1
- package/resources/beta/webhooks.d.ts +11 -2
- package/resources/beta/webhooks.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/batches.d.mts +11 -3
- package/resources/messages/batches.d.mts.map +1 -1
- package/resources/messages/batches.d.ts +11 -3
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.js +10 -2
- package/resources/messages/batches.js.map +1 -1
- package/resources/messages/batches.mjs +10 -2
- package/resources/messages/batches.mjs.map +1 -1
- package/resources/messages/index.d.mts +1 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +84 -48
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +84 -48
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +9 -4
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +9 -4
- package/resources/messages/messages.mjs.map +1 -1
- package/src/client.ts +2 -0
- package/src/core/streaming.ts +2 -1
- package/src/helpers/beta/mcp.ts +1 -1
- package/src/internal/headers.ts +47 -4
- package/src/internal/message-stream-utils.ts +30 -0
- package/src/internal/stainless-helper-header.ts +122 -0
- package/src/lib/BetaMessageStream.ts +39 -31
- package/src/lib/MessageStream.ts +17 -23
- package/src/lib/helper-client.ts +6 -9
- package/src/lib/middleware.ts +17 -5
- package/src/lib/tools/BetaToolRunner.ts +15 -6
- package/src/lib/tools/SessionToolRunner.ts +2 -4
- package/src/resources/beta/agents/agents.ts +7 -2
- package/src/resources/beta/beta.ts +6 -0
- package/src/resources/beta/files.ts +1 -1
- package/src/resources/beta/index.ts +3 -0
- package/src/resources/beta/messages/batches.ts +14 -8
- package/src/resources/beta/messages/index.ts +2 -0
- package/src/resources/beta/messages/messages.ts +157 -51
- package/src/resources/beta/webhooks.ts +16 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/messages/batches.ts +21 -4
- package/src/resources/messages/index.ts +1 -0
- package/src/resources/messages/messages.ts +134 -50
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/lib/stainless-helper-header.d.mts +0 -34
- package/lib/stainless-helper-header.d.mts.map +0 -1
- package/lib/stainless-helper-header.d.ts +0 -34
- package/lib/stainless-helper-header.d.ts.map +0 -1
- package/lib/stainless-helper-header.js.map +0 -1
- package/lib/stainless-helper-header.mjs.map +0 -1
- package/src/lib/stainless-helper-header.ts +0 -80
|
@@ -5,7 +5,7 @@ import { APIResource } from '../../core/resource';
|
|
|
5
5
|
import { Stream } from '../../core/streaming';
|
|
6
6
|
import { buildHeaders } from '../../internal/headers';
|
|
7
7
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
|
-
import { stainlessHelperHeader } from '../../
|
|
8
|
+
import { stainlessHelperHeader } from '../../internal/stainless-helper-header';
|
|
9
9
|
import { MessageStream } from '../../lib/MessageStream';
|
|
10
10
|
import {
|
|
11
11
|
parseMessage,
|
|
@@ -55,19 +55,20 @@ export class Messages extends APIResource {
|
|
|
55
55
|
* });
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
create(
|
|
58
|
+
create(params: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
|
|
59
59
|
create(
|
|
60
|
-
|
|
60
|
+
params: MessageCreateParamsStreaming,
|
|
61
61
|
options?: RequestOptions,
|
|
62
62
|
): APIPromise<Stream<RawMessageStreamEvent>>;
|
|
63
63
|
create(
|
|
64
|
-
|
|
64
|
+
params: MessageCreateParamsBase,
|
|
65
65
|
options?: RequestOptions,
|
|
66
66
|
): APIPromise<Stream<RawMessageStreamEvent> | Message>;
|
|
67
67
|
create(
|
|
68
|
-
|
|
68
|
+
params: MessageCreateParams,
|
|
69
69
|
options?: RequestOptions,
|
|
70
70
|
): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
|
|
71
|
+
const { user_profile_id, ...body } = params;
|
|
71
72
|
if (body.model in DEPRECATED_MODELS) {
|
|
72
73
|
console.warn(
|
|
73
74
|
`The model '${body.model}' is deprecated and will reach end-of-life on ${
|
|
@@ -93,13 +94,16 @@ export class Messages extends APIResource {
|
|
|
93
94
|
|
|
94
95
|
// Collect helper info from tools and messages
|
|
95
96
|
const helperHeader = stainlessHelperHeader(body.tools, body.messages);
|
|
96
|
-
|
|
97
97
|
return this._client.post('/v1/messages', {
|
|
98
98
|
body,
|
|
99
99
|
timeout: timeout ?? 600000,
|
|
100
100
|
...options,
|
|
101
|
-
headers: buildHeaders([
|
|
102
|
-
|
|
101
|
+
headers: buildHeaders([
|
|
102
|
+
{ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
|
|
103
|
+
helperHeader,
|
|
104
|
+
options?.headers,
|
|
105
|
+
]),
|
|
106
|
+
stream: params.stream ?? false,
|
|
103
107
|
}) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -289,7 +293,9 @@ export interface CacheControlEphemeral {
|
|
|
289
293
|
* - `5m`: 5 minutes
|
|
290
294
|
* - `1h`: 1 hour
|
|
291
295
|
*
|
|
292
|
-
* Defaults to `5m`.
|
|
296
|
+
* Defaults to `5m`. See
|
|
297
|
+
* [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
298
|
+
* for details.
|
|
293
299
|
*/
|
|
294
300
|
ttl?: '5m' | '1h';
|
|
295
301
|
}
|
|
@@ -605,7 +611,9 @@ export interface CodeExecutionTool20250522 {
|
|
|
605
611
|
|
|
606
612
|
type: 'code_execution_20250522';
|
|
607
613
|
|
|
608
|
-
allowed_callers?: Array<
|
|
614
|
+
allowed_callers?: Array<
|
|
615
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
616
|
+
>;
|
|
609
617
|
|
|
610
618
|
/**
|
|
611
619
|
* Create a cache control breakpoint at this content block.
|
|
@@ -634,7 +642,9 @@ export interface CodeExecutionTool20250825 {
|
|
|
634
642
|
|
|
635
643
|
type: 'code_execution_20250825';
|
|
636
644
|
|
|
637
|
-
allowed_callers?: Array<
|
|
645
|
+
allowed_callers?: Array<
|
|
646
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
647
|
+
>;
|
|
638
648
|
|
|
639
649
|
/**
|
|
640
650
|
* Create a cache control breakpoint at this content block.
|
|
@@ -667,7 +677,43 @@ export interface CodeExecutionTool20260120 {
|
|
|
667
677
|
|
|
668
678
|
type: 'code_execution_20260120';
|
|
669
679
|
|
|
670
|
-
allowed_callers?: Array<
|
|
680
|
+
allowed_callers?: Array<
|
|
681
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
682
|
+
>;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Create a cache control breakpoint at this content block.
|
|
686
|
+
*/
|
|
687
|
+
cache_control?: CacheControlEphemeral | null;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
691
|
+
* returned via tool_reference from tool search.
|
|
692
|
+
*/
|
|
693
|
+
defer_loading?: boolean;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
697
|
+
*/
|
|
698
|
+
strict?: boolean;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Code execution tool with REPL state persistence.
|
|
703
|
+
*/
|
|
704
|
+
export interface CodeExecutionTool20260521 {
|
|
705
|
+
/**
|
|
706
|
+
* Name of the tool.
|
|
707
|
+
*
|
|
708
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
709
|
+
*/
|
|
710
|
+
name: 'code_execution';
|
|
711
|
+
|
|
712
|
+
type: 'code_execution_20260521';
|
|
713
|
+
|
|
714
|
+
allowed_callers?: Array<
|
|
715
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
716
|
+
>;
|
|
671
717
|
|
|
672
718
|
/**
|
|
673
719
|
* Create a cache control breakpoint at this content block.
|
|
@@ -940,7 +986,9 @@ export interface MemoryTool20250818 {
|
|
|
940
986
|
|
|
941
987
|
type: 'memory_20250818';
|
|
942
988
|
|
|
943
|
-
allowed_callers?: Array<
|
|
989
|
+
allowed_callers?: Array<
|
|
990
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
991
|
+
>;
|
|
944
992
|
|
|
945
993
|
/**
|
|
946
994
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1095,6 +1143,7 @@ export type MessageCountTokensTool =
|
|
|
1095
1143
|
| CodeExecutionTool20250522
|
|
1096
1144
|
| CodeExecutionTool20250825
|
|
1097
1145
|
| CodeExecutionTool20260120
|
|
1146
|
+
| CodeExecutionTool20260521
|
|
1098
1147
|
| MemoryTool20250818
|
|
1099
1148
|
| ToolTextEditor20250124
|
|
1100
1149
|
| ToolTextEditor20250429
|
|
@@ -1398,11 +1447,9 @@ export interface RedactedThinkingBlockParam {
|
|
|
1398
1447
|
*/
|
|
1399
1448
|
export interface RefusalStopDetails {
|
|
1400
1449
|
/**
|
|
1401
|
-
* The policy category that triggered
|
|
1402
|
-
*
|
|
1403
|
-
* `null` when the refusal doesn't map to a named category.
|
|
1450
|
+
* The policy category that triggered a refusal.
|
|
1404
1451
|
*/
|
|
1405
|
-
category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | null;
|
|
1452
|
+
category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | 'military_weapons' | null;
|
|
1406
1453
|
|
|
1407
1454
|
/**
|
|
1408
1455
|
* Human-readable explanation of the refusal.
|
|
@@ -1776,7 +1823,9 @@ export interface Tool {
|
|
|
1776
1823
|
*/
|
|
1777
1824
|
name: string;
|
|
1778
1825
|
|
|
1779
|
-
allowed_callers?: Array<
|
|
1826
|
+
allowed_callers?: Array<
|
|
1827
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1828
|
+
>;
|
|
1780
1829
|
|
|
1781
1830
|
/**
|
|
1782
1831
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1846,7 +1895,9 @@ export interface ToolBash20250124 {
|
|
|
1846
1895
|
|
|
1847
1896
|
type: 'bash_20250124';
|
|
1848
1897
|
|
|
1849
|
-
allowed_callers?: Array<
|
|
1898
|
+
allowed_callers?: Array<
|
|
1899
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1900
|
+
>;
|
|
1850
1901
|
|
|
1851
1902
|
/**
|
|
1852
1903
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1983,7 +2034,9 @@ export interface ToolSearchToolBm25_20251119 {
|
|
|
1983
2034
|
|
|
1984
2035
|
type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
|
|
1985
2036
|
|
|
1986
|
-
allowed_callers?: Array<
|
|
2037
|
+
allowed_callers?: Array<
|
|
2038
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2039
|
+
>;
|
|
1987
2040
|
|
|
1988
2041
|
/**
|
|
1989
2042
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2012,7 +2065,9 @@ export interface ToolSearchToolRegex20251119 {
|
|
|
2012
2065
|
|
|
2013
2066
|
type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
|
|
2014
2067
|
|
|
2015
|
-
allowed_callers?: Array<
|
|
2068
|
+
allowed_callers?: Array<
|
|
2069
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2070
|
+
>;
|
|
2016
2071
|
|
|
2017
2072
|
/**
|
|
2018
2073
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2096,7 +2151,9 @@ export interface ToolTextEditor20250124 {
|
|
|
2096
2151
|
|
|
2097
2152
|
type: 'text_editor_20250124';
|
|
2098
2153
|
|
|
2099
|
-
allowed_callers?: Array<
|
|
2154
|
+
allowed_callers?: Array<
|
|
2155
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2156
|
+
>;
|
|
2100
2157
|
|
|
2101
2158
|
/**
|
|
2102
2159
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2127,7 +2184,9 @@ export interface ToolTextEditor20250429 {
|
|
|
2127
2184
|
|
|
2128
2185
|
type: 'text_editor_20250429';
|
|
2129
2186
|
|
|
2130
|
-
allowed_callers?: Array<
|
|
2187
|
+
allowed_callers?: Array<
|
|
2188
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2189
|
+
>;
|
|
2131
2190
|
|
|
2132
2191
|
/**
|
|
2133
2192
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2158,7 +2217,9 @@ export interface ToolTextEditor20250728 {
|
|
|
2158
2217
|
|
|
2159
2218
|
type: 'text_editor_20250728';
|
|
2160
2219
|
|
|
2161
|
-
allowed_callers?: Array<
|
|
2220
|
+
allowed_callers?: Array<
|
|
2221
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2222
|
+
>;
|
|
2162
2223
|
|
|
2163
2224
|
/**
|
|
2164
2225
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2195,6 +2256,7 @@ export type ToolUnion =
|
|
|
2195
2256
|
| CodeExecutionTool20250522
|
|
2196
2257
|
| CodeExecutionTool20250825
|
|
2197
2258
|
| CodeExecutionTool20260120
|
|
2259
|
+
| CodeExecutionTool20260521
|
|
2198
2260
|
| MemoryTool20250818
|
|
2199
2261
|
| ToolTextEditor20250124
|
|
2200
2262
|
| ToolTextEditor20250429
|
|
@@ -2374,7 +2436,9 @@ export interface WebFetchTool20250910 {
|
|
|
2374
2436
|
|
|
2375
2437
|
type: 'web_fetch_20250910';
|
|
2376
2438
|
|
|
2377
|
-
allowed_callers?: Array<
|
|
2439
|
+
allowed_callers?: Array<
|
|
2440
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2441
|
+
>;
|
|
2378
2442
|
|
|
2379
2443
|
/**
|
|
2380
2444
|
* List of domains to allow fetching from
|
|
@@ -2430,7 +2494,9 @@ export interface WebFetchTool20260209 {
|
|
|
2430
2494
|
|
|
2431
2495
|
type: 'web_fetch_20260209';
|
|
2432
2496
|
|
|
2433
|
-
allowed_callers?: Array<
|
|
2497
|
+
allowed_callers?: Array<
|
|
2498
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2499
|
+
>;
|
|
2434
2500
|
|
|
2435
2501
|
/**
|
|
2436
2502
|
* List of domains to allow fetching from
|
|
@@ -2489,7 +2555,9 @@ export interface WebFetchTool20260309 {
|
|
|
2489
2555
|
|
|
2490
2556
|
type: 'web_fetch_20260309';
|
|
2491
2557
|
|
|
2492
|
-
allowed_callers?: Array<
|
|
2558
|
+
allowed_callers?: Array<
|
|
2559
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2560
|
+
>;
|
|
2493
2561
|
|
|
2494
2562
|
/**
|
|
2495
2563
|
* List of domains to allow fetching from
|
|
@@ -2630,7 +2698,9 @@ export interface WebSearchTool20250305 {
|
|
|
2630
2698
|
|
|
2631
2699
|
type: 'web_search_20250305';
|
|
2632
2700
|
|
|
2633
|
-
allowed_callers?: Array<
|
|
2701
|
+
allowed_callers?: Array<
|
|
2702
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2703
|
+
>;
|
|
2634
2704
|
|
|
2635
2705
|
/**
|
|
2636
2706
|
* If provided, only these domains will be included in results. Cannot be used
|
|
@@ -2691,7 +2761,9 @@ export interface WebSearchTool20260209 {
|
|
|
2691
2761
|
|
|
2692
2762
|
type: 'web_search_20260209';
|
|
2693
2763
|
|
|
2694
|
-
allowed_callers?: Array<
|
|
2764
|
+
allowed_callers?: Array<
|
|
2765
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
2766
|
+
>;
|
|
2695
2767
|
|
|
2696
2768
|
/**
|
|
2697
2769
|
* If provided, only these domains will be included in results. Cannot be used
|
|
@@ -2817,7 +2889,7 @@ export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreat
|
|
|
2817
2889
|
|
|
2818
2890
|
export interface MessageCreateParamsBase {
|
|
2819
2891
|
/**
|
|
2820
|
-
* The maximum number of tokens to generate before stopping.
|
|
2892
|
+
* Body param: The maximum number of tokens to generate before stopping.
|
|
2821
2893
|
*
|
|
2822
2894
|
* Note that our models may stop _before_ reaching this maximum. This parameter
|
|
2823
2895
|
* only specifies the absolute maximum number of tokens to generate.
|
|
@@ -2832,7 +2904,7 @@ export interface MessageCreateParamsBase {
|
|
|
2832
2904
|
max_tokens: number;
|
|
2833
2905
|
|
|
2834
2906
|
/**
|
|
2835
|
-
* Input messages.
|
|
2907
|
+
* Body param: Input messages.
|
|
2836
2908
|
*
|
|
2837
2909
|
* Our models are trained to operate on alternating `user` and `assistant`
|
|
2838
2910
|
* conversational turns. When creating a new `Message`, you specify the prior
|
|
@@ -2901,7 +2973,7 @@ export interface MessageCreateParamsBase {
|
|
|
2901
2973
|
messages: Array<MessageParam>;
|
|
2902
2974
|
|
|
2903
2975
|
/**
|
|
2904
|
-
* The model that will complete your prompt.
|
|
2976
|
+
* Body param: The model that will complete your prompt.
|
|
2905
2977
|
*
|
|
2906
2978
|
* See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
2907
2979
|
* details and options.
|
|
@@ -2909,35 +2981,36 @@ export interface MessageCreateParamsBase {
|
|
|
2909
2981
|
model: Model;
|
|
2910
2982
|
|
|
2911
2983
|
/**
|
|
2912
|
-
* Top-level cache control automatically applies a cache_control marker
|
|
2913
|
-
* cacheable block in the request.
|
|
2984
|
+
* Body param: Top-level cache control automatically applies a cache_control marker
|
|
2985
|
+
* to the last cacheable block in the request.
|
|
2914
2986
|
*/
|
|
2915
2987
|
cache_control?: CacheControlEphemeral | null;
|
|
2916
2988
|
|
|
2917
2989
|
/**
|
|
2918
|
-
* Container identifier for reuse across requests.
|
|
2990
|
+
* Body param: Container identifier for reuse across requests.
|
|
2919
2991
|
*/
|
|
2920
2992
|
container?: string | null;
|
|
2921
2993
|
|
|
2922
2994
|
/**
|
|
2923
|
-
* Specifies the geographic region for inference processing. If not
|
|
2924
|
-
* workspace's `default_inference_geo` is used.
|
|
2995
|
+
* Body param: Specifies the geographic region for inference processing. If not
|
|
2996
|
+
* specified, the workspace's `default_inference_geo` is used.
|
|
2925
2997
|
*/
|
|
2926
2998
|
inference_geo?: string | null;
|
|
2927
2999
|
|
|
2928
3000
|
/**
|
|
2929
|
-
* An object describing metadata about the request.
|
|
3001
|
+
* Body param: An object describing metadata about the request.
|
|
2930
3002
|
*/
|
|
2931
3003
|
metadata?: Metadata;
|
|
2932
3004
|
|
|
2933
3005
|
/**
|
|
2934
|
-
* Configuration options for the model's output, such as the output
|
|
3006
|
+
* Body param: Configuration options for the model's output, such as the output
|
|
3007
|
+
* format.
|
|
2935
3008
|
*/
|
|
2936
3009
|
output_config?: OutputConfig;
|
|
2937
3010
|
|
|
2938
3011
|
/**
|
|
2939
|
-
* Determines whether to use priority capacity (if available) or
|
|
2940
|
-
* for this request.
|
|
3012
|
+
* Body param: Determines whether to use priority capacity (if available) or
|
|
3013
|
+
* standard capacity for this request.
|
|
2941
3014
|
*
|
|
2942
3015
|
* Anthropic offers different levels of service for your API requests. See
|
|
2943
3016
|
* [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
|
|
@@ -2945,7 +3018,7 @@ export interface MessageCreateParamsBase {
|
|
|
2945
3018
|
service_tier?: 'auto' | 'standard_only';
|
|
2946
3019
|
|
|
2947
3020
|
/**
|
|
2948
|
-
* Custom text sequences that will cause the model to stop generating.
|
|
3021
|
+
* Body param: Custom text sequences that will cause the model to stop generating.
|
|
2949
3022
|
*
|
|
2950
3023
|
* Our models will normally stop when they have naturally completed their turn,
|
|
2951
3024
|
* which will result in a response `stop_reason` of `"end_turn"`.
|
|
@@ -2958,14 +3031,15 @@ export interface MessageCreateParamsBase {
|
|
|
2958
3031
|
stop_sequences?: Array<string>;
|
|
2959
3032
|
|
|
2960
3033
|
/**
|
|
2961
|
-
* Whether to incrementally stream the response using server-sent
|
|
3034
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3035
|
+
* events.
|
|
2962
3036
|
*
|
|
2963
3037
|
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
2964
3038
|
*/
|
|
2965
3039
|
stream?: boolean;
|
|
2966
3040
|
|
|
2967
3041
|
/**
|
|
2968
|
-
* System prompt.
|
|
3042
|
+
* Body param: System prompt.
|
|
2969
3043
|
*
|
|
2970
3044
|
* A system prompt is a way of providing context and instructions to Claude, such
|
|
2971
3045
|
* as specifying a particular goal or role. See our
|
|
@@ -2981,7 +3055,7 @@ export interface MessageCreateParamsBase {
|
|
|
2981
3055
|
temperature?: number;
|
|
2982
3056
|
|
|
2983
3057
|
/**
|
|
2984
|
-
* Configuration for enabling Claude's extended thinking.
|
|
3058
|
+
* Body param: Configuration for enabling Claude's extended thinking.
|
|
2985
3059
|
*
|
|
2986
3060
|
* When enabled, responses include `thinking` content blocks showing Claude's
|
|
2987
3061
|
* thinking process before the final answer. Requires a minimum budget of 1,024
|
|
@@ -2994,13 +3068,13 @@ export interface MessageCreateParamsBase {
|
|
|
2994
3068
|
thinking?: ThinkingConfigParam;
|
|
2995
3069
|
|
|
2996
3070
|
/**
|
|
2997
|
-
* How the model should use the provided tools. The model can use a
|
|
2998
|
-
* any available tool, decide by itself, or not use tools at all.
|
|
3071
|
+
* Body param: How the model should use the provided tools. The model can use a
|
|
3072
|
+
* specific tool, any available tool, decide by itself, or not use tools at all.
|
|
2999
3073
|
*/
|
|
3000
3074
|
tool_choice?: ToolChoice;
|
|
3001
3075
|
|
|
3002
3076
|
/**
|
|
3003
|
-
* Definitions of tools that the model may use.
|
|
3077
|
+
* Body param: Definitions of tools that the model may use.
|
|
3004
3078
|
*
|
|
3005
3079
|
* If you include `tools` in your API request, the model may return `tool_use`
|
|
3006
3080
|
* content blocks that represent the model's use of those tools. You can then run
|
|
@@ -3090,6 +3164,13 @@ export interface MessageCreateParamsBase {
|
|
|
3090
3164
|
* other values will be rejected with a 400 error.
|
|
3091
3165
|
*/
|
|
3092
3166
|
top_p?: number;
|
|
3167
|
+
|
|
3168
|
+
/**
|
|
3169
|
+
* Header param: The user profile ID to attribute this request to. Use when acting
|
|
3170
|
+
* on behalf of a party other than your organization. Requires the `user-profiles`
|
|
3171
|
+
* beta header.
|
|
3172
|
+
*/
|
|
3173
|
+
user_profile_id?: string;
|
|
3093
3174
|
}
|
|
3094
3175
|
|
|
3095
3176
|
export namespace MessageCreateParams {
|
|
@@ -3099,7 +3180,8 @@ export namespace MessageCreateParams {
|
|
|
3099
3180
|
|
|
3100
3181
|
export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
|
|
3101
3182
|
/**
|
|
3102
|
-
* Whether to incrementally stream the response using server-sent
|
|
3183
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3184
|
+
* events.
|
|
3103
3185
|
*
|
|
3104
3186
|
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
3105
3187
|
*/
|
|
@@ -3108,7 +3190,8 @@ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase
|
|
|
3108
3190
|
|
|
3109
3191
|
export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
|
3110
3192
|
/**
|
|
3111
|
-
* Whether to incrementally stream the response using server-sent
|
|
3193
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3194
|
+
* events.
|
|
3112
3195
|
*
|
|
3113
3196
|
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
3114
3197
|
*/
|
|
@@ -3351,6 +3434,7 @@ export declare namespace Messages {
|
|
|
3351
3434
|
type CodeExecutionTool20250522 as CodeExecutionTool20250522,
|
|
3352
3435
|
type CodeExecutionTool20250825 as CodeExecutionTool20250825,
|
|
3353
3436
|
type CodeExecutionTool20260120 as CodeExecutionTool20260120,
|
|
3437
|
+
type CodeExecutionTool20260521 as CodeExecutionTool20260521,
|
|
3354
3438
|
type CodeExecutionToolResultBlock as CodeExecutionToolResultBlock,
|
|
3355
3439
|
type CodeExecutionToolResultBlockContent as CodeExecutionToolResultBlockContent,
|
|
3356
3440
|
type CodeExecutionToolResultBlockParam as CodeExecutionToolResultBlockParam,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.106.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.106.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.106.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.106.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utilities for tracking SDK helper usage.
|
|
3
|
-
*/
|
|
4
|
-
import type { BetaMessageParam, BetaToolUnion } from "../resources/beta.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* Symbol used to mark objects created by SDK helpers for tracking.
|
|
7
|
-
* The value is the helper name (e.g., 'mcpTool', 'betaZodTool').
|
|
8
|
-
*/
|
|
9
|
-
export declare const SDK_HELPER_SYMBOL: unique symbol;
|
|
10
|
-
type StainlessHelperObject = {
|
|
11
|
-
[SDK_HELPER_SYMBOL]: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function wasCreatedByStainlessHelper(value: unknown): value is StainlessHelperObject;
|
|
14
|
-
/**
|
|
15
|
-
* Collects helper names from tools and messages arrays.
|
|
16
|
-
* Returns a deduplicated array of helper names found.
|
|
17
|
-
*/
|
|
18
|
-
export declare function collectStainlessHelpers(tools: BetaToolUnion[] | undefined, messages: BetaMessageParam[] | undefined): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Builds x-stainless-helper header value from tools and messages.
|
|
21
|
-
* Returns an empty object if no helpers are found.
|
|
22
|
-
*/
|
|
23
|
-
export declare function stainlessHelperHeader(tools: BetaToolUnion[] | undefined, messages: BetaMessageParam[] | undefined): {
|
|
24
|
-
'x-stainless-helper'?: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Builds x-stainless-helper header value from a file object.
|
|
28
|
-
* Returns an empty object if the file is not marked with a helper.
|
|
29
|
-
*/
|
|
30
|
-
export declare function stainlessHelperHeaderFromFile(file: unknown): {
|
|
31
|
-
'x-stainless-helper'?: string;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=stainless-helper-header.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stainless-helper-header.d.mts","sourceRoot":"","sources":["../src/lib/stainless-helper-header.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,8BAA0B;AAEzE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAA0C,CAAC;AAEzE,KAAK,qBAAqB,GAAG;IAAE,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAE1F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EAAE,GAAG,SAAS,EAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,GACvC,MAAM,EAAE,CA8BV;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EAAE,GAAG,SAAS,EAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,GACvC;IAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAAE,CAInC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAAE,CAK9F"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utilities for tracking SDK helper usage.
|
|
3
|
-
*/
|
|
4
|
-
import type { BetaMessageParam, BetaToolUnion } from "../resources/beta.js";
|
|
5
|
-
/**
|
|
6
|
-
* Symbol used to mark objects created by SDK helpers for tracking.
|
|
7
|
-
* The value is the helper name (e.g., 'mcpTool', 'betaZodTool').
|
|
8
|
-
*/
|
|
9
|
-
export declare const SDK_HELPER_SYMBOL: unique symbol;
|
|
10
|
-
type StainlessHelperObject = {
|
|
11
|
-
[SDK_HELPER_SYMBOL]: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function wasCreatedByStainlessHelper(value: unknown): value is StainlessHelperObject;
|
|
14
|
-
/**
|
|
15
|
-
* Collects helper names from tools and messages arrays.
|
|
16
|
-
* Returns a deduplicated array of helper names found.
|
|
17
|
-
*/
|
|
18
|
-
export declare function collectStainlessHelpers(tools: BetaToolUnion[] | undefined, messages: BetaMessageParam[] | undefined): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Builds x-stainless-helper header value from tools and messages.
|
|
21
|
-
* Returns an empty object if no helpers are found.
|
|
22
|
-
*/
|
|
23
|
-
export declare function stainlessHelperHeader(tools: BetaToolUnion[] | undefined, messages: BetaMessageParam[] | undefined): {
|
|
24
|
-
'x-stainless-helper'?: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Builds x-stainless-helper header value from a file object.
|
|
28
|
-
* Returns an empty object if the file is not marked with a helper.
|
|
29
|
-
*/
|
|
30
|
-
export declare function stainlessHelperHeaderFromFile(file: unknown): {
|
|
31
|
-
'x-stainless-helper'?: string;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=stainless-helper-header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stainless-helper-header.d.ts","sourceRoot":"","sources":["../src/lib/stainless-helper-header.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,6BAA0B;AAEzE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAA0C,CAAC;AAEzE,KAAK,qBAAqB,GAAG;IAAE,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAE1F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EAAE,GAAG,SAAS,EAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,GACvC,MAAM,EAAE,CA8BV;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EAAE,GAAG,SAAS,EAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,GACvC;IAAE,oBAAoB,CAAC,EAAE,MAAM,C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CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,oBAAoB,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utilities for tracking SDK helper usage.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { BetaMessageParam, BetaToolUnion } from '../resources/beta';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Symbol used to mark objects created by SDK helpers for tracking.
|
|
9
|
-
* The value is the helper name (e.g., 'mcpTool', 'betaZodTool').
|
|
10
|
-
*/
|
|
11
|
-
export const SDK_HELPER_SYMBOL = Symbol('anthropic.sdk.stainlessHelper');
|
|
12
|
-
|
|
13
|
-
type StainlessHelperObject = { [SDK_HELPER_SYMBOL]: string };
|
|
14
|
-
|
|
15
|
-
export function wasCreatedByStainlessHelper(value: unknown): value is StainlessHelperObject {
|
|
16
|
-
return typeof value === 'object' && value !== null && SDK_HELPER_SYMBOL in value;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Collects helper names from tools and messages arrays.
|
|
21
|
-
* Returns a deduplicated array of helper names found.
|
|
22
|
-
*/
|
|
23
|
-
export function collectStainlessHelpers(
|
|
24
|
-
tools: BetaToolUnion[] | undefined,
|
|
25
|
-
messages: BetaMessageParam[] | undefined,
|
|
26
|
-
): string[] {
|
|
27
|
-
const helpers = new Set<string>();
|
|
28
|
-
|
|
29
|
-
// Collect from tools
|
|
30
|
-
if (tools) {
|
|
31
|
-
for (const tool of tools) {
|
|
32
|
-
if (wasCreatedByStainlessHelper(tool)) {
|
|
33
|
-
helpers.add(tool[SDK_HELPER_SYMBOL]);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Collect from messages and their content blocks
|
|
39
|
-
if (messages) {
|
|
40
|
-
for (const message of messages) {
|
|
41
|
-
if (wasCreatedByStainlessHelper(message)) {
|
|
42
|
-
helpers.add(message[SDK_HELPER_SYMBOL]);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (Array.isArray(message.content)) {
|
|
46
|
-
for (const block of message.content) {
|
|
47
|
-
if (wasCreatedByStainlessHelper(block)) {
|
|
48
|
-
helpers.add(block[SDK_HELPER_SYMBOL]);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return Array.from(helpers);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Builds x-stainless-helper header value from tools and messages.
|
|
60
|
-
* Returns an empty object if no helpers are found.
|
|
61
|
-
*/
|
|
62
|
-
export function stainlessHelperHeader(
|
|
63
|
-
tools: BetaToolUnion[] | undefined,
|
|
64
|
-
messages: BetaMessageParam[] | undefined,
|
|
65
|
-
): { 'x-stainless-helper'?: string } {
|
|
66
|
-
const helpers = collectStainlessHelpers(tools, messages);
|
|
67
|
-
if (helpers.length === 0) return {};
|
|
68
|
-
return { 'x-stainless-helper': helpers.join(', ') };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Builds x-stainless-helper header value from a file object.
|
|
73
|
-
* Returns an empty object if the file is not marked with a helper.
|
|
74
|
-
*/
|
|
75
|
-
export function stainlessHelperHeaderFromFile(file: unknown): { 'x-stainless-helper'?: string } {
|
|
76
|
-
if (wasCreatedByStainlessHelper(file)) {
|
|
77
|
-
return { 'x-stainless-helper': file[SDK_HELPER_SYMBOL] };
|
|
78
|
-
}
|
|
79
|
-
return {};
|
|
80
|
-
}
|