maxpool 1.5.32 → 1.5.33
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/package.json +1 -1
- package/src/account-manager.js +14 -0
- package/src/tui.js +19 -3
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -62,6 +62,11 @@ function emptyQuota() {
|
|
|
62
62
|
lastProbeError: null, // string
|
|
63
63
|
lastProbeErrorAt: null, // ms
|
|
64
64
|
lastProbeErrorStatus: null, // http status (429, 500, …) or null
|
|
65
|
+
// Last time the DISPLAYED bars (unified5h/7d for OAuth, tokens/requests for
|
|
66
|
+
// API-key) were refreshed from a RESPONSE HEADER (updateQuota). Lets the TUI
|
|
67
|
+
// staleness marker tell "probe stale but bars fresh from live traffic" (a busy
|
|
68
|
+
// account — NOT stale) from "genuinely nothing refreshed it" (idle — stale).
|
|
69
|
+
lastHeaderQuotaAt: null, // ms
|
|
65
70
|
};
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -2118,6 +2123,15 @@ export class AccountManager {
|
|
|
2118
2123
|
if (genericRemaining != null) account.quota.genericRemaining = genericRemaining;
|
|
2119
2124
|
if (genericReset != null) account.quota.genericReset = genericReset;
|
|
2120
2125
|
|
|
2126
|
+
// Stamp header-freshness ONLY when a real quota header actually arrived — so a
|
|
2127
|
+
// header-less response never falsely marks the bars fresh. Drives the TUI's
|
|
2128
|
+
// "busy account isn't stale even if its background probe is 429-throttled".
|
|
2129
|
+
const gotQuotaHeader = !isNaN(u5h) || !isNaN(u7d)
|
|
2130
|
+
|| !isNaN(tokensLimit) || !isNaN(tokensRemaining)
|
|
2131
|
+
|| !isNaN(requestsLimit) || !isNaN(requestsRemaining)
|
|
2132
|
+
|| genericLimit != null || genericRemaining != null;
|
|
2133
|
+
if (gotQuotaHeader) account.quota.lastHeaderQuotaAt = Date.now();
|
|
2134
|
+
|
|
2121
2135
|
account.usage.totalRequests++;
|
|
2122
2136
|
account.usage.lastUsed = new Date().toISOString();
|
|
2123
2137
|
|
package/src/tui.js
CHANGED
|
@@ -985,7 +985,7 @@ export class TUI {
|
|
|
985
985
|
// Glossary FOOTER (expands the abbreviations the header + inline labels can't
|
|
986
986
|
// spell out). Below the rows so it never breaks the header↔column alignment.
|
|
987
987
|
if (W >= 88) {
|
|
988
|
-
lines.push(' ' + dim('Ses 5h · Wk 7d · Now in-flight (weight) · 15m/1h served (avg · f fails)'));
|
|
988
|
+
lines.push(' ' + dim('Legend Ses = 5h · Wk = 7d · Now = in-flight (weight) · 15m/1h = served (avg · f = fails)'));
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
|
|
@@ -1174,8 +1174,24 @@ export class TUI {
|
|
|
1174
1174
|
// Only annotate probe-staleness for LIVE accounts, where a failing probe
|
|
1175
1175
|
// (e.g. a 429) is a real, actionable signal.
|
|
1176
1176
|
if (a?.refreshDead || a?.enabled === false) return '';
|
|
1177
|
-
if (!this.am._quotaProbeStale?.(a)) return '';
|
|
1178
|
-
|
|
1177
|
+
if (!this.am._quotaProbeStale?.(a)) return ''; // probe fresh (or off) → nothing to flag; interval>0 after this
|
|
1178
|
+
// The background probe IS stale — but only flag it if something DISPLAYED is
|
|
1179
|
+
// actually stale. An OAuth account's Ses/Wk bars come from unified5h/7d, which
|
|
1180
|
+
// response headers refresh on every served request (updateQuota → lastHeaderQuotaAt);
|
|
1181
|
+
// so a BUSY oauth account with a header-fresh reading and no probe-only scoped
|
|
1182
|
+
// cap is NOT stale, even if its background probe is 429-throttled. Provider bars
|
|
1183
|
+
// and per-model scoped caps ARE probe-only, so for those a stale probe genuinely
|
|
1184
|
+
// means stale data → keep flagging.
|
|
1185
|
+
const q = a.quota || {};
|
|
1186
|
+
const reserveFloor = this.am.scheduler?.weeklyReserveThreshold ?? 0.85; // mirrors _renderAcct's scoped-tag gate
|
|
1187
|
+
const hasDisplayedScopedCap = Object.values(q.scopedWeekly || {}).some(
|
|
1188
|
+
e => e && e.isActive !== false && e.utilization != null && e.utilization >= reserveFloor);
|
|
1189
|
+
if (a.type !== 'provider' && !hasDisplayedScopedCap) {
|
|
1190
|
+
const interval = this.am.quotaProbeIntervalMs; // > 0 here (else _quotaProbeStale returned false)
|
|
1191
|
+
const headerFresh = q.lastHeaderQuotaAt && (Date.now() - q.lastHeaderQuotaAt) <= Math.max(3 * interval, 180_000);
|
|
1192
|
+
if (headerFresh) return '';
|
|
1193
|
+
}
|
|
1194
|
+
const s = q.lastProbeErrorStatus;
|
|
1179
1195
|
if (s === 429) return ` ${yellow('stale·rate-limited')}`;
|
|
1180
1196
|
if (s) return ` ${yellow('stale·probe ' + s)}`;
|
|
1181
1197
|
return ` ${dim('stale')}`;
|