@lucascouts/claude-agent-acp-plus 0.10.0 → 0.11.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/dist/account-usage.d.ts +91 -0
- package/dist/account-usage.d.ts.map +1 -0
- package/dist/account-usage.js +333 -0
- package/dist/acp-agent.d.ts +55 -0
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +160 -16
- package/package.json +8 -8
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account quota transport — the structured `/usage` report mapped into the
|
|
3
|
+
* `_meta["_claude/rateLimit"]` payload shape the installed Zed (patch `0011`,
|
|
4
|
+
* `AccountUsage::ingest`) already ingests.
|
|
5
|
+
*
|
|
6
|
+
* The mapping is deliberately a pure module: no session, no SDK query, no I/O,
|
|
7
|
+
* so the wire shape can be pinned by tests alone. `basename` is its only runtime
|
|
8
|
+
* import, and `node:path` is a string module -- see `accountIdentity` for why that
|
|
9
|
+
* matters and which test holds it to it.
|
|
10
|
+
*/
|
|
11
|
+
import type { SDKControlGetUsageResponse, SDKRateLimitInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
12
|
+
/** Utilization at or above which a derived status becomes `allowed_warning`. 0..1. */
|
|
13
|
+
export declare const WARNING_THRESHOLD = 0.8;
|
|
14
|
+
/** The three values `0011`'s `AccountUsageStatus::from_wire` accepts. */
|
|
15
|
+
export type AccountUsageStatus = "allowed" | "allowed_warning" | "rejected";
|
|
16
|
+
/**
|
|
17
|
+
* One payload in the `_meta["_claude/rateLimit"]` shape `AccountUsage::ingest` reads.
|
|
18
|
+
* Field names are the WIRE names, not the report's snake_case ones.
|
|
19
|
+
*/
|
|
20
|
+
export type AccountQuotaWindow = {
|
|
21
|
+
rateLimitType: string;
|
|
22
|
+
status: AccountUsageStatus;
|
|
23
|
+
/** 0..1, clamped. Omitted when the report carried none. */
|
|
24
|
+
utilization?: number;
|
|
25
|
+
/** Unix seconds. Omitted when the report's ISO instant would not parse. */
|
|
26
|
+
resetsAt?: number;
|
|
27
|
+
/** Server-supplied bucket name; present only on model-scoped windows. */
|
|
28
|
+
displayName?: string;
|
|
29
|
+
/** Emitted as `credits_required` only while a live event measured that state. */
|
|
30
|
+
errorCode?: "credits_required";
|
|
31
|
+
/** Emitted only once a live event has measured it. */
|
|
32
|
+
isUsingOverage?: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** 0..100 -> 0..1, CLAMPED to [0,1]. undefined for null/undefined/non-finite. */
|
|
35
|
+
export declare function normalizeUtilization(value: number | null | undefined): number | undefined;
|
|
36
|
+
/** ISO 8601 -> Unix seconds (floored). undefined for null/undefined/unparseable. */
|
|
37
|
+
export declare function toEpochSeconds(value: string | null | undefined): number | undefined;
|
|
38
|
+
/** Derived status. NEVER `rejected` -- the adapter cannot know a request was refused. */
|
|
39
|
+
export declare function deriveStatus(utilization: number | undefined): "allowed" | "allowed_warning";
|
|
40
|
+
/**
|
|
41
|
+
* `<subscription> · <profile>`, or the profile alone when no subscription type.
|
|
42
|
+
*
|
|
43
|
+
* Both halves are already in hand: the subscription type arrives in the structured
|
|
44
|
+
* usage report (R2.1) and the profile is a string operation on the configuration
|
|
45
|
+
* directory the session was started with (R2.2).
|
|
46
|
+
*
|
|
47
|
+
* NO FILE IS OPENED TO BUILD THIS. The account e-mail is what the VS Code extension
|
|
48
|
+
* shows and it is the more informative label, but it lives in `.credentials.json`, and
|
|
49
|
+
* reading it would carry credential material through `_meta` over ACP and into every
|
|
50
|
+
* log that records a notification (D7, R2.3).
|
|
51
|
+
*
|
|
52
|
+
* The directory arrives as a PARAMETER rather than being read from `CLAUDE_CONFIG_DIR`
|
|
53
|
+
* directly: that constant lives in `acp-agent.ts`, which already imports this module,
|
|
54
|
+
* so importing it back would both close a cycle and cost this module its purity.
|
|
55
|
+
*/
|
|
56
|
+
export declare function accountIdentity(subscriptionType: string | null | undefined, configDir: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Maps structured usage reports to quota-window payloads, remembering a status
|
|
59
|
+
* measured by a live `rate_limit_event` for the life of that window instance, and
|
|
60
|
+
* the account-wide flags such an event carries until another event changes them.
|
|
61
|
+
*/
|
|
62
|
+
export declare class AccountUsageTracker {
|
|
63
|
+
/**
|
|
64
|
+
* The status last measured for each wire `rateLimitType`, for as long as the
|
|
65
|
+
* instance it was measured in lasts.
|
|
66
|
+
*/
|
|
67
|
+
private readonly measured;
|
|
68
|
+
/**
|
|
69
|
+
* What the last live event said about the account as a whole. Empty until one
|
|
70
|
+
* has said anything -- which leaves both keys off every payload, and `ingest`
|
|
71
|
+
* defaulting them to false exactly as it did before this transport existed.
|
|
72
|
+
*/
|
|
73
|
+
private measuredFlags;
|
|
74
|
+
/** Record a status measured by a live rate-limit event (D4 part 2). */
|
|
75
|
+
recordMeasured(info: SDKRateLimitInfo): void;
|
|
76
|
+
/**
|
|
77
|
+
* The status one derived window should carry: its own, unless a status measured for
|
|
78
|
+
* that same instance is more constrained (R1.6).
|
|
79
|
+
*
|
|
80
|
+
* A rollover DELETES the memory rather than merely declining to apply it. Comparing
|
|
81
|
+
* instants alone would let a later report naming the old instant again resurrect a
|
|
82
|
+
* status whose instance has already ended.
|
|
83
|
+
*/
|
|
84
|
+
private statusFor;
|
|
85
|
+
/**
|
|
86
|
+
* Every window the report carries, in wire shape. Empty list when
|
|
87
|
+
* `rate_limits_available` is false or `rate_limits` is null.
|
|
88
|
+
*/
|
|
89
|
+
windowsFrom(report: SDKControlGetUsageResponse): AccountQuotaWindow[];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=account-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-usage.d.ts","sourceRoot":"","sources":["../src/account-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEnG,sFAAsF;AACtF,eAAO,MAAM,iB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;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,0BAA0B,GAAG,kBAAkB,EAAE;CAyCtE"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account quota transport — the structured `/usage` report mapped into the
|
|
3
|
+
* `_meta["_claude/rateLimit"]` payload shape the installed Zed (patch `0011`,
|
|
4
|
+
* `AccountUsage::ingest`) already ingests.
|
|
5
|
+
*
|
|
6
|
+
* The mapping is deliberately a pure module: no session, no SDK query, no I/O,
|
|
7
|
+
* so the wire shape can be pinned by tests alone. `basename` is its only runtime
|
|
8
|
+
* import, and `node:path` is a string module -- see `accountIdentity` for why that
|
|
9
|
+
* matters and which test holds it to it.
|
|
10
|
+
*/
|
|
11
|
+
import { basename } from "node:path";
|
|
12
|
+
/** Utilization at or above which a derived status becomes `allowed_warning`. 0..1. */
|
|
13
|
+
export const WARNING_THRESHOLD = 0.8;
|
|
14
|
+
/**
|
|
15
|
+
* The one `errorCode` `0011` acts on -- it raises the "usage credits required"
|
|
16
|
+
* warning. `satisfies` rather than a bare literal so the constant and the wire
|
|
17
|
+
* type above cannot drift apart, and a plain literal in the type above rather
|
|
18
|
+
* than a `typeof` query so this module-private name stays out of the published
|
|
19
|
+
* declarations.
|
|
20
|
+
*/
|
|
21
|
+
const CREDITS_REQUIRED = "credits_required";
|
|
22
|
+
/** The report states a utilization as a percentage; the wire carries a fraction. */
|
|
23
|
+
const PERCENT = 100;
|
|
24
|
+
/** The bounds of the 0..1 scale R1.9 names -- an empty bar and a full one. */
|
|
25
|
+
const UTILIZATION_FLOOR = 0;
|
|
26
|
+
const UTILIZATION_CEILING = 1;
|
|
27
|
+
/** Milliseconds per second: `Date.parse` answers in the former, the wire reads the latter. */
|
|
28
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
29
|
+
/**
|
|
30
|
+
* The plan windows, emitted in the order the report declares them.
|
|
31
|
+
*
|
|
32
|
+
* `seven_day_oauth_apps` has no kind in `0011`'s `from_wire` and is dropped by the
|
|
33
|
+
* client today; it is emitted anyway, for the same reason `model_scoped` is — the
|
|
34
|
+
* adapter's job is to carry what the report said, not to predict which client
|
|
35
|
+
* version is listening.
|
|
36
|
+
*/
|
|
37
|
+
const PLAN_WINDOW_FIELDS = [
|
|
38
|
+
"five_hour",
|
|
39
|
+
"seven_day",
|
|
40
|
+
"seven_day_oauth_apps",
|
|
41
|
+
"seven_day_opus",
|
|
42
|
+
"seven_day_sonnet",
|
|
43
|
+
];
|
|
44
|
+
/** 0..100 -> 0..1, CLAMPED to [0,1]. undefined for null/undefined/non-finite. */
|
|
45
|
+
export function normalizeUtilization(value) {
|
|
46
|
+
// The client normalises defensively with `if v > 1.0 { v / 100.0 }`, so a window
|
|
47
|
+
// at 1% passed through as `1` would fail that test and render as a FULL bar.
|
|
48
|
+
// Dividing here is what keeps 1% and 100% two different numbers (D2, R1.9).
|
|
49
|
+
//
|
|
50
|
+
// CLAMPING here is what keeps the two normalisations from COMPOSING badly above
|
|
51
|
+
// 100: a report of `137` divided once is `1.37`, which passes the client's
|
|
52
|
+
// `> 1.0` test, is divided a second time, and draws a saturated window as a 1%
|
|
53
|
+
// bar -- beside a row `deriveStatus` still coloured as a warning. Clamped, no
|
|
54
|
+
// value we emit can exceed 1.0, so that heuristic can never fire and is a no-op
|
|
55
|
+
// on every input. R1.9 asks for the 0..1 scale, and `1.37` is not on it.
|
|
56
|
+
//
|
|
57
|
+
// The lower bound is the same argument mirrored: a negative percentage is off
|
|
58
|
+
// the scale too, and `0` is the honest floor for it.
|
|
59
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return Math.min(Math.max(value / PERCENT, UTILIZATION_FLOOR), UTILIZATION_CEILING);
|
|
63
|
+
}
|
|
64
|
+
/** ISO 8601 -> Unix seconds (floored). undefined for null/undefined/unparseable. */
|
|
65
|
+
export function toEpochSeconds(value) {
|
|
66
|
+
// `0011` reads `resetsAt` with `as_i64()`: a string is dropped silently, taking
|
|
67
|
+
// the reset time with it. Omitting the field is the honest failure (R1.10).
|
|
68
|
+
if (typeof value !== "string") {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const milliseconds = Date.parse(value);
|
|
72
|
+
if (!Number.isFinite(milliseconds)) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return Math.floor(milliseconds / MILLISECONDS_PER_SECOND);
|
|
76
|
+
}
|
|
77
|
+
/** Derived status. NEVER `rejected` -- the adapter cannot know a request was refused. */
|
|
78
|
+
export function deriveStatus(utilization) {
|
|
79
|
+
return utilization !== undefined && utilization >= WARNING_THRESHOLD
|
|
80
|
+
? "allowed_warning"
|
|
81
|
+
: "allowed";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* How constrained each status is: `allowed` < `allowed_warning` < `rejected`.
|
|
85
|
+
*
|
|
86
|
+
* The order `0011`'s `most_constrained()` ranks by -- and it ranks by status BEFORE
|
|
87
|
+
* utilization, so a status wrong by one step reorders the panel more than a
|
|
88
|
+
* utilization wrong by half a bar.
|
|
89
|
+
*/
|
|
90
|
+
const CONSTRAINT_ORDER = {
|
|
91
|
+
allowed: 0,
|
|
92
|
+
allowed_warning: 1,
|
|
93
|
+
rejected: 2,
|
|
94
|
+
};
|
|
95
|
+
/** Whether a value is one of the three statuses `0011`'s `from_wire` accepts. */
|
|
96
|
+
function isAccountUsageStatus(value) {
|
|
97
|
+
return typeof value === "string" && Object.hasOwn(CONSTRAINT_ORDER, value);
|
|
98
|
+
}
|
|
99
|
+
/** The stricter of two statuses; the first when they are equal. */
|
|
100
|
+
function moreConstrained(a, b) {
|
|
101
|
+
return CONSTRAINT_ORDER[a] >= CONSTRAINT_ORDER[b] ? a : b;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Whether a live event says overage is in use, or undefined when it says nothing.
|
|
105
|
+
*
|
|
106
|
+
* Both spellings are read, in the client's own order -- `ingest` takes
|
|
107
|
+
* `isUsingOverage` and falls back to `overageInUse`, and the SDK declares the two
|
|
108
|
+
* as separate optional fields. Anything that is not a boolean is no measurement at
|
|
109
|
+
* all, so it falls through rather than becoming a `false` nobody reported.
|
|
110
|
+
*/
|
|
111
|
+
function measuredOverage(info) {
|
|
112
|
+
if (typeof info.isUsingOverage === "boolean") {
|
|
113
|
+
return info.isUsingOverage;
|
|
114
|
+
}
|
|
115
|
+
if (typeof info.overageInUse === "boolean") {
|
|
116
|
+
return info.overageInUse;
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The account-wide flags one live event measured; empty when it measured neither.
|
|
122
|
+
*
|
|
123
|
+
* `errorCode` is compared against the one value `0011` acts on rather than copied:
|
|
124
|
+
* the field is declared with a single member, so any other string is a state this
|
|
125
|
+
* client has no rendering for, and forwarding it would only widen the wire.
|
|
126
|
+
*/
|
|
127
|
+
function measuredFlagsOf(info) {
|
|
128
|
+
const isUsingOverage = measuredOverage(info);
|
|
129
|
+
return {
|
|
130
|
+
...(info.errorCode === CREDITS_REQUIRED && { errorCode: CREDITS_REQUIRED }),
|
|
131
|
+
...(isUsingOverage !== undefined && { isUsingOverage }),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** The default configuration directory's own name -- where it lives, not what it is called. */
|
|
135
|
+
const DEFAULT_CONFIG_DIR_NAME = ".claude";
|
|
136
|
+
/** What the default profile is labelled, in place of the directory name above. */
|
|
137
|
+
const DEFAULT_PROFILE_NAME = "default";
|
|
138
|
+
/** Between the two halves of an identity: U+00B7 MIDDLE DOT, spaced. */
|
|
139
|
+
const IDENTITY_SEPARATOR = " \u00b7 ";
|
|
140
|
+
/**
|
|
141
|
+
* The profile a configuration directory names: its basename, with the default
|
|
142
|
+
* directory reported as `default` rather than as the `.claude` it happens to be
|
|
143
|
+
* stored in (D7, R2.2). Empty string when the directory names no profile.
|
|
144
|
+
*
|
|
145
|
+
* `basename` rather than a hand-rolled split: it is a pure string function, it drops
|
|
146
|
+
* a trailing separator, and it reads the platform's own separator -- which a split on
|
|
147
|
+
* `/` would not. It is also what built the directory in the first place
|
|
148
|
+
* (`acp-agent.ts`'s `CLAUDE_CONFIG_DIR`), so the two agree by construction.
|
|
149
|
+
*
|
|
150
|
+
* The empty cases are reachable, not theoretical: `CLAUDE_CONFIG_DIR` is an env var,
|
|
151
|
+
* and `??` does not catch a variable that is SET BUT EMPTY. `basename("")` and
|
|
152
|
+
* `basename("/")` are both `""`, and an empty profile costs that half of the identity
|
|
153
|
+
* rather than throwing.
|
|
154
|
+
*/
|
|
155
|
+
function profileName(configDir) {
|
|
156
|
+
// Trimming a LABEL, never a path: nothing here is opened, so whitespace around the
|
|
157
|
+
// name is noise in the panel and nothing else. Trimmed before the comparison so a
|
|
158
|
+
// stray trailing space in the env var still resolves to the default profile.
|
|
159
|
+
const profile = basename(configDir).trim();
|
|
160
|
+
return profile === DEFAULT_CONFIG_DIR_NAME ? DEFAULT_PROFILE_NAME : profile;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* `<subscription> · <profile>`, or the profile alone when no subscription type.
|
|
164
|
+
*
|
|
165
|
+
* Both halves are already in hand: the subscription type arrives in the structured
|
|
166
|
+
* usage report (R2.1) and the profile is a string operation on the configuration
|
|
167
|
+
* directory the session was started with (R2.2).
|
|
168
|
+
*
|
|
169
|
+
* NO FILE IS OPENED TO BUILD THIS. The account e-mail is what the VS Code extension
|
|
170
|
+
* shows and it is the more informative label, but it lives in `.credentials.json`, and
|
|
171
|
+
* reading it would carry credential material through `_meta` over ACP and into every
|
|
172
|
+
* log that records a notification (D7, R2.3).
|
|
173
|
+
*
|
|
174
|
+
* The directory arrives as a PARAMETER rather than being read from `CLAUDE_CONFIG_DIR`
|
|
175
|
+
* directly: that constant lives in `acp-agent.ts`, which already imports this module,
|
|
176
|
+
* so importing it back would both close a cycle and cost this module its purity.
|
|
177
|
+
*/
|
|
178
|
+
export function accountIdentity(subscriptionType, configDir) {
|
|
179
|
+
// `subscription_type` is `string | null` on an API whose own doc comment says the
|
|
180
|
+
// shape may change, so it is read as it arrives rather than as it is declared.
|
|
181
|
+
const subscription = typeof subscriptionType === "string" ? subscriptionType.trim() : "";
|
|
182
|
+
const profile = profileName(configDir);
|
|
183
|
+
// R2.4: an API-key, Bedrock or Vertex session carries no subscription type, and the
|
|
184
|
+
// identity then degrades to the profile alone rather than disappearing. Joining only
|
|
185
|
+
// the halves that exist covers the other side of that -- an unnameable profile -- with
|
|
186
|
+
// the same line, and leaves an empty identity as the only answer when neither half is
|
|
187
|
+
// available, which is the honest one.
|
|
188
|
+
return [subscription, profile].filter((half) => half.length > 0).join(IDENTITY_SEPARATOR);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* One report entry as one wire payload, or undefined when the report carried no
|
|
192
|
+
* entry for that window.
|
|
193
|
+
*
|
|
194
|
+
* A window whose `utilization` is null is still emitted with the field omitted:
|
|
195
|
+
* R1.4 asks for the utilization *when the report supplies one*, and `0011` renders
|
|
196
|
+
* an absent utilization as an em dash, where a zero would claim the window is
|
|
197
|
+
* untouched rather than unmeasured.
|
|
198
|
+
*/
|
|
199
|
+
function toQuotaWindow(rateLimitType, entry) {
|
|
200
|
+
if (entry === null || entry === undefined) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const utilization = normalizeUtilization(entry.utilization);
|
|
204
|
+
const resetsAt = toEpochSeconds(entry.resets_at);
|
|
205
|
+
const displayName = typeof entry.display_name === "string" ? entry.display_name : undefined;
|
|
206
|
+
return {
|
|
207
|
+
rateLimitType,
|
|
208
|
+
status: deriveStatus(utilization),
|
|
209
|
+
...(utilization !== undefined && { utilization }),
|
|
210
|
+
...(resetsAt !== undefined && { resetsAt }),
|
|
211
|
+
...(displayName !== undefined && { displayName }),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Maps structured usage reports to quota-window payloads, remembering a status
|
|
216
|
+
* measured by a live `rate_limit_event` for the life of that window instance, and
|
|
217
|
+
* the account-wide flags such an event carries until another event changes them.
|
|
218
|
+
*/
|
|
219
|
+
export class AccountUsageTracker {
|
|
220
|
+
/**
|
|
221
|
+
* The status last measured for each wire `rateLimitType`, for as long as the
|
|
222
|
+
* instance it was measured in lasts.
|
|
223
|
+
*/
|
|
224
|
+
measured = new Map();
|
|
225
|
+
/**
|
|
226
|
+
* What the last live event said about the account as a whole. Empty until one
|
|
227
|
+
* has said anything -- which leaves both keys off every payload, and `ingest`
|
|
228
|
+
* defaulting them to false exactly as it did before this transport existed.
|
|
229
|
+
*/
|
|
230
|
+
measuredFlags = {};
|
|
231
|
+
/** Record a status measured by a live rate-limit event (D4 part 2). */
|
|
232
|
+
recordMeasured(info) {
|
|
233
|
+
// Read BEFORE the guard below, mirroring `ingest`, which reads the same two
|
|
234
|
+
// flags before its own `rateLimitType` guard: an event that names no window
|
|
235
|
+
// still carries the account-wide state, and an event whose kind this client
|
|
236
|
+
// drops is exactly the kind that announces one.
|
|
237
|
+
//
|
|
238
|
+
// Overwritten WHOLESALE, because a live event is the only thing that may
|
|
239
|
+
// clear these. An event carrying no `errorCode` clears `credits_required`
|
|
240
|
+
// here exactly as it would have on ingest; `windowsFrom` re-asserts what was
|
|
241
|
+
// last measured and never clears on its own.
|
|
242
|
+
this.measuredFlags = measuredFlagsOf(info);
|
|
243
|
+
const { rateLimitType, resetsAt, status } = info;
|
|
244
|
+
// All three are read as they arrive, so none may be assumed well formed:
|
|
245
|
+
// `rateLimitType` and `resetsAt` are optional on the wire, and `status` is only
|
|
246
|
+
// required by a declaration, not by the sender. Without the kind there is no
|
|
247
|
+
// window to attach the status to; without the reset instant there is no instance
|
|
248
|
+
// to scope it to (R1.6.1); a status `0011` would not parse costs the whole window
|
|
249
|
+
// on ingest. Any of the three missing means no memory, and the derived status
|
|
250
|
+
// then stands -- which is the honest answer, not a degraded one.
|
|
251
|
+
if (typeof rateLimitType !== "string" ||
|
|
252
|
+
typeof resetsAt !== "number" ||
|
|
253
|
+
!Number.isFinite(resetsAt) ||
|
|
254
|
+
!isAccountUsageStatus(status)) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this.measured.set(rateLimitType, { status, resetsAt });
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The status one derived window should carry: its own, unless a status measured for
|
|
261
|
+
* that same instance is more constrained (R1.6).
|
|
262
|
+
*
|
|
263
|
+
* A rollover DELETES the memory rather than merely declining to apply it. Comparing
|
|
264
|
+
* instants alone would let a later report naming the old instant again resurrect a
|
|
265
|
+
* status whose instance has already ended.
|
|
266
|
+
*/
|
|
267
|
+
statusFor(window) {
|
|
268
|
+
// What the window carries at this point is the DERIVED status; naming it says so.
|
|
269
|
+
const derived = window.status;
|
|
270
|
+
const instant = window.resetsAt;
|
|
271
|
+
const remembered = this.measured.get(window.rateLimitType);
|
|
272
|
+
if (remembered === undefined || instant === undefined) {
|
|
273
|
+
return derived;
|
|
274
|
+
}
|
|
275
|
+
if (instant > remembered.resetsAt) {
|
|
276
|
+
this.measured.delete(window.rateLimitType);
|
|
277
|
+
return derived;
|
|
278
|
+
}
|
|
279
|
+
// An EARLIER instant is a report from before the measurement, not a new instance:
|
|
280
|
+
// it neither matches the remembered one nor ends it, so the memory is kept for the
|
|
281
|
+
// report that does match.
|
|
282
|
+
if (instant < remembered.resetsAt) {
|
|
283
|
+
return derived;
|
|
284
|
+
}
|
|
285
|
+
// R1.6 forbids reporting LESS constrained than measured -- it does not license
|
|
286
|
+
// softening a window that has since crossed the warning threshold back down to an
|
|
287
|
+
// `allowed` measured earlier in the same instance.
|
|
288
|
+
return moreConstrained(derived, remembered.status);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Every window the report carries, in wire shape. Empty list when
|
|
292
|
+
* `rate_limits_available` is false or `rate_limits` is null.
|
|
293
|
+
*/
|
|
294
|
+
windowsFrom(report) {
|
|
295
|
+
// R1.5: the flag governs, not the presence of data. A report can carry a
|
|
296
|
+
// populated `rate_limits` while declaring the limits inapplicable, and a
|
|
297
|
+
// section of bars then states the account is unused rather than unmeasured.
|
|
298
|
+
if (!report.rate_limits_available) {
|
|
299
|
+
return [];
|
|
300
|
+
}
|
|
301
|
+
const limits = report.rate_limits;
|
|
302
|
+
if (limits === null || limits === undefined) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
const sources = PLAN_WINDOW_FIELDS.map((field) => [field, limits[field]]);
|
|
306
|
+
// Every model-scoped entry, kept as its own payload: they share one
|
|
307
|
+
// `rateLimitType`, so the display name and the number are the only things
|
|
308
|
+
// telling two of them apart (R1.11).
|
|
309
|
+
for (const entry of limits.model_scoped ?? []) {
|
|
310
|
+
sources.push(["model_scoped", entry]);
|
|
311
|
+
}
|
|
312
|
+
// `extra_usage` is a quota window only once overage is switched on; disabled,
|
|
313
|
+
// its numbers describe a limit nobody is spending against. It carries no
|
|
314
|
+
// reset instant, so the emitted window has no `resetsAt`.
|
|
315
|
+
const extraUsage = limits.extra_usage;
|
|
316
|
+
if (extraUsage?.is_enabled === true) {
|
|
317
|
+
sources.push(["overage", extraUsage]);
|
|
318
|
+
}
|
|
319
|
+
const windows = [];
|
|
320
|
+
for (const [rateLimitType, entry] of sources) {
|
|
321
|
+
const window = toQuotaWindow(rateLimitType, entry);
|
|
322
|
+
if (window !== undefined) {
|
|
323
|
+
window.status = this.statusFor(window);
|
|
324
|
+
// The flags ride EVERY window: they describe the account, and `ingest`
|
|
325
|
+
// reads them off whichever payload it is handed. Repeating them is
|
|
326
|
+
// idempotent -- `ingest` compares before assigning, so only the first
|
|
327
|
+
// payload of a report can report a change.
|
|
328
|
+
windows.push({ ...window, ...this.measuredFlags });
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return windows;
|
|
332
|
+
}
|
|
333
|
+
}
|
package/dist/acp-agent.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { type SessionFailureState } from "./session-failure-extension.js";
|
|
|
9
9
|
import { type FileChangeAuditSupport, type FileChangeAuditTurnState } from "./file-change-audit.js";
|
|
10
10
|
import { TaskState } from "./tools.js";
|
|
11
11
|
import { Pushable } from "./utils.js";
|
|
12
|
+
import { AccountUsageTracker } from "./account-usage.js";
|
|
12
13
|
export { DEFAULT_AGENT_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
|
13
14
|
import { MODE_CONFIG_ID } from "./session-mode.js";
|
|
14
15
|
export declare const CLAUDE_CONFIG_DIR: string;
|
|
@@ -374,7 +375,39 @@ export type Session = {
|
|
|
374
375
|
* fresh session it stalls until the first turn runs (see the seeding call
|
|
375
376
|
* sites and `contextWindowCache`). */
|
|
376
377
|
contextWindowSize: number;
|
|
378
|
+
/** Context-window occupancy last reported for this session, in tokens — the
|
|
379
|
+
* `used` half of every `usage_update`. `undefined` means nothing has been
|
|
380
|
+
* READ yet, which is a different statement from a measured zero and is
|
|
381
|
+
* treated as one: the permission request's `contextUsedPercent` omits the
|
|
382
|
+
* figure entirely rather than showing 0%.
|
|
383
|
+
*
|
|
384
|
+
* Written by the turn itself (each top-level assistant message's usage, and
|
|
385
|
+
* the compact boundary's `getContextUsage`), and seeded once at session
|
|
386
|
+
* creation on session/load — never on session/new — from the resumed
|
|
387
|
+
* session's own `getContextUsage` report, the same response
|
|
388
|
+
* `getAvailableModels` already awaits to learn the live model, so no extra
|
|
389
|
+
* IPC (see `readResumedLiveModel`). Without that seed a thread reloaded
|
|
390
|
+
* with real context reported `used: 0` until its first turn ended, and the
|
|
391
|
+
* client renders that as an empty ring rather than as "unknown": its
|
|
392
|
+
* `UsageUpdate` arm assigns `used`/`size` unconditionally and creates the
|
|
393
|
+
* token-usage record where there was none. A fresh session really has used
|
|
394
|
+
* nothing, so `publishAccountUsage` reporting its `undefined` as 0 is not
|
|
395
|
+
* the same defect and stays as it is. */
|
|
377
396
|
contextUsedTokens?: number;
|
|
397
|
+
/** Maps this session's structured `/usage` reports onto the quota-window
|
|
398
|
+
* payloads the client ingests, and remembers the status a live
|
|
399
|
+
* `rate_limit_event` MEASURED for as long as that window instance lasts
|
|
400
|
+
* (see {@link AccountUsageTracker}).
|
|
401
|
+
*
|
|
402
|
+
* Session-scoped on purpose, and in both directions: the memory has to
|
|
403
|
+
* outlive a turn (a five-hour window measured on turn one still governs
|
|
404
|
+
* turn nine) and must never outlive the session (it is per-account state,
|
|
405
|
+
* and two sessions can run against different accounts). Living on the
|
|
406
|
+
* Session gives it exactly that lifetime — a consumer local would lose it
|
|
407
|
+
* on the lazy Thinking recreate, which starts a fresh consumer mid-session.
|
|
408
|
+
* Always set by `createSession`; optional only because tests hand-build
|
|
409
|
+
* Session objects, so the accessor creates it on demand. */
|
|
410
|
+
accountUsage?: AccountUsageTracker;
|
|
378
411
|
/** Whether `contextWindowSize` came from an authoritative source (the
|
|
379
412
|
* cross-session cache, a resumed session's `getContextUsage` report, or a
|
|
380
413
|
* `result.modelUsage`) rather than the text heuristic / default. Guards the
|
|
@@ -769,6 +802,28 @@ export declare class ClaudeAcpAgent {
|
|
|
769
802
|
goal(params: GoalRequest): Promise<GoalControlResponse>;
|
|
770
803
|
private publishGoal;
|
|
771
804
|
private publishTaskPlan;
|
|
805
|
+
/** This session's quota-window mapper, created on first use (see
|
|
806
|
+
* {@link Session.accountUsage} for why it lives on the Session). */
|
|
807
|
+
private accountUsageTracker;
|
|
808
|
+
/**
|
|
809
|
+
* Ask the SDK for the structured `/usage` report and forward every quota
|
|
810
|
+
* window it carries to the client (R1.1 at session establishment, R1.2 at the
|
|
811
|
+
* end of each turn).
|
|
812
|
+
*
|
|
813
|
+
* ONE notification per window, never one aggregate: the client's
|
|
814
|
+
* `AccountUsage::ingest` reads a single `rateLimitType` per payload and merges
|
|
815
|
+
* by kind, so it is the sequence that accumulates into a full panel.
|
|
816
|
+
*
|
|
817
|
+
* Total by construction (R1.7). The report rides an SDK method whose own
|
|
818
|
+
* declaration says it "may change or be removed in any release without
|
|
819
|
+
* notice", so a rejection, a method that no longer exists, a response shaped
|
|
820
|
+
* differently than declared, or a client channel that has gone away must all
|
|
821
|
+
* cost the windows and nothing else — never the session. The failure is
|
|
822
|
+
* logged (which window kinds went unreported is not knowable, so the log says
|
|
823
|
+
* only that the request failed and why) and the previously reported windows
|
|
824
|
+
* are left standing, because nothing was sent.
|
|
825
|
+
*/
|
|
826
|
+
private publishAccountUsage;
|
|
772
827
|
private publishGoalFromPrompt;
|
|
773
828
|
private publishRuntimeGoal;
|
|
774
829
|
/** Steer the session per the ACP steering wire protocol: inject a follow-up
|
package/dist/acp-agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EAEd,mBAAmB,EACnB,oBAAoB,EAEpB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EAGV,sBAAsB,EACtB,aAAa,EAIb,SAAS,EAIT,OAAO,EACP,cAAc,E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,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;CAC7C,GACA,mBAAmB,EAAE,CAgIvB;AAED;;;;;;;;;;;oEAWoE;AACpE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,EAC3D,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED,wBAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM;;;EAgDrC"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -28,6 +28,7 @@ import { nodeToWebReadable, nodeToWebWritable, Pushable, unreachable } from "./u
|
|
|
28
28
|
import { acceptedPlanToolResult, ExitPlanCoordinator, executionDiagnostic, exitPlanModeRawOutput, observeExitPlanToolResults, } from "./exit-plan.js";
|
|
29
29
|
import { DEFAULT_AGENT_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
|
30
30
|
import { parseToolResultMeta } from "./tool-result-meta.js";
|
|
31
|
+
import { AccountUsageTracker } from "./account-usage.js";
|
|
31
32
|
export { DEFAULT_AGENT_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
|
32
33
|
import { MODE_CONFIG_ID, SessionModeManager } from "./session-mode.js";
|
|
33
34
|
export const CLAUDE_CONFIG_DIR = process.env.CLAUDE_CONFIG_DIR ?? path.join(os.homedir(), ".claude");
|
|
@@ -1074,6 +1075,72 @@ export class ClaudeAcpAgent {
|
|
|
1074
1075
|
},
|
|
1075
1076
|
});
|
|
1076
1077
|
}
|
|
1078
|
+
/** This session's quota-window mapper, created on first use (see
|
|
1079
|
+
* {@link Session.accountUsage} for why it lives on the Session). */
|
|
1080
|
+
accountUsageTracker(session) {
|
|
1081
|
+
return (session.accountUsage ??= new AccountUsageTracker());
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Ask the SDK for the structured `/usage` report and forward every quota
|
|
1085
|
+
* window it carries to the client (R1.1 at session establishment, R1.2 at the
|
|
1086
|
+
* end of each turn).
|
|
1087
|
+
*
|
|
1088
|
+
* ONE notification per window, never one aggregate: the client's
|
|
1089
|
+
* `AccountUsage::ingest` reads a single `rateLimitType` per payload and merges
|
|
1090
|
+
* by kind, so it is the sequence that accumulates into a full panel.
|
|
1091
|
+
*
|
|
1092
|
+
* Total by construction (R1.7). The report rides an SDK method whose own
|
|
1093
|
+
* declaration says it "may change or be removed in any release without
|
|
1094
|
+
* notice", so a rejection, a method that no longer exists, a response shaped
|
|
1095
|
+
* differently than declared, or a client channel that has gone away must all
|
|
1096
|
+
* cost the windows and nothing else — never the session. The failure is
|
|
1097
|
+
* logged (which window kinds went unreported is not knowable, so the log says
|
|
1098
|
+
* only that the request failed and why) and the previously reported windows
|
|
1099
|
+
* are left standing, because nothing was sent.
|
|
1100
|
+
*/
|
|
1101
|
+
async publishAccountUsage(sessionId, session) {
|
|
1102
|
+
try {
|
|
1103
|
+
// Not `getUsage`: this awful spelling is the only name the real `Query`
|
|
1104
|
+
// answers to, and it is written out here rather than hidden behind a
|
|
1105
|
+
// helper so a rename lands as one named failure in the log below, not as
|
|
1106
|
+
// a quiet degradation to no report at all.
|
|
1107
|
+
const report = await session.query.usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET();
|
|
1108
|
+
// The session can be torn down or recreated while the request is in
|
|
1109
|
+
// flight (provider switch, a changed cwd on session/load). A successor
|
|
1110
|
+
// must not inherit its predecessor's windows.
|
|
1111
|
+
if (this.sessions[sessionId] !== session) {
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
// `usage_update` is the only carrier ACP gives this `_meta`, and it
|
|
1115
|
+
// requires both numbers. `contextUsedTokens` is the session-scoped mirror
|
|
1116
|
+
// of the consumer's `lastAssistantTotalUsage`, so at the end of a turn
|
|
1117
|
+
// this is the same occupancy the turn's own usage_update reported. At
|
|
1118
|
+
// session establishment nothing has been measured yet and 0 says exactly
|
|
1119
|
+
// that — the consumer's `!== null` guard would instead emit NOTHING, at
|
|
1120
|
+
// precisely the border R1.1 exists for.
|
|
1121
|
+
//
|
|
1122
|
+
// Snapshotted once, outside the loop: every window below comes from ONE
|
|
1123
|
+
// report, and each `sessionUpdate` yields to the event loop, where the
|
|
1124
|
+
// consumer can advance both fields. Reading them per window would let a
|
|
1125
|
+
// single report's bars disagree about the context they were measured in.
|
|
1126
|
+
const used = session.contextUsedTokens ?? 0;
|
|
1127
|
+
const size = session.contextWindowSize;
|
|
1128
|
+
for (const window of this.accountUsageTracker(session).windowsFrom(report)) {
|
|
1129
|
+
await this.client.sessionUpdate({
|
|
1130
|
+
sessionId,
|
|
1131
|
+
update: {
|
|
1132
|
+
sessionUpdate: "usage_update",
|
|
1133
|
+
used,
|
|
1134
|
+
size,
|
|
1135
|
+
_meta: { "_claude/rateLimit": window },
|
|
1136
|
+
},
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
catch (error) {
|
|
1141
|
+
this.logger.error(`Session ${sessionId}: structured usage report unavailable: ${error}`);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1077
1144
|
async publishGoalFromPrompt(sessionId, prompt, commandUuid) {
|
|
1078
1145
|
const goalUpdate = goalUpdateFromPrompt(prompt);
|
|
1079
1146
|
if (goalUpdate !== undefined) {
|
|
@@ -2955,6 +3022,21 @@ export class ClaudeAcpAgent {
|
|
|
2955
3022
|
finally {
|
|
2956
3023
|
if (!isAutonomousResult) {
|
|
2957
3024
|
session.emittedAssistantText = false;
|
|
3025
|
+
// R1.2: a user turn's terminal result is the moment consumption
|
|
3026
|
+
// actually changed, so refresh the account quota windows here —
|
|
3027
|
+
// in the `finally`, which is the one point EVERY exit from this
|
|
3028
|
+
// case passes through (refusal, cancellation, a failed turn,
|
|
3029
|
+
// the plain success), so no lane ends a turn without asking.
|
|
3030
|
+
// Autonomous cycles are excluded by the same gate that guards
|
|
3031
|
+
// the flag above: they are background work alongside a turn,
|
|
3032
|
+
// not a turn ending, and would spend one request each.
|
|
3033
|
+
//
|
|
3034
|
+
// Awaited, not fired and forgotten: the turn has already
|
|
3035
|
+
// settled a few lines above, so the client is not kept waiting
|
|
3036
|
+
// on this round-trip — only the consumer's own progression to
|
|
3037
|
+
// the trailing idle is, and a stalled control request there is
|
|
3038
|
+
// the same exposure `fetchContextUsedTokens` already accepts.
|
|
3039
|
+
await this.publishAccountUsage(params.sessionId, session);
|
|
2958
3040
|
}
|
|
2959
3041
|
}
|
|
2960
3042
|
break;
|
|
@@ -3413,6 +3495,20 @@ export class ClaudeAcpAgent {
|
|
|
3413
3495
|
break;
|
|
3414
3496
|
}
|
|
3415
3497
|
case "rate_limit_event": {
|
|
3498
|
+
// A live event is the ONLY source of a MEASURED status — the report
|
|
3499
|
+
// read at the two borders can derive `allowed`/`allowed_warning`
|
|
3500
|
+
// from a utilization, but never `rejected`, which means "a request
|
|
3501
|
+
// was actually refused". Remember it so the derived windows that
|
|
3502
|
+
// follow cannot report the same window instance as less
|
|
3503
|
+
// constrained than it was measured (R1.6).
|
|
3504
|
+
//
|
|
3505
|
+
// Recorded OUTSIDE the emission guard below, and before it: the
|
|
3506
|
+
// memory is fed by the event itself, not by our ability to forward
|
|
3507
|
+
// it, and before the first assistant message of a session that
|
|
3508
|
+
// guard is false. The forwarding itself is untouched (R1.8) — it
|
|
3509
|
+
// still sends `rate_limit_info` verbatim, still on the same
|
|
3510
|
+
// notification shape, still only when a context total exists.
|
|
3511
|
+
this.accountUsageTracker(session).recordMeasured(message.rate_limit_info);
|
|
3416
3512
|
if (lastAssistantTotalUsage !== null) {
|
|
3417
3513
|
await sendUpdate({
|
|
3418
3514
|
sessionId: message.session_id,
|
|
@@ -5326,7 +5422,7 @@ export class ClaudeAcpAgent {
|
|
|
5326
5422
|
const allowedModels = Array.isArray(settingsAvailableModels)
|
|
5327
5423
|
? applyAvailableModelsAllowlist(initializationResult.models, settingsAvailableModels, settingsModelOverrides, this.logger)
|
|
5328
5424
|
: hideDeprecatedModels(initializationResult.models, this.logger);
|
|
5329
|
-
const { modelState: models, resumedContextWindow } = await getAvailableModels(q, catalogModels, allowedModels, initializationResult.models, settingsManager, this.logger, creationOpts.resume !== undefined);
|
|
5425
|
+
const { modelState: models, resumedContextWindow, resumedContextUsedTokens, } = await getAvailableModels(q, catalogModels, allowedModels, initializationResult.models, settingsManager, this.logger, creationOpts.resume !== undefined);
|
|
5330
5426
|
// Resolve the current model's capabilities separately from the stable
|
|
5331
5427
|
// permission-mode catalog advertised to ACP clients.
|
|
5332
5428
|
// Looked up in the UNfiltered catalog: a session honoring a persisted
|
|
@@ -5431,14 +5527,16 @@ export class ClaudeAcpAgent {
|
|
|
5431
5527
|
// On session/load, the resumed session's own `getContextUsage` report — a
|
|
5432
5528
|
// response `getAvailableModels` already awaited to learn the live model
|
|
5433
5529
|
// (resumed sessions ARE serviced pre-turn, unlike fresh ones) — is
|
|
5434
|
-
// authoritative and wins.
|
|
5435
|
-
//
|
|
5436
|
-
//
|
|
5437
|
-
//
|
|
5438
|
-
//
|
|
5439
|
-
//
|
|
5440
|
-
//
|
|
5441
|
-
//
|
|
5530
|
+
// authoritative and wins. That one response also carries how much of the
|
|
5531
|
+
// window is already occupied, seeded onto `contextUsedTokens` below.
|
|
5532
|
+
// Otherwise: the cached authoritative window if a prior turn has learned
|
|
5533
|
+
// it for this model (`result.modelUsage`, cross-session), else the text
|
|
5534
|
+
// heuristic, else the default. We deliberately do NOT issue a
|
|
5535
|
+
// getContextUsage call here: on a fresh session that control request is
|
|
5536
|
+
// not serviced until the first prompt turn runs, so awaiting it — as
|
|
5537
|
+
// 0.59.0 did — made session/new take ~15s (issues #886/#880). The
|
|
5538
|
+
// authoritative window arrives on the first `result.modelUsage` and is
|
|
5539
|
+
// cached from there.
|
|
5442
5540
|
//
|
|
5443
5541
|
// Text inference alone misses aliases that resolve to extended-context
|
|
5444
5542
|
// models with no "1m" token anywhere in their id or description (e.g.
|
|
@@ -5495,6 +5593,13 @@ export class ClaudeAcpAgent {
|
|
|
5495
5593
|
forwardSubagentText,
|
|
5496
5594
|
contextWindowSize: seededWindow.size,
|
|
5497
5595
|
contextWindowAuthoritative: seededWindow.authoritative,
|
|
5596
|
+
// A resumed session's occupancy, from that same report. `null` means it
|
|
5597
|
+
// was never read — a fresh session, or a resumed one whose model pin
|
|
5598
|
+
// re-asserted (see `getAvailableModels`) — which is precisely what the
|
|
5599
|
+
// field's `undefined` states, so the two map onto each other. A read
|
|
5600
|
+
// zero is carried through AS zero: an empty resumed session has used
|
|
5601
|
+
// nothing, and that is a measurement, not a missing one.
|
|
5602
|
+
contextUsedTokens: resumedContextUsedTokens ?? undefined,
|
|
5498
5603
|
providerCacheKey,
|
|
5499
5604
|
taskState,
|
|
5500
5605
|
toolUseCache: {},
|
|
@@ -5506,7 +5611,18 @@ export class ClaudeAcpAgent {
|
|
|
5506
5611
|
sessionFailureState: createSessionFailureState(),
|
|
5507
5612
|
fileChangeReportRequestIds: new Set(),
|
|
5508
5613
|
fileChangeAuditSupport,
|
|
5614
|
+
accountUsage: new AccountUsageTracker(),
|
|
5509
5615
|
};
|
|
5616
|
+
// R1.1: the account quota bars are born filled rather than waiting for a
|
|
5617
|
+
// push that only arrives when a limit is nearly hit. Deliberately NOT
|
|
5618
|
+
// awaited — for the same reason the context window above is seeded without
|
|
5619
|
+
// one: on a FRESH session a control request is not serviced until the first
|
|
5620
|
+
// turn runs, so awaiting it here would stall `session/new` for ~15s (issues
|
|
5621
|
+
// #886/#880). R1.1 only requires the report to be asked for before the
|
|
5622
|
+
// first prompt is answered, which issuing it here satisfies; the windows
|
|
5623
|
+
// land whenever the response does. `publishAccountUsage` never rejects, so
|
|
5624
|
+
// this cannot become an unhandled rejection.
|
|
5625
|
+
void this.publishAccountUsage(sessionId, this.sessions[sessionId]);
|
|
5510
5626
|
return {
|
|
5511
5627
|
sessionId,
|
|
5512
5628
|
modes,
|
|
@@ -6247,12 +6363,17 @@ export function applyAvailableModelsAllowlist(sdkModels, allowlist, settingsMode
|
|
|
6247
6363
|
/** Read the model a resumed session is actually running (via the
|
|
6248
6364
|
* `getContextUsage` control request — the same source `/context` prints) and
|
|
6249
6365
|
* map it onto the picker, along with the report's authoritative context
|
|
6250
|
-
* window (`rawMaxTokens`)
|
|
6366
|
+
* window (`rawMaxTokens`) and the occupancy already filling it
|
|
6367
|
+
* (`totalTokens`). Resumed sessions get this request serviced before
|
|
6251
6368
|
* any turn runs in the new process — unlike fresh sessions, where it stalls
|
|
6252
6369
|
* until the first prompt turn (issues #886/#880) — so the same response that
|
|
6253
6370
|
* restores the live model (issue #845) also seeds the window for free,
|
|
6254
6371
|
* covering post-restart reloads of models the text heuristic misses (issue
|
|
6255
|
-
* #596)
|
|
6372
|
+
* #596), and the occupancy with it: a thread reloaded carrying 150k of
|
|
6373
|
+
* context otherwise reports `used: 0` until its first turn ends, and the
|
|
6374
|
+
* client assigns that number to the ring unconditionally. All three come out
|
|
6375
|
+
* of ONE response — nothing here adds a control request.
|
|
6376
|
+
* Best-effort: a control-request failure is logged and returns nulls
|
|
6256
6377
|
* so callers keep their current choice; failing the whole session/load over
|
|
6257
6378
|
* an unreadable report would be worse. */
|
|
6258
6379
|
async function readResumedLiveModel(query, models, logger) {
|
|
@@ -6261,11 +6382,20 @@ async function readResumedLiveModel(query, models, logger) {
|
|
|
6261
6382
|
return {
|
|
6262
6383
|
model: usage.model ? matchResumedModel(models, usage.model) : null,
|
|
6263
6384
|
contextWindow: usage.rawMaxTokens > 0 ? usage.rawMaxTokens : null,
|
|
6385
|
+
// Deliberately NOT the `> 0` test the window uses: the two zeros say
|
|
6386
|
+
// different things. A window of zero tokens is not a window, so 0 there
|
|
6387
|
+
// can only be a report with nothing to say — but an occupancy of zero is
|
|
6388
|
+
// an answer, the genuinely empty resumed session, and folding it into
|
|
6389
|
+
// null would hand that session back the "absent read as 0" this seeding
|
|
6390
|
+
// exists to remove. Only a value that cannot be an occupancy at all
|
|
6391
|
+
// (negative, or a non-number from a response whose own declaration says
|
|
6392
|
+
// it may change shape) falls back to "not read".
|
|
6393
|
+
contextUsedTokens: Number.isFinite(usage.totalTokens) && usage.totalTokens >= 0 ? usage.totalTokens : null,
|
|
6264
6394
|
};
|
|
6265
6395
|
}
|
|
6266
6396
|
catch (error) {
|
|
6267
6397
|
logger.error("Failed to read the resumed session's live model:", error);
|
|
6268
|
-
return { model: null, contextWindow: null };
|
|
6398
|
+
return { model: null, contextWindow: null, contextUsedTokens: null };
|
|
6269
6399
|
}
|
|
6270
6400
|
}
|
|
6271
6401
|
async function getAvailableModels(query,
|
|
@@ -6281,11 +6411,22 @@ pickerModels, sdkModels, settingsManager, logger, isResumedSession) {
|
|
|
6281
6411
|
const settings = settingsManager.getSettings();
|
|
6282
6412
|
let currentModel = models[0];
|
|
6283
6413
|
let resolvedFromInput;
|
|
6284
|
-
// The context window reported alongside a resumed session's live model
|
|
6285
|
-
//
|
|
6286
|
-
//
|
|
6287
|
-
//
|
|
6414
|
+
// The context window reported alongside a resumed session's live model, and
|
|
6415
|
+
// the occupancy already filling it. Both stay null unless the report was
|
|
6416
|
+
// read, and it is read on exactly the paths where `currentModel` IS the live
|
|
6417
|
+
// model (no env/settings override, or an override whose re-assert failed) —
|
|
6418
|
+
// so the window always describes the model the session actually runs, and
|
|
6419
|
+
// the occupancy the context that model actually carries.
|
|
6420
|
+
//
|
|
6421
|
+
// A resumed session whose env/settings pin re-asserts SUCCESSFULLY is
|
|
6422
|
+
// therefore seeded with neither: the report was never asked for, and asking
|
|
6423
|
+
// for one here purely to seed would put a second control request on the
|
|
6424
|
+
// session/load path, serialized on the one channel behind the `setModel`
|
|
6425
|
+
// below — the cost every seeding comment in this file is written to avoid
|
|
6426
|
+
// (issues #886/#880). Such a session reports `used: 0` until its first turn
|
|
6427
|
+
// ends, exactly as every resumed session did before this seeding existed.
|
|
6288
6428
|
let resumedContextWindow = null;
|
|
6429
|
+
let resumedContextUsedTokens = null;
|
|
6289
6430
|
// Model priority (highest to lowest):
|
|
6290
6431
|
// 1. ANTHROPIC_MODEL environment variable
|
|
6291
6432
|
// 2. settings.model (user configuration)
|
|
@@ -6316,6 +6457,7 @@ pickerModels, sdkModels, settingsManager, logger, isResumedSession) {
|
|
|
6316
6457
|
const live = await readResumedLiveModel(query, models, logger);
|
|
6317
6458
|
currentModel = live.model ?? currentModel;
|
|
6318
6459
|
resumedContextWindow = live.contextWindow;
|
|
6460
|
+
resumedContextUsedTokens = live.contextUsedTokens;
|
|
6319
6461
|
}
|
|
6320
6462
|
// Skip the setModel round-trip when we can prove the SDK has already landed
|
|
6321
6463
|
// on the same model. Two cases qualify:
|
|
@@ -6351,6 +6493,7 @@ pickerModels, sdkModels, settingsManager, logger, isResumedSession) {
|
|
|
6351
6493
|
const live = await readResumedLiveModel(query, models, logger);
|
|
6352
6494
|
currentModel = live.model ?? currentModel;
|
|
6353
6495
|
resumedContextWindow = live.contextWindow;
|
|
6496
|
+
resumedContextUsedTokens = live.contextUsedTokens;
|
|
6354
6497
|
}
|
|
6355
6498
|
}
|
|
6356
6499
|
return {
|
|
@@ -6367,6 +6510,7 @@ pickerModels, sdkModels, settingsManager, logger, isResumedSession) {
|
|
|
6367
6510
|
currentModelId: currentModel.value,
|
|
6368
6511
|
},
|
|
6369
6512
|
resumedContextWindow,
|
|
6513
|
+
resumedContextUsedTokens,
|
|
6370
6514
|
};
|
|
6371
6515
|
}
|
|
6372
6516
|
function getAvailableSlashCommands(commands,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.11.0",
|
|
7
7
|
"description": "ACP adapter for the Claude Agent SDK with VS Code-parity UX for Zed and other ACP clients — checkbox multi-select questions, refusal consent dialog, dynamic agent name. Fork of claude-agent-acp.",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"node": ">=24"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@agentclientprotocol/sdk": "1.
|
|
71
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
70
|
+
"@agentclientprotocol/sdk": "1.4.0",
|
|
71
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.250",
|
|
72
72
|
"zod": "^3.25.0 || ^4.0.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@anthropic-ai/sdk": "0.
|
|
75
|
+
"@anthropic-ai/sdk": "0.122.0",
|
|
76
76
|
"@eslint/js": "10.0.1",
|
|
77
77
|
"@tsconfig/node24": "24.0.5",
|
|
78
|
-
"@types/node": "26.
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
80
|
-
"@typescript-eslint/parser": "8.
|
|
81
|
-
"eslint": "10.
|
|
78
|
+
"@types/node": "26.4.0",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "8.68.0",
|
|
80
|
+
"@typescript-eslint/parser": "8.68.0",
|
|
81
|
+
"eslint": "10.9.1",
|
|
82
82
|
"eslint-config-prettier": "10.1.8",
|
|
83
83
|
"globals": "17.11.0",
|
|
84
84
|
"prettier": "3.9.6",
|