@eddyskywalker/dsh-chatgpt-subscription 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +93 -38
- package/lib/client.js +2126 -1693
- package/lib/client.js.map +1 -1
- package/lib/index.js +7588 -2772
- 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/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,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire contracts between the Claude subscription host routes and the browser
|
|
3
|
+
* settings card. Everything here is public: NO CREDENTIAL EVER CROSSES THIS
|
|
4
|
+
* BOUNDARY, and no shape below has a field a token could live in.
|
|
5
|
+
*
|
|
6
|
+
* ---------------------------------------------------------------------------
|
|
7
|
+
* THE ONE RULE THIS FILE OBEYS, AND WHY IT IS NOT NEGOTIABLE
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
*
|
|
10
|
+
* **Nothing in this file may resolve a module under 'src/host/'.** Not a value
|
|
11
|
+
* import, not an `import type`, not an `export type … from`.
|
|
12
|
+
*
|
|
13
|
+
* This file is compiled by TWO projects with different worlds:
|
|
14
|
+
*
|
|
15
|
+
* - the host project ('tsconfig.host.json'): Node types, and 'src/host/**' in
|
|
16
|
+
* its include list;
|
|
17
|
+
* - the client project ('tsconfig.client.json'): NO 'types' at all, and
|
|
18
|
+
* 'src/host/**' deliberately absent from its include list.
|
|
19
|
+
*
|
|
20
|
+
* The second one is the constraint. A type-only import is ERASED for emit but
|
|
21
|
+
* still RESOLVED for checking, so a single `import type` of
|
|
22
|
+
* '../host/claude/account-pool.ts' from here pulls that whole subtree —
|
|
23
|
+
* node:path, node:fs, node:http, node:crypto — into the client program. It does
|
|
24
|
+
* not degrade quietly; it fails the build:
|
|
25
|
+
*
|
|
26
|
+
* src/host/claude/account-pool.ts(104,18): error TS2307:
|
|
27
|
+
* Cannot find module 'node:path' or its corresponding type declarations.
|
|
28
|
+
* src/host/claude/account-pool.ts(105,28): error TS6307:
|
|
29
|
+
* File '…/src/host/common/home.ts' is not listed within the file list of
|
|
30
|
+
* project '…/tsconfig.client.json'.
|
|
31
|
+
*
|
|
32
|
+
* That was measured, not assumed: `npx tsc -p tsconfig.client.json` exits 0
|
|
33
|
+
* with this file absent and exits 2 with a single type-only host re-export in
|
|
34
|
+
* it. So the boundary is a property of the build, and this file is on the public
|
|
35
|
+
* side of it.
|
|
36
|
+
*
|
|
37
|
+
* ---------------------------------------------------------------------------
|
|
38
|
+
* THE TWO CONSEQUENCES, STATED PLAINLY RATHER THAN HIDDEN
|
|
39
|
+
* ---------------------------------------------------------------------------
|
|
40
|
+
*
|
|
41
|
+
* 1. {@link ClaudeAccountSummaryDto} is DECLARED here rather than re-exported
|
|
42
|
+
* from 'src/host/claude/account-pool.ts', which is where the pool chunk put
|
|
43
|
+
* it. A re-export is what this file would prefer — and it is what the task
|
|
44
|
+
* asked for — but it cannot compile, for the reason above.
|
|
45
|
+
*
|
|
46
|
+
* The drift that risks is closed from the OTHER side instead:
|
|
47
|
+
* 'src/host/claude/routes.ts' imports BOTH declarations and carries a
|
|
48
|
+
* compile-time assertion that each is assignable to the other. Adding a field
|
|
49
|
+
* to the pool's copy without adding it here is therefore a build failure in
|
|
50
|
+
* `npx tsc -p tsconfig.host.json` — the same protection a re-export would
|
|
51
|
+
* have given, minus the impossible direction.
|
|
52
|
+
*
|
|
53
|
+
* 2. {@link CLAUDE_REASONING_EFFORTS} cannot be DERIVED from the catalog's
|
|
54
|
+
* ladders by an indexed access, for the same reason. It is a literal, and the
|
|
55
|
+
* equivalence between it and the catalog is asserted at the bottom of
|
|
56
|
+
* 'src/host/claude/routes.ts' — against the real `CLAUDE_MODELS` table, in
|
|
57
|
+
* the project that can read it. Adding a level to a catalog ladder without
|
|
58
|
+
* adding it here stops the host typecheck, so the card cannot silently omit a
|
|
59
|
+
* level the wire would accept.
|
|
60
|
+
*
|
|
61
|
+
* Both assertions live in the host project because that is the only project that
|
|
62
|
+
* can see both sides. Neither is documentation: each is a line of TypeScript
|
|
63
|
+
* whose deletion is the only way to make it stop working.
|
|
64
|
+
*/
|
|
65
|
+
import type { AccountPoolStatusDto, AccountRotationStrategy, PoolAccountSummaryDto } from './account-pool-contracts.ts';
|
|
66
|
+
/**
|
|
67
|
+
* How a model wants its thinking block shaped on the wire.
|
|
68
|
+
*
|
|
69
|
+
* Restated here rather than indexed off `ClaudeModelEntry` — see the module
|
|
70
|
+
* comment. These four are not a quality ordering: 'mid-convo' and 'adaptive' are
|
|
71
|
+
* different wire SHAPES, and the first is checked before every other branch
|
|
72
|
+
* because a managed-effort model needs `block_binding` and `output_config`
|
|
73
|
+
* or it answers with persistent 400s.
|
|
74
|
+
*
|
|
75
|
+
* The equivalence with the catalog's own `thinkingMode` field is asserted in
|
|
76
|
+
* 'src/host/claude/routes.ts'.
|
|
77
|
+
*/
|
|
78
|
+
export type ClaudeThinkingMode = 'mid-convo' | 'adaptive' | 'budget' | 'none';
|
|
79
|
+
/**
|
|
80
|
+
* Every thinking level this route can name, in escalating order.
|
|
81
|
+
*
|
|
82
|
+
* The union of the whole shipped catalog rather than one model's ladder: these
|
|
83
|
+
* are WIRE effort values, already collapsed by the upstream reference mapping
|
|
84
|
+
* the frozen catalog transcribes ('minimal' and 'low' both send 'low', so
|
|
85
|
+
* offering both would advertise a distinction the wire cannot make). The card
|
|
86
|
+
* offers them as default-effort choices and narrows the dropdown per model with
|
|
87
|
+
* {@link ClaudeModelOption.reasoningEfforts}.
|
|
88
|
+
*
|
|
89
|
+
* 'off' is deliberately absent, exactly as it is from every ladder in the
|
|
90
|
+
* catalog: turning thinking off is the ABSENCE of a thinking block rather than
|
|
91
|
+
* an effort level, and whether a model permits it is stated separately in
|
|
92
|
+
* {@link ClaudeModelOption.canDisableThinking}.
|
|
93
|
+
*
|
|
94
|
+
* NOT derived from the catalog by an indexed access — the client project cannot
|
|
95
|
+
* read that module. The equivalence is asserted against the real table in
|
|
96
|
+
* 'src/host/claude/routes.ts'; see the module comment.
|
|
97
|
+
*/
|
|
98
|
+
export declare const CLAUDE_REASONING_EFFORTS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
99
|
+
/** One selectable thinking level. */
|
|
100
|
+
export type ClaudeReasoningEffort = (typeof CLAUDE_REASONING_EFFORTS)[number];
|
|
101
|
+
/**
|
|
102
|
+
* Whether a posted value is one of the levels this route can name.
|
|
103
|
+
*
|
|
104
|
+
* The membership test every settings route in this plugin performs against its
|
|
105
|
+
* own constant, so a level no ladder carries is refused at the wire boundary
|
|
106
|
+
* instead of being persisted and converged later.
|
|
107
|
+
*/
|
|
108
|
+
export declare function isClaudeReasoningEffort(value: unknown): value is ClaudeReasoningEffort;
|
|
109
|
+
/** One model offered by the Claude subscription route. */
|
|
110
|
+
export interface ClaudeModelOption {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
/** Enabled models are the ones DSH offers in the conversation model picker. */
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
/** Context window this route assumes when the card saves no override. */
|
|
116
|
+
defaultContextWindow: number;
|
|
117
|
+
/** Effective context window: the override when one is saved, else the default. */
|
|
118
|
+
contextWindow: number;
|
|
119
|
+
/** Maximum output tokens this route requests when a caller omits one. */
|
|
120
|
+
defaultMaxTokens: number;
|
|
121
|
+
/** Thinking levels this model exposes; empty for a model that takes none. */
|
|
122
|
+
reasoningEfforts: string[];
|
|
123
|
+
/**
|
|
124
|
+
* Whether thinking can be turned off for this model.
|
|
125
|
+
*
|
|
126
|
+
* Reported because it is NOT derivable from {@link reasoningEfforts}: a model
|
|
127
|
+
* the catalog maps `off: null` has a full ladder and still refuses to stop
|
|
128
|
+
* thinking, and a card that offered the switch anyway would send a request the
|
|
129
|
+
* wire rejects.
|
|
130
|
+
*/
|
|
131
|
+
canDisableThinking: boolean;
|
|
132
|
+
/** Which thinking form this model needs; see {@link ClaudeThinkingMode}. */
|
|
133
|
+
thinkingMode: ClaudeThinkingMode;
|
|
134
|
+
/** Whether the model accepts image input on this route. */
|
|
135
|
+
supportsImage: boolean;
|
|
136
|
+
/** Whether the model accepts a `temperature` at all. */
|
|
137
|
+
supportsTemperature: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* One quota window, as the usage endpoint or the response headers stated it.
|
|
141
|
+
*
|
|
142
|
+
* The three numeric fields are null TOGETHER: null means "the source did not
|
|
143
|
+
* say", which is a different statement from 0. A card that rendered null as 0
|
|
144
|
+
* would show "nothing used" for a window nobody measured.
|
|
145
|
+
*/
|
|
146
|
+
export interface ClaudeQuotaWindow {
|
|
147
|
+
/** Wire key: `five_hour`, `seven_day`, `seven_day_sonnet`. */
|
|
148
|
+
id: string;
|
|
149
|
+
label: string;
|
|
150
|
+
/** Nominal length of the window in minutes, or null when unknown. */
|
|
151
|
+
windowMinutes: number | null;
|
|
152
|
+
/** Fraction of the window consumed, 0-1. */
|
|
153
|
+
usedFraction: number | null;
|
|
154
|
+
/** The same number as a percent, 0-100. */
|
|
155
|
+
usedPercent: number | null;
|
|
156
|
+
/** Percent still available, 0-100. */
|
|
157
|
+
remainingPercent: number | null;
|
|
158
|
+
/** ISO 8601 instant the window resets, or null. */
|
|
159
|
+
resetsAt: string | null;
|
|
160
|
+
/** Which source these numbers came from, for the card's footnote. */
|
|
161
|
+
source: 'usage' | 'headers';
|
|
162
|
+
}
|
|
163
|
+
/** One credit / usage meter the account carries beside its windows. */
|
|
164
|
+
export interface ClaudeMeter {
|
|
165
|
+
id: string;
|
|
166
|
+
label: string;
|
|
167
|
+
/** Percent of the allowance consumed, 0-100. Null when the source said nothing. */
|
|
168
|
+
usedPercent: number | null;
|
|
169
|
+
/** Percent still available, 0-100. Null when the source said nothing. */
|
|
170
|
+
remainingPercent: number | null;
|
|
171
|
+
/** Monthly limit, in the account's own unit, when stated. */
|
|
172
|
+
limit: number | null;
|
|
173
|
+
/** Amount consumed, in the same unit, when stated. */
|
|
174
|
+
used: number | null;
|
|
175
|
+
/** Whether this meter is switched on for the account. */
|
|
176
|
+
enabled: boolean;
|
|
177
|
+
}
|
|
178
|
+
/** One point-in-time quota snapshot for the account the card displays. */
|
|
179
|
+
export interface ClaudeAccountQuota {
|
|
180
|
+
/** Every window the account currently has, shortest first. */
|
|
181
|
+
windows: ClaudeQuotaWindow[];
|
|
182
|
+
/** Pay-as-you-go overage pool, when the account has one. */
|
|
183
|
+
extraUsage: ClaudeMeter | null;
|
|
184
|
+
/** Unix milliseconds of the last successful FULL usage read; null if none. */
|
|
185
|
+
fetchedAt: number | null;
|
|
186
|
+
/** Unix milliseconds of the most recent update from any source. */
|
|
187
|
+
observedAt: number;
|
|
188
|
+
/** Unified rate-limit verdict the headers last reported, when they did. */
|
|
189
|
+
status: string | null;
|
|
190
|
+
/** Window the headers last named as representative, when they did. */
|
|
191
|
+
representativeClaim: string | null;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Account identity as the settings card renders it.
|
|
195
|
+
*
|
|
196
|
+
* There is no bearer field and no token: the identity this line can state from a
|
|
197
|
+
* credential alone is exactly what the exchange reported — an address and a tier
|
|
198
|
+
* — and everything else the card shows about WHO is signed in comes from the
|
|
199
|
+
* account list.
|
|
200
|
+
*/
|
|
201
|
+
export interface ClaudeAccount {
|
|
202
|
+
/** Address the sign-in reported, when it reported one. */
|
|
203
|
+
email: string | null;
|
|
204
|
+
/** Subscription tier the exchange reported, verbatim ('max', 'pro', …). */
|
|
205
|
+
subscriptionType: string | null;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* One Claude account as the shared pool card renders it. Never carries a token.
|
|
209
|
+
*
|
|
210
|
+
* DECLARED here rather than re-exported from 'src/host/claude/account-pool.ts';
|
|
211
|
+
* see the module comment for the measured reason. The two are kept identical by
|
|
212
|
+
* the compile-time assertion in 'src/host/claude/routes.ts'.
|
|
213
|
+
*/
|
|
214
|
+
export interface ClaudeAccountSummaryDto extends PoolAccountSummaryDto {
|
|
215
|
+
/** Where the credential came from; a card offers different actions per source. */
|
|
216
|
+
source?: 'managed' | 'claude-code';
|
|
217
|
+
/** Whether this row is a snapshot borrowed from a local Claude Code sign-in. */
|
|
218
|
+
adopted?: boolean;
|
|
219
|
+
/** The Claude Code file an adopted snapshot was read from. */
|
|
220
|
+
sourcePath?: string;
|
|
221
|
+
/** Subscription tier, from the credential itself. */
|
|
222
|
+
subscriptionType?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Everything the settings card and the composer badge render. */
|
|
225
|
+
export interface ClaudeWebStatus extends Partial<AccountPoolStatusDto> {
|
|
226
|
+
enabled?: boolean;
|
|
227
|
+
authenticated: boolean;
|
|
228
|
+
hasCredentials: boolean;
|
|
229
|
+
/** Storage description for this line's encrypted credential store. */
|
|
230
|
+
storagePath: string;
|
|
231
|
+
/** Whether this plugin currently owns the provider route. */
|
|
232
|
+
serving: boolean;
|
|
233
|
+
/** Diagnostic when another adapter family owns the provider route. */
|
|
234
|
+
conflict: string | null;
|
|
235
|
+
/**
|
|
236
|
+
* Whether a local Claude Code sign-in exists to offer for adoption.
|
|
237
|
+
*
|
|
238
|
+
* Answered by a stat and NOT by a read (see 'src/host/claude/adopt.ts'), so
|
|
239
|
+
* the card can offer the import before anything has been read from the file.
|
|
240
|
+
*/
|
|
241
|
+
claudeCodeSignInAvailable: boolean;
|
|
242
|
+
/** Paths the adoption reader consulted, whether or not each existed. */
|
|
243
|
+
claudeCodePaths: string[];
|
|
244
|
+
/** Account the displayed credential belongs to. */
|
|
245
|
+
account: ClaudeAccount | null;
|
|
246
|
+
quota: ClaudeAccountQuota | null;
|
|
247
|
+
lastFetchedAt: number | null;
|
|
248
|
+
/**
|
|
249
|
+
* Whether a quota refresh is running behind this answer.
|
|
250
|
+
*
|
|
251
|
+
* The card renders the snapshot it already had instead of waiting on the
|
|
252
|
+
* upstream request; when this is true the client asks again shortly so the
|
|
253
|
+
* refreshed snapshot reaches the UI.
|
|
254
|
+
*/
|
|
255
|
+
quotaRefreshing?: boolean;
|
|
256
|
+
/** Why the last quota read failed, when it did. Reported BESIDE the snapshot. */
|
|
257
|
+
quotaError?: string | null;
|
|
258
|
+
models: ClaudeModelOption[];
|
|
259
|
+
contextWindowOverrides: Record<string, number>;
|
|
260
|
+
defaultReasoningEffort: ClaudeReasoningEffort | null;
|
|
261
|
+
/** Account selected for catalog, quota and all requests; null means automatic. */
|
|
262
|
+
selectedAccountId: string | null;
|
|
263
|
+
/** Signed-in accounts; empty or absent when no pool is installed. */
|
|
264
|
+
accounts?: ClaudeAccountSummaryDto[];
|
|
265
|
+
/** Account the next request would use. */
|
|
266
|
+
activeAccountId?: string;
|
|
267
|
+
rotationStrategy?: AccountRotationStrategy;
|
|
268
|
+
}
|
|
269
|
+
/** Patch accepted by the models/settings route. */
|
|
270
|
+
export interface ClaudeSettingsUpdateDto {
|
|
271
|
+
enabled?: boolean;
|
|
272
|
+
enabledModelIds?: string[];
|
|
273
|
+
/** A number sets an override for that model; `null` restores the default. */
|
|
274
|
+
contextWindowOverrides?: Record<string, number | null>;
|
|
275
|
+
defaultReasoningEffort?: ClaudeReasoningEffort | null;
|
|
276
|
+
selectedAccountId?: string | null;
|
|
277
|
+
}
|
|
278
|
+
/** One account-pool action the card can post. */
|
|
279
|
+
export type ClaudeAccountAction = 'set-primary' | 'set-alias' | 'delete' | 'clear-cooldown' | 'clear-auth-failed' | 'relogin' | 'strategy';
|
|
280
|
+
/** Body accepted by the accounts route. */
|
|
281
|
+
export interface ClaudeAccountActionDto {
|
|
282
|
+
action: ClaudeAccountAction;
|
|
283
|
+
accountId?: string;
|
|
284
|
+
alias?: string;
|
|
285
|
+
strategy?: AccountRotationStrategy;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Result of an explicit connection test.
|
|
289
|
+
*
|
|
290
|
+
* A failure is a VALUE rather than a thrown error, because the card's whole job
|
|
291
|
+
* here is to render the reason: a probe that was refused is a fact about the
|
|
292
|
+
* credential, not a failed request.
|
|
293
|
+
*/
|
|
294
|
+
export interface ClaudeConnectionDto {
|
|
295
|
+
connected: boolean;
|
|
296
|
+
/** Model the probe asked for. */
|
|
297
|
+
model: string;
|
|
298
|
+
/** Round-trip time of the probe request, in milliseconds. */
|
|
299
|
+
latencyMs: number;
|
|
300
|
+
/** HTTP status the probe received; 0 when no response arrived at all. */
|
|
301
|
+
status: number;
|
|
302
|
+
/** Why the probe did not connect, when it did not. */
|
|
303
|
+
error: string | null;
|
|
304
|
+
/** Whether repeating the same probe could succeed. */
|
|
305
|
+
retryable: boolean;
|
|
306
|
+
/** `stop_reason` of the one-token answer, when one arrived. */
|
|
307
|
+
stopReason: string | null;
|
|
308
|
+
checkedAt: number;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Live state of the sign-in flow the card polls.
|
|
312
|
+
*
|
|
313
|
+
* This restates 'src/host/claude/oauth.ts''s `LoginFlowStatus` field for field,
|
|
314
|
+
* and the restatement is deliberate rather than lazy: that object is serialized
|
|
315
|
+
* straight into the HTTP response, and its own comment records that no secret
|
|
316
|
+
* has a field to live in. Renaming a field here cannot leak anything — the host
|
|
317
|
+
* serializes its own object — but it CAN make the card read a field the host
|
|
318
|
+
* never sends, so the two are kept in step by eye and by the tests that drive
|
|
319
|
+
* the real flow.
|
|
320
|
+
*/
|
|
321
|
+
export interface ClaudeLoginFlowDto {
|
|
322
|
+
status: 'idle' | 'pending' | 'exchanging' | 'complete' | 'error';
|
|
323
|
+
/** Correlates a status reading with the flow the user started. */
|
|
324
|
+
flowId?: string;
|
|
325
|
+
/** Not a secret: it is the value that goes INTO the browser. */
|
|
326
|
+
authUrl?: string;
|
|
327
|
+
mode?: 'manual' | 'loopback';
|
|
328
|
+
/** Which redirect URI is armed, for the card to display. */
|
|
329
|
+
redirectUri?: string;
|
|
330
|
+
hint?: string;
|
|
331
|
+
error?: string;
|
|
332
|
+
/** Why a loopback attempt degraded to manual. */
|
|
333
|
+
fallbackReason?: string;
|
|
334
|
+
createdAt?: number;
|
|
335
|
+
completedAt?: number;
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=claude-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-contracts.d.ts","sourceRoot":"","sources":["../../../src/shared/claude-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,K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AAE,MAAM,CAAA;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ModelDirectoryState } from '@deepseek-ai/dsh-client-ui-model-selection/client';
|
|
2
|
-
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
-
import type { ZhipuWebStatus } from '../../shared/zhipu-contracts.ts';
|
|
4
|
-
import type { SnapshotStore } from '../store.ts';
|
|
5
|
-
import { NS_ZHIPU } from './locales.ts';
|
|
6
|
-
type Props = PropsRuntime<'conversation.input.right'> & PropsLocale<typeof NS_ZHIPU> & {
|
|
7
|
-
directory: SnapshotStore<ModelDirectoryState>;
|
|
8
|
-
loadModelDirectory: () => void;
|
|
9
|
-
};
|
|
10
|
-
interface BadgeFacts {
|
|
11
|
-
text: string;
|
|
12
|
-
tooltip: string;
|
|
13
|
-
level: 'normal' | 'warning' | 'danger';
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Pick the most meaningful number for the badge.
|
|
17
|
-
*
|
|
18
|
-
* A Coding Plan is bounded by two windows at once, and the one closer to
|
|
19
|
-
* exhaustion is what the user needs to see: the 5-hour window can be spent
|
|
20
|
-
* while the weekly one has room, and the reverse. So the tightest *remaining*
|
|
21
|
-
* fraction wins, and its window names the tooltip.
|
|
22
|
-
*/
|
|
23
|
-
export declare function selectBadgeFacts(status: ZhipuWebStatus | null): BadgeFacts | null;
|
|
24
|
-
export declare function ZhipuComposerQuota({ directory, loadModelDirectory }: Props): React.JSX.Element | null;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=ZhipuComposerQuota.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZhipuComposerQuota.d.ts","sourceRoot":"","sources":["../../../../src/client/zhipu/ZhipuComposerQuota.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAA;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAmBvC,KAAK,KAAK,GAAG,YAAY,CAAC,0BAA0B,CAAC,GACnD,WAAW,CAAC,OAAO,QAAQ,CAAC,GAAG;IAC7B,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAA;IAC7C,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,CAAA;AAEH,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;CACvC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAuBjF;AAED,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAgErG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZhipuSection.d.ts","sourceRoot":"","sources":["../../../../src/client/zhipu/ZhipuS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