@eddyskywalker/dsh-chatgpt-subscription 0.8.5 → 0.9.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.
- package/CHANGELOG.md +44 -0
- package/README.md +94 -38
- package/lib/client.js +2126 -1693
- package/lib/client.js.map +1 -1
- package/lib/index.js +7935 -2956
- package/lib/types/client/claude/ClaudeComposerQuota.d.ts +33 -0
- package/lib/types/client/claude/ClaudeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/{zhipu/ZhipuSection.d.ts → claude/ClaudeSection.d.ts} +2 -2
- package/lib/types/client/claude/ClaudeSection.d.ts.map +1 -0
- package/lib/types/client/claude/locales.d.ts +444 -0
- package/lib/types/client/claude/locales.d.ts.map +1 -0
- package/lib/types/client/claude/styles.d.ts +15 -0
- package/lib/types/client/claude/styles.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/host/claude/__probe-assert.d.ts +2 -0
- package/lib/types/host/claude/__probe-assert.d.ts.map +1 -0
- package/lib/types/host/claude/account-pool.d.ts +580 -0
- package/lib/types/host/claude/account-pool.d.ts.map +1 -0
- package/lib/types/host/claude/adapter.d.ts +267 -0
- package/lib/types/host/claude/adapter.d.ts.map +1 -0
- package/lib/types/host/claude/adopt.d.ts +292 -0
- package/lib/types/host/claude/adopt.d.ts.map +1 -0
- package/lib/types/host/claude/client.d.ts +513 -0
- package/lib/types/host/claude/client.d.ts.map +1 -0
- package/lib/types/host/claude/mapper.d.ts +510 -0
- package/lib/types/host/claude/mapper.d.ts.map +1 -0
- package/lib/types/host/claude/model-catalog.d.ts +365 -0
- package/lib/types/host/claude/model-catalog.d.ts.map +1 -0
- package/lib/types/host/claude/oauth.d.ts +393 -0
- package/lib/types/host/claude/oauth.d.ts.map +1 -0
- package/lib/types/host/claude/routes.d.ts +128 -0
- package/lib/types/host/claude/routes.d.ts.map +1 -0
- package/lib/types/host/claude/token-store.d.ts +312 -0
- package/lib/types/host/claude/token-store.d.ts.map +1 -0
- package/lib/types/host/claude/types.d.ts +237 -0
- package/lib/types/host/claude/types.d.ts.map +1 -0
- package/lib/types/host/common/account-pool.d.ts +40 -0
- package/lib/types/host/common/account-pool.d.ts.map +1 -1
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/client.d.ts +28 -0
- package/lib/types/host/kimi-code/client.d.ts.map +1 -1
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -1
- package/lib/types/index.d.ts +10 -7
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/__probe-claude-import.d.ts +2 -0
- package/lib/types/shared/__probe-claude-import.d.ts.map +1 -0
- package/lib/types/shared/claude-contracts.d.ts +337 -0
- package/lib/types/shared/claude-contracts.d.ts.map +1 -0
- package/package.json +1 -1
- package/lib/types/client/zhipu/ZhipuComposerQuota.d.ts +0 -26
- package/lib/types/client/zhipu/ZhipuComposerQuota.d.ts.map +0 -1
- package/lib/types/client/zhipu/ZhipuSection.d.ts.map +0 -1
- package/lib/types/client/zhipu/locales.d.ts +0 -275
- package/lib/types/client/zhipu/locales.d.ts.map +0 -1
- package/lib/types/client/zhipu/styles.d.ts +0 -12
- package/lib/types/client/zhipu/styles.d.ts.map +0 -1
- package/lib/types/host/zhipu/account-pool.d.ts +0 -43
- package/lib/types/host/zhipu/account-pool.d.ts.map +0 -1
- package/lib/types/host/zhipu/adapter.d.ts +0 -93
- package/lib/types/host/zhipu/adapter.d.ts.map +0 -1
- package/lib/types/host/zhipu/client.d.ts +0 -153
- package/lib/types/host/zhipu/client.d.ts.map +0 -1
- package/lib/types/host/zhipu/mapper.d.ts +0 -111
- package/lib/types/host/zhipu/mapper.d.ts.map +0 -1
- package/lib/types/host/zhipu/model-catalog.d.ts +0 -73
- package/lib/types/host/zhipu/model-catalog.d.ts.map +0 -1
- package/lib/types/host/zhipu/routes.d.ts +0 -33
- package/lib/types/host/zhipu/routes.d.ts.map +0 -1
- package/lib/types/host/zhipu/token-store.d.ts +0 -112
- package/lib/types/host/zhipu/token-store.d.ts.map +0 -1
- package/lib/types/host/zhipu/types.d.ts +0 -125
- package/lib/types/host/zhipu/types.d.ts.map +0 -1
- package/lib/types/shared/zhipu-contracts.d.ts +0 -164
- package/lib/types/shared/zhipu-contracts.d.ts.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential and model-settings persistence for the Claude subscription line.
|
|
3
|
+
*
|
|
4
|
+
* ---------------------------------------------------------------------------
|
|
5
|
+
* WHY ACCOUNT IDENTITY HAS TWO LAYERS
|
|
6
|
+
* ---------------------------------------------------------------------------
|
|
7
|
+
*
|
|
8
|
+
* A subscription credential is not stable text. Every refresh returns a NEW
|
|
9
|
+
* refresh token, and signing in to the same account a second time mints yet
|
|
10
|
+
* another one. The obvious key — a hash of the refresh token — therefore says
|
|
11
|
+
* "new account" for what is the same account, and one ghost row appears per
|
|
12
|
+
* refresh and per re-login. That is the defect this module exists to prevent.
|
|
13
|
+
*
|
|
14
|
+
* A stored account therefore carries two distinct things:
|
|
15
|
+
*
|
|
16
|
+
* 1. `internalId` — minted exactly once, at the first save of an account, as
|
|
17
|
+
* `cl_` + ten random bytes in hex. It never changes for the lifetime of the
|
|
18
|
+
* record, and it is the ONLY key routing may use: set-primary, delete and
|
|
19
|
+
* re-login all address a record by this id.
|
|
20
|
+
* 2. `identityKeys` — an append-only set of ALIASES derived from the credential
|
|
21
|
+
* itself: `uuid:<account.uuid>`, `email:<address>`, and — only when neither
|
|
22
|
+
* of those is available — `seed:<sha256(refreshToken).slice(0,16)>`. Every save
|
|
23
|
+
* MERGES the freshly derived keys into the stored set: a key is never
|
|
24
|
+
* replaced, never dropped, and never re-derived from a token that rotated.
|
|
25
|
+
*
|
|
26
|
+
* Both spellings of the account's address (`email_address`, the wire's own, and
|
|
27
|
+
* `emailAddress`) and both of the account's uuid spellings are read, because a
|
|
28
|
+
* silently missed field here is precisely the ghost-account failure above. Keys
|
|
29
|
+
* are lower-cased on the way in for the same reason: an address that differs only
|
|
30
|
+
* in case is one account.
|
|
31
|
+
*
|
|
32
|
+
* ---------------------------------------------------------------------------
|
|
33
|
+
* THE KNOWN, ACCEPTED LIMITATION: `seed:` CANNOT RECOGNISE A RE-LOGIN
|
|
34
|
+
* ---------------------------------------------------------------------------
|
|
35
|
+
*
|
|
36
|
+
* `seed:` is a digest of the refresh token, so the SAME account signing in again
|
|
37
|
+
* produces a DIFFERENT seed and is stored as a SECOND record. Nothing can tell
|
|
38
|
+
* those two records apart from two genuinely different accounts: neither states
|
|
39
|
+
* a uuid or an address, and the tokens they hold have nothing in common.
|
|
40
|
+
*
|
|
41
|
+
* This is a real limitation, and it is deliberately NOT papered over with an id
|
|
42
|
+
* that pretends to be stable — an id derived from a rotating token is exactly
|
|
43
|
+
* the bug this design removes. The remedy is the one the settings card must
|
|
44
|
+
* offer: a MANUAL MERGE, where the user marks two rows as one account and the
|
|
45
|
+
* surviving record merges the other's keys. Nothing in this module guesses it.
|
|
46
|
+
* A provider whose exchange always returns a uuid or an address never reaches
|
|
47
|
+
* this case; only a credential stating neither does.
|
|
48
|
+
*
|
|
49
|
+
* A second, narrower case follows from the same rule and is worth stating
|
|
50
|
+
* outright: matching requires a SHARED alias, so a sign-in that states only a
|
|
51
|
+
* uuid and a later one that states only an address for the very same account are
|
|
52
|
+
* two records. They become one the moment any single save states both — which is
|
|
53
|
+
* why {@link identityKeysFor} collects everything a credential offers rather
|
|
54
|
+
* than stopping at the first field it finds — and otherwise the same manual
|
|
55
|
+
* merge applies.
|
|
56
|
+
*
|
|
57
|
+
* ---------------------------------------------------------------------------
|
|
58
|
+
* STORAGE
|
|
59
|
+
* ---------------------------------------------------------------------------
|
|
60
|
+
*
|
|
61
|
+
* Encryption is the platform's own and identical to the sibling provider lines:
|
|
62
|
+
* Windows CurrentUser DPAPI (`<file>.dpapi`), the macOS login Keychain, and the
|
|
63
|
+
* Linux Secret Service through `secret-tool`. There is no plaintext fallback — a
|
|
64
|
+
* platform with none of the three throws rather than writing bearer tokens in
|
|
65
|
+
* the clear. The plaintext JSON beside the encrypted file is only ever a
|
|
66
|
+
* MIGRATION SOURCE: it is read once, written back encrypted, verified by
|
|
67
|
+
* reading the ciphertext back, and only then deleted. A failed verification
|
|
68
|
+
* throws and leaves the previous good data untouched.
|
|
69
|
+
*
|
|
70
|
+
* Mutations are serialised per absolute path, so a token refresh, a settings
|
|
71
|
+
* save and a re-login cannot interleave into a read-modify-write that loses an
|
|
72
|
+
* account.
|
|
73
|
+
*/
|
|
74
|
+
import type { CredentialStore } from '../token-store.ts';
|
|
75
|
+
import { type ContextWindowOverridePatch } from '../common/context-window-overrides.ts';
|
|
76
|
+
/** Namespace the model settings live in when the harness still registers one. */
|
|
77
|
+
export declare const CLAUDE_PREFERENCES_NAMESPACE = "dsh-claude";
|
|
78
|
+
/** Prefix of every internal account id. */
|
|
79
|
+
export declare const INTERNAL_ID_PREFIX = "cl_";
|
|
80
|
+
/** The OAuth scope that makes a credential a *subscription* credential. */
|
|
81
|
+
export declare const SUBSCRIPTION_INFERENCE_SCOPE = "user:inference";
|
|
82
|
+
/** Revision of the on-disk credential document. */
|
|
83
|
+
export declare const CREDENTIAL_DOCUMENT_VERSION = 1;
|
|
84
|
+
/** Account facts the exchange states about the signed-in user. */
|
|
85
|
+
export interface ClaudeAccountInfo {
|
|
86
|
+
/** Stable account uuid the exchange reports, when it reports one. */
|
|
87
|
+
uuid?: string;
|
|
88
|
+
/** Account address, as the wire spells it. */
|
|
89
|
+
email_address?: string;
|
|
90
|
+
/** The same address, as a hand-written credential spells it. */
|
|
91
|
+
emailAddress?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* One stored subscription credential.
|
|
95
|
+
*
|
|
96
|
+
* `scopes` is not decoration: `user:inference` is what makes the token usable
|
|
97
|
+
* against /v1/messages at all, so its absence means this is not a subscription
|
|
98
|
+
* credential and is refused rather than tried. See
|
|
99
|
+
* {@link isSubscriptionCredential}.
|
|
100
|
+
*/
|
|
101
|
+
export interface ClaudeCredentials {
|
|
102
|
+
/** Bearer access token. Host-only; never sent to a browser. */
|
|
103
|
+
accessToken: string;
|
|
104
|
+
/** Rotating refresh token. Host-only. */
|
|
105
|
+
refreshToken: string;
|
|
106
|
+
/** Unix milliseconds the access token stops being valid. */
|
|
107
|
+
expiresAt: number;
|
|
108
|
+
/** OAuth scopes the exchange granted. */
|
|
109
|
+
scopes?: string[];
|
|
110
|
+
/** Subscription tier the exchange reported, when it reported one. */
|
|
111
|
+
subscriptionType?: string;
|
|
112
|
+
/** Account facts the exchange reported, when it reported any. */
|
|
113
|
+
account?: ClaudeAccountInfo;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One account record in the credential document.
|
|
117
|
+
*
|
|
118
|
+
* The index signature is deliberate: a later chunk may hang its own fields on a
|
|
119
|
+
* record (an alias, an added-at stamp, a primary flag), and a save from this
|
|
120
|
+
* module must carry them through instead of silently dropping them. Nothing
|
|
121
|
+
* here reads them.
|
|
122
|
+
*/
|
|
123
|
+
export interface ClaudeAccountRecord {
|
|
124
|
+
/** Immutable routing key. See the module comment. */
|
|
125
|
+
internalId: string;
|
|
126
|
+
/** Append-only alias set. Never empty in practice; see {@link mergeIdentityKeys}. */
|
|
127
|
+
identityKeys: string[];
|
|
128
|
+
credentials: ClaudeCredentials;
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
}
|
|
131
|
+
/** Whole credential file: every signed-in account, in insertion order. */
|
|
132
|
+
export interface ClaudeCredentialDocument {
|
|
133
|
+
/** Format revision, so a later chunk can migrate without guessing. */
|
|
134
|
+
version: number;
|
|
135
|
+
accounts: ClaudeAccountRecord[];
|
|
136
|
+
[key: string]: unknown;
|
|
137
|
+
}
|
|
138
|
+
/** Persisted model settings for this line. */
|
|
139
|
+
export interface ClaudeModelSettings {
|
|
140
|
+
enabled?: boolean;
|
|
141
|
+
enabledModelIds: string[];
|
|
142
|
+
contextWindowOverrides: Record<string, number>;
|
|
143
|
+
defaultReasoningEffort: string | null;
|
|
144
|
+
/** Account pinned in the card, by {@link ClaudeAccountRecord.internalId}. */
|
|
145
|
+
selectedAccountId: string | null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* One settings patch. `null` in an override map drops that override, and a
|
|
149
|
+
* field left out keeps its stored value.
|
|
150
|
+
*/
|
|
151
|
+
export interface ClaudeSettingsPatch {
|
|
152
|
+
enabled?: boolean;
|
|
153
|
+
enabledModelIds?: string[];
|
|
154
|
+
/** `null` deletes one override and falls back to the catalog default. */
|
|
155
|
+
contextWindowOverrides?: ContextWindowOverridePatch;
|
|
156
|
+
defaultReasoningEffort?: string | null;
|
|
157
|
+
selectedAccountId?: string | null;
|
|
158
|
+
}
|
|
159
|
+
/** The preference surface the routes and the settings card talk to. */
|
|
160
|
+
export interface ClaudePreferenceStore {
|
|
161
|
+
status(): ClaudeModelSettings;
|
|
162
|
+
update(patch: ClaudeSettingsPatch): Promise<ClaudeModelSettings>;
|
|
163
|
+
}
|
|
164
|
+
/** A fresh settings document, with a copy of the default model list. */
|
|
165
|
+
export declare function defaultClaudeSettings(): ClaudeModelSettings;
|
|
166
|
+
/** Mint an internal id. Called once per record; never derived from a token. */
|
|
167
|
+
export declare function createInternalId(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Whether a value has the shape of an internal id this module minted.
|
|
170
|
+
*
|
|
171
|
+
* A shape test for the settings card and for tests — NOT a gate on the stored
|
|
172
|
+
* document, which keeps a foreign id verbatim rather than discarding the account
|
|
173
|
+
* it names.
|
|
174
|
+
*/
|
|
175
|
+
export declare function isClaudeAccountId(value: unknown): value is string;
|
|
176
|
+
/**
|
|
177
|
+
* Whether a credential is a *subscription* credential.
|
|
178
|
+
*
|
|
179
|
+
* The exchange can hand back a token that authenticates but is not entitled to
|
|
180
|
+
* the routes this provider exists to serve; `user:inference` is the scope that
|
|
181
|
+
* separates the two, so its absence is a refusal rather than a retry.
|
|
182
|
+
*/
|
|
183
|
+
export declare function isSubscriptionCredential(credentials: Pick<ClaudeCredentials, 'scopes'>): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Aliases one credential states about its account.
|
|
186
|
+
*
|
|
187
|
+
* Order is deliberate — uuid, then address — because {@link mergeIdentityKeys}
|
|
188
|
+
* appends in this order and a stable order keeps the stored file diffable. The
|
|
189
|
+
* `seed:` fallback is emitted ONLY when neither of the other two exists: a
|
|
190
|
+
* seed is not identity, it is a fingerprint of a token that rotates, and mixing
|
|
191
|
+
* it into a set that already has real identity would add noise that changes on
|
|
192
|
+
* every refresh.
|
|
193
|
+
*/
|
|
194
|
+
export declare function identityKeysFor(credentials: Pick<ClaudeCredentials, 'refreshToken' | 'account'>): string[];
|
|
195
|
+
/**
|
|
196
|
+
* Union of two alias sets, existing first.
|
|
197
|
+
*
|
|
198
|
+
* Append-only in both directions: a key already present is kept where it is, a
|
|
199
|
+
* new key is appended, and an exact duplicate is not repeated. Nothing is ever
|
|
200
|
+
* removed — including a `seed:` a credential has since outgrown, because a user
|
|
201
|
+
* who signs in with the same token again would otherwise get a ghost row.
|
|
202
|
+
*/
|
|
203
|
+
export declare function mergeIdentityKeys(existing: readonly string[], incoming: readonly string[]): string[];
|
|
204
|
+
/**
|
|
205
|
+
* Validate and normalize one credential, strictly.
|
|
206
|
+
*
|
|
207
|
+
* Every field is rebuilt from a validated value rather than carried over from
|
|
208
|
+
* the input, so nothing a caller happens to attach — an `undefined`-valued key
|
|
209
|
+
* among it — can make the encrypted write fail its own read-back comparison.
|
|
210
|
+
* A wrong shape throws; nothing is guessed, and in particular a credential with
|
|
211
|
+
* no `user:inference` scope is refused here (see {@link isSubscriptionCredential}).
|
|
212
|
+
*/
|
|
213
|
+
export declare function parseClaudeCredentials(value: unknown): ClaudeCredentials;
|
|
214
|
+
/**
|
|
215
|
+
* Validate one whole credential document, migrating the pre-two-layer shape.
|
|
216
|
+
*
|
|
217
|
+
* A bare credential object — one token pair, no account envelope — is what an
|
|
218
|
+
* earlier build wrote, and it is accepted as a one-account document so an
|
|
219
|
+
* existing sign-in survives the upgrade instead of forcing a re-login. The
|
|
220
|
+
* record it becomes is minted an internal id right here, at the moment it is
|
|
221
|
+
* first read.
|
|
222
|
+
*/
|
|
223
|
+
export declare function parseClaudeCredentialDocument(value: unknown): ClaudeCredentialDocument;
|
|
224
|
+
/**
|
|
225
|
+
* Validate one settings document.
|
|
226
|
+
*
|
|
227
|
+
* Unlike the credential parse this one is lenient by design: settings are
|
|
228
|
+
* preferences, and a hand-edited or half-written value must degrade to the
|
|
229
|
+
* shipped default for that one field instead of unlinking the user's model
|
|
230
|
+
* choice entirely. Being lenient is also what lets a document written by an
|
|
231
|
+
* EARLIER build keep working: this reader picks the fields it knows and ignores
|
|
232
|
+
* every other key rather than rejecting the document for stating one, so a file
|
|
233
|
+
* still carrying a key this build no longer has is read successfully and every
|
|
234
|
+
* field it does have survives. Rejecting unknown keys here would answer "not
|
|
235
|
+
* signed in" for a user whose model selection is sitting intact on disk.
|
|
236
|
+
* The settings route's zod schema has the same property for its own store:
|
|
237
|
+
* schemastery strips undeclared keys instead of failing on them.
|
|
238
|
+
*/
|
|
239
|
+
export declare function parseClaudeModelSettings(value: unknown): ClaudeModelSettings;
|
|
240
|
+
export declare function credentialPath(): string;
|
|
241
|
+
export declare function modelSettingsPath(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Encrypted credential store; the plaintext JSON is only a migration source.
|
|
244
|
+
*
|
|
245
|
+
* Every mutation goes through {@link saveVerified}: encrypt, read the ciphertext
|
|
246
|
+
* back, compare, and only then remove the plaintext. A verification failure
|
|
247
|
+
* throws and leaves both the ciphertext and the plaintext as they were, so the
|
|
248
|
+
* previous good data is never destroyed by a failed write.
|
|
249
|
+
*/
|
|
250
|
+
export declare class FileCredentialStore {
|
|
251
|
+
private readonly filePath;
|
|
252
|
+
private readonly backend;
|
|
253
|
+
constructor(filePath?: string, backend?: CredentialStore<ClaudeCredentialDocument>);
|
|
254
|
+
/** Human-readable location, in the form the settings card reports it. */
|
|
255
|
+
path(): string;
|
|
256
|
+
/**
|
|
257
|
+
* Test seam and extension point: the one place an id is minted.
|
|
258
|
+
*
|
|
259
|
+
* Overridable so a test can make the id deterministic without reaching into
|
|
260
|
+
* the randomness, and so a later chunk can mint ids through the same path.
|
|
261
|
+
*/
|
|
262
|
+
protected createAccountId(): string;
|
|
263
|
+
private serialize;
|
|
264
|
+
private removeLegacy;
|
|
265
|
+
private saveVerified;
|
|
266
|
+
/** Unserialized body shared by {@link read} and the mutations above it. */
|
|
267
|
+
private readDocument;
|
|
268
|
+
read(): Promise<ClaudeCredentialDocument | null>;
|
|
269
|
+
listAccounts(): Promise<ClaudeAccountRecord[]>;
|
|
270
|
+
/**
|
|
271
|
+
* Store one credential, merging it into the account it belongs to.
|
|
272
|
+
*
|
|
273
|
+
* The merge is the whole point of the two-layer design: the same account
|
|
274
|
+
* saving a SECOND, rotated refresh token is matched by the uuid or address
|
|
275
|
+
* alias it still carries, so it updates the existing record — same
|
|
276
|
+
* `internalId`, union of aliases — instead of adding a ghost row. Pass
|
|
277
|
+
* `options.internalId` to address a record directly; that is what a re-login
|
|
278
|
+
* whose token states no identity uses, and it is the only way to fold such a
|
|
279
|
+
* credential onto a record the user picked by hand.
|
|
280
|
+
*/
|
|
281
|
+
saveAccount(credentials: ClaudeCredentials, options?: {
|
|
282
|
+
internalId?: string;
|
|
283
|
+
}): Promise<ClaudeAccountRecord>;
|
|
284
|
+
write(document: ClaudeCredentialDocument): Promise<void>;
|
|
285
|
+
delete(): Promise<void>;
|
|
286
|
+
/** Drop exactly one account, by its immutable id. Returns whether it existed. */
|
|
287
|
+
deleteAccount(internalId: string): Promise<boolean>;
|
|
288
|
+
}
|
|
289
|
+
/** Plain-JSON model settings used when the settings service is unavailable. */
|
|
290
|
+
export declare class FileModelSettingsStore {
|
|
291
|
+
private readonly filePath;
|
|
292
|
+
constructor(filePath?: string);
|
|
293
|
+
path(): string;
|
|
294
|
+
read(): Promise<ClaudeModelSettings>;
|
|
295
|
+
write(settings: ClaudeModelSettings): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Read-modify-write under the same per-path lock the credentials use.
|
|
298
|
+
*
|
|
299
|
+
* Without it two patches landing together each read the same document and the
|
|
300
|
+
* second write silently discards the first — a lost model selection, with no
|
|
301
|
+
* error anywhere.
|
|
302
|
+
*/
|
|
303
|
+
updateSettings(patch: ClaudeSettingsPatch): Promise<ClaudeModelSettings>;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Bind the model selection to the DSH settings document when the harness still
|
|
307
|
+
* offers one, and to the JSON file beside the credentials otherwise: a harness
|
|
308
|
+
* without the register seam (0.1.7, and a headless test) reads that file back on
|
|
309
|
+
* boot.
|
|
310
|
+
*/
|
|
311
|
+
export declare function registerClaudePreferenceStore(settings?: unknown, fallbackStore?: FileModelSettingsStore): ClaudePreferenceStore;
|
|
312
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/token-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAA+B,KAAK,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAMpH,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,eAAe,CAAA;AAExD,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAKvC,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B,mBAAmB,CAAA;AAC5D,mDAAmD;AACnD,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAK5C,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,CAAC,EAA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AAmB,CAAC;CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,CAAC,EAAE,OAAO,EAClB,aAAa,yBAA+B,GAC3C,qBAAqB,CAsDvB"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static facts about Anthropic's Claude subscription surface.
|
|
3
|
+
*
|
|
4
|
+
* The subscription (Claude Pro/Max, the credential Claude Code uses) is a
|
|
5
|
+
* distinct product from the pay-as-you-go Console API. It is served by the same
|
|
6
|
+
* host — https://api.anthropic.com — but a subscription credential is a Bearer
|
|
7
|
+
* **OAuth access token**, not an `x-api-key`, and the subscription routes are
|
|
8
|
+
* gated behind betas the API-key line never sends.
|
|
9
|
+
*
|
|
10
|
+
* Every constant below was read out of a locally installed reference
|
|
11
|
+
* implementation, not recalled: the Anthropic wire layer and OAuth module of
|
|
12
|
+
* `@earendil-works/pi-ai` (dist/api/anthropic-messages.js,
|
|
13
|
+
* dist/auth/oauth/anthropic.js) and its `data/anthropic.json` model snapshot.
|
|
14
|
+
* Each constant names the source that establishes it, so a later reviewer can
|
|
15
|
+
* re-check the claim instead of trusting this file.
|
|
16
|
+
*
|
|
17
|
+
* The one fact this module cannot assert is which models the *server* will
|
|
18
|
+
* serve, or at what entitlement: that answer is the server's own
|
|
19
|
+
* GET /v1/models plus the account's plan, and the sibling model table says so
|
|
20
|
+
* at length.
|
|
21
|
+
*/
|
|
22
|
+
/** Provider id registered with DSH. */
|
|
23
|
+
export declare const PROVIDER_ID = "claude-subscription";
|
|
24
|
+
/** Display name for the settings surface and the model picker. */
|
|
25
|
+
export declare const PROVIDER_NAME = "Claude\uFF08\u8BA2\u9605\uFF09";
|
|
26
|
+
/** Host serving both the Messages API and the subscription's own OAuth routes. */
|
|
27
|
+
export declare const API_BASE = "https://api.anthropic.com";
|
|
28
|
+
/**
|
|
29
|
+
* Path the Messages API is posted to.
|
|
30
|
+
*
|
|
31
|
+
* The `?beta=true` query is part of the subscription contract rather than a
|
|
32
|
+
* cache buster: it is the beta route, not an alias of the plain one, so dropping
|
|
33
|
+
* it changes which endpoint answers rather than how the same endpoint is cached.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MESSAGES_PATH = "/v1/messages?beta=true";
|
|
36
|
+
/** Model listing. The authority on what this account can actually call. */
|
|
37
|
+
export declare const MODELS_PATH = "/v1/models";
|
|
38
|
+
/** Subscription usage meters (the 5-hour and 7-day windows). */
|
|
39
|
+
export declare const USAGE_PATH = "/api/oauth/usage";
|
|
40
|
+
/**
|
|
41
|
+
* Browser authorization endpoint of the subscription flow.
|
|
42
|
+
*
|
|
43
|
+
* This is the claude.ai property, which is what makes the resulting token a
|
|
44
|
+
* subscription credential. The Console's own authorization host mints
|
|
45
|
+
* API-key-scoped grants instead and is deliberately not used here.
|
|
46
|
+
*
|
|
47
|
+
* Overridable: see {@link oauthAuthorizeUrl}.
|
|
48
|
+
*/
|
|
49
|
+
export declare const OAUTH_AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
50
|
+
/** Token endpoint for both the authorization-code grant and refresh. */
|
|
51
|
+
export declare const OAUTH_TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
|
|
52
|
+
/**
|
|
53
|
+
* Redirect URI for the manual paste flow.
|
|
54
|
+
*
|
|
55
|
+
* The loopback flow ({@link loopbackRedirectUri}) is the primary one, but the
|
|
56
|
+
* authorization host only accepts a redirect URI the client is registered for.
|
|
57
|
+
* When no browser on this machine can complete the callback — a headless box, a
|
|
58
|
+
* remote shell, a browser in another profile — the user opens the authorize URL,
|
|
59
|
+
* lets the page fail to load, and pastes the resulting code back. Recognising
|
|
60
|
+
* this URI is what lets the flow tell the two apart.
|
|
61
|
+
*/
|
|
62
|
+
export declare const OAUTH_MANUAL_REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
63
|
+
/**
|
|
64
|
+
* Public OAuth client id of the subscription flow.
|
|
65
|
+
*
|
|
66
|
+
* A public client id is not a secret — it identifies the client, and PKCE is
|
|
67
|
+
* what actually protects the exchange. It is still a fixed upstream fact: the
|
|
68
|
+
* authorization host rejects an unknown client id before any user is asked to
|
|
69
|
+
* authorize anything.
|
|
70
|
+
*/
|
|
71
|
+
export declare const OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
72
|
+
/**
|
|
73
|
+
* Scopes the subscription flow requests, space-separated as the endpoint wants.
|
|
74
|
+
*
|
|
75
|
+
* `user:inference` is the one that makes the token usable against
|
|
76
|
+
* /v1/messages; `user:profile` is what the usage endpoint answers against.
|
|
77
|
+
* A narrower set yields a token that authenticates but is refused on the routes
|
|
78
|
+
* this provider exists to serve, so the full set is requested.
|
|
79
|
+
*/
|
|
80
|
+
export declare const OAUTH_SCOPES = "org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
|
|
81
|
+
/**
|
|
82
|
+
* Required on any request authenticated with a subscription OAuth token.
|
|
83
|
+
*
|
|
84
|
+
* The `anthropic-beta` header is cumulative: one request carries every marker
|
|
85
|
+
* that applies, and the values below are the wire tokens, not capability names.
|
|
86
|
+
*/
|
|
87
|
+
export declare const OAUTH_BETA = "oauth-2025-04-20";
|
|
88
|
+
/** Identity beta pairing with the Claude Code system prompt and version headers. */
|
|
89
|
+
export declare const CLAUDE_CODE_BETA = "claude-code-20250219";
|
|
90
|
+
/** Lets thinking blocks interleave with tool use across a multi-turn loop. */
|
|
91
|
+
export declare const INTERLEAVED_THINKING_BETA = "interleaved-thinking-2025-05-14";
|
|
92
|
+
/** Anthropic protocol revision sent as `anthropic-version`. */
|
|
93
|
+
export declare const ANTHROPIC_VERSION = "2023-06-01";
|
|
94
|
+
/**
|
|
95
|
+
* Baseline client version this route reports to the subscription gateway.
|
|
96
|
+
*
|
|
97
|
+
* Upstream enforces a *minimum reported client version* on the subscription
|
|
98
|
+
* path: a value below the floor is refused with HTTP 400 and an error body whose
|
|
99
|
+
* code is `claude_code_version_too_old`. That is a hard stop for every request
|
|
100
|
+
* rather than a per-request failure, so it cannot be a compile-time literal that
|
|
101
|
+
* only moves when this package is republished — a user whose installed baseline
|
|
102
|
+
* has aged past the server's floor has to be able to raise it without waiting
|
|
103
|
+
* for a release.
|
|
104
|
+
*
|
|
105
|
+
* Read the effective value with {@link claudeCliVersion}, pin one with
|
|
106
|
+
* {@link setClaudeCliVersion}.
|
|
107
|
+
*/
|
|
108
|
+
export declare const CLAUDE_CLI_VERSION = "2.1.251";
|
|
109
|
+
/**
|
|
110
|
+
* Loopback callback port the subscription flow defaults to.
|
|
111
|
+
*
|
|
112
|
+
* The port is not free-form: it is part of the redirect URI, and the
|
|
113
|
+
* authorization host only accepts a redirect URI registered for the client, so
|
|
114
|
+
* this default is the one known to be accepted. It is still only a *default* —
|
|
115
|
+
* see {@link CALLBACK_PORT_ATTEMPTS}.
|
|
116
|
+
*/
|
|
117
|
+
export declare const DEFAULT_CALLBACK_PORT = 53692;
|
|
118
|
+
/**
|
|
119
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
120
|
+
*
|
|
121
|
+
* Windows (Hyper-V/WinNAT) dynamically reserves TCP port ranges that change on
|
|
122
|
+
* every reboot. A fixed callback port can land inside one and `listen` fails
|
|
123
|
+
* with `EACCES`, so browser authorization never completes. Excluded ranges are
|
|
124
|
+
* reserved in blocks of up to 100 ports, which is why a probe narrower than that
|
|
125
|
+
* can stop inside a block and still fail; 128 covers any single block the
|
|
126
|
+
* default port can start in. Mirrors the Antigravity line's own probe.
|
|
127
|
+
*/
|
|
128
|
+
export declare const CALLBACK_PORT_ATTEMPTS = 128;
|
|
129
|
+
/** Path of the loopback callback the browser is redirected to. */
|
|
130
|
+
export declare const CALLBACK_PATH = "/callback";
|
|
131
|
+
/** Idle ceiling for one streaming response before it is declared stalled. */
|
|
132
|
+
export declare const STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
133
|
+
/** Failure code the adapter reports for that stall. */
|
|
134
|
+
export declare const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
|
|
135
|
+
/** Ceiling for a model-listing or usage fetch. */
|
|
136
|
+
export declare const DISCOVERY_TIMEOUT_MS = 20000;
|
|
137
|
+
/** Whole-request ceiling for one non-streaming chat call. */
|
|
138
|
+
export declare const CHAT_TIMEOUT_MS = 300000;
|
|
139
|
+
/** How long a usage reading is served from cache before it is refetched. */
|
|
140
|
+
export declare const QUOTA_CACHE_TTL_MS = 120000;
|
|
141
|
+
/** How long a usage reading keeps answering while refreshes fail behind it. */
|
|
142
|
+
export declare const QUOTA_FULL_REFRESH_MS = 300000;
|
|
143
|
+
/** How long a model listing is served from cache. */
|
|
144
|
+
export declare const CATALOG_CACHE_TTL_MS = 1800000;
|
|
145
|
+
/** How long a sign-in may stay open before it is abandoned. */
|
|
146
|
+
export declare const LOGIN_TIMEOUT_MS = 600000;
|
|
147
|
+
/** Output cap requested when the caller states none. */
|
|
148
|
+
export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
149
|
+
/**
|
|
150
|
+
* Context window assumed for a model the catalog does not describe.
|
|
151
|
+
*
|
|
152
|
+
* 200K is the window every non-1M Claude model ships, so it is the value that is
|
|
153
|
+
* wrong for the fewest ids. The dangerous direction is a window that is too
|
|
154
|
+
* large — the request is rejected outright — while one that is too small only
|
|
155
|
+
* compacts earlier than it had to.
|
|
156
|
+
*/
|
|
157
|
+
export declare const DEFAULT_CONTEXT_WINDOW = 200000;
|
|
158
|
+
/**
|
|
159
|
+
* Product identity for the `User-Agent`.
|
|
160
|
+
*
|
|
161
|
+
* The endpoint and the header vocabulary are Anthropic's own public contract, so
|
|
162
|
+
* this route identifies itself honestly as this plugin rather than
|
|
163
|
+
* impersonating a client it is not.
|
|
164
|
+
*/
|
|
165
|
+
export declare const PLUGIN_USER_AGENT = "dsh-chatgpt-subscription (+https://github.com/Aa728848/dsh-chatgpt-subscription)";
|
|
166
|
+
/**
|
|
167
|
+
* Anthropic error types this line classifies.
|
|
168
|
+
*
|
|
169
|
+
* Anthropic reports the real condition in the response body's `error.type`
|
|
170
|
+
* while the HTTP status stays coarse — several unrelated conditions share a
|
|
171
|
+
* status — so classification reads the body and only falls back to the status
|
|
172
|
+
* line when the body is unreadable.
|
|
173
|
+
*
|
|
174
|
+
* The keys are what this route calls each condition; the values are the wire
|
|
175
|
+
* strings, so an unknown string is never silently mapped onto a neighbour.
|
|
176
|
+
*/
|
|
177
|
+
export declare const ERROR_TYPE: {
|
|
178
|
+
/** 401 — the credential is absent, malformed, or expired. Re-signing in fixes it. */
|
|
179
|
+
readonly AUTHENTICATION: "authentication_error";
|
|
180
|
+
/** 403 — the credential is valid but the account may not use this resource. */
|
|
181
|
+
readonly PERMISSION: "permission_error";
|
|
182
|
+
/** 400 — the request itself is malformed or carries an unsupported parameter. */
|
|
183
|
+
readonly INVALID_REQUEST: "invalid_request_error";
|
|
184
|
+
/** 429 — request-rate or usage-window limit. The body may name a reset instant. */
|
|
185
|
+
readonly RATE_LIMIT: "rate_limit_error";
|
|
186
|
+
/** 529 — transient capacity shortage; retrying is the whole remedy. */
|
|
187
|
+
readonly OVERLOADED: "overloaded_error";
|
|
188
|
+
/** 404 — unknown model id or unknown resource. */
|
|
189
|
+
readonly NOT_FOUND: "not_found_error";
|
|
190
|
+
/** 500 — an unexpected server-side failure. */
|
|
191
|
+
readonly API: "api_error";
|
|
192
|
+
/** 413 — the request body exceeds the maximum size, independent of token count. */
|
|
193
|
+
readonly REQUEST_TOO_LARGE: "request_too_large";
|
|
194
|
+
};
|
|
195
|
+
/** One error type this line classifies. */
|
|
196
|
+
export type ClaudeErrorType = (typeof ERROR_TYPE)[keyof typeof ERROR_TYPE];
|
|
197
|
+
/**
|
|
198
|
+
* Error code the server reports when the client version it was told is too old.
|
|
199
|
+
*
|
|
200
|
+
* Distinct from {@link ERROR_TYPE}: the failure arrives as an ordinary
|
|
201
|
+
* `invalid_request_error` whose *details* carry this code, which is why it needs
|
|
202
|
+
* its own constant rather than a slot in the table above.
|
|
203
|
+
*/
|
|
204
|
+
export declare const ERROR_CODE_CLIENT_VERSION_TOO_OLD = "claude_code_version_too_old";
|
|
205
|
+
/** Every error type this line recognizes, for validation and tests. */
|
|
206
|
+
export declare const CLAUDE_ERROR_TYPES: readonly ClaudeErrorType[];
|
|
207
|
+
/** Whether a wire string is one of the error types this line classifies. */
|
|
208
|
+
export declare function isClaudeErrorType(value: unknown): value is ClaudeErrorType;
|
|
209
|
+
/**
|
|
210
|
+
* Effective client version to report.
|
|
211
|
+
*
|
|
212
|
+
* Resolution order is deliberate: an explicit {@link setClaudeCliVersion} pin
|
|
213
|
+
* wins, then the `DSH_CLAUDE_CLI_VERSION` environment variable, then the shipped
|
|
214
|
+
* baseline. The pin lets a running host react to
|
|
215
|
+
* `claude_code_version_too_old` without a restart; the environment variable lets a
|
|
216
|
+
* user do it without any code path at all.
|
|
217
|
+
*/
|
|
218
|
+
export declare function claudeCliVersion(): string;
|
|
219
|
+
/**
|
|
220
|
+
* Pin the reported client version.
|
|
221
|
+
*
|
|
222
|
+
* Pass `null` (or a blank string) to clear the pin and fall back to the
|
|
223
|
+
* environment and then the shipped baseline.
|
|
224
|
+
*/
|
|
225
|
+
export declare function setClaudeCliVersion(value: string | null): void;
|
|
226
|
+
/**
|
|
227
|
+
* Resolve the browser authorization endpoint.
|
|
228
|
+
*
|
|
229
|
+
* The subscription flow has answered on more than one host, while its Console
|
|
230
|
+
* counterpart has always been a different product, so a user hitting an
|
|
231
|
+
* authorization failure needs a way to point this route elsewhere without a
|
|
232
|
+
* republish — the same escape hatch the sibling Kimi line gives its OAuth host.
|
|
233
|
+
*/
|
|
234
|
+
export declare function oauthAuthorizeUrl(): string;
|
|
235
|
+
/** Loopback redirect URI the authorization host is told to return to. */
|
|
236
|
+
export declare function loopbackRedirectUri(port?: number): string;
|
|
237
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/types.ts"],"names":[],"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;AACzE,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,MAA8B,GAAG,MAAM,CAEhF"}
|
|
@@ -233,6 +233,46 @@ export declare class AccountPoolCore<TCredentials, TAccount extends PoolAccountS
|
|
|
233
233
|
account: TAccount;
|
|
234
234
|
credentials: TCredentials;
|
|
235
235
|
}>;
|
|
236
|
+
/**
|
|
237
|
+
* Refresh one named account's credential for a caller that is not a metered
|
|
238
|
+
* model request.
|
|
239
|
+
*
|
|
240
|
+
* The settings card is what this exists for. It addresses an account by id
|
|
241
|
+
* rather than taking a rotation slot, and it used to hand the stored
|
|
242
|
+
* credential to the provider unchanged; with a 15-minute access token that
|
|
243
|
+
* meant a card opened more than a quarter of an hour after the last model
|
|
244
|
+
* request sent an expired bearer to the usage endpoint and was answered with
|
|
245
|
+
* 401 — "sign in again" for a credential that a plain refresh would have
|
|
246
|
+
* renewed.
|
|
247
|
+
*
|
|
248
|
+
* Rotation bookkeeping is deliberately ignored, matching
|
|
249
|
+
* {@link getCredentialAccount}: a cooldown or a pinned account describes
|
|
250
|
+
* routing, not whether the credential can be read. A credential the provider
|
|
251
|
+
* has already declared unusable is still refused, because refreshing it
|
|
252
|
+
* cannot succeed.
|
|
253
|
+
*
|
|
254
|
+
* @param accountId - the pool account to read, or undefined for the primary.
|
|
255
|
+
* @param fetchFn - fetch used by the provider's token refresh.
|
|
256
|
+
*/
|
|
257
|
+
getFreshCredential(accountId?: string, fetchFn?: typeof fetch): Promise<TCredentials>;
|
|
258
|
+
/**
|
|
259
|
+
* Renew one account's credential unconditionally.
|
|
260
|
+
*
|
|
261
|
+
* This is the answer to a 401 that the local clock did not predict: an access
|
|
262
|
+
* token can be revoked upstream or rotated by another holder while it still
|
|
263
|
+
* looks unexpired, and only the service's own refusal says so. Renewing it is
|
|
264
|
+
* what separates that from a credential that genuinely needs a new sign-in.
|
|
265
|
+
*/
|
|
266
|
+
renewCredential(accountId?: string, fetchFn?: typeof fetch): Promise<TCredentials>;
|
|
267
|
+
/**
|
|
268
|
+
* Resolve, and if needed renew, one account's credential.
|
|
269
|
+
*
|
|
270
|
+
* With no id the account that would serve the next request is used — the
|
|
271
|
+
* active one, then the primary, then the first — because a caller that does
|
|
272
|
+
* not name an account (the catalog loader) still has to present the
|
|
273
|
+
* credential that is actually in play.
|
|
274
|
+
*/
|
|
275
|
+
private credentialFor;
|
|
236
276
|
/** Whether one account's credential must be refreshed before it is handed out. */
|
|
237
277
|
private shouldRefreshCredential;
|
|
238
278
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/common/account-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wCAAwC,CAAA;AAE/C,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,QAAS,CAAA;AAK5C,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,YAAY;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,YAAY,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,4EAA4E;AAC5E,MAAM,WAAW,QAAQ,CAAC,QAAQ;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,uBAAuB,CAAA;IACzC,QAAQ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