dsh-keys-manager 0.2.9 → 0.2.11

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 CHANGED
@@ -2,6 +2,31 @@
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.11] - 2026-10-28
6
+
7
+ ### Changed
8
+
9
+ - A route without a usage probe now says "usage is not shown for this route" instead of leaving the plan-usage line looking like a failed read.
10
+
11
+ ## [0.2.10] - 2026-10-26
12
+
13
+ ### Added
14
+
15
+ - 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.
16
+ - 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.
17
+
18
+ ### Fixed
19
+
20
+ - 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.
21
+ - 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.
22
+ - 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.
23
+ - 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.
24
+ - A stale usage reading is re-checked on the slow (ten-minute) cadence instead of sticking until the card is remounted.
25
+ - 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.
26
+ - 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).
27
+ - 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.
28
+ - 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.
29
+
5
30
  ## [0.2.9] - 2026-10-25
6
31
 
7
32
  ### Fixed
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm downloads](https://img.shields.io/npm/dm/dsh-keys-manager)](https://www.npmjs.com/package/dsh-keys-manager)
4
4
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
5
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-339933)](https://www.npmjs.com/package/dsh-keys-manager)
6
- [![DSH](https://img.shields.io/badge/DSH-%5E0.2.1--rc.3-0969DA)](https://www.npmjs.com/package/@deepseek-ai/dsh-llm)
6
+ [![DSH](https://img.shields.io/badge/DSH-%5E0.2.1--rc.4-0969DA)](https://www.npmjs.com/package/@deepseek-ai/dsh-llm)
7
7
 
8
8
  **English** | [简体中文](README.zh-CN.md)
9
9
 
package/README.zh-CN.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm downloads](https://img.shields.io/npm/dm/dsh-keys-manager)](https://www.npmjs.com/package/dsh-keys-manager)
4
4
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
5
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-339933)](https://www.npmjs.com/package/dsh-keys-manager)
6
- [![DSH](https://img.shields.io/badge/DSH-%5E0.2.1--rc.3-0969DA)](https://www.npmjs.com/package/@deepseek-ai/dsh-llm)
6
+ [![DSH](https://img.shields.io/badge/DSH-%5E0.2.1--rc.4-0969DA)](https://www.npmjs.com/package/@deepseek-ai/dsh-llm)
7
7
 
8
8
  [English](README.md) | **简体中文**
9
9
 
@@ -17,11 +17,17 @@ export declare function modelPickerRows(view: TransportModelsView): Array<{
17
17
  selected: boolean;
18
18
  }>;
19
19
  /**
20
- * How long a snapshot serves before the card asks for a new one (D4). This is
21
- * the server's MAXIMUM freshness (`ttlMs * (1 + jitterRatio)` = 300 s × 1.25);
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, or holds a usable one past its
38
- * TTL. The host's cache owns `fetchedAt` for every status and owns the retry
39
- * schedule for non-`ok` answers (10 s / 60 s backoff); only `ok` snapshots age
40
- * out on the client, otherwise a non-reporting row would be asked forever.
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;
@@ -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
- export declare function createStore(ctx: ClientContext): ClientStore;
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;
@@ -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 = 'session' | 'week';
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
@@ -230,10 +230,16 @@ var zh = {
230
230
  transportModelsMissingCatalog: "\u5DF2\u5B89\u88C5\u7684\u4F20\u8F93\u6784\u5EFA\u6CA1\u6709\u4E3A\u8BE5\u8DEF\u7531\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF1B\u5217\u8868\u4F1A\u4E00\u76F4\u4E3A\u7A7A\uFF0C\u76F4\u5230\u91CD\u65B0\u6784\u5EFA\u6216\u5347\u7EA7 dsh-llm-omp-transports\u3002",
231
231
  // Plan usage on a key row (issue #22). The window abbreviations (5h / W)
232
232
  // are technical and stay untranslated, so they are code, not dictionary
233
- // entries; a pending, `absent` or `error` snapshot needs no copy at all.
234
- // `natively-managed` does: it is the host saying a DSH projection serves
235
- // the route while its usage stays unreadable, which is its own verdict.
233
+ // entries; a pending, `error` or probe-reported `absent` snapshot needs no
234
+ // copy at all. `natively-managed` does: it is the host saying a DSH
235
+ // projection serves the route while its usage stays unreadable, which is
236
+ // its own verdict. `quotaNoProbe` says only that this card does not show
237
+ // usage for the route (issue #62): some of those routes DO have an
238
+ // endpoint whose payload this window model cannot carry, so the copy must
239
+ // not claim there is none.
236
240
  quotaNativelyManaged: "\u7531 DSH \u539F\u751F\u7BA1\u7406",
241
+ quotaNoProbe: "\u8BE5\u8DEF\u7531\u6682\u4E0D\u663E\u793A\u7528\u91CF",
242
+ quotaNotReported: "\u672A\u62A5\u544A",
237
243
  quotaResetDue: "\u5DF2\u5230\u91CD\u7F6E\u65F6\u95F4",
238
244
  quotaSignInAgain: "\u8BF7\u91CD\u65B0\u767B\u5F55",
239
245
  quotaStale: "\u6570\u636E\u8F83\u65E7",
@@ -427,6 +433,8 @@ var en = {
427
433
  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
434
  // Plan usage on a key row (issue #22).
429
435
  quotaNativelyManaged: "Managed by DSH",
436
+ quotaNoProbe: "Usage is not shown for this route",
437
+ quotaNotReported: "Not reported",
430
438
  quotaResetDue: "Reset due",
431
439
  quotaSignInAgain: "Sign in again",
432
440
  quotaStale: "Stale",
@@ -736,6 +744,7 @@ function modelPickerRows(view) {
736
744
  return view.catalog.map((row) => ({ id: row.id, name: row.name, selected: selected.has(row.id) }));
737
745
  }
738
746
  var QUOTA_TTL_MS = 375e3;
747
+ var QUOTA_RETRY_MS = 10 * 60 * 1e3;
739
748
  var QUOTA_WINDOW_LABEL = { session: "5h", week: "W" };
740
749
  var QUOTA_WINDOW_ORDER = ["session", "week"];
741
750
  function quotaPercent(fraction) {
@@ -757,9 +766,12 @@ function tightestQuotaWindow(quotas) {
757
766
  return tightest;
758
767
  }
759
768
  function quotaNeedsRefresh(quotas, now) {
760
- return quotas.some(
761
- (quota) => quota === void 0 || quota.status === "ok" && now - quota.fetchedAt > QUOTA_TTL_MS
762
- );
769
+ return quotas.some((quota) => {
770
+ if (quota === void 0) return true;
771
+ if (quota.status !== "ok") return now - quota.fetchedAt > QUOTA_RETRY_MS;
772
+ if (quota.stale === true) return now - quota.fetchedAt > QUOTA_RETRY_MS;
773
+ return now - quota.fetchedAt > QUOTA_TTL_MS;
774
+ });
763
775
  }
764
776
 
765
777
  // src/client/store.ts
@@ -779,7 +791,8 @@ async function withDeadline(work, ms, label) {
779
791
  if (timer !== void 0) clearTimeout(timer);
780
792
  }
781
793
  }
782
- function createStore(ctx) {
794
+ var QUOTA_WAIT_MS = 3e4;
795
+ function createStore(ctx, options = {}) {
783
796
  let snapshot = {
784
797
  status: "idle",
785
798
  state: null,
@@ -795,6 +808,8 @@ function createStore(ctx) {
795
808
  let mutationGeneration = 0;
796
809
  let stateDropped = false;
797
810
  const quotaInFlight = /* @__PURE__ */ new Map();
811
+ const quotaGenerations = /* @__PURE__ */ new Map();
812
+ const quotaWaitMs = options.quotaWaitMs ?? QUOTA_WAIT_MS;
798
813
  const listeners = /* @__PURE__ */ new Set();
799
814
  const emit = () => {
800
815
  for (const listener of [...listeners]) {
@@ -878,11 +893,11 @@ function createStore(ctx) {
878
893
  listeners.add(listener);
879
894
  return () => listeners.delete(listener);
880
895
  },
881
- async load(options = {}) {
896
+ async load(options2 = {}) {
882
897
  if (snapshot.busy !== null) return;
883
898
  const request = ++loadSequence;
884
899
  const generation = testGeneration;
885
- update({ busy: "load", error: options.keepError === true ? snapshot.error : null });
900
+ update({ busy: "load", error: options2.keepError === true ? snapshot.error : null });
886
901
  try {
887
902
  const result = await rpc("getState", {});
888
903
  if (request !== loadSequence) return;
@@ -965,22 +980,51 @@ function createStore(ctx) {
965
980
  const pending = quotaInFlight.get(provider);
966
981
  if (pending !== void 0) return pending;
967
982
  const generation = testGeneration;
983
+ const stamp = (quotaGenerations.get(provider) ?? 0) + 1;
984
+ quotaGenerations.set(provider, stamp);
968
985
  let dropped = false;
969
- const request = (async () => {
986
+ let settled = false;
987
+ const install = (state) => {
988
+ if (activeTests > 0 || testGeneration !== generation) {
989
+ stateDropped = true;
990
+ dropped = true;
991
+ } else {
992
+ update({ status: "ready", state, now: Date.now(), error: snapshot.error });
993
+ }
994
+ };
995
+ const read = (async () => {
970
996
  try {
971
997
  const result = await rpc("quotaRefresh", { provider });
972
- if (!result.ok) throw new Error(result.error.message);
973
- const state = result.value;
974
- if (activeTests > 0 || testGeneration !== generation) {
975
- stateDropped = true;
976
- dropped = true;
977
- } else {
978
- update({ status: "ready", state, now: Date.now(), error: snapshot.error });
998
+ if (!result.ok) return { ok: false, error: result.error.message };
999
+ if (quotaGenerations.get(provider) !== stamp) {
1000
+ return { ok: false, error: "superseded by a newer usage read" };
979
1001
  }
1002
+ const state = result.value;
1003
+ if (!settled) install(state);
980
1004
  return { ok: true, value: state };
981
1005
  } catch (error) {
982
1006
  return { ok: false, error: messageOf(error) };
1007
+ }
1008
+ })();
1009
+ let timer;
1010
+ const request = (async () => {
1011
+ try {
1012
+ const answer = await Promise.race([
1013
+ read,
1014
+ new Promise((resolve) => {
1015
+ timer = setTimeout(() => resolve("timed-out"), quotaWaitMs);
1016
+ })
1017
+ ]);
1018
+ if (answer === "timed-out") {
1019
+ quotaGenerations.set(provider, stamp + 1);
1020
+ return { ok: false, error: "the usage read did not answer in time" };
1021
+ }
1022
+ return answer;
1023
+ } catch (error) {
1024
+ return { ok: false, error: messageOf(error) };
983
1025
  } finally {
1026
+ if (timer !== void 0) clearTimeout(timer);
1027
+ settled = true;
984
1028
  quotaInFlight.delete(provider);
985
1029
  if (dropped) refreshDroppedState();
986
1030
  }
@@ -1408,7 +1452,7 @@ function testLine(test, t) {
1408
1452
  const detail = test.error !== void 0 && test.error.length > 0 ? test.error : test.timedOut === true ? t("testTimedOut") : t("testFailedUnknown");
1409
1453
  return h("div", { className: "km-key-time km-warn", role: "status", style: ROW_TEST_STYLE }, t("testFailed", { error: detail }));
1410
1454
  }
1411
- function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
1455
+ function KeyRow({ provider, keyRecord, now, onReauthenticate, quotaRejected }) {
1412
1456
  const key = keyRecord;
1413
1457
  const runtime = useRuntime();
1414
1458
  const t = useT();
@@ -1581,7 +1625,7 @@ function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
1581
1625
  }, disabled: busy }, h(Icon, { name: "trash", size: 15 }), t("delete"))
1582
1626
  ) : null
1583
1627
  ),
1584
- quotaInline(key, t, now),
1628
+ quotaInline(key, t, now, quotaRejected),
1585
1629
  error !== null ? h("div", { className: "km-key-error", role: "alert" }, error) : null,
1586
1630
  testLine(test, t),
1587
1631
  confirm ? h(Modal, {
@@ -1595,7 +1639,7 @@ function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
1595
1639
  }, h("p", { className: "km-modal-copy" }, t("deleteBody"))) : null
1596
1640
  );
1597
1641
  }
1598
- function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
1642
+ function AccountRow({ provider, keyRecord, now, onReauthenticate, quotaRejected }) {
1599
1643
  const runtime = useRuntime();
1600
1644
  const t = useT();
1601
1645
  const locale = useLocaleId();
@@ -1742,7 +1786,7 @@ function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
1742
1786
  }, disabled: busy }, h(Icon, { name: "trash", size: 15 }), t("delete"))
1743
1787
  ) : null
1744
1788
  ),
1745
- quotaInline(keyRecord, t, now),
1789
+ quotaInline(keyRecord, t, now, quotaRejected),
1746
1790
  error !== null ? h("div", { className: "km-key-error", role: "alert" }, error) : null,
1747
1791
  testLine(test, t),
1748
1792
  confirm ? h(Modal, {
@@ -1760,7 +1804,7 @@ function AccountRow({ provider, keyRecord, now, onReauthenticate }) {
1760
1804
  }, h("p", { className: "km-modal-copy" }, t(provider.supported === true ? "deleteAccountBody" : "deleteAccountBodyNoKeys"))) : null
1761
1805
  );
1762
1806
  }
1763
- function TransportAccountRow({ account }) {
1807
+ function TransportAccountRow({ account, now }) {
1764
1808
  const runtime = useRuntime();
1765
1809
  const t = useT();
1766
1810
  const locale = useLocaleId();
@@ -1768,6 +1812,7 @@ function TransportAccountRow({ account }) {
1768
1812
  const [error, setError] = import_react2.default.useState(null);
1769
1813
  const [confirm, setConfirm] = import_react2.default.useState(false);
1770
1814
  const [login, setLogin] = import_react2.default.useState(null);
1815
+ const [quotaRejected, setQuotaRejected] = import_react2.default.useState(false);
1771
1816
  async function signIn() {
1772
1817
  setBusy(true);
1773
1818
  setError(null);
@@ -1828,6 +1873,13 @@ function TransportAccountRow({ account }) {
1828
1873
  { className: "km-key-last" },
1829
1874
  h("div", { className: "km-key-time" }, t("transportExpires", { time: formatClock(account.expiresAt, locale, t) }))
1830
1875
  ),
1876
+ h(QuotaRefresh, {
1877
+ providerId: account.id,
1878
+ now,
1879
+ onRejected: setQuotaRejected,
1880
+ quotas: [account.quota]
1881
+ }),
1882
+ quotaInline(account, t, now, quotaRejected),
1831
1883
  h(
1832
1884
  "div",
1833
1885
  { className: "km-key-actions" },
@@ -1988,13 +2040,22 @@ function TransportModels({ route }) {
1988
2040
  ) : null
1989
2041
  );
1990
2042
  }
1991
- function quotaInline(row, t, now) {
2043
+ function quotaInline(row, t, now, rejected = false) {
1992
2044
  const windows = quotaWindows(row.quota);
1993
2045
  if (windows.length === 0) {
1994
2046
  if (row.quota?.status === "natively-managed") {
1995
2047
  return h("div", { className: "km-quota-inline" }, t("quotaNativelyManaged"));
1996
2048
  }
1997
- return row.quota?.status === "unauthorized" && row.kind === "oauth" ? h("div", { className: "km-quota-inline" }, t("quotaSignInAgain")) : null;
2049
+ if (row.quota?.status === "unauthorized" && row.kind === "oauth") {
2050
+ return h("div", { className: "km-quota-inline" }, t("quotaSignInAgain"));
2051
+ }
2052
+ if (row.quota?.status === "absent" && row.quota.absentCause === "no-probe") {
2053
+ return h("div", { className: "km-quota-inline" }, t("quotaNoProbe"));
2054
+ }
2055
+ if (rejected && row.quota === void 0) {
2056
+ return h("div", { className: "km-quota-inline" }, t("quotaNotReported"));
2057
+ }
2058
+ return null;
1998
2059
  }
1999
2060
  const tightest = windows.reduce((best, window) => window.usedFraction > best.usedFraction ? window : best);
2000
2061
  const remainingMs = tightest.resetsAt - now;
@@ -2005,41 +2066,32 @@ function quotaInline(row, t, now) {
2005
2066
  if (row.quota?.stale === true) parts.push(t("quotaStale"));
2006
2067
  return h("div", { className: "km-quota-inline", title: parts.join(" \xB7 ") }, parts.join(" \xB7 "));
2007
2068
  }
2008
- function quotaSignature(provider) {
2009
- return provider.keys.map((key) => `${key.id}:${key.quota?.status ?? "-"}:${key.quota?.fetchedAt ?? 0}`).join("|");
2069
+ function quotaSignature(quotas) {
2070
+ return quotas.map((quota) => `${quota?.status ?? "none"}:${quota?.fetchedAt ?? 0}`).join("|");
2010
2071
  }
2011
- function QuotaRefresh({ provider, now }) {
2072
+ function QuotaRefresh({ providerId, now, onRejected, quotas }) {
2012
2073
  const runtime = useRuntime();
2013
2074
  const attempted = import_react2.default.useRef(null);
2014
- const retryBudget = import_react2.default.useRef(null);
2015
- const retried = import_react2.default.useRef(null);
2016
- const quotas = provider.keys.map((key) => key.quota);
2075
+ const lastAttemptAt = import_react2.default.useRef(null);
2017
2076
  const needsRefresh = quotaNeedsRefresh(quotas, now);
2018
2077
  const minute = Math.floor(now / 6e4);
2019
- const signature = quotaSignature(provider);
2078
+ const signature = quotaSignature(quotas);
2020
2079
  import_react2.default.useEffect(() => {
2021
2080
  if (!needsRefresh) {
2022
2081
  attempted.current = null;
2023
- retried.current = null;
2024
- retryBudget.current = null;
2082
+ lastAttemptAt.current = null;
2025
2083
  return void 0;
2026
2084
  }
2027
2085
  if (attempted.current === signature) return void 0;
2028
- if (retried.current === signature) return void 0;
2086
+ if (lastAttemptAt.current !== null && now - lastAttemptAt.current < QUOTA_RETRY_MS) return void 0;
2029
2087
  attempted.current = signature;
2030
- if (retryBudget.current === signature) {
2031
- retried.current = signature;
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;
2088
+ lastAttemptAt.current = now;
2089
+ void runtime.store.refreshQuota(providerId).then((outcome) => {
2038
2090
  attempted.current = null;
2039
- retryBudget.current = moved ? null : signature;
2091
+ onRejected(!outcome.ok);
2040
2092
  });
2041
2093
  return void 0;
2042
- }, [provider.provider, signature, minute, needsRefresh]);
2094
+ }, [providerId, signature, minute, needsRefresh]);
2043
2095
  return null;
2044
2096
  }
2045
2097
  function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
@@ -2052,6 +2104,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
2052
2104
  const [login, setLogin] = import_react2.default.useState(null);
2053
2105
  const [startingLogin, setStartingLogin] = import_react2.default.useState(false);
2054
2106
  const [error, setError] = import_react2.default.useState(null);
2107
+ const [quotaRejected, setQuotaRejected] = import_react2.default.useState(false);
2055
2108
  const managed = provider.managed;
2056
2109
  const broken = managed && provider.bindingHealthy === false;
2057
2110
  const keyCount = provider.keyCount;
@@ -2186,7 +2239,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
2186
2239
  transport ? h(
2187
2240
  "div",
2188
2241
  { className: "km-transport-body" },
2189
- transportAccount !== void 0 ? h("div", { className: "km-keys" }, h(TransportAccountRow, { account: transportAccount })) : h("div", { className: "km-muted" }, t("transportProviderHint")),
2242
+ transportAccount !== void 0 ? h("div", { className: "km-keys" }, h(TransportAccountRow, { account: transportAccount, now })) : h("div", { className: "km-muted" }, t("transportProviderHint")),
2190
2243
  h(TransportModels, { route: provider.provider })
2191
2244
  ) : !managed ? h(
2192
2245
  "div",
@@ -2277,13 +2330,18 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
2277
2330
  )
2278
2331
  ),
2279
2332
  adding ? h(KeyForm, { provider, onDone: () => setAdding(false), autoFocus: true }) : null,
2280
- provider.keys.length > 0 ? h(QuotaRefresh, { provider, now }) : null,
2333
+ provider.keys.length > 0 ? h(QuotaRefresh, {
2334
+ providerId: provider.provider,
2335
+ now,
2336
+ onRejected: setQuotaRejected,
2337
+ quotas: provider.keys.map((key) => key.quota)
2338
+ }) : null,
2281
2339
  provider.keys.length === 0 ? h(
2282
2340
  "div",
2283
2341
  { className: "km-empty-keys" },
2284
2342
  h("div", null, provider.supported ? t("noKeys") : oauthCapable(provider) ? t("noKeysAccount") : t("unsupported")),
2285
2343
  !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) })))
2344
+ ) : 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
2345
  ),
2288
2346
  h(
2289
2347
  "div",
@@ -2826,7 +2884,8 @@ function KeysManagerBody() {
2826
2884
  }))) : null,
2827
2885
  visibleOrphans.length > 0 ? h("div", { className: "km-provider-list" }, visibleOrphans.map((account) => h(TransportAccountRow, {
2828
2886
  key: account.scope,
2829
- account
2887
+ account,
2888
+ now
2830
2889
  }))) : null
2831
2890
  ) : null,
2832
2891
  !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,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