maxpool 1.13.0 → 1.13.1
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 +5 -1
- package/src/capacity-ledger.js +9 -1
- package/src/tui.js +7 -6
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { refreshAccessToken, isTokenExpiringSoon, modelFamily, tokenFingerprint } from './oauth.js';
|
|
2
|
-
import { CapacityLedger } from './capacity-ledger.js';
|
|
2
|
+
import { CapacityLedger, TANK_MIN_UTIL } from './capacity-ledger.js';
|
|
3
3
|
|
|
4
4
|
// Nominal window length per kind — mirrors capacity-ledger's WINDOW_MS (kept here as a
|
|
5
5
|
// local table so account-manager does not import a private constant).
|
|
@@ -3299,6 +3299,10 @@ export class AccountManager {
|
|
|
3299
3299
|
if (measured) return { ...measured, source: 'cycles' };
|
|
3300
3300
|
const est = this.capacityEstimate(accountIndex, window);
|
|
3301
3301
|
if (!est) return null;
|
|
3302
|
+
// Same rounding-noise guard as tankStats: a 1%-full window divides by vendor
|
|
3303
|
+
// whole-percent rounding and can read absurd (measured live: 455k ÷ 1% = "≥45M").
|
|
3304
|
+
// Below the floor the reading is noise — withhold rather than print a fiction.
|
|
3305
|
+
if (est.utilization < TANK_MIN_UTIL) return null;
|
|
3302
3306
|
return {
|
|
3303
3307
|
avg: est.tokens, last: est.tokens, n: 0, exact: est.lowerBound ? 0 : 1,
|
|
3304
3308
|
bounded: est.lowerBound ? 1 : 0, lowerBound: Boolean(est.lowerBound),
|
package/src/capacity-ledger.js
CHANGED
|
@@ -35,6 +35,14 @@ const SAME_BOUNDARY_MS = 5_000;
|
|
|
35
35
|
// The minimum span of a COMPLETE cycle per window (80% of nominal): a real one is
|
|
36
36
|
// flagged partial by the writer, so a complete cycle below this is corrupt history.
|
|
37
37
|
const READ_FLOOR_MS = { ses: 4 * 3600_000, wk: 5 * 86400_000 };
|
|
38
|
+
|
|
39
|
+
// TANK floor. tank = tokens ÷ utilization, and vendors report WHOLE percents — so at
|
|
40
|
+
// 1% full, one percentage point of rounding swings the answer by 100% (measured live
|
|
41
|
+
// 2026-08-25: a 1%-full window read "≥45M"). Below this the reading is rounding noise,
|
|
42
|
+
// not a measurement. Exported because BOTH the closed-cycle average and the live
|
|
43
|
+
// in-window estimate must apply the same floor; one guarding without the other is how
|
|
44
|
+
// the absurd number reached the screen in the first place.
|
|
45
|
+
export const TANK_MIN_UTIL = 0.05;
|
|
38
46
|
const MAX_CYCLES_PER_WINDOW = 50;
|
|
39
47
|
const MAX_DAY_BUCKETS = 10;
|
|
40
48
|
|
|
@@ -404,7 +412,7 @@ export class CapacityLedger {
|
|
|
404
412
|
const usable = (rec?.[window]?.closed || []).filter(c =>
|
|
405
413
|
c.complete && !c.disabledDuring
|
|
406
414
|
&& Number.isFinite(c.finalUtilization)
|
|
407
|
-
&& c.finalUtilization >=
|
|
415
|
+
&& c.finalUtilization >= TANK_MIN_UTIL
|
|
408
416
|
&& (c.endedAt - c.startedAt) >= floor - 1_000);
|
|
409
417
|
if (!usable.length) return null;
|
|
410
418
|
let sum = 0, exact = 0, bounded = 0;
|
package/src/tui.js
CHANGED
|
@@ -2089,13 +2089,14 @@ export class TUI {
|
|
|
2089
2089
|
continue;
|
|
2090
2090
|
}
|
|
2091
2091
|
const st = ledger.windowStats(a.name, win);
|
|
2092
|
-
|
|
2092
|
+
const tank = this.am.capacityTank?.(i, win);
|
|
2093
2093
|
const nowOpen = ledger.openCycle(a.name, win);
|
|
2094
2094
|
const util = this.am._windowUtilization?.(a, win);
|
|
2095
|
-
// A reading we cannot prove is from THIS window
|
|
2096
|
-
//
|
|
2097
|
-
//
|
|
2098
|
-
|
|
2095
|
+
// A reading we cannot prove is from THIS window may describe the previous one —
|
|
2096
|
+
// the basis line says "unproven" instead of "live", but the number still renders:
|
|
2097
|
+
// a restored reading after a restart is real data, and suppressing it would blank
|
|
2098
|
+
// the page at exactly the moment the user opens it.
|
|
2099
|
+
const unproven = tank?.source === 'live' && tank.fresh === false;
|
|
2099
2100
|
|
|
2100
2101
|
// A row with NEITHER a tank nor any delivery has genuinely nothing to say. Say
|
|
2101
2102
|
// WHY in the account's own terms — "no completed cycle yet" was true and useless
|
|
@@ -2131,7 +2132,7 @@ export class TUI {
|
|
|
2131
2132
|
const basis = !tank ? dim('no capacity reading yet')
|
|
2132
2133
|
: tank.source === 'cycles'
|
|
2133
2134
|
? dim(`${tank.n} full ${tank.n === 1 ? 'window' : 'windows'}`)
|
|
2134
|
-
: dim(
|
|
2135
|
+
: dim(`${unproven ? 'from an older reading' : 'live'} · ${((tank.utilization ?? 0) * 100).toFixed(0)}% used`);
|
|
2135
2136
|
const pct = util != null && tank?.source !== 'live' ? dim(` (${(util * 100).toFixed(0)}% full now)`) : '';
|
|
2136
2137
|
out.push(' ' + name + ' ' + prov + ' ' + cyan(cells) + ' ' + basis + pct);
|
|
2137
2138
|
}
|