maxpool 1.22.0 → 1.22.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tui.js +17 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "description": "Multi-account Claude Code proxy with adaptive, rate-aware load balancing across Claude accounts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/tui.js CHANGED
@@ -211,23 +211,31 @@ function capText(a, benched, am) {
211
211
  // scheduler is not using. `cap 50%>67%` reads as "reserved 50%, currently allowing
212
212
  // 67%"; the two collapse to one number while the cap sits at its floor, so an
213
213
  // early-window dynamic account looks exactly like the fixed one it replaced.
214
+ // The WINDOW is named, not just the number. `cap 50%>75%` alone is ambiguous in the
215
+ // way that matters for the decision the row exists to support ("is it safe for me to
216
+ // use this account myself right now?"): a lift driven by the 5h window means reduced
217
+ // protection for minutes, the same number off the weekly means DAYS of it. Council
218
+ // finding 2026-09-24.
214
219
  const eff = capEffectivePct(am, a);
215
- const t = (eff != null && eff !== floorPct)
216
- ? `cap ${floorPct}%>${eff}%`
220
+ const t = (eff != null && eff.pct !== floorPct)
221
+ ? `cap ${floorPct}%>${eff.pct}% ${eff.window}`
217
222
  : `cap ${floorPct}%`;
218
223
  return benched ? yellow(t) : dim(t);
219
224
  }
220
225
 
221
- /** The percentage routing is ACTUALLY enforcing on this account right now: the worse
222
- * (lower) of its two windows' effective caps, which is the one that benches first.
223
- * Null for a fixed cap or when the manager cannot compute one. */
226
+ /** What routing is ACTUALLY enforcing on this account right now: the worse (lower) of
227
+ * its two windows' effective caps — the one that benches first — AND WHICH window that
228
+ * is. Returns {pct, window:'5h'|'wk'} or null for a fixed cap / when the manager cannot
229
+ * compute one. The window label is load-bearing: the same percentage means "protection
230
+ * is thin for the next few minutes" off the 5h window and "thin for days" off the weekly. */
224
231
  function capEffectivePct(am, a) {
225
232
  if (!am?._effectiveCap || a?.capMode !== 'dynamic') return null;
226
- const vals = ['ses', 'wk']
227
- .map(w => am._effectiveCap(a, w))
228
- .filter(v => typeof v === 'number' && Number.isFinite(v));
233
+ const vals = [['ses', '5h'], ['wk', 'wk']]
234
+ .map(([w, label]) => ({ v: am._effectiveCap(a, w), window: label }))
235
+ .filter(e => typeof e.v === 'number' && Number.isFinite(e.v));
229
236
  if (!vals.length) return null;
230
- return Math.round(Math.min(...vals) * 100);
237
+ const worst = vals.reduce((lo, e) => (e.v < lo.v ? e : lo));
238
+ return { pct: Math.round(worst.v * 100), window: worst.window };
231
239
  }
232
240
 
233
241
  /** PER-ACCOUNT SETTINGS the user set by hand — the last column's whole job