@agentclientprotocol/claude-agent-acp 0.104.1-preview.1 → 0.104.1-preview.2
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.
|
@@ -94,8 +94,8 @@ export declare class AuthStatusReporter {
|
|
|
94
94
|
/**
|
|
95
95
|
* Report the identity behind a session's `AccountInfo`.
|
|
96
96
|
*
|
|
97
|
-
* `AccountInfo`
|
|
98
|
-
*
|
|
97
|
+
* `AccountInfo` describes what the live query authenticates with, but lacks
|
|
98
|
+
* the CLI's plan tier. The v1 core calls it before the
|
|
99
99
|
* `--hide-claude-auth` guard may refuse the session or the turn: that flag
|
|
100
100
|
* blocks the *use* of a subscription, it does not make the state secret, and
|
|
101
101
|
* a refusal is when the client most needs to know the account it was
|
|
@@ -139,8 +139,8 @@ export class AuthStatusReporter {
|
|
|
139
139
|
/**
|
|
140
140
|
* Report the identity behind a session's `AccountInfo`.
|
|
141
141
|
*
|
|
142
|
-
* `AccountInfo`
|
|
143
|
-
*
|
|
142
|
+
* `AccountInfo` describes what the live query authenticates with, but lacks
|
|
143
|
+
* the CLI's plan tier. The v1 core calls it before the
|
|
144
144
|
* `--hide-claude-auth` guard may refuse the session or the turn: that flag
|
|
145
145
|
* blocks the *use* of a subscription, it does not make the state secret, and
|
|
146
146
|
* a refusal is when the client most needs to know the account it was
|
|
@@ -174,7 +174,7 @@ export class AuthStatusReporter {
|
|
|
174
174
|
}
|
|
175
175
|
const fromSession = fromAccountInfo(account, apiKeyHelper);
|
|
176
176
|
if (fromSession) {
|
|
177
|
-
this.set(fromSession);
|
|
177
|
+
this.set(mergeAuthStatus(this.current, fromSession, "session"));
|
|
178
178
|
}
|
|
179
179
|
else if (!this.loggedUninformativeAccount) {
|
|
180
180
|
this.loggedUninformativeAccount = true;
|
|
@@ -281,7 +281,7 @@ export class AuthStatusReporter {
|
|
|
281
281
|
// The CLI probe can be poorer than the session `AccountInfo` for the very
|
|
282
282
|
// same login (no organization, say). Keep those extra fields rather than
|
|
283
283
|
// regressing the payload; a different identity replaces it wholesale.
|
|
284
|
-
const merged = mergeAuthStatus(this.current, status);
|
|
284
|
+
const merged = mergeAuthStatus(this.current, status, "cli");
|
|
285
285
|
this.set(merged);
|
|
286
286
|
this.options.onProbe?.(status.kind);
|
|
287
287
|
return merged;
|
package/dist/auth-status.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ export type CliAuthStatus = {
|
|
|
113
113
|
orgId?: string;
|
|
114
114
|
orgName?: string;
|
|
115
115
|
subscriptionType?: string;
|
|
116
|
+
/** CLI-only tier, e.g. "max_5x" or "max_20x"; not in SDK AccountInfo. */
|
|
117
|
+
planTier?: string;
|
|
116
118
|
};
|
|
117
119
|
export declare function notLoggedInAuthStatus(): AuthStatus;
|
|
118
120
|
/** ACP-level gateway auth (`authenticate` with `gateway`/`gateway-bedrock`).
|
|
@@ -153,8 +155,10 @@ export declare function sameIdentity(a: AuthStatus, b: AuthStatus): boolean;
|
|
|
153
155
|
* organization the CLI probe omits. So when the read describes the same
|
|
154
156
|
* identity, its values win field by field but the fields it lacks are kept;
|
|
155
157
|
* when it describes a different identity, it replaces the old one wholesale.
|
|
158
|
+
* Session reads lack the CLI's plan tier, so keep the label for the same plan.
|
|
159
|
+
* A CLI read always replaces the label, including when its tier is absent.
|
|
156
160
|
*/
|
|
157
|
-
export declare function mergeAuthStatus(previous: AuthStatus | undefined, next: AuthStatus): AuthStatus;
|
|
161
|
+
export declare function mergeAuthStatus(previous: AuthStatus | undefined, next: AuthStatus, source: "cli" | "session"): AuthStatus;
|
|
158
162
|
/**
|
|
159
163
|
* Do two payloads carry the same information? Unlike {@link sameIdentity},
|
|
160
164
|
* which asks "is this the same login", this compares every rendered field, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-status.d.ts","sourceRoot":"","sources":["../src/auth-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAuC3F;AAyED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAYlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,KAAK,GAAG,SAAS,GACxB,UAAU,CAuBZ;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAgBhF"}
|
package/dist/auth-status.js
CHANGED
|
@@ -206,6 +206,7 @@ export function fromCliStatus(stdout, apiKeyHelper) {
|
|
|
206
206
|
return mapAuthFields({
|
|
207
207
|
apiProvider: status.apiProvider,
|
|
208
208
|
subscriptionType: status.subscriptionType,
|
|
209
|
+
planTier: status.planTier,
|
|
209
210
|
apiKeySource: status.apiKeySource,
|
|
210
211
|
email: status.email,
|
|
211
212
|
organization: status.orgName,
|
|
@@ -256,19 +257,21 @@ function mapAuthFields(fields) {
|
|
|
256
257
|
account.organization = organization;
|
|
257
258
|
return {
|
|
258
259
|
kind: "account",
|
|
259
|
-
label: planLabel(subscriptionType),
|
|
260
|
+
label: planLabel(subscriptionType, fields.planTier),
|
|
260
261
|
// No detail: the client falls back to `account.email` for line 2.
|
|
261
262
|
account,
|
|
262
263
|
};
|
|
263
264
|
}
|
|
264
265
|
return notLoggedInAuthStatus();
|
|
265
266
|
}
|
|
266
|
-
/** Names the plan with exactly one "Claude".
|
|
267
|
-
*
|
|
268
|
-
* Each word is title-cased; a word that already carries capitals is kept.
|
|
269
|
-
|
|
267
|
+
/** Names the plan with exactly one "Claude". Without a tier, "Claude Max"
|
|
268
|
+
* from a newer CLI and "max" from an older one both read "Claude Max".
|
|
269
|
+
* Each word is title-cased; a word that already carries capitals is kept.
|
|
270
|
+
* The CLI's max_20x tier identifies Ultra; other tiers keep the plan label. */
|
|
271
|
+
function planLabel(plan, planTier) {
|
|
270
272
|
const titled = plan.replace(/\S+/g, (word) => word.charAt(0).toUpperCase() + word.slice(1));
|
|
271
|
-
|
|
273
|
+
const label = /^claude(\s|$)/i.test(plan) ? titled : `Claude ${titled}`;
|
|
274
|
+
return label.toLowerCase() === "claude max" && planTier === "max_20x" ? "Claude Ultra" : label;
|
|
272
275
|
}
|
|
273
276
|
/**
|
|
274
277
|
* Do two payloads describe the same login? Compared on the field that
|
|
@@ -294,8 +297,10 @@ export function sameIdentity(a, b) {
|
|
|
294
297
|
* organization the CLI probe omits. So when the read describes the same
|
|
295
298
|
* identity, its values win field by field but the fields it lacks are kept;
|
|
296
299
|
* when it describes a different identity, it replaces the old one wholesale.
|
|
300
|
+
* Session reads lack the CLI's plan tier, so keep the label for the same plan.
|
|
301
|
+
* A CLI read always replaces the label, including when its tier is absent.
|
|
297
302
|
*/
|
|
298
|
-
export function mergeAuthStatus(previous, next) {
|
|
303
|
+
export function mergeAuthStatus(previous, next, source) {
|
|
299
304
|
if (!previous || !sameIdentity(previous, next)) {
|
|
300
305
|
return next;
|
|
301
306
|
}
|
|
@@ -306,6 +311,12 @@ export function mergeAuthStatus(previous, next) {
|
|
|
306
311
|
if (previous.account || next.account) {
|
|
307
312
|
merged.account = { ...previous.account, ...next.account };
|
|
308
313
|
}
|
|
314
|
+
if (source === "session" &&
|
|
315
|
+
previous.account?.plan &&
|
|
316
|
+
next.account?.plan &&
|
|
317
|
+
planLabel(previous.account.plan).toLowerCase() === planLabel(next.account.plan).toLowerCase()) {
|
|
318
|
+
merged.label = previous.label;
|
|
319
|
+
}
|
|
309
320
|
if (merged.vendor === undefined && previous.vendor !== undefined) {
|
|
310
321
|
merged.vendor = previous.vendor;
|
|
311
322
|
}
|
package/package.json
CHANGED