dsh-keys-manager 0.2.5 → 0.2.8
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 +55 -0
- package/README.md +220 -233
- package/README.zh-CN.md +143 -126
- package/lib/client/format.d.ts +29 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +10 -2
- package/lib/client.js +222 -7
- package/lib/domain.d.ts +30 -5
- package/lib/index.d.ts +44 -5
- package/lib/index.js +232 -84
- package/lib/index.js.map +1 -1
- package/lib/quota/cache.d.ts +61 -0
- package/lib/quota/cache.js +88 -0
- package/lib/quota/cache.js.map +1 -0
- package/lib/quota/fetch.d.ts +33 -0
- package/lib/quota/fetch.js +36 -0
- package/lib/quota/fetch.js.map +1 -0
- package/lib/quota/model.d.ts +56 -0
- package/lib/quota/model.js +62 -0
- package/lib/quota/model.js.map +1 -0
- package/lib/quota/providers.d.ts +48 -0
- package/lib/quota/providers.js +364 -0
- package/lib/quota/providers.js.map +1 -0
- package/locale/en.json +10 -1
- package/locale/zh.json +10 -1
- package/package.json +15 -15
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor usage endpoints, one probe per route id.
|
|
3
|
+
*
|
|
4
|
+
* Probes are deliberately lenient: private endpoints drift, fields come back
|
|
5
|
+
* missing or under aliases, and a card must degrade to `absent`/`error`
|
|
6
|
+
* instead of throwing. This release ships Claude, Codex, Z.AI, Kimi, MiniMax
|
|
7
|
+
* and OpenCode Go; any other route id has no probe and resolves to `absent`,
|
|
8
|
+
* never to a guessed endpoint. Nothing here writes cooldown or failure state.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-keys-manager/quota/providers
|
|
11
|
+
*/
|
|
12
|
+
import { readQuotaJson } from './fetch.js';
|
|
13
|
+
import { fractionFromUsed, resetFrom } from './model.js';
|
|
14
|
+
const CLAUDE_USAGE_URL = 'https://api.anthropic.com/api/oauth/usage';
|
|
15
|
+
const CLAUDE_BETA_HEADER = 'oauth-2025-04-20';
|
|
16
|
+
const CODEX_USAGE_URL = 'https://chatgpt.com/backend-api/wham/usage';
|
|
17
|
+
const ZAI_QUOTA_URL = 'https://api.z.ai/api/monitor/usage/quota/limit';
|
|
18
|
+
const KIMI_USAGE_URL = 'https://api.kimi.com/coding/v1/usages';
|
|
19
|
+
const MINIMAX_QUOTA_URL = 'https://api.minimax.io/v1/api/openplatform/coding_plan/remains';
|
|
20
|
+
const OPENCODE_GO_USAGE_URL = 'https://opencode.ai/zen/go/v1/usage';
|
|
21
|
+
/** A window longer than three days is the weekly pool; the short one is the session. */
|
|
22
|
+
const WEEK_SECONDS_THRESHOLD = 3 * 24 * 60 * 60;
|
|
23
|
+
function asRecord(value) {
|
|
24
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
25
|
+
? value
|
|
26
|
+
: undefined;
|
|
27
|
+
}
|
|
28
|
+
/** Numbers arrive as numbers or numeric strings depending on the endpoint. */
|
|
29
|
+
function toNumber(value) {
|
|
30
|
+
if (typeof value === 'number')
|
|
31
|
+
return Number.isFinite(value) ? value : undefined;
|
|
32
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build the snapshot from a classified read. An extraction returns either the
|
|
40
|
+
* windows or a reason string; an empty result is a parse failure, never an
|
|
41
|
+
* "ok" with zero windows.
|
|
42
|
+
*/
|
|
43
|
+
function snapshotFromRead(read, extract) {
|
|
44
|
+
const fetchedAt = Date.now();
|
|
45
|
+
if (!read.ok)
|
|
46
|
+
return { status: read.status, fetchedAt, windows: [], reason: read.reason };
|
|
47
|
+
const extracted = extract(read.body);
|
|
48
|
+
if (typeof extracted === 'string') {
|
|
49
|
+
return { status: 'error', fetchedAt, windows: [], reason: extracted };
|
|
50
|
+
}
|
|
51
|
+
if (extracted.length === 0) {
|
|
52
|
+
return { status: 'error', fetchedAt, windows: [], reason: 'unrecognized usage payload' };
|
|
53
|
+
}
|
|
54
|
+
return { status: 'ok', fetchedAt, windows: extracted };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Lenient reset-time read across aliases: ISO strings, numeric strings, epoch
|
|
58
|
+
* seconds or epoch milliseconds (the fallback covers count-less payloads).
|
|
59
|
+
*/
|
|
60
|
+
function resetOf(row, keys) {
|
|
61
|
+
for (const key of keys) {
|
|
62
|
+
const value = row[key];
|
|
63
|
+
const direct = resetFrom(value);
|
|
64
|
+
if (direct !== undefined)
|
|
65
|
+
return direct;
|
|
66
|
+
const numeric = toNumber(value);
|
|
67
|
+
if (numeric !== undefined)
|
|
68
|
+
return resetFrom(numeric);
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/** Used fraction from a used/limit counter pair; `undefined` when unusable. */
|
|
73
|
+
function fractionFromCounts(used, limit) {
|
|
74
|
+
// A negative used count (remaining above the limit) is not "0% used": drop
|
|
75
|
+
// the window instead of rendering a fake empty bar.
|
|
76
|
+
if (used === undefined || limit === undefined || limit <= 0 || used < 0)
|
|
77
|
+
return undefined;
|
|
78
|
+
return Math.min(1, used / limit);
|
|
79
|
+
}
|
|
80
|
+
/** A span under a day is the session window; longer spans are the weekly pool. */
|
|
81
|
+
const SESSION_MAX_MS = 24 * 60 * 60 * 1000;
|
|
82
|
+
function windowIdForSpan(spanMs) {
|
|
83
|
+
return spanMs < SESSION_MAX_MS ? 'session' : 'week';
|
|
84
|
+
}
|
|
85
|
+
/** Window span in milliseconds from a `duration` + unit pair (hours/days/weeks). */
|
|
86
|
+
function spanFromDuration(duration, unit) {
|
|
87
|
+
if (duration === undefined || unit.length === 0)
|
|
88
|
+
return undefined;
|
|
89
|
+
const upper = unit.toUpperCase();
|
|
90
|
+
if (upper.includes('MINUTE'))
|
|
91
|
+
return duration * 60_000;
|
|
92
|
+
if (upper.includes('HOUR'))
|
|
93
|
+
return duration * 3_600_000;
|
|
94
|
+
if (upper.includes('DAY'))
|
|
95
|
+
return duration * 86_400_000;
|
|
96
|
+
if (upper.includes('WEEK'))
|
|
97
|
+
return duration * 7 * 86_400_000;
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/** Keep the most-binding window per id: several model buckets share one plan quota. */
|
|
101
|
+
function tighterWindow(current, next) {
|
|
102
|
+
return current === undefined || next.usedFraction > current.usedFraction ? next : current;
|
|
103
|
+
}
|
|
104
|
+
/** Claude OAuth plan usage: `five_hour` is the session, `seven_day` the week. */
|
|
105
|
+
export const claudeQuotaProbe = async ({ token, signal, fetch }) => {
|
|
106
|
+
const read = await readQuotaJson(CLAUDE_USAGE_URL, { Authorization: `Bearer ${token}`, 'anthropic-beta': CLAUDE_BETA_HEADER }, { fetch, signal });
|
|
107
|
+
return snapshotFromRead(read, (body) => {
|
|
108
|
+
const windows = [];
|
|
109
|
+
const add = (raw, id) => {
|
|
110
|
+
const row = asRecord(raw);
|
|
111
|
+
if (row === undefined)
|
|
112
|
+
return;
|
|
113
|
+
// Anthropic reports USED percent, so the inversion lives in the normalizer.
|
|
114
|
+
const usedPercent = toNumber(row.utilization);
|
|
115
|
+
const usedFraction = usedPercent === undefined ? undefined : fractionFromUsed(usedPercent);
|
|
116
|
+
const resetsAt = resetFrom(row.resets_at ?? row.reset_at ?? row.resetsAt ?? row.resetAt);
|
|
117
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
118
|
+
return;
|
|
119
|
+
windows.push({ id, usedFraction, resetsAt });
|
|
120
|
+
};
|
|
121
|
+
add(body.five_hour, 'session');
|
|
122
|
+
add(body.seven_day, 'week');
|
|
123
|
+
return windows;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
/** Codex / ChatGPT plan usage: primary and secondary windows, classified by duration. */
|
|
127
|
+
export const codexQuotaProbe = async ({ token, accountId, signal, fetch }) => {
|
|
128
|
+
const headers = { Authorization: `Bearer ${token}` };
|
|
129
|
+
if (accountId !== undefined && accountId.length > 0)
|
|
130
|
+
headers['chatgpt-account-id'] = accountId;
|
|
131
|
+
const read = await readQuotaJson(CODEX_USAGE_URL, headers, { fetch, signal });
|
|
132
|
+
return snapshotFromRead(read, (body) => {
|
|
133
|
+
const rateLimit = asRecord(body.rate_limit) ?? asRecord(body.rateLimit) ?? {};
|
|
134
|
+
// Both slots can describe the same window (a 5h primary and a 5h
|
|
135
|
+
// secondary), so collapse repeated ids and keep the tighter one.
|
|
136
|
+
const windows = new Map();
|
|
137
|
+
const add = (raw, fallback) => {
|
|
138
|
+
const row = asRecord(raw);
|
|
139
|
+
if (row === undefined)
|
|
140
|
+
return;
|
|
141
|
+
const usedPercent = toNumber(row.used_percent ?? row.usedPercent);
|
|
142
|
+
const usedFraction = usedPercent === undefined ? undefined : fractionFromUsed(usedPercent);
|
|
143
|
+
const resetsAt = resetFrom(row.reset_at ?? row.resets_at ?? row.resetAt ?? row.resetsAt) ??
|
|
144
|
+
resetAfterSeconds(toNumber(row.reset_after_seconds ?? row.resetAfterSeconds));
|
|
145
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
146
|
+
return;
|
|
147
|
+
const seconds = toNumber(row.limit_window_seconds ?? row.limitWindowSeconds);
|
|
148
|
+
const id = seconds === undefined ? fallback : seconds >= WEEK_SECONDS_THRESHOLD ? 'week' : 'session';
|
|
149
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
150
|
+
};
|
|
151
|
+
add(rateLimit.primary_window, 'session');
|
|
152
|
+
add(rateLimit.secondary_window, 'week');
|
|
153
|
+
return [...windows.values()];
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
function resetAfterSeconds(seconds) {
|
|
157
|
+
return seconds === undefined || seconds <= 0 ? undefined : Date.now() + seconds * 1000;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Z.AI / Zhipu GLM coding-plan quota. The key is sent verbatim, with no
|
|
161
|
+
* `Bearer` prefix, and `percentage` is USED percent. `unit` 3 = hours,
|
|
162
|
+
* 4 = days, 5 = months, 6 = weeks; `TIME_LIMIT` buckets only map when their
|
|
163
|
+
* unit says hours or weeks (the monthly MCP-call quota stays unmapped).
|
|
164
|
+
*/
|
|
165
|
+
export const zaiQuotaProbe = async ({ token, signal, fetch }) => {
|
|
166
|
+
const read = await readQuotaJson(ZAI_QUOTA_URL, { Authorization: token, 'Content-Type': 'application/json' }, { fetch, signal });
|
|
167
|
+
return snapshotFromRead(read, (body) => {
|
|
168
|
+
if (body.success === false)
|
|
169
|
+
return 'usage request rejected';
|
|
170
|
+
const data = asRecord(body.data) ?? {};
|
|
171
|
+
const limits = Array.isArray(data.limits) ? data.limits : [];
|
|
172
|
+
const windows = new Map();
|
|
173
|
+
for (const raw of limits) {
|
|
174
|
+
const row = asRecord(raw);
|
|
175
|
+
if (row === undefined)
|
|
176
|
+
continue;
|
|
177
|
+
const unit = toNumber(row.unit);
|
|
178
|
+
const id = unit === 3 ? 'session' : unit === 6 ? 'week' : undefined;
|
|
179
|
+
if (id === undefined)
|
|
180
|
+
continue;
|
|
181
|
+
// `percentage` is a server-rounded integer; the counters are exact.
|
|
182
|
+
// A present-but-invalid counter pair (negative spend) drops the window
|
|
183
|
+
// instead of falling back to the rounded percentage — only a MISSING
|
|
184
|
+
// field may fall back.
|
|
185
|
+
const spent = toNumber(row.currentValue);
|
|
186
|
+
const usedFraction = spent !== undefined
|
|
187
|
+
? fractionFromCounts(spent, toNumber(row.usage))
|
|
188
|
+
: fractionFromUsed(toNumber(row.percentage) ?? Number.NaN);
|
|
189
|
+
const resetsAt = resetOf(row, ['nextResetTime', 'next_reset_time']);
|
|
190
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
191
|
+
continue;
|
|
192
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
193
|
+
}
|
|
194
|
+
return [...windows.values()];
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Kimi Code quota: the aggregate `usage` object is the weekly window, each
|
|
199
|
+
* `limits[]` row is classified by its `window.duration` + `time_unit`.
|
|
200
|
+
* Numbers arrive as strings.
|
|
201
|
+
*/
|
|
202
|
+
export const kimiQuotaProbe = async ({ token, signal, fetch }) => {
|
|
203
|
+
const read = await readQuotaJson(KIMI_USAGE_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
204
|
+
return snapshotFromRead(read, (body) => {
|
|
205
|
+
const windows = new Map();
|
|
206
|
+
const add = (usedFraction, resetsAt, id) => {
|
|
207
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
208
|
+
return;
|
|
209
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
210
|
+
};
|
|
211
|
+
const usage = asRecord(body.usage);
|
|
212
|
+
if (usage !== undefined) {
|
|
213
|
+
const limit = toNumber(usage.limit);
|
|
214
|
+
const used = toNumber(usage.used) ??
|
|
215
|
+
(toNumber(usage.remaining) !== undefined && limit !== undefined
|
|
216
|
+
? limit - toNumber(usage.remaining)
|
|
217
|
+
: undefined);
|
|
218
|
+
add(fractionFromCounts(used, limit), resetOf(usage, ['resetTime', 'reset_time']), 'week');
|
|
219
|
+
}
|
|
220
|
+
const limits = Array.isArray(body.limits) ? body.limits : [];
|
|
221
|
+
for (const raw of limits) {
|
|
222
|
+
const row = asRecord(raw);
|
|
223
|
+
if (row === undefined)
|
|
224
|
+
continue;
|
|
225
|
+
const window = asRecord(row.window) ?? {};
|
|
226
|
+
const detail = asRecord(row.detail) ?? row;
|
|
227
|
+
const spanMs = spanFromDuration(toNumber(window.duration), String(window.time_unit ?? window.timeUnit ?? ''));
|
|
228
|
+
if (spanMs === undefined)
|
|
229
|
+
continue;
|
|
230
|
+
const limit = toNumber(detail.limit);
|
|
231
|
+
const used = toNumber(detail.used) ??
|
|
232
|
+
(toNumber(detail.remaining) !== undefined && limit !== undefined
|
|
233
|
+
? limit - toNumber(detail.remaining)
|
|
234
|
+
: undefined);
|
|
235
|
+
add(fractionFromCounts(used, limit), resetOf(detail, ['resetTime', 'reset_time']), windowIdForSpan(spanMs));
|
|
236
|
+
}
|
|
237
|
+
return [...windows.values()];
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* MiniMax coding-plan quota. The vendor answers HTTP 200 even for a rejected
|
|
242
|
+
* credential, so `base_resp.status_code` is the real success signal. Plan-wide
|
|
243
|
+
* buckets repeat the same two windows, so the most-binding row wins.
|
|
244
|
+
*/
|
|
245
|
+
export const minimaxQuotaProbe = async ({ token, signal, fetch }) => {
|
|
246
|
+
const read = await readQuotaJson(MINIMAX_QUOTA_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
247
|
+
return snapshotFromRead(read, (body) => {
|
|
248
|
+
const baseResp = asRecord(body.base_resp);
|
|
249
|
+
if (baseResp !== undefined && toNumber(baseResp.status_code) !== 0) {
|
|
250
|
+
return `usage request rejected (${String(baseResp.status_code)})`;
|
|
251
|
+
}
|
|
252
|
+
const rows = Array.isArray(body.model_remains) ? body.model_remains : [];
|
|
253
|
+
const windows = new Map();
|
|
254
|
+
for (const raw of rows) {
|
|
255
|
+
const row = asRecord(raw);
|
|
256
|
+
if (row === undefined)
|
|
257
|
+
continue;
|
|
258
|
+
const add = (id, total, usage, remaining, endTime, remainsTime) => {
|
|
259
|
+
const limit = toNumber(row[total]);
|
|
260
|
+
const used = toNumber(row[usage]);
|
|
261
|
+
const left = toNumber(row[remaining]);
|
|
262
|
+
// The remaining-based fallback is for a MISSING usage counter only: a
|
|
263
|
+
// present-but-negative count is corrupt data, and deriving 0% from it
|
|
264
|
+
// would render a healthy bar for a payload we cannot interpret.
|
|
265
|
+
const usedFraction = used !== undefined
|
|
266
|
+
? fractionFromCounts(used, limit)
|
|
267
|
+
: left !== undefined && limit !== undefined && limit > 0 && left <= limit
|
|
268
|
+
? Math.min(1, 1 - left / limit)
|
|
269
|
+
: undefined;
|
|
270
|
+
const resetsAt = resetOf(row, [endTime]) ?? resetAfterMs(toNumber(row[remainsTime]));
|
|
271
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
272
|
+
return;
|
|
273
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
274
|
+
};
|
|
275
|
+
add('session', 'current_interval_total_count', 'current_interval_usage_count', 'current_interval_remaining_count', 'end_time', 'remains_time');
|
|
276
|
+
add('week', 'current_weekly_total_count', 'current_weekly_usage_count', 'current_weekly_remaining_count', 'weekly_end_time', 'weekly_remains_time');
|
|
277
|
+
}
|
|
278
|
+
return [...windows.values()];
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
/** Relative delays are reported in milliseconds; only positives are usable. */
|
|
282
|
+
function resetAfterMs(ms) {
|
|
283
|
+
return ms === undefined || ms <= 0 ? undefined : Date.now() + ms;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* OpenCode Go quota. `percent` is USED percent, `resetsAt` an ISO stamp, and
|
|
287
|
+
* `status: 'rate-limited'` outranks the percent. The monthly window anchors on
|
|
288
|
+
* the subscription anniversary, so it is deliberately not mapped to `week`.
|
|
289
|
+
*/
|
|
290
|
+
export const opencodeGoQuotaProbe = async ({ token, signal, fetch }) => {
|
|
291
|
+
const read = await readQuotaJson(OPENCODE_GO_USAGE_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
292
|
+
return snapshotFromRead(read, (body) => {
|
|
293
|
+
const usage = asRecord(body.usage) ?? {};
|
|
294
|
+
const windows = [];
|
|
295
|
+
const add = (raw, id) => {
|
|
296
|
+
const row = asRecord(raw);
|
|
297
|
+
if (row === undefined)
|
|
298
|
+
return;
|
|
299
|
+
const rateLimited = row.status === 'rate-limited';
|
|
300
|
+
const usedFraction = rateLimited ? 1 : fractionFromUsed(toNumber(row.percent) ?? Number.NaN);
|
|
301
|
+
const resetsAt = resetOf(row, ['resetsAt', 'resets_at']);
|
|
302
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
303
|
+
return;
|
|
304
|
+
windows.push({ id, usedFraction, resetsAt });
|
|
305
|
+
};
|
|
306
|
+
add(usage.rolling, 'session');
|
|
307
|
+
add(usage.weekly, 'week');
|
|
308
|
+
return windows;
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Route id → probe. The ids are the variants this repo and the Host directory
|
|
313
|
+
* actually use (OAuth catalog ids `anthropic`/`openai-codex`/`kimi-coding`, the
|
|
314
|
+
* seed routes in `src/providers.ts`, the sign-in routes in `src/oauth`).
|
|
315
|
+
* Unknown ids have no entry by design and resolve to `absent`.
|
|
316
|
+
*
|
|
317
|
+
* shortcut: the CN-region routes (`zai-coding-cn`, `minimax-code-cn`) reuse the
|
|
318
|
+
* international endpoints, so a CN key reports `unauthorized`; add per-region
|
|
319
|
+
* base URLs when a CN-hosted account must show quota.
|
|
320
|
+
*/
|
|
321
|
+
const QUOTA_PROBES = Object.freeze({
|
|
322
|
+
claude: claudeQuotaProbe,
|
|
323
|
+
anthropic: claudeQuotaProbe,
|
|
324
|
+
codex: codexQuotaProbe,
|
|
325
|
+
'openai-codex': codexQuotaProbe,
|
|
326
|
+
zai: zaiQuotaProbe,
|
|
327
|
+
'zai-coding-cn': zaiQuotaProbe,
|
|
328
|
+
'zhipu-coding-plan': zaiQuotaProbe,
|
|
329
|
+
kimi: kimiQuotaProbe,
|
|
330
|
+
'kimi-code': kimiQuotaProbe,
|
|
331
|
+
'kimi-coding': kimiQuotaProbe,
|
|
332
|
+
minimax: minimaxQuotaProbe,
|
|
333
|
+
'minimax-code': minimaxQuotaProbe,
|
|
334
|
+
'minimax-code-cn': minimaxQuotaProbe,
|
|
335
|
+
'opencode-go': opencodeGoQuotaProbe,
|
|
336
|
+
});
|
|
337
|
+
/** The probe for a route id, or `undefined` when the provider exposes no usage API. */
|
|
338
|
+
export function quotaProbe(provider) {
|
|
339
|
+
// Own-property check: a plain index would answer `constructor` with a
|
|
340
|
+
// function and hand it back as if it were a probe.
|
|
341
|
+
return Object.hasOwn(QUOTA_PROBES, provider) ? QUOTA_PROBES[provider] : undefined;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Probe one route id, degrading an unknown route to `absent` and a probe that
|
|
345
|
+
* somehow throws to `error`, so callers never handle an exception.
|
|
346
|
+
*/
|
|
347
|
+
export async function resolveQuota(provider, input) {
|
|
348
|
+
const probe = quotaProbe(provider);
|
|
349
|
+
if (probe === undefined) {
|
|
350
|
+
return { status: 'absent', fetchedAt: Date.now(), windows: [], reason: `no quota profile for ${provider}` };
|
|
351
|
+
}
|
|
352
|
+
try {
|
|
353
|
+
return await probe(input);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
return {
|
|
357
|
+
status: 'error',
|
|
358
|
+
fetchedAt: Date.now(),
|
|
359
|
+
windows: [],
|
|
360
|
+
reason: error instanceof Error ? error.message : 'quota probe failed',
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/quota/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAexD,MAAM,gBAAgB,GAAG,2CAA2C,CAAA;AACpE,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AAC7C,MAAM,eAAe,GAAG,4CAA4C,CAAA;AACpE,MAAM,aAAa,GAAG,gDAAgD,CAAA;AACtE,MAAM,cAAc,GAAG,uCAAuC,CAAA;AAC9D,MAAM,iBAAiB,GAAG,gEAAgE,CAAA;AAC1F,MAAM,qBAAqB,GAAG,qCAAqC,CAAA;AAEnE,wFAA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G,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,wBAAwB,QAAQ,EAAE,EAAE,CAAA;IAC7G,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB;SACtE,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/locale/en.json
CHANGED
|
@@ -57,5 +57,14 @@
|
|
|
57
57
|
"transportEmpty": "No transport accounts yet.",
|
|
58
58
|
"signInAgain": "Sign in again",
|
|
59
59
|
"loginPasteHint": "Paste the full URL from your browser address bar, or just the authorization code.",
|
|
60
|
-
"loginReveal": "Show pasted code"
|
|
60
|
+
"loginReveal": "Show pasted code",
|
|
61
|
+
"signingIn": "Signing in…",
|
|
62
|
+
"quotaTitle": "Plan usage",
|
|
63
|
+
"quotaRefreshing": "Refreshing…",
|
|
64
|
+
"quotaChecking": "Checking…",
|
|
65
|
+
"quotaNotReported": "Not reported",
|
|
66
|
+
"quotaSignInAgain": "Sign in again",
|
|
67
|
+
"quotaStale": "Stale",
|
|
68
|
+
"quotaCompactHint": "The tightest plan window across this provider's accounts; expand the card for every account.",
|
|
69
|
+
"quotaBarLabel": "{window} window {percent}% used"
|
|
61
70
|
}
|
package/locale/zh.json
CHANGED
|
@@ -57,5 +57,14 @@
|
|
|
57
57
|
"transportEmpty": "还没有传输账户。",
|
|
58
58
|
"signInAgain": "重新登录",
|
|
59
59
|
"loginPasteHint": "从浏览器地址栏复制完整 URL,或只粘贴授权码。",
|
|
60
|
-
"loginReveal": "显示粘贴的内容"
|
|
60
|
+
"loginReveal": "显示粘贴的内容",
|
|
61
|
+
"signingIn": "正在登录…",
|
|
62
|
+
"quotaTitle": "计划用量",
|
|
63
|
+
"quotaRefreshing": "刷新中…",
|
|
64
|
+
"quotaChecking": "正在检查…",
|
|
65
|
+
"quotaNotReported": "未报告",
|
|
66
|
+
"quotaSignInAgain": "请重新登录",
|
|
67
|
+
"quotaStale": "数据较旧",
|
|
68
|
+
"quotaCompactHint": "该 Provider 各账号中最紧的计划用量窗口;展开卡片查看每个账号。",
|
|
69
|
+
"quotaBarLabel": "{window} 窗口已用 {percent}%"
|
|
61
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-keys-manager",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-key management for DSH providers: sticky per-session round-robin, retry failover, cooldown recovery, and searchable extra providers.",
|
|
6
6
|
"repository": {
|
|
@@ -61,26 +61,26 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
64
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.
|
|
65
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.1-rc.
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-settings-models": "^0.2.1-rc.
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.
|
|
70
|
-
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.
|
|
71
|
-
"@deepseek-ai/dsh-llm": "^0.2.1-rc.
|
|
72
|
-
"@deepseek-ai/dsh-settings": "^0.2.1-rc.
|
|
73
|
-
"@deepseek-ai/dsh-typert-registry": "^0.2.1-rc.
|
|
64
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.1-rc.3",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.3",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "^0.2.1-rc.3",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
|
|
70
|
+
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.3",
|
|
71
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-rc.3",
|
|
72
|
+
"@deepseek-ai/dsh-settings": "^0.2.1-rc.3",
|
|
73
|
+
"@deepseek-ai/dsh-typert-registry": "^0.2.1-rc.3",
|
|
74
74
|
"react": "^18.2.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"dsh-llm-omp-transports": "^0.2.
|
|
77
|
+
"dsh-llm-omp-transports": "^0.2.8"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
81
|
-
"@oh-my-pi/pi-ai": "18.12.
|
|
82
|
-
"@oh-my-pi/pi-catalog": "18.12.
|
|
83
|
-
"@oh-my-pi/pi-utils": "18.12.
|
|
81
|
+
"@oh-my-pi/pi-ai": "18.12.6",
|
|
82
|
+
"@oh-my-pi/pi-catalog": "18.12.6",
|
|
83
|
+
"@oh-my-pi/pi-utils": "18.12.6",
|
|
84
84
|
"@types/node": "^22.20.0",
|
|
85
85
|
"@types/react": "~18.3.31",
|
|
86
86
|
"esbuild": "^0.28.2",
|