@anthropic-ai/sdk 0.114.0 → 0.116.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 +40 -0
- package/client.d.mts +3 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -3
- package/client.d.ts.map +1 -1
- package/client.js +9 -2
- package/client.js.map +1 -1
- package/client.mjs +9 -2
- 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 +3 -0
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +3 -0
- package/core/streaming.mjs.map +1 -1
- package/internal/constants.d.mts.map +1 -1
- package/internal/constants.d.ts.map +1 -1
- package/internal/constants.js +0 -5
- package/internal/constants.js.map +1 -1
- package/internal/constants.mjs +0 -5
- package/internal/constants.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +10 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +10 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/request-signal.d.mts +4 -0
- package/internal/request-signal.d.mts.map +1 -0
- package/internal/request-signal.d.ts +4 -0
- package/internal/request-signal.d.ts.map +1 -0
- package/internal/request-signal.js +50 -0
- package/internal/request-signal.js.map +1 -0
- package/internal/request-signal.mjs +45 -0
- package/internal/request-signal.mjs.map +1 -0
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.js +3 -0
- package/lib/BetaMessageStream.js.map +1 -1
- package/lib/BetaMessageStream.mjs +3 -0
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/middleware.d.mts +5 -3
- package/lib/middleware.d.mts.map +1 -1
- package/lib/middleware.d.ts +5 -3
- package/lib/middleware.d.ts.map +1 -1
- package/lib/middleware.js +58 -15
- package/lib/middleware.js.map +1 -1
- package/lib/middleware.mjs +58 -15
- package/lib/middleware.mjs.map +1 -1
- package/lib/sessions/accumulate.js +1 -0
- package/lib/sessions/accumulate.js.map +1 -1
- package/lib/sessions/accumulate.mjs +1 -0
- package/lib/sessions/accumulate.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 +80 -7
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +80 -7
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/agents/agents.d.mts +26 -4
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +26 -4
- 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/agents/index.d.mts +1 -1
- package/resources/beta/agents/index.d.mts.map +1 -1
- package/resources/beta/agents/index.d.ts +1 -1
- package/resources/beta/agents/index.d.ts.map +1 -1
- package/resources/beta/agents/index.js.map +1 -1
- package/resources/beta/agents/index.mjs.map +1 -1
- package/resources/beta/beta.d.mts +28 -10
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +28 -10
- 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/deployments.d.mts +16 -1
- package/resources/beta/deployments.d.mts.map +1 -1
- package/resources/beta/deployments.d.ts +16 -1
- package/resources/beta/deployments.d.ts.map +1 -1
- package/resources/beta/index.d.mts +5 -5
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +5 -5
- 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 +4 -3
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +4 -3
- package/resources/beta/messages/batches.d.ts.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 +205 -6
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +205 -6
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +1 -22
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +1 -22
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/sessions/events.d.mts +60 -10
- package/resources/beta/sessions/events.d.mts.map +1 -1
- package/resources/beta/sessions/events.d.ts +60 -10
- package/resources/beta/sessions/events.d.ts.map +1 -1
- package/resources/beta/sessions/events.js.map +1 -1
- package/resources/beta/sessions/events.mjs.map +1 -1
- package/resources/beta/sessions/index.d.mts +2 -2
- package/resources/beta/sessions/index.d.mts.map +1 -1
- package/resources/beta/sessions/index.d.ts +2 -2
- package/resources/beta/sessions/index.d.ts.map +1 -1
- package/resources/beta/sessions/index.js.map +1 -1
- package/resources/beta/sessions/index.mjs.map +1 -1
- package/resources/beta/sessions/sessions.d.mts +101 -6
- package/resources/beta/sessions/sessions.d.mts.map +1 -1
- package/resources/beta/sessions/sessions.d.ts +101 -6
- package/resources/beta/sessions/sessions.d.ts.map +1 -1
- package/resources/beta/sessions/sessions.js.map +1 -1
- package/resources/beta/sessions/sessions.mjs.map +1 -1
- package/resources/beta/sessions/threads/threads.d.mts +17 -5
- package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
- package/resources/beta/sessions/threads/threads.d.ts +17 -5
- package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
- package/resources/beta/sessions/threads/threads.js.map +1 -1
- package/resources/beta/sessions/threads/threads.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/messages.d.mts +52 -1
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +52 -1
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +1 -22
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +1 -22
- package/resources/messages/messages.mjs.map +1 -1
- package/src/client.ts +19 -3
- package/src/core/streaming.ts +3 -0
- package/src/internal/constants.ts +0 -5
- package/src/internal/parse.ts +10 -1
- package/src/internal/request-signal.ts +68 -0
- package/src/lib/BetaMessageStream.ts +4 -0
- package/src/lib/middleware.ts +61 -16
- package/src/lib/sessions/accumulate.ts +1 -0
- package/src/lib/tools/BetaToolRunner.ts +101 -8
- package/src/resources/beta/agents/agents.ts +30 -2
- package/src/resources/beta/agents/index.ts +1 -0
- package/src/resources/beta/beta.ts +59 -1
- package/src/resources/beta/deployments.ts +19 -0
- package/src/resources/beta/index.ts +18 -0
- package/src/resources/beta/messages/batches.ts +4 -3
- package/src/resources/beta/messages/index.ts +10 -0
- package/src/resources/beta/messages/messages.ts +251 -26
- package/src/resources/beta/sessions/events.ts +95 -9
- package/src/resources/beta/sessions/index.ts +7 -0
- package/src/resources/beta/sessions/sessions.ts +127 -3
- package/src/resources/beta/sessions/threads/threads.ts +21 -5
- package/src/resources/beta/webhooks.ts +16 -1
- package/src/resources/index.ts +2 -0
- package/src/resources/messages/messages.ts +53 -24
- package/src/tools/agent-toolset/node.browser.ts +14 -0
- package/src/tools/agent-toolset/node.ts +19 -8
- package/src/version.ts +1 -1
- package/tools/agent-toolset/node.browser.d.mts +9 -0
- package/tools/agent-toolset/node.browser.d.mts.map +1 -1
- package/tools/agent-toolset/node.browser.d.ts +9 -0
- package/tools/agent-toolset/node.browser.d.ts.map +1 -1
- package/tools/agent-toolset/node.browser.js +13 -1
- package/tools/agent-toolset/node.browser.js.map +1 -1
- package/tools/agent-toolset/node.browser.mjs +11 -0
- package/tools/agent-toolset/node.browser.mjs.map +1 -1
- package/tools/agent-toolset/node.d.mts +9 -0
- package/tools/agent-toolset/node.d.mts.map +1 -1
- package/tools/agent-toolset/node.d.ts +9 -0
- package/tools/agent-toolset/node.d.ts.map +1 -1
- package/tools/agent-toolset/node.js +18 -6
- package/tools/agent-toolset/node.js.map +1 -1
- package/tools/agent-toolset/node.mjs +16 -5
- package/tools/agent-toolset/node.mjs.map +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/tools/ToolRunner.d.mts +0 -132
- package/lib/tools/ToolRunner.d.mts.map +0 -1
- package/lib/tools/ToolRunner.d.ts +0 -132
- package/lib/tools/ToolRunner.d.ts.map +0 -1
- package/lib/tools/ToolRunner.js +0 -294
- package/lib/tools/ToolRunner.js.map +0 -1
- package/lib/tools/ToolRunner.mjs +0 -290
- package/lib/tools/ToolRunner.mjs.map +0 -1
- package/src/lib/tools/ToolRunner.ts +0 -381
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
BetaManagedAgentsModelRateLimitedError,
|
|
33
33
|
BetaManagedAgentsModelRequestFailedError,
|
|
34
34
|
BetaManagedAgentsPlainTextDocumentSource,
|
|
35
|
+
BetaManagedAgentsRedactedBlock,
|
|
35
36
|
BetaManagedAgentsRetryStatusExhausted,
|
|
36
37
|
BetaManagedAgentsRetryStatusRetrying,
|
|
37
38
|
BetaManagedAgentsRetryStatusTerminal,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
BetaManagedAgentsSearchResultCitations,
|
|
40
41
|
BetaManagedAgentsSearchResultContent,
|
|
41
42
|
BetaManagedAgentsSendSessionEvents,
|
|
43
|
+
BetaManagedAgentsSessionBudgetReached,
|
|
42
44
|
BetaManagedAgentsSessionDeletedEvent,
|
|
43
45
|
BetaManagedAgentsSessionEndTurn,
|
|
44
46
|
BetaManagedAgentsSessionErrorEvent,
|
|
@@ -55,6 +57,7 @@ import {
|
|
|
55
57
|
BetaManagedAgentsSessionThreadStatusRescheduledEvent,
|
|
56
58
|
BetaManagedAgentsSessionThreadStatusRunningEvent,
|
|
57
59
|
BetaManagedAgentsSessionThreadStatusTerminatedEvent,
|
|
60
|
+
BetaManagedAgentsSessionUsageSnapshot,
|
|
58
61
|
BetaManagedAgentsSpanModelRequestEndEvent,
|
|
59
62
|
BetaManagedAgentsSpanModelRequestStartEvent,
|
|
60
63
|
BetaManagedAgentsSpanModelUsage,
|
|
@@ -293,6 +296,21 @@ export class Sessions extends APIResource {
|
|
|
293
296
|
export type BetaManagedAgentsSessionsBidirectionalPageCursor =
|
|
294
297
|
BidirectionalPageCursor<BetaManagedAgentsSession>;
|
|
295
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Platform advisor roster entry: a model the session's primary thread may consult
|
|
301
|
+
* mid-turn. At most one per roster; the entry occupies the roster name
|
|
302
|
+
* `anthropic.advisor`.
|
|
303
|
+
*/
|
|
304
|
+
export interface BetaManagedAgentsAdvisorParams {
|
|
305
|
+
/**
|
|
306
|
+
* A Claude model id. The model must be permitted as an advisor for this agent's
|
|
307
|
+
* model — see the sessions/threads/advisor spec.
|
|
308
|
+
*/
|
|
309
|
+
model: string;
|
|
310
|
+
|
|
311
|
+
type: 'advisor';
|
|
312
|
+
}
|
|
313
|
+
|
|
296
314
|
export interface BetaManagedAgentsAgentMessagePreview {
|
|
297
315
|
/**
|
|
298
316
|
* The id the buffered agent.message will carry if it is emitted. Matches the
|
|
@@ -394,6 +412,19 @@ export interface BetaManagedAgentsBranchCheckout {
|
|
|
394
412
|
type: 'branch';
|
|
395
413
|
}
|
|
396
414
|
|
|
415
|
+
/**
|
|
416
|
+
* A hard spend ceiling. The session stops issuing new model requests once the
|
|
417
|
+
* tracked list cost reaches `max_list_cost`.
|
|
418
|
+
*/
|
|
419
|
+
export interface BetaManagedAgentsBudgetLimit {
|
|
420
|
+
/**
|
|
421
|
+
* A monetary amount in a specific currency.
|
|
422
|
+
*/
|
|
423
|
+
max_list_cost: BetaAPI.BetaMonetaryAmount;
|
|
424
|
+
|
|
425
|
+
type: 'limit';
|
|
426
|
+
}
|
|
427
|
+
|
|
397
428
|
/**
|
|
398
429
|
* Prompt-cache creation token usage broken down by cache lifetime.
|
|
399
430
|
*/
|
|
@@ -549,7 +580,7 @@ export interface BetaManagedAgentsMultiagent {
|
|
|
549
580
|
* Agents the coordinator may spawn as session threads, each resolved to a specific
|
|
550
581
|
* version.
|
|
551
582
|
*/
|
|
552
|
-
agents: Array<AgentsAPI.BetaManagedAgentsAgentReference>;
|
|
583
|
+
agents: Array<AgentsAPI.BetaManagedAgentsAgentReference | AgentsAPI.BetaManagedAgentsAdvisor>;
|
|
553
584
|
|
|
554
585
|
type: 'coordinator';
|
|
555
586
|
}
|
|
@@ -579,7 +610,8 @@ export interface BetaManagedAgentsMultiagentParams {
|
|
|
579
610
|
export type BetaManagedAgentsMultiagentRosterEntryParams =
|
|
580
611
|
| string
|
|
581
612
|
| BetaManagedAgentsAgentParams
|
|
582
|
-
| AgentsAPI.BetaManagedAgentsMultiagentSelfParams
|
|
613
|
+
| AgentsAPI.BetaManagedAgentsMultiagentSelfParams
|
|
614
|
+
| BetaManagedAgentsAdvisorParams;
|
|
583
615
|
|
|
584
616
|
/**
|
|
585
617
|
* Evaluation state for a single outcome defined via a define_outcome event.
|
|
@@ -622,6 +654,21 @@ export interface BetaManagedAgentsOutcomeEvaluationResource {
|
|
|
622
654
|
type: 'outcome_evaluation';
|
|
623
655
|
}
|
|
624
656
|
|
|
657
|
+
/**
|
|
658
|
+
* Cumulative count of server-executed tool invocations, broken down by tool.
|
|
659
|
+
*/
|
|
660
|
+
export interface BetaManagedAgentsServerToolUsage {
|
|
661
|
+
/**
|
|
662
|
+
* Number of server-executed web fetch requests.
|
|
663
|
+
*/
|
|
664
|
+
web_fetch_requests?: number;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Number of server-executed web search requests.
|
|
668
|
+
*/
|
|
669
|
+
web_search_requests?: number;
|
|
670
|
+
}
|
|
671
|
+
|
|
625
672
|
/**
|
|
626
673
|
* A Managed Agents `session`.
|
|
627
674
|
*/
|
|
@@ -639,6 +686,12 @@ export interface BetaManagedAgentsSession {
|
|
|
639
686
|
*/
|
|
640
687
|
archived_at: string | null;
|
|
641
688
|
|
|
689
|
+
/**
|
|
690
|
+
* A hard spend ceiling. The session stops issuing new model requests once the
|
|
691
|
+
* tracked list cost reaches `max_list_cost`.
|
|
692
|
+
*/
|
|
693
|
+
budget: BetaManagedAgentsBudgetLimit | null;
|
|
694
|
+
|
|
642
695
|
/**
|
|
643
696
|
* A timestamp in RFC 3339 format
|
|
644
697
|
*/
|
|
@@ -763,7 +816,7 @@ export interface BetaManagedAgentsSessionMultiagentCoordinator {
|
|
|
763
816
|
/**
|
|
764
817
|
* Full `agent` definitions the coordinator may spawn as session threads.
|
|
765
818
|
*/
|
|
766
|
-
agents: Array<AgentsAPI.BetaManagedAgentsSessionThreadAgent>;
|
|
819
|
+
agents: Array<AgentsAPI.BetaManagedAgentsSessionThreadAgent | AgentsAPI.BetaManagedAgentsAdvisor>;
|
|
767
820
|
|
|
768
821
|
type: 'coordinator';
|
|
769
822
|
}
|
|
@@ -809,6 +862,12 @@ export interface BetaManagedAgentsSessionUpdatedEvent {
|
|
|
809
862
|
*/
|
|
810
863
|
agent?: BetaManagedAgentsSessionAgent | null;
|
|
811
864
|
|
|
865
|
+
/**
|
|
866
|
+
* A hard spend ceiling. The session stops issuing new model requests once the
|
|
867
|
+
* tracked list cost reaches `max_list_cost`.
|
|
868
|
+
*/
|
|
869
|
+
budget?: BetaManagedAgentsBudgetLimit | null;
|
|
870
|
+
|
|
812
871
|
/**
|
|
813
872
|
* The session's full metadata bag after the update. Present when the update set
|
|
814
873
|
* non-empty metadata; absent when metadata was unchanged or cleared to empty.
|
|
@@ -825,6 +884,14 @@ export interface BetaManagedAgentsSessionUpdatedEvent {
|
|
|
825
884
|
* Cumulative token usage for a session across all turns.
|
|
826
885
|
*/
|
|
827
886
|
export interface BetaManagedAgentsSessionUsage {
|
|
887
|
+
/**
|
|
888
|
+
* Cumulative time in seconds during which the session had at least one thread in
|
|
889
|
+
* running status. Overlapping activity from concurrent threads is counted once,
|
|
890
|
+
* unlike `stats.active_seconds`, which sums each thread's own active time. This is
|
|
891
|
+
* the duration the session's runtime cost is priced on.
|
|
892
|
+
*/
|
|
893
|
+
active_seconds?: number;
|
|
894
|
+
|
|
828
895
|
/**
|
|
829
896
|
* Prompt-cache creation token usage broken down by cache lifetime.
|
|
830
897
|
*/
|
|
@@ -840,10 +907,48 @@ export interface BetaManagedAgentsSessionUsage {
|
|
|
840
907
|
*/
|
|
841
908
|
input_tokens?: number;
|
|
842
909
|
|
|
910
|
+
/**
|
|
911
|
+
* A monetary amount in a specific currency.
|
|
912
|
+
*/
|
|
913
|
+
list_cost?: BetaAPI.BetaMonetaryAmount | null;
|
|
914
|
+
|
|
843
915
|
/**
|
|
844
916
|
* Total output tokens generated across all turns.
|
|
845
917
|
*/
|
|
846
918
|
output_tokens?: number;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Cumulative count of server-executed tool invocations, broken down by tool.
|
|
922
|
+
*/
|
|
923
|
+
server_tool_use?: BetaManagedAgentsServerToolUsage | null;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Periodic snapshot of the session's cumulative usage and tracked list cost.
|
|
928
|
+
*/
|
|
929
|
+
export interface BetaManagedAgentsSessionUsageEvent {
|
|
930
|
+
/**
|
|
931
|
+
* Unique identifier for this event.
|
|
932
|
+
*/
|
|
933
|
+
id: string;
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* A timestamp in RFC 3339 format
|
|
937
|
+
*/
|
|
938
|
+
processed_at: string;
|
|
939
|
+
|
|
940
|
+
type: 'session.usage';
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Point-in-time snapshot of a session's cumulative usage.
|
|
944
|
+
*/
|
|
945
|
+
usage: EventsAPI.BetaManagedAgentsSessionUsageSnapshot;
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* A hard spend ceiling. The session stops issuing new model requests once the
|
|
949
|
+
* tracked list cost reaches `max_list_cost`.
|
|
950
|
+
*/
|
|
951
|
+
budget?: BetaManagedAgentsBudgetLimit | null;
|
|
847
952
|
}
|
|
848
953
|
|
|
849
954
|
/**
|
|
@@ -967,6 +1072,12 @@ export interface SessionCreateParams {
|
|
|
967
1072
|
*/
|
|
968
1073
|
environment_id: string;
|
|
969
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* Body param: A hard spend ceiling. The session stops issuing new model requests
|
|
1077
|
+
* once the tracked list cost reaches `max_list_cost`.
|
|
1078
|
+
*/
|
|
1079
|
+
budget?: BetaManagedAgentsBudgetLimit;
|
|
1080
|
+
|
|
970
1081
|
/**
|
|
971
1082
|
* Body param: Initial events to send to the `session` at creation, processed in
|
|
972
1083
|
* order. Supports `user.message` and `user.define_outcome` events. Maximum 50
|
|
@@ -1026,6 +1137,12 @@ export interface SessionUpdateParams {
|
|
|
1026
1137
|
*/
|
|
1027
1138
|
agent?: BetaManagedAgentsSessionAgentUpdate;
|
|
1028
1139
|
|
|
1140
|
+
/**
|
|
1141
|
+
* Body param: A hard spend ceiling. The session stops issuing new model requests
|
|
1142
|
+
* once the tracked list cost reaches `max_list_cost`.
|
|
1143
|
+
*/
|
|
1144
|
+
budget?: BetaManagedAgentsBudgetLimit | null;
|
|
1145
|
+
|
|
1029
1146
|
/**
|
|
1030
1147
|
* Body param: Metadata patch. Set a key to a string to upsert it, or to null to
|
|
1031
1148
|
* delete it. Omit the field to preserve.
|
|
@@ -1135,11 +1252,13 @@ Sessions.Threads = Threads;
|
|
|
1135
1252
|
|
|
1136
1253
|
export declare namespace Sessions {
|
|
1137
1254
|
export {
|
|
1255
|
+
type BetaManagedAgentsAdvisorParams as BetaManagedAgentsAdvisorParams,
|
|
1138
1256
|
type BetaManagedAgentsAgentMessagePreview as BetaManagedAgentsAgentMessagePreview,
|
|
1139
1257
|
type BetaManagedAgentsAgentParams as BetaManagedAgentsAgentParams,
|
|
1140
1258
|
type BetaManagedAgentsAgentThinkingPreview as BetaManagedAgentsAgentThinkingPreview,
|
|
1141
1259
|
type BetaManagedAgentsAgentWithOverridesParams as BetaManagedAgentsAgentWithOverridesParams,
|
|
1142
1260
|
type BetaManagedAgentsBranchCheckout as BetaManagedAgentsBranchCheckout,
|
|
1261
|
+
type BetaManagedAgentsBudgetLimit as BetaManagedAgentsBudgetLimit,
|
|
1143
1262
|
type BetaManagedAgentsCacheCreationUsage as BetaManagedAgentsCacheCreationUsage,
|
|
1144
1263
|
type BetaManagedAgentsCommitCheckout as BetaManagedAgentsCommitCheckout,
|
|
1145
1264
|
type BetaManagedAgentsDeletedSession as BetaManagedAgentsDeletedSession,
|
|
@@ -1153,6 +1272,7 @@ export declare namespace Sessions {
|
|
|
1153
1272
|
type BetaManagedAgentsMultiagentParams as BetaManagedAgentsMultiagentParams,
|
|
1154
1273
|
type BetaManagedAgentsMultiagentRosterEntryParams as BetaManagedAgentsMultiagentRosterEntryParams,
|
|
1155
1274
|
type BetaManagedAgentsOutcomeEvaluationResource as BetaManagedAgentsOutcomeEvaluationResource,
|
|
1275
|
+
type BetaManagedAgentsServerToolUsage as BetaManagedAgentsServerToolUsage,
|
|
1156
1276
|
type BetaManagedAgentsSession as BetaManagedAgentsSession,
|
|
1157
1277
|
type BetaManagedAgentsSessionAgent as BetaManagedAgentsSessionAgent,
|
|
1158
1278
|
type BetaManagedAgentsSessionAgentUpdate as BetaManagedAgentsSessionAgentUpdate,
|
|
@@ -1160,6 +1280,7 @@ export declare namespace Sessions {
|
|
|
1160
1280
|
type BetaManagedAgentsSessionStats as BetaManagedAgentsSessionStats,
|
|
1161
1281
|
type BetaManagedAgentsSessionUpdatedEvent as BetaManagedAgentsSessionUpdatedEvent,
|
|
1162
1282
|
type BetaManagedAgentsSessionUsage as BetaManagedAgentsSessionUsage,
|
|
1283
|
+
type BetaManagedAgentsSessionUsageEvent as BetaManagedAgentsSessionUsageEvent,
|
|
1163
1284
|
type BetaManagedAgentsStartEvent as BetaManagedAgentsStartEvent,
|
|
1164
1285
|
type BetaManagedAgentsStartEventPreview as BetaManagedAgentsStartEventPreview,
|
|
1165
1286
|
type BetaManagedAgentsSystemContentBlock as BetaManagedAgentsSystemContentBlock,
|
|
@@ -1203,6 +1324,7 @@ export declare namespace Sessions {
|
|
|
1203
1324
|
type BetaManagedAgentsModelRateLimitedError as BetaManagedAgentsModelRateLimitedError,
|
|
1204
1325
|
type BetaManagedAgentsModelRequestFailedError as BetaManagedAgentsModelRequestFailedError,
|
|
1205
1326
|
type BetaManagedAgentsPlainTextDocumentSource as BetaManagedAgentsPlainTextDocumentSource,
|
|
1327
|
+
type BetaManagedAgentsRedactedBlock as BetaManagedAgentsRedactedBlock,
|
|
1206
1328
|
type BetaManagedAgentsRetryStatusExhausted as BetaManagedAgentsRetryStatusExhausted,
|
|
1207
1329
|
type BetaManagedAgentsRetryStatusRetrying as BetaManagedAgentsRetryStatusRetrying,
|
|
1208
1330
|
type BetaManagedAgentsRetryStatusTerminal as BetaManagedAgentsRetryStatusTerminal,
|
|
@@ -1210,6 +1332,7 @@ export declare namespace Sessions {
|
|
|
1210
1332
|
type BetaManagedAgentsSearchResultCitations as BetaManagedAgentsSearchResultCitations,
|
|
1211
1333
|
type BetaManagedAgentsSearchResultContent as BetaManagedAgentsSearchResultContent,
|
|
1212
1334
|
type BetaManagedAgentsSendSessionEvents as BetaManagedAgentsSendSessionEvents,
|
|
1335
|
+
type BetaManagedAgentsSessionBudgetReached as BetaManagedAgentsSessionBudgetReached,
|
|
1213
1336
|
type BetaManagedAgentsSessionDeletedEvent as BetaManagedAgentsSessionDeletedEvent,
|
|
1214
1337
|
type BetaManagedAgentsSessionEndTurn as BetaManagedAgentsSessionEndTurn,
|
|
1215
1338
|
type BetaManagedAgentsSessionErrorEvent as BetaManagedAgentsSessionErrorEvent,
|
|
@@ -1225,6 +1348,7 @@ export declare namespace Sessions {
|
|
|
1225
1348
|
type BetaManagedAgentsSessionThreadStatusRescheduledEvent as BetaManagedAgentsSessionThreadStatusRescheduledEvent,
|
|
1226
1349
|
type BetaManagedAgentsSessionThreadStatusRunningEvent as BetaManagedAgentsSessionThreadStatusRunningEvent,
|
|
1227
1350
|
type BetaManagedAgentsSessionThreadStatusTerminatedEvent as BetaManagedAgentsSessionThreadStatusTerminatedEvent,
|
|
1351
|
+
type BetaManagedAgentsSessionUsageSnapshot as BetaManagedAgentsSessionUsageSnapshot,
|
|
1228
1352
|
type BetaManagedAgentsSpanModelRequestEndEvent as BetaManagedAgentsSpanModelRequestEndEvent,
|
|
1229
1353
|
type BetaManagedAgentsSpanModelRequestStartEvent as BetaManagedAgentsSpanModelRequestStartEvent,
|
|
1230
1354
|
type BetaManagedAgentsSpanModelUsage as BetaManagedAgentsSpanModelUsage,
|
|
@@ -117,11 +117,9 @@ export interface BetaManagedAgentsSessionThread {
|
|
|
117
117
|
id: string;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
121
|
-
* at thread creation time. The multiagent roster is not repeated here; read it
|
|
122
|
-
* from `Session.agent`.
|
|
120
|
+
* A session-resolved multiagent roster entry.
|
|
123
121
|
*/
|
|
124
|
-
agent: AgentsAPI.BetaManagedAgentsSessionThreadAgent;
|
|
122
|
+
agent: AgentsAPI.BetaManagedAgentsSessionThreadAgent | AgentsAPI.BetaManagedAgentsAdvisor;
|
|
125
123
|
|
|
126
124
|
/**
|
|
127
125
|
* A timestamp in RFC 3339 format
|
|
@@ -198,6 +196,13 @@ export type BetaManagedAgentsSessionThreadStatus = 'running' | 'idle' | 'resched
|
|
|
198
196
|
* Cumulative token usage for a session thread across all turns.
|
|
199
197
|
*/
|
|
200
198
|
export interface BetaManagedAgentsSessionThreadUsage {
|
|
199
|
+
/**
|
|
200
|
+
* Cumulative time in seconds this thread spent in running status. Equal to
|
|
201
|
+
* `stats.active_seconds`; surfaced here so a thread's usage carries every quantity
|
|
202
|
+
* its cost is priced on.
|
|
203
|
+
*/
|
|
204
|
+
active_seconds?: number;
|
|
205
|
+
|
|
201
206
|
/**
|
|
202
207
|
* Prompt-cache creation token usage broken down by cache lifetime.
|
|
203
208
|
*/
|
|
@@ -213,10 +218,20 @@ export interface BetaManagedAgentsSessionThreadUsage {
|
|
|
213
218
|
*/
|
|
214
219
|
input_tokens?: number;
|
|
215
220
|
|
|
221
|
+
/**
|
|
222
|
+
* A monetary amount in a specific currency.
|
|
223
|
+
*/
|
|
224
|
+
list_cost?: BetaAPI.BetaMonetaryAmount | null;
|
|
225
|
+
|
|
216
226
|
/**
|
|
217
227
|
* Total output tokens generated across all turns.
|
|
218
228
|
*/
|
|
219
229
|
output_tokens?: number;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Cumulative count of server-executed tool invocations, broken down by tool.
|
|
233
|
+
*/
|
|
234
|
+
server_tool_use?: SessionsAPI.BetaManagedAgentsServerToolUsage | null;
|
|
220
235
|
}
|
|
221
236
|
|
|
222
237
|
/**
|
|
@@ -258,7 +273,8 @@ export type BetaManagedAgentsStreamSessionThreadEvents =
|
|
|
258
273
|
| SessionsAPI.BetaManagedAgentsSessionUpdatedEvent
|
|
259
274
|
| SessionsAPI.BetaManagedAgentsStartEvent
|
|
260
275
|
| SessionsAPI.BetaManagedAgentsDeltaEvent
|
|
261
|
-
| SessionsAPI.BetaManagedAgentsSystemMessageEvent
|
|
276
|
+
| SessionsAPI.BetaManagedAgentsSystemMessageEvent
|
|
277
|
+
| SessionsAPI.BetaManagedAgentsSessionUsageEvent;
|
|
262
278
|
|
|
263
279
|
export interface ThreadRetrieveParams {
|
|
264
280
|
/**
|
|
@@ -301,7 +301,8 @@ export type BetaWebhookEventData =
|
|
|
301
301
|
| BetaWebhookEnvironmentDeletedEventData
|
|
302
302
|
| BetaWebhookMemoryStoreCreatedEventData
|
|
303
303
|
| BetaWebhookMemoryStoreArchivedEventData
|
|
304
|
-
| BetaWebhookMemoryStoreDeletedEventData
|
|
304
|
+
| BetaWebhookMemoryStoreDeletedEventData
|
|
305
|
+
| BetaWebhookSessionBudgetReachedEventData;
|
|
305
306
|
|
|
306
307
|
export interface BetaWebhookMemoryStoreArchivedEventData {
|
|
307
308
|
/**
|
|
@@ -355,6 +356,19 @@ export interface BetaWebhookSessionArchivedEventData {
|
|
|
355
356
|
workspace_id: string;
|
|
356
357
|
}
|
|
357
358
|
|
|
359
|
+
export interface BetaWebhookSessionBudgetReachedEventData {
|
|
360
|
+
/**
|
|
361
|
+
* ID of the session that triggered the event.
|
|
362
|
+
*/
|
|
363
|
+
id: string;
|
|
364
|
+
|
|
365
|
+
organization_id: string;
|
|
366
|
+
|
|
367
|
+
type: 'session.budget_reached';
|
|
368
|
+
|
|
369
|
+
workspace_id: string;
|
|
370
|
+
}
|
|
371
|
+
|
|
358
372
|
export interface BetaWebhookSessionCreatedEventData {
|
|
359
373
|
/**
|
|
360
374
|
* ID of the session that triggered the event.
|
|
@@ -720,6 +734,7 @@ export declare namespace Webhooks {
|
|
|
720
734
|
type BetaWebhookMemoryStoreCreatedEventData as BetaWebhookMemoryStoreCreatedEventData,
|
|
721
735
|
type BetaWebhookMemoryStoreDeletedEventData as BetaWebhookMemoryStoreDeletedEventData,
|
|
722
736
|
type BetaWebhookSessionArchivedEventData as BetaWebhookSessionArchivedEventData,
|
|
737
|
+
type BetaWebhookSessionBudgetReachedEventData as BetaWebhookSessionBudgetReachedEventData,
|
|
723
738
|
type BetaWebhookSessionCreatedEventData as BetaWebhookSessionCreatedEventData,
|
|
724
739
|
type BetaWebhookSessionDeletedEventData as BetaWebhookSessionDeletedEventData,
|
|
725
740
|
type BetaWebhookSessionIdledEventData as BetaWebhookSessionIdledEventData,
|
package/src/resources/index.ts
CHANGED
|
@@ -7,10 +7,12 @@ export {
|
|
|
7
7
|
type BetaAPIError,
|
|
8
8
|
type BetaAuthenticationError,
|
|
9
9
|
type BetaBillingError,
|
|
10
|
+
type BetaCurrency,
|
|
10
11
|
type BetaError,
|
|
11
12
|
type BetaErrorResponse,
|
|
12
13
|
type BetaGatewayTimeoutError,
|
|
13
14
|
type BetaInvalidRequestError,
|
|
15
|
+
type BetaMonetaryAmount,
|
|
14
16
|
type BetaNotFoundError,
|
|
15
17
|
type BetaOverloadedError,
|
|
16
18
|
type BetaPermissionError,
|
|
@@ -1260,6 +1260,7 @@ export type Model =
|
|
|
1260
1260
|
| 'claude-sonnet-5'
|
|
1261
1261
|
| 'claude-fable-5'
|
|
1262
1262
|
| 'claude-mythos-5'
|
|
1263
|
+
| 'claude-opus-5'
|
|
1263
1264
|
| 'claude-opus-4-8'
|
|
1264
1265
|
| 'claude-opus-4-7'
|
|
1265
1266
|
| 'claude-mythos-preview'
|
|
@@ -1271,8 +1272,6 @@ export type Model =
|
|
|
1271
1272
|
| 'claude-opus-4-5-20251101'
|
|
1272
1273
|
| 'claude-sonnet-4-5'
|
|
1273
1274
|
| 'claude-sonnet-4-5-20250929'
|
|
1274
|
-
| 'claude-opus-4-1'
|
|
1275
|
-
| 'claude-opus-4-1-20250805'
|
|
1276
1275
|
| (string & {});
|
|
1277
1276
|
|
|
1278
1277
|
export interface OutputConfig {
|
|
@@ -1303,28 +1302,7 @@ export interface OutputTokensDetails {
|
|
|
1303
1302
|
}
|
|
1304
1303
|
const DEPRECATED_MODELS: {
|
|
1305
1304
|
[K in Model]?: string;
|
|
1306
|
-
} = {
|
|
1307
|
-
'claude-1.3': 'November 6th, 2024',
|
|
1308
|
-
'claude-1.3-100k': 'November 6th, 2024',
|
|
1309
|
-
'claude-instant-1.1': 'November 6th, 2024',
|
|
1310
|
-
'claude-instant-1.1-100k': 'November 6th, 2024',
|
|
1311
|
-
'claude-instant-1.2': 'November 6th, 2024',
|
|
1312
|
-
'claude-3-sonnet-20240229': 'July 21st, 2025',
|
|
1313
|
-
'claude-3-opus-20240229': 'January 5th, 2026',
|
|
1314
|
-
'claude-2.1': 'July 21st, 2025',
|
|
1315
|
-
'claude-2.0': 'July 21st, 2025',
|
|
1316
|
-
'claude-3-7-sonnet-latest': 'February 19th, 2026',
|
|
1317
|
-
'claude-3-7-sonnet-20250219': 'February 19th, 2026',
|
|
1318
|
-
'claude-3-5-haiku-latest': 'February 19th, 2026',
|
|
1319
|
-
'claude-3-5-haiku-20241022': 'February 19th, 2026',
|
|
1320
|
-
'claude-opus-4-0': 'June 15th, 2026',
|
|
1321
|
-
'claude-opus-4-20250514': 'June 15th, 2026',
|
|
1322
|
-
'claude-sonnet-4-0': 'June 15th, 2026',
|
|
1323
|
-
'claude-sonnet-4-20250514': 'June 15th, 2026',
|
|
1324
|
-
'claude-opus-4-1': 'August 5th, 2026',
|
|
1325
|
-
'claude-opus-4-1-20250805': 'August 5th, 2026',
|
|
1326
|
-
'claude-mythos-preview': 'June 30th, 2026',
|
|
1327
|
-
};
|
|
1305
|
+
} = {};
|
|
1328
1306
|
|
|
1329
1307
|
const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6'];
|
|
1330
1308
|
|
|
@@ -1443,12 +1421,28 @@ export type RawMessageStreamEvent =
|
|
|
1443
1421
|
| RawContentBlockStopEvent;
|
|
1444
1422
|
|
|
1445
1423
|
export interface RedactedThinkingBlock {
|
|
1424
|
+
/**
|
|
1425
|
+
* The contents of this redacted thinking block, returned when portions of the
|
|
1426
|
+
* model's thinking were safety-redacted. This field is opaque and encrypted, with
|
|
1427
|
+
* no readable content.
|
|
1428
|
+
*
|
|
1429
|
+
* Pass `redacted_thinking` blocks back to the API unchanged when continuing a
|
|
1430
|
+
* multi-turn conversation.
|
|
1431
|
+
*
|
|
1432
|
+
* See
|
|
1433
|
+
* [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#redacted-thinking-blocks)
|
|
1434
|
+
* for details.
|
|
1435
|
+
*/
|
|
1446
1436
|
data: string;
|
|
1447
1437
|
|
|
1448
1438
|
type: 'redacted_thinking';
|
|
1449
1439
|
}
|
|
1450
1440
|
|
|
1451
1441
|
export interface RedactedThinkingBlockParam {
|
|
1442
|
+
/**
|
|
1443
|
+
* The `data` value of this redacted thinking block, exactly as returned by the API
|
|
1444
|
+
* in a previous response. Opaque and encrypted; pass it back unchanged.
|
|
1445
|
+
*/
|
|
1452
1446
|
data: string;
|
|
1453
1447
|
|
|
1454
1448
|
type: 'redacted_thinking';
|
|
@@ -1583,6 +1577,11 @@ export interface ServerToolUseBlockParam {
|
|
|
1583
1577
|
}
|
|
1584
1578
|
|
|
1585
1579
|
export interface SignatureDelta {
|
|
1580
|
+
/**
|
|
1581
|
+
* The `signature` for this thinking block: an opaque value used to verify that the
|
|
1582
|
+
* block was generated by Claude when it is passed back to the API. Delivered in a
|
|
1583
|
+
* `signature_delta` event just before the block's `content_block_stop` event.
|
|
1584
|
+
*/
|
|
1586
1585
|
signature: string;
|
|
1587
1586
|
|
|
1588
1587
|
type: 'signature_delta';
|
|
@@ -1766,16 +1765,41 @@ export interface TextEditorCodeExecutionViewResultBlockParam {
|
|
|
1766
1765
|
}
|
|
1767
1766
|
|
|
1768
1767
|
export interface ThinkingBlock {
|
|
1768
|
+
/**
|
|
1769
|
+
* A value used to verify that this thinking block was generated by Claude when it
|
|
1770
|
+
* is passed back to the API.
|
|
1771
|
+
*
|
|
1772
|
+
* This is an opaque field and should not be interpreted or parsed. When passing
|
|
1773
|
+
* thinking blocks back to the API (required when using tools with extended
|
|
1774
|
+
* thinking), pass them back exactly as received, with this field intact.
|
|
1775
|
+
*
|
|
1776
|
+
* See
|
|
1777
|
+
* [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
|
|
1778
|
+
* for details.
|
|
1779
|
+
*/
|
|
1769
1780
|
signature: string;
|
|
1770
1781
|
|
|
1782
|
+
/**
|
|
1783
|
+
* The text of Claude's thinking process for this block.
|
|
1784
|
+
*/
|
|
1771
1785
|
thinking: string;
|
|
1772
1786
|
|
|
1773
1787
|
type: 'thinking';
|
|
1774
1788
|
}
|
|
1775
1789
|
|
|
1776
1790
|
export interface ThinkingBlockParam {
|
|
1791
|
+
/**
|
|
1792
|
+
* The `signature` value of this thinking block, exactly as returned by the API in
|
|
1793
|
+
* a previous response. Used to verify that the block was generated by Claude.
|
|
1794
|
+
*
|
|
1795
|
+
* Thinking blocks must be passed back unmodified and in their original order; a
|
|
1796
|
+
* modified block results in a 400 `invalid_request_error`.
|
|
1797
|
+
*/
|
|
1777
1798
|
signature: string;
|
|
1778
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* The `thinking` text of this block as returned by the API.
|
|
1802
|
+
*/
|
|
1779
1803
|
thinking: string;
|
|
1780
1804
|
|
|
1781
1805
|
type: 'thinking';
|
|
@@ -1836,6 +1860,11 @@ export interface ThinkingConfigEnabled {
|
|
|
1836
1860
|
export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive;
|
|
1837
1861
|
|
|
1838
1862
|
export interface ThinkingDelta {
|
|
1863
|
+
/**
|
|
1864
|
+
* The incremental `thinking` text for this content block. Concatenate the
|
|
1865
|
+
* `thinking` values of successive `thinking_delta` events to assemble the block's
|
|
1866
|
+
* full `thinking` value.
|
|
1867
|
+
*/
|
|
1839
1868
|
thinking: string;
|
|
1840
1869
|
|
|
1841
1870
|
type: 'thinking_delta';
|
|
@@ -44,6 +44,20 @@ export function resolvePath(_ctx: AgentToolContext, _p: string): Promise<string>
|
|
|
44
44
|
return nodeOnly('resolvePath');
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* A bash command exceeded its `timeoutMs`. Carries the timeout so a caller can
|
|
49
|
+
* tell it apart from an abort without matching on the message text.
|
|
50
|
+
*/
|
|
51
|
+
export class BashTimeoutError extends AnthropicError {
|
|
52
|
+
readonly timeoutMs: number;
|
|
53
|
+
|
|
54
|
+
constructor(timeoutMs: number) {
|
|
55
|
+
super(`bash command timed out after ${timeoutMs}ms`);
|
|
56
|
+
this.name = 'BashTimeoutError';
|
|
57
|
+
this.timeoutMs = timeoutMs;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
47
61
|
export class BashSession {
|
|
48
62
|
constructor(_dir: string, _env?: NodeJS.ProcessEnv) {
|
|
49
63
|
nodeOnly('BashSession');
|
|
@@ -55,6 +55,20 @@ const GREP_OUTPUT_LIMIT = 100 * 1024;
|
|
|
55
55
|
const GREP_MAX_LINE_LENGTH = 2000;
|
|
56
56
|
const GLOB_RESULT_LIMIT = 200;
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A bash command exceeded its `timeoutMs`. Carries the timeout so a caller can
|
|
60
|
+
* tell it apart from an abort without matching on the message text.
|
|
61
|
+
*/
|
|
62
|
+
export class BashTimeoutError extends AnthropicError {
|
|
63
|
+
readonly timeoutMs: number;
|
|
64
|
+
|
|
65
|
+
constructor(timeoutMs: number) {
|
|
66
|
+
super(`bash command timed out after ${timeoutMs}ms`);
|
|
67
|
+
this.name = 'BashTimeoutError';
|
|
68
|
+
this.timeoutMs = timeoutMs;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
const ANSI_RE = /\x1b\[[0-9;?]*[ -/]*[@-~]/g;
|
|
59
73
|
|
|
60
74
|
// `fs.glob` is Node 22+. `@types/node` may still target an older line, so the
|
|
@@ -271,9 +285,9 @@ export class BashSession {
|
|
|
271
285
|
}
|
|
272
286
|
const timeoutMs = opts.timeoutMs ?? BASH_DEFAULT_TIMEOUT_MS;
|
|
273
287
|
const signal = opts.signal;
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
288
|
+
// Reject with the signal's own reason, so a caller telling a user cancel
|
|
289
|
+
// apart from an `AbortSignal.timeout()` sees the platform's name intact.
|
|
290
|
+
signal?.throwIfAborted();
|
|
277
291
|
this.#buf = '';
|
|
278
292
|
this.#truncated = false;
|
|
279
293
|
// Per-call nonce so a command that prints a fixed marker can't spoof the
|
|
@@ -298,14 +312,11 @@ export class BashSession {
|
|
|
298
312
|
await Promise.race([
|
|
299
313
|
sentinelSeen,
|
|
300
314
|
new Promise<never>((_, reject) => {
|
|
301
|
-
timer = setTimeout(
|
|
302
|
-
() => reject(new AnthropicError(`bash command timed out after ${timeoutMs}ms`)),
|
|
303
|
-
timeoutMs,
|
|
304
|
-
);
|
|
315
|
+
timer = setTimeout(() => reject(new BashTimeoutError(timeoutMs)), timeoutMs);
|
|
305
316
|
}),
|
|
306
317
|
new Promise<never>((_, reject) => {
|
|
307
318
|
if (!signal) return;
|
|
308
|
-
onAbort = () => reject(
|
|
319
|
+
onAbort = () => reject(signal.reason);
|
|
309
320
|
signal.addEventListener('abort', onAbort, { once: true });
|
|
310
321
|
}),
|
|
311
322
|
]);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.116.0'; // x-release-please-version
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* exports are re-exported from the real module (erased at build time), so
|
|
13
13
|
* type-level usage is unaffected.
|
|
14
14
|
*/
|
|
15
|
+
import { AnthropicError } from "../../core/error.mjs";
|
|
15
16
|
import type { Anthropic } from "../../client.mjs";
|
|
16
17
|
import type { BetaRunnableTool } from "../../lib/tools/BetaRunnableTool.mjs";
|
|
17
18
|
import type { AgentToolContext } from "./node.mjs";
|
|
@@ -21,6 +22,14 @@ export declare function resolveSkillVersion(_client: Anthropic, _skillId: string
|
|
|
21
22
|
export declare function extractSkillArchive(_resp: Response, _dest: string): Promise<void>;
|
|
22
23
|
export declare function betaAgentToolset20260401(_ctx: AgentToolContext): BetaRunnableTool[];
|
|
23
24
|
export declare function resolvePath(_ctx: AgentToolContext, _p: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* A bash command exceeded its `timeoutMs`. Carries the timeout so a caller can
|
|
27
|
+
* tell it apart from an abort without matching on the message text.
|
|
28
|
+
*/
|
|
29
|
+
export declare class BashTimeoutError extends AnthropicError {
|
|
30
|
+
readonly timeoutMs: number;
|
|
31
|
+
constructor(timeoutMs: number);
|
|
32
|
+
}
|
|
24
33
|
export declare class BashSession {
|
|
25
34
|
constructor(_dir: string, _env?: NodeJS.ProcessEnv);
|
|
26
35
|
get closed(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.browser.d.mts","sourceRoot":"","sources":["../../src/tools/agent-toolset/node.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"node.browser.d.mts","sourceRoot":"","sources":["../../src/tools/agent-toolset/node.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,6BAAyB;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,6CAAyC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAe;AAE/C,YAAY,EAAE,gBAAgB,EAAE,mBAAe;AAM/C,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAEhF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3G;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAEnF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE/E;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAK9B;AAED,qBAAa,WAAW;gBACV,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,UAAU;IAIlD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,CACF,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;KAAO,GAC1E,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhD,KAAK,IAAI,IAAI;CAGd;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* exports are re-exported from the real module (erased at build time), so
|
|
13
13
|
* type-level usage is unaffected.
|
|
14
14
|
*/
|
|
15
|
+
import { AnthropicError } from "../../core/error.js";
|
|
15
16
|
import type { Anthropic } from "../../client.js";
|
|
16
17
|
import type { BetaRunnableTool } from "../../lib/tools/BetaRunnableTool.js";
|
|
17
18
|
import type { AgentToolContext } from "./node.js";
|
|
@@ -21,6 +22,14 @@ export declare function resolveSkillVersion(_client: Anthropic, _skillId: string
|
|
|
21
22
|
export declare function extractSkillArchive(_resp: Response, _dest: string): Promise<void>;
|
|
22
23
|
export declare function betaAgentToolset20260401(_ctx: AgentToolContext): BetaRunnableTool[];
|
|
23
24
|
export declare function resolvePath(_ctx: AgentToolContext, _p: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* A bash command exceeded its `timeoutMs`. Carries the timeout so a caller can
|
|
27
|
+
* tell it apart from an abort without matching on the message text.
|
|
28
|
+
*/
|
|
29
|
+
export declare class BashTimeoutError extends AnthropicError {
|
|
30
|
+
readonly timeoutMs: number;
|
|
31
|
+
constructor(timeoutMs: number);
|
|
32
|
+
}
|
|
24
33
|
export declare class BashSession {
|
|
25
34
|
constructor(_dir: string, _env?: NodeJS.ProcessEnv);
|
|
26
35
|
get closed(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.browser.d.ts","sourceRoot":"","sources":["../../src/tools/agent-toolset/node.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"node.browser.d.ts","sourceRoot":"","sources":["../../src/tools/agent-toolset/node.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAqB;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,4CAAyC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAe;AAE/C,YAAY,EAAE,gBAAgB,EAAE,kBAAe;AAM/C,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAEhF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3G;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAEnF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE/E;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAK9B;AAED,qBAAa,WAAW;gBACV,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,UAAU;IAIlD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,CACF,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;KAAO,GAC1E,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhD,KAAK,IAAI,IAAI;CAGd;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAErE"}
|