dsh-keys-manager 0.2.9 → 0.2.10
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 +19 -0
- package/lib/client/format.d.ts +16 -7
- package/lib/client/store.d.ts +8 -1
- package/lib/client/types.d.ts +2 -1
- package/lib/client.js +95 -45
- package/lib/core.d.ts +31 -0
- package/lib/core.js +77 -0
- package/lib/core.js.map +1 -1
- package/lib/domain.d.ts +5 -1
- package/lib/index.d.ts +50 -10
- package/lib/index.js +288 -49
- package/lib/index.js.map +1 -1
- package/lib/quota/cache.d.ts +14 -0
- package/lib/quota/cache.js +61 -8
- package/lib/quota/cache.js.map +1 -1
- package/lib/quota/fetch.d.ts +7 -1
- package/lib/quota/fetch.js.map +1 -1
- package/lib/quota/model.d.ts +2 -2
- package/lib/quota/model.js +0 -12
- package/lib/quota/model.js.map +1 -1
- package/lib/quota/providers.d.ts +5 -0
- package/lib/quota/providers.js +75 -5
- package/lib/quota/providers.js.map +1 -1
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to dsh-keys-manager are documented here. Assembled from `.changes/unreleased/` fragments by the release-prep workflow.
|
|
4
4
|
|
|
5
|
+
## [0.2.10] - 2026-10-26
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Key-pool routes now prefer the account whose plan quota resets soonest (weekly window first, then a session window below 90% used), so leftover quota is spent before it expires; routes without usage data and equally-ranked accounts keep the existing cursor rotation.
|
|
10
|
+
- Plan usage can now be read for the Factory Droid transport route: the host resolves the route's read-only `llm-omp-transports/factory-droid` grant and probes its billing limits, so the five-hour and weekly windows become visible without ever rotating or writing the credential.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- A plan-usage read that never answers now gives up after a bounded wait and reports "not reported" (retrying on the slow cadence), and an answer that arrives later is discarded instead of overwriting a newer reading.
|
|
15
|
+
- Plan-usage reads now probe at most four accounts at once and skip the credential lookup entirely for a cached account, so a wide key pool no longer opens one vendor request per key on every refresh.
|
|
16
|
+
- Dead cache entries are evicted when a key is removed or a provider is released, and a displayed snapshot can no longer be mutated by a caller.
|
|
17
|
+
- The plan-usage label now trusts the expiry of the credential actually used, so a stale account-row timestamp can neither mask a real refusal nor fake an expired account.
|
|
18
|
+
- A stale usage reading is re-checked on the slow (ten-minute) cadence instead of sticking until the card is remounted.
|
|
19
|
+
- A rejected plan-usage refresh now shows a localized "not reported" state and retries on the slow ten-minute cadence, instead of leaving the account row pending for the rest of the card session.
|
|
20
|
+
- A credential-store read that fails transiently is retried once and then reported as a temporary failure, so a momentary blip no longer looks like a refused or expired credential (the last known numbers stay visible and no sign-in is prompted).
|
|
21
|
+
- An expired stored OAuth credential no longer asks the user to sign in again for plan usage: the card says the account is managed by DSH instead, because only a model request refreshes that token.
|
|
22
|
+
- Plan-usage states that are not reported now refresh on a ten-minute cadence (and keep their last known label while doing so), instead of sticking until the card is remounted.
|
|
23
|
+
|
|
5
24
|
## [0.2.9] - 2026-10-25
|
|
6
25
|
|
|
7
26
|
### Fixed
|
package/lib/client/format.d.ts
CHANGED
|
@@ -17,11 +17,17 @@ export declare function modelPickerRows(view: TransportModelsView): Array<{
|
|
|
17
17
|
selected: boolean;
|
|
18
18
|
}>;
|
|
19
19
|
/**
|
|
20
|
-
* How long
|
|
21
|
-
* the server's MAXIMUM freshness (`ttlMs * (1 + jitterRatio)` =
|
|
22
|
-
* asking earlier could be answered by a guaranteed cache hit.
|
|
20
|
+
* How long an `ok` snapshot serves before the card asks for a new one (D4).
|
|
21
|
+
* This is the server's MAXIMUM freshness (`ttlMs * (1 + jitterRatio)` =
|
|
22
|
+
* 300 s × 1.25); asking earlier could be answered by a guaranteed cache hit.
|
|
23
23
|
*/
|
|
24
24
|
export declare const QUOTA_TTL_MS = 375000;
|
|
25
|
+
/**
|
|
26
|
+
* How long a non-`ok` snapshot is trusted before the card retries it (D2).
|
|
27
|
+
* Long enough not to hammer private endpoints, short enough that a token pi-ai
|
|
28
|
+
* refreshed on model traffic shows up in the same session.
|
|
29
|
+
*/
|
|
30
|
+
export declare const QUOTA_RETRY_MS: number;
|
|
25
31
|
/** Short window labels; technical abbreviations, identical in both locales. */
|
|
26
32
|
export declare const QUOTA_WINDOW_LABEL: Record<QuotaWindowId, string>;
|
|
27
33
|
/** Whole percentage the card prints; clamped so a hostile fraction cannot print 140%. */
|
|
@@ -34,9 +40,12 @@ export declare function quotaWindows(quota: QuotaView | undefined): QuotaWindowV
|
|
|
34
40
|
*/
|
|
35
41
|
export declare function tightestQuotaWindow(quotas: ReadonlyArray<QuotaView | undefined>): QuotaWindowView | undefined;
|
|
36
42
|
/**
|
|
37
|
-
* True while any row still has no snapshot,
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
43
|
+
* True while any row still has no snapshot, holds a usable one past its TTL, or
|
|
44
|
+
* holds a non-`ok` one past the slower retry cadence.
|
|
45
|
+
*
|
|
46
|
+
* Every snapshot carries the host cache's `fetchedAt`, so a failed or
|
|
47
|
+
* non-reporting state is retried every `QUOTA_RETRY_MS` instead of sticking
|
|
48
|
+
* until the card remounts; the host's own per-row backoff still gates the
|
|
49
|
+
* vendor call behind it.
|
|
41
50
|
*/
|
|
42
51
|
export declare function quotaNeedsRefresh(quotas: ReadonlyArray<QuotaView | undefined>, now: number): boolean;
|
package/lib/client/store.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
/** State store shared by the plugin-detail card and the Models badges. */
|
|
2
2
|
import type { ClientContext, ClientStore } from './types';
|
|
3
3
|
/** Create the store bound to one connected Client context. */
|
|
4
|
-
|
|
4
|
+
/** How long a quota read may stay unanswered before the card reports it (`I-000322`). */
|
|
5
|
+
export declare const QUOTA_WAIT_MS = 30000;
|
|
6
|
+
/** Overrides, test-only. */
|
|
7
|
+
export interface ClientStoreOptions {
|
|
8
|
+
/** Bound on one quota read; defaults to {@link QUOTA_WAIT_MS}. */
|
|
9
|
+
quotaWaitMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function createStore(ctx: ClientContext, options?: ClientStoreOptions): ClientStore;
|
package/lib/client/types.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** Browser-half domain and service contracts for the Keys Manager. */
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
+
import type { QuotaWindowId } from '../domain';
|
|
3
4
|
import type { AccountAttemptNotice, AccountAttemptPrompt, AccountAttemptView, KeyStatus, KeyTestResult, KeyView, ManagerSettings, OAuthAccountView, ProviderStatus, ProviderView, QuotaView, QuotaWindowView, StateView, TransportAccountStatus, TransportAccountView, TransportModelsView } from '../domain';
|
|
4
5
|
export type { AccountAttemptNotice, AccountAttemptPrompt, AccountAttemptView, KeyStatus, KeyTestResult, KeyView, ManagerSettings, OAuthAccountView, ProviderStatus, ProviderView, QuotaView, QuotaWindowView, StateView, TransportAccountStatus, TransportAccountView, TransportModelsView, };
|
|
5
6
|
/** The plan windows a card renders; the host's view type carries the same union. */
|
|
6
|
-
export type QuotaWindowId
|
|
7
|
+
export type { QuotaWindowId };
|
|
7
8
|
/** Locale dictionaries registered under the plugin namespace. */
|
|
8
9
|
export interface LocaleDicts {
|
|
9
10
|
zh: Record<string, string>;
|
package/lib/client.js
CHANGED
|
@@ -234,6 +234,7 @@ var zh = {
|
|
|
234
234
|
// `natively-managed` does: it is the host saying a DSH projection serves
|
|
235
235
|
// the route while its usage stays unreadable, which is its own verdict.
|
|
236
236
|
quotaNativelyManaged: "\u7531 DSH \u539F\u751F\u7BA1\u7406",
|
|
237
|
+
quotaNotReported: "\u672A\u62A5\u544A",
|
|
237
238
|
quotaResetDue: "\u5DF2\u5230\u91CD\u7F6E\u65F6\u95F4",
|
|
238
239
|
quotaSignInAgain: "\u8BF7\u91CD\u65B0\u767B\u5F55",
|
|
239
240
|
quotaStale: "\u6570\u636E\u8F83\u65E7",
|
|
@@ -427,6 +428,7 @@ var en = {
|
|
|
427
428
|
transportModelsMissingCatalog: "The installed transport build ships no model catalog for this route; the list stays empty until dsh-llm-omp-transports is rebuilt or upgraded.",
|
|
428
429
|
// Plan usage on a key row (issue #22).
|
|
429
430
|
quotaNativelyManaged: "Managed by DSH",
|
|
431
|
+
quotaNotReported: "Not reported",
|
|
430
432
|
quotaResetDue: "Reset due",
|
|
431
433
|
quotaSignInAgain: "Sign in again",
|
|
432
434
|
quotaStale: "Stale",
|
|
@@ -736,6 +738,7 @@ function modelPickerRows(view) {
|
|
|
736
738
|
return view.catalog.map((row) => ({ id: row.id, name: row.name, selected: selected.has(row.id) }));
|
|
737
739
|
}
|
|
738
740
|
var QUOTA_TTL_MS = 375e3;
|
|
741
|
+
var QUOTA_RETRY_MS = 10 * 60 * 1e3;
|
|
739
742
|
var QUOTA_WINDOW_LABEL = { session: "5h", week: "W" };
|
|
740
743
|
var QUOTA_WINDOW_ORDER = ["session", "week"];
|
|
741
744
|
function quotaPercent(fraction) {
|
|
@@ -757,9 +760,12 @@ function tightestQuotaWindow(quotas) {
|
|
|
757
760
|
return tightest;
|
|
758
761
|
}
|
|
759
762
|
function quotaNeedsRefresh(quotas, now) {
|
|
760
|
-
return quotas.some(
|
|
761
|
-
(quota
|
|
762
|
-
|
|
763
|
+
return quotas.some((quota) => {
|
|
764
|
+
if (quota === void 0) return true;
|
|
765
|
+
if (quota.status !== "ok") return now - quota.fetchedAt > QUOTA_RETRY_MS;
|
|
766
|
+
if (quota.stale === true) return now - quota.fetchedAt > QUOTA_RETRY_MS;
|
|
767
|
+
return now - quota.fetchedAt > QUOTA_TTL_MS;
|
|
768
|
+
});
|
|
763
769
|
}
|
|
764
770
|
|
|
765
771
|
// src/client/store.ts
|
|
@@ -779,7 +785,8 @@ async function withDeadline(work, ms, label) {
|
|
|
779
785
|
if (timer !== void 0) clearTimeout(timer);
|
|
780
786
|
}
|
|
781
787
|
}
|
|
782
|
-
|
|
788
|
+
var QUOTA_WAIT_MS = 3e4;
|
|
789
|
+
function createStore(ctx, options = {}) {
|
|
783
790
|
let snapshot = {
|
|
784
791
|
status: "idle",
|
|
785
792
|
state: null,
|
|
@@ -795,6 +802,8 @@ function createStore(ctx) {
|
|
|
795
802
|
let mutationGeneration = 0;
|
|
796
803
|
let stateDropped = false;
|
|
797
804
|
const quotaInFlight = /* @__PURE__ */ new Map();
|
|
805
|
+
const quotaGenerations = /* @__PURE__ */ new Map();
|
|
806
|
+
const quotaWaitMs = options.quotaWaitMs ?? QUOTA_WAIT_MS;
|
|
798
807
|
const listeners = /* @__PURE__ */ new Set();
|
|
799
808
|
const emit = () => {
|
|
800
809
|
for (const listener of [...listeners]) {
|
|
@@ -878,11 +887,11 @@ function createStore(ctx) {
|
|
|
878
887
|
listeners.add(listener);
|
|
879
888
|
return () => listeners.delete(listener);
|
|
880
889
|
},
|
|
881
|
-
async load(
|
|
890
|
+
async load(options2 = {}) {
|
|
882
891
|
if (snapshot.busy !== null) return;
|
|
883
892
|
const request = ++loadSequence;
|
|
884
893
|
const generation = testGeneration;
|
|
885
|
-
update({ busy: "load", error:
|
|
894
|
+
update({ busy: "load", error: options2.keepError === true ? snapshot.error : null });
|
|
886
895
|
try {
|
|
887
896
|
const result = await rpc("getState", {});
|
|
888
897
|
if (request !== loadSequence) return;
|
|
@@ -965,22 +974,51 @@ function createStore(ctx) {
|
|
|
965
974
|
const pending = quotaInFlight.get(provider);
|
|
966
975
|
if (pending !== void 0) return pending;
|
|
967
976
|
const generation = testGeneration;
|
|
977
|
+
const stamp = (quotaGenerations.get(provider) ?? 0) + 1;
|
|
978
|
+
quotaGenerations.set(provider, stamp);
|
|
968
979
|
let dropped = false;
|
|
969
|
-
|
|
980
|
+
let settled = false;
|
|
981
|
+
const install = (state) => {
|
|
982
|
+
if (activeTests > 0 || testGeneration !== generation) {
|
|
983
|
+
stateDropped = true;
|
|
984
|
+
dropped = true;
|
|
985
|
+
} else {
|
|
986
|
+
update({ status: "ready", state, now: Date.now(), error: snapshot.error });
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
const read = (async () => {
|
|
970
990
|
try {
|
|
971
991
|
const result = await rpc("quotaRefresh", { provider });
|
|
972
|
-
if (!result.ok)
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
stateDropped = true;
|
|
976
|
-
dropped = true;
|
|
977
|
-
} else {
|
|
978
|
-
update({ status: "ready", state, now: Date.now(), error: snapshot.error });
|
|
992
|
+
if (!result.ok) return { ok: false, error: result.error.message };
|
|
993
|
+
if (quotaGenerations.get(provider) !== stamp) {
|
|
994
|
+
return { ok: false, error: "superseded by a newer usage read" };
|
|
979
995
|
}
|
|
996
|
+
const state = result.value;
|
|
997
|
+
if (!settled) install(state);
|
|
980
998
|
return { ok: true, value: state };
|
|
981
999
|
} catch (error) {
|
|
982
1000
|
return { ok: false, error: messageOf(error) };
|
|
1001
|
+
}
|
|
1002
|
+
})();
|
|
1003
|
+
let timer;
|
|
1004
|
+
const request = (async () => {
|
|
1005
|
+
try {
|
|
1006
|
+
const answer = await Promise.race([
|
|
1007
|
+
read,
|
|
1008
|
+
new Promise((resolve) => {
|
|
1009
|
+
timer = setTimeout(() => resolve("timed-out"), quotaWaitMs);
|
|
1010
|
+
})
|
|
1011
|
+
]);
|
|
1012
|
+
if (answer === "timed-out") {
|
|
1013
|
+
quotaGenerations.set(provider, stamp + 1);
|
|
1014
|
+
return { ok: false, error: "the usage read did not answer in time" };
|
|
1015
|
+
}
|
|
1016
|
+
return answer;
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
return { ok: false, error: messageOf(error) };
|
|
983
1019
|
} finally {
|
|
1020
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
1021
|
+
settled = true;
|
|
984
1022
|
quotaInFlight.delete(provider);
|
|
985
1023
|
if (dropped) refreshDroppedState();
|
|
986
1024
|
}
|
|
@@ -1408,7 +1446,7 @@ function testLine(test, t) {
|
|
|
1408
1446
|
const detail = test.error !== void 0 && test.error.length > 0 ? test.error : test.timedOut === true ? t("testTimedOut") : t("testFailedUnknown");
|
|
1409
1447
|
return h("div", { className: "km-key-time km-warn", role: "status", style: ROW_TEST_STYLE }, t("testFailed", { error: detail }));
|
|
1410
1448
|
}
|
|
1411
|
-
function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
1449
|
+
function KeyRow({ provider, keyRecord, now, onReauthenticate, quotaRejected }) {
|
|
1412
1450
|
const key = keyRecord;
|
|
1413
1451
|
const runtime = useRuntime();
|
|
1414
1452
|
const t = useT();
|
|
@@ -1581,7 +1619,7 @@ function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
|
1581
1619
|
}, disabled: busy }, h(Icon, { name: "trash", size: 15 }), t("delete"))
|
|
1582
1620
|
) : null
|
|
1583
1621
|
),
|
|
1584
|
-
quotaInline(key, t, now),
|
|
1622
|
+
quotaInline(key, t, now, quotaRejected),
|
|
1585
1623
|
error !== null ? h("div", { className: "km-key-error", role: "alert" }, error) : null,
|
|
1586
1624
|
testLine(test, t),
|
|
1587
1625
|
confirm ? h(Modal, {
|
|
@@ -1595,7 +1633,7 @@ function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
|
1595
1633
|
}, h("p", { className: "km-modal-copy" }, t("deleteBody"))) : null
|
|
1596
1634
|
);
|
|
1597
1635
|
}
|
|
1598
|
-
function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
1636
|
+
function AccountRow({ provider, keyRecord, now, onReauthenticate, quotaRejected }) {
|
|
1599
1637
|
const runtime = useRuntime();
|
|
1600
1638
|
const t = useT();
|
|
1601
1639
|
const locale = useLocaleId();
|
|
@@ -1742,7 +1780,7 @@ function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
|
1742
1780
|
}, disabled: busy }, h(Icon, { name: "trash", size: 15 }), t("delete"))
|
|
1743
1781
|
) : null
|
|
1744
1782
|
),
|
|
1745
|
-
quotaInline(keyRecord, t, now),
|
|
1783
|
+
quotaInline(keyRecord, t, now, quotaRejected),
|
|
1746
1784
|
error !== null ? h("div", { className: "km-key-error", role: "alert" }, error) : null,
|
|
1747
1785
|
testLine(test, t),
|
|
1748
1786
|
confirm ? h(Modal, {
|
|
@@ -1760,7 +1798,7 @@ function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
|
1760
1798
|
}, h("p", { className: "km-modal-copy" }, t(provider.supported === true ? "deleteAccountBody" : "deleteAccountBodyNoKeys"))) : null
|
|
1761
1799
|
);
|
|
1762
1800
|
}
|
|
1763
|
-
function TransportAccountRow({ account }) {
|
|
1801
|
+
function TransportAccountRow({ account, now }) {
|
|
1764
1802
|
const runtime = useRuntime();
|
|
1765
1803
|
const t = useT();
|
|
1766
1804
|
const locale = useLocaleId();
|
|
@@ -1768,6 +1806,7 @@ function TransportAccountRow({ account }) {
|
|
|
1768
1806
|
const [error, setError] = import_react2.default.useState(null);
|
|
1769
1807
|
const [confirm, setConfirm] = import_react2.default.useState(false);
|
|
1770
1808
|
const [login, setLogin] = import_react2.default.useState(null);
|
|
1809
|
+
const [quotaRejected, setQuotaRejected] = import_react2.default.useState(false);
|
|
1771
1810
|
async function signIn() {
|
|
1772
1811
|
setBusy(true);
|
|
1773
1812
|
setError(null);
|
|
@@ -1828,6 +1867,13 @@ function TransportAccountRow({ account }) {
|
|
|
1828
1867
|
{ className: "km-key-last" },
|
|
1829
1868
|
h("div", { className: "km-key-time" }, t("transportExpires", { time: formatClock(account.expiresAt, locale, t) }))
|
|
1830
1869
|
),
|
|
1870
|
+
h(QuotaRefresh, {
|
|
1871
|
+
providerId: account.id,
|
|
1872
|
+
now,
|
|
1873
|
+
onRejected: setQuotaRejected,
|
|
1874
|
+
quotas: [account.quota]
|
|
1875
|
+
}),
|
|
1876
|
+
quotaInline(account, t, now, quotaRejected),
|
|
1831
1877
|
h(
|
|
1832
1878
|
"div",
|
|
1833
1879
|
{ className: "km-key-actions" },
|
|
@@ -1988,13 +2034,19 @@ function TransportModels({ route }) {
|
|
|
1988
2034
|
) : null
|
|
1989
2035
|
);
|
|
1990
2036
|
}
|
|
1991
|
-
function quotaInline(row, t, now) {
|
|
2037
|
+
function quotaInline(row, t, now, rejected = false) {
|
|
1992
2038
|
const windows = quotaWindows(row.quota);
|
|
1993
2039
|
if (windows.length === 0) {
|
|
1994
2040
|
if (row.quota?.status === "natively-managed") {
|
|
1995
2041
|
return h("div", { className: "km-quota-inline" }, t("quotaNativelyManaged"));
|
|
1996
2042
|
}
|
|
1997
|
-
|
|
2043
|
+
if (row.quota?.status === "unauthorized" && row.kind === "oauth") {
|
|
2044
|
+
return h("div", { className: "km-quota-inline" }, t("quotaSignInAgain"));
|
|
2045
|
+
}
|
|
2046
|
+
if (rejected && row.quota === void 0) {
|
|
2047
|
+
return h("div", { className: "km-quota-inline" }, t("quotaNotReported"));
|
|
2048
|
+
}
|
|
2049
|
+
return null;
|
|
1998
2050
|
}
|
|
1999
2051
|
const tightest = windows.reduce((best, window) => window.usedFraction > best.usedFraction ? window : best);
|
|
2000
2052
|
const remainingMs = tightest.resetsAt - now;
|
|
@@ -2005,41 +2057,32 @@ function quotaInline(row, t, now) {
|
|
|
2005
2057
|
if (row.quota?.stale === true) parts.push(t("quotaStale"));
|
|
2006
2058
|
return h("div", { className: "km-quota-inline", title: parts.join(" \xB7 ") }, parts.join(" \xB7 "));
|
|
2007
2059
|
}
|
|
2008
|
-
function quotaSignature(
|
|
2009
|
-
return
|
|
2060
|
+
function quotaSignature(quotas) {
|
|
2061
|
+
return quotas.map((quota) => `${quota?.status ?? "none"}:${quota?.fetchedAt ?? 0}`).join("|");
|
|
2010
2062
|
}
|
|
2011
|
-
function QuotaRefresh({
|
|
2063
|
+
function QuotaRefresh({ providerId, now, onRejected, quotas }) {
|
|
2012
2064
|
const runtime = useRuntime();
|
|
2013
2065
|
const attempted = import_react2.default.useRef(null);
|
|
2014
|
-
const
|
|
2015
|
-
const retried = import_react2.default.useRef(null);
|
|
2016
|
-
const quotas = provider.keys.map((key) => key.quota);
|
|
2066
|
+
const lastAttemptAt = import_react2.default.useRef(null);
|
|
2017
2067
|
const needsRefresh = quotaNeedsRefresh(quotas, now);
|
|
2018
2068
|
const minute = Math.floor(now / 6e4);
|
|
2019
|
-
const signature = quotaSignature(
|
|
2069
|
+
const signature = quotaSignature(quotas);
|
|
2020
2070
|
import_react2.default.useEffect(() => {
|
|
2021
2071
|
if (!needsRefresh) {
|
|
2022
2072
|
attempted.current = null;
|
|
2023
|
-
|
|
2024
|
-
retryBudget.current = null;
|
|
2073
|
+
lastAttemptAt.current = null;
|
|
2025
2074
|
return void 0;
|
|
2026
2075
|
}
|
|
2027
2076
|
if (attempted.current === signature) return void 0;
|
|
2028
|
-
if (
|
|
2077
|
+
if (lastAttemptAt.current !== null && now - lastAttemptAt.current < QUOTA_RETRY_MS) return void 0;
|
|
2029
2078
|
attempted.current = signature;
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
retryBudget.current = null;
|
|
2033
|
-
}
|
|
2034
|
-
void runtime.store.refreshQuota(provider.provider).then((outcome) => {
|
|
2035
|
-
if (!outcome.ok) return;
|
|
2036
|
-
const latest = runtime.store.getSnapshot().state?.providers.find((row) => row.provider === provider.provider);
|
|
2037
|
-
const moved = latest === void 0 || quotaSignature(latest) !== signature;
|
|
2079
|
+
lastAttemptAt.current = now;
|
|
2080
|
+
void runtime.store.refreshQuota(providerId).then((outcome) => {
|
|
2038
2081
|
attempted.current = null;
|
|
2039
|
-
|
|
2082
|
+
onRejected(!outcome.ok);
|
|
2040
2083
|
});
|
|
2041
2084
|
return void 0;
|
|
2042
|
-
}, [
|
|
2085
|
+
}, [providerId, signature, minute, needsRefresh]);
|
|
2043
2086
|
return null;
|
|
2044
2087
|
}
|
|
2045
2088
|
function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
@@ -2052,6 +2095,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2052
2095
|
const [login, setLogin] = import_react2.default.useState(null);
|
|
2053
2096
|
const [startingLogin, setStartingLogin] = import_react2.default.useState(false);
|
|
2054
2097
|
const [error, setError] = import_react2.default.useState(null);
|
|
2098
|
+
const [quotaRejected, setQuotaRejected] = import_react2.default.useState(false);
|
|
2055
2099
|
const managed = provider.managed;
|
|
2056
2100
|
const broken = managed && provider.bindingHealthy === false;
|
|
2057
2101
|
const keyCount = provider.keyCount;
|
|
@@ -2186,7 +2230,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2186
2230
|
transport ? h(
|
|
2187
2231
|
"div",
|
|
2188
2232
|
{ className: "km-transport-body" },
|
|
2189
|
-
transportAccount !== void 0 ? h("div", { className: "km-keys" }, h(TransportAccountRow, { account: transportAccount })) : h("div", { className: "km-muted" }, t("transportProviderHint")),
|
|
2233
|
+
transportAccount !== void 0 ? h("div", { className: "km-keys" }, h(TransportAccountRow, { account: transportAccount, now })) : h("div", { className: "km-muted" }, t("transportProviderHint")),
|
|
2190
2234
|
h(TransportModels, { route: provider.provider })
|
|
2191
2235
|
) : !managed ? h(
|
|
2192
2236
|
"div",
|
|
@@ -2277,13 +2321,18 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2277
2321
|
)
|
|
2278
2322
|
),
|
|
2279
2323
|
adding ? h(KeyForm, { provider, onDone: () => setAdding(false), autoFocus: true }) : null,
|
|
2280
|
-
provider.keys.length > 0 ? h(QuotaRefresh, {
|
|
2324
|
+
provider.keys.length > 0 ? h(QuotaRefresh, {
|
|
2325
|
+
providerId: provider.provider,
|
|
2326
|
+
now,
|
|
2327
|
+
onRejected: setQuotaRejected,
|
|
2328
|
+
quotas: provider.keys.map((key) => key.quota)
|
|
2329
|
+
}) : null,
|
|
2281
2330
|
provider.keys.length === 0 ? h(
|
|
2282
2331
|
"div",
|
|
2283
2332
|
{ className: "km-empty-keys" },
|
|
2284
2333
|
h("div", null, provider.supported ? t("noKeys") : oauthCapable(provider) ? t("noKeysAccount") : t("unsupported")),
|
|
2285
2334
|
!provider.supported && provider.reason !== void 0 ? h("div", { className: "km-muted" }, provider.reason) : null
|
|
2286
|
-
) : h("div", { className: "km-keys" }, provider.keys.map((key) => key.kind === "oauth" ? h(AccountRow, { key: key.id, provider, keyRecord: key, now, onReauthenticate: () => void openLogin(key.id, key.alias) }) : h(KeyRow, { key: key.id, provider, keyRecord: key, now, onReauthenticate: () => void openLogin(key.id, key.alias) })))
|
|
2335
|
+
) : h("div", { className: "km-keys" }, provider.keys.map((key) => key.kind === "oauth" ? h(AccountRow, { key: key.id, provider, keyRecord: key, now, quotaRejected, onReauthenticate: () => void openLogin(key.id, key.alias) }) : h(KeyRow, { key: key.id, provider, keyRecord: key, now, quotaRejected, onReauthenticate: () => void openLogin(key.id, key.alias) })))
|
|
2287
2336
|
),
|
|
2288
2337
|
h(
|
|
2289
2338
|
"div",
|
|
@@ -2826,7 +2875,8 @@ function KeysManagerBody() {
|
|
|
2826
2875
|
}))) : null,
|
|
2827
2876
|
visibleOrphans.length > 0 ? h("div", { className: "km-provider-list" }, visibleOrphans.map((account) => h(TransportAccountRow, {
|
|
2828
2877
|
key: account.scope,
|
|
2829
|
-
account
|
|
2878
|
+
account,
|
|
2879
|
+
now
|
|
2830
2880
|
}))) : null
|
|
2831
2881
|
) : null,
|
|
2832
2882
|
!loading && !failed ? h(
|
package/lib/core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { KeyRecord, KeyStatus, ManagerSettings, ProviderRecord, ProviderStatus } from './domain.js';
|
|
2
2
|
import type { LlmFailureLike } from './host-types.js';
|
|
3
|
+
import type { QuotaWindow } from './quota/model.js';
|
|
3
4
|
/** Defaults also exposed in the manager's policy card. */
|
|
4
5
|
export declare const DEFAULT_SETTINGS: ManagerSettings;
|
|
5
6
|
/** Normalize one persisted settings object. */
|
|
@@ -14,6 +15,36 @@ export declare function isSelectable(key: KeyRecord | undefined, now: number): k
|
|
|
14
15
|
export declare function pickRoundRobin(provider: ProviderRecord, now: number, exclude?: ReadonlySet<string>): KeyRecord | undefined;
|
|
15
16
|
/** Pick the next healthy key other than `excludeKeyId`, advancing the cursor. */
|
|
16
17
|
export declare function pickHealthyExcluding(provider: ProviderRecord, excludeKeyId: string, now: number): KeyRecord | undefined;
|
|
18
|
+
/** Quota ranking tier of one candidate; lower is preferred. */
|
|
19
|
+
export type QuotaRankTier = 0 | 1 | 2 | 3;
|
|
20
|
+
/** One candidate's ranking verdict: its tier and the reset time that orders it. */
|
|
21
|
+
export interface QuotaRank {
|
|
22
|
+
tier: QuotaRankTier;
|
|
23
|
+
/** Reset time used inside a tier; `Infinity` when no snapshot is usable. */
|
|
24
|
+
resetsAt: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Classify one candidate for quota-aware ranking (issue #22).
|
|
28
|
+
*
|
|
29
|
+
* Tier 0 is a live weekly window with quota left, ordered by the soonest reset
|
|
30
|
+
* (leftover quota that resets soonest is the first to waste). Tier 1 is the
|
|
31
|
+
* session-only fallback below 90% used. Tier 3 is exhausted usage; tier 2 is
|
|
32
|
+
* "no usable snapshot", which keeps plain cursor rotation.
|
|
33
|
+
*
|
|
34
|
+
* A window whose reset instant is already `<= now` describes the window that
|
|
35
|
+
* just ended: its numbers say nothing about the next one, so a weekly window in
|
|
36
|
+
* that state is treated as absent (session fallback) rather than as healthy.
|
|
37
|
+
*/
|
|
38
|
+
export declare function quotaRank(windows: readonly QuotaWindow[] | undefined, now: number): QuotaRank;
|
|
39
|
+
/**
|
|
40
|
+
* Every selectable key of a provider in quota-tier order (issue #22).
|
|
41
|
+
*
|
|
42
|
+
* Pure: it never probes, never mutates `provider.cursor`, and never re-admits a
|
|
43
|
+
* key `isSelectable` rejected (cooldown stays a hard exclusion). Inside a tier
|
|
44
|
+
* the cursor decides the starting point, so equally-ranked keys still rotate;
|
|
45
|
+
* the caller advances the cursor past whatever it selects.
|
|
46
|
+
*/
|
|
47
|
+
export declare function rankCandidates(provider: ProviderRecord, now: number, quotaOf: (keyId: string) => readonly QuotaWindow[] | undefined): KeyRecord[];
|
|
17
48
|
/** Coerce a persisted cursor into range without mutating it. */
|
|
18
49
|
export declare function normalizeCursor(cursor: number, length: number): number;
|
|
19
50
|
/** Result of marking one key failure. */
|
package/lib/core.js
CHANGED
|
@@ -106,6 +106,83 @@ export function pickHealthyExcluding(provider, excludeKeyId, now) {
|
|
|
106
106
|
}
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
|
+
const NO_QUOTA_RANK = { tier: 2, resetsAt: Number.POSITIVE_INFINITY };
|
|
110
|
+
/** The window with `id`, or `undefined` when the snapshot does not carry it. */
|
|
111
|
+
function quotaWindowOf(windows, id) {
|
|
112
|
+
if (windows === undefined)
|
|
113
|
+
return undefined;
|
|
114
|
+
for (const window of windows) {
|
|
115
|
+
if (window.id === id)
|
|
116
|
+
return window;
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Classify one candidate for quota-aware ranking (issue #22).
|
|
122
|
+
*
|
|
123
|
+
* Tier 0 is a live weekly window with quota left, ordered by the soonest reset
|
|
124
|
+
* (leftover quota that resets soonest is the first to waste). Tier 1 is the
|
|
125
|
+
* session-only fallback below 90% used. Tier 3 is exhausted usage; tier 2 is
|
|
126
|
+
* "no usable snapshot", which keeps plain cursor rotation.
|
|
127
|
+
*
|
|
128
|
+
* A window whose reset instant is already `<= now` describes the window that
|
|
129
|
+
* just ended: its numbers say nothing about the next one, so a weekly window in
|
|
130
|
+
* that state is treated as absent (session fallback) rather than as healthy.
|
|
131
|
+
*/
|
|
132
|
+
export function quotaRank(windows, now) {
|
|
133
|
+
const week = quotaWindowOf(windows, 'week');
|
|
134
|
+
const session = quotaWindowOf(windows, 'session');
|
|
135
|
+
// Every branch requires a LIVE window: an expired one describes the window
|
|
136
|
+
// that just ended, so its usage says nothing — not even "exhausted".
|
|
137
|
+
const weekLive = week !== undefined && week.resetsAt > now;
|
|
138
|
+
const sessionLive = session !== undefined && session.resetsAt > now;
|
|
139
|
+
if (weekLive && week.usedFraction < 1) {
|
|
140
|
+
return { tier: 0, resetsAt: week.resetsAt };
|
|
141
|
+
}
|
|
142
|
+
if (weekLive && week.usedFraction >= 1) {
|
|
143
|
+
return { tier: 3, resetsAt: week.resetsAt };
|
|
144
|
+
}
|
|
145
|
+
if (sessionLive && session.usedFraction < 0.9) {
|
|
146
|
+
return { tier: 1, resetsAt: session.resetsAt };
|
|
147
|
+
}
|
|
148
|
+
if (sessionLive && session.usedFraction >= 0.9) {
|
|
149
|
+
return { tier: 3, resetsAt: session.resetsAt };
|
|
150
|
+
}
|
|
151
|
+
return NO_QUOTA_RANK;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Every selectable key of a provider in quota-tier order (issue #22).
|
|
155
|
+
*
|
|
156
|
+
* Pure: it never probes, never mutates `provider.cursor`, and never re-admits a
|
|
157
|
+
* key `isSelectable` rejected (cooldown stays a hard exclusion). Inside a tier
|
|
158
|
+
* the cursor decides the starting point, so equally-ranked keys still rotate;
|
|
159
|
+
* the caller advances the cursor past whatever it selects.
|
|
160
|
+
*/
|
|
161
|
+
export function rankCandidates(provider, now, quotaOf) {
|
|
162
|
+
const keys = Array.isArray(provider.keys) ? provider.keys : [];
|
|
163
|
+
if (keys.length === 0)
|
|
164
|
+
return [];
|
|
165
|
+
const start = normalizeCursor(provider.cursor, keys.length);
|
|
166
|
+
const ranked = keys
|
|
167
|
+
.map((key, index) => ({ key, index }))
|
|
168
|
+
.filter(entry => isSelectable(entry.key, now))
|
|
169
|
+
.map(entry => {
|
|
170
|
+
const rank = quotaRank(quotaOf(entry.key.id), now);
|
|
171
|
+
return { ...entry, tier: rank.tier, resetsAt: rank.resetsAt };
|
|
172
|
+
});
|
|
173
|
+
ranked.sort((left, right) => {
|
|
174
|
+
if (left.tier !== right.tier)
|
|
175
|
+
return left.tier - right.tier;
|
|
176
|
+
if (left.tier !== 2 && left.resetsAt !== right.resetsAt)
|
|
177
|
+
return left.resetsAt - right.resetsAt;
|
|
178
|
+
// Cursor-relative order is the tie-break, so a stable "best" ordering can
|
|
179
|
+
// never pin one account.
|
|
180
|
+
const leftOffset = (left.index - start + keys.length) % keys.length;
|
|
181
|
+
const rightOffset = (right.index - start + keys.length) % keys.length;
|
|
182
|
+
return leftOffset - rightOffset;
|
|
183
|
+
});
|
|
184
|
+
return ranked.map(entry => entry.key);
|
|
185
|
+
}
|
|
109
186
|
/** Coerce a persisted cursor into range without mutating it. */
|
|
110
187
|
export function normalizeCursor(cursor, length) {
|
|
111
188
|
if (!Number.isInteger(cursor) || length <= 0)
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAkBA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAC7B,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IAC/B,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACtC,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;CACjB,CAAA;AAED,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAA;AACjC,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAChC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAC3B,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,CAAA;AAEhC,6EAA6E;AAC7E,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,wBAAwB;IACxB,wBAAwB;IACxB,uBAAuB;IACvB,iBAAiB;IACjB,YAAY;IACZ,uBAAuB;IACvB,eAAe;IACf,oBAAoB;CACrB,CAAC,CAAA;AA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H,MAAM,MAAM,GAAG,KAAgC,CAAA;IAC/C,MAAM,MAAM,GAA0C,EAAE,CAAA;IACxD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QACzE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAA;QAChE,IAAI,KAAK,CAAC,MAAM,GAAG,gBAAgB;YAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,gBAAgB,aAAa,CAAC,CAAA;QAChH,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IACtB,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAA;QACzF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;IACjC,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAA;IAC1F,OAAO,MAAM,CAAA;AACf,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAwD,CAAA"}
|
package/lib/domain.d.ts
CHANGED
|
@@ -125,8 +125,10 @@ export interface StateDocument {
|
|
|
125
125
|
}>;
|
|
126
126
|
}
|
|
127
127
|
/** One plan window projected into an account row. */
|
|
128
|
+
/** The plan windows a card can render; the one declaration every layer imports. */
|
|
129
|
+
export type QuotaWindowId = 'session' | 'week';
|
|
128
130
|
export interface QuotaWindowView {
|
|
129
|
-
id:
|
|
131
|
+
id: QuotaWindowId;
|
|
130
132
|
/** Share of the window already used, `0`..`1`. */
|
|
131
133
|
usedFraction: number;
|
|
132
134
|
/** Reset time as epoch milliseconds. */
|
|
@@ -245,6 +247,8 @@ export interface TransportAccountView {
|
|
|
245
247
|
status: TransportAccountStatus;
|
|
246
248
|
/** Derived from {@link status}: true only while it is `'active'`. */
|
|
247
249
|
active: boolean;
|
|
250
|
+
/** Latest cached plan usage; absent until a quota refresh ran for this route. */
|
|
251
|
+
quota?: QuotaView;
|
|
248
252
|
}
|
|
249
253
|
/** One model row a transport route can advertise. */
|
|
250
254
|
export interface TransportCatalogModel {
|