maxpool 1.24.84 → 1.24.86

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.24.84",
3
+ "version": "1.24.86",
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",
@@ -5659,6 +5659,13 @@ export class AccountManager {
5659
5659
  // when a leak's cards are most at risk — remediation rotates keys and
5660
5660
  // restarts the pool, and the in-memory flag would vanish mid-remediation.
5661
5661
  if (a.outsideUsage?.outside) out.outsideUsage = { ...a.outsideUsage };
5662
+ // RESETS survive restart (2026-11-10, live during the 1.24.84 rollout:
5663
+ // every local row blanked ~5-10 min after each seamless reload because the
5664
+ // serialized grants sweep takes minutes to re-list all accounts). Persist a
5665
+ // grants/cards SNAPSHOT so the post-reload screen shows the last known
5666
+ // count instead of nothing; restoreQuotaState marks it stale.
5667
+ if (a.resetGrants) out.resetGrants = { ...a.resetGrants, grants: (a.resetGrants.grants || []).map(g => ({ ...g })) };
5668
+ if (a.resetCards) out.resetCards = { ...a.resetCards, fiveHour: (a.resetCards.fiveHour || []).map(c => ({ ...c })), weekly: (a.resetCards.weekly || []).map(c => ({ ...c })) };
5662
5669
  return out;
5663
5670
  });
5664
5671
  }
@@ -5693,6 +5700,18 @@ export class AccountManager {
5693
5700
  }
5694
5701
  // We already know this account's weekly window, so it isn't "probing".
5695
5702
  if (account.quota.unified7dReset != null) account.probing = false;
5703
+ // RESTORED RESETS (2026-11-10): a pre-reload snapshot is a proof, not a
5704
+ // live listing — restore it marked STALE so the screen shows the count
5705
+ // with the not-fresh marker (never blank) and the first live listing
5706
+ // (≤ GRANTS_EVERY_MS) overwrites it. Never claim off a restored listing:
5707
+ // usability is re-derived by the next live check (C5 gates on usableNow
5708
+ // from the LIVE response; a restored entry may be hours old).
5709
+ if (match.resetGrants && !account.resetGrants) {
5710
+ account.resetGrants = { ...match.resetGrants, stale: true };
5711
+ }
5712
+ if (match.resetCards && !account.resetCards) {
5713
+ account.resetCards = { ...match.resetCards, stale: true };
5714
+ }
5696
5715
  // OUTSIDE-USAGE restored: keep holding R7 and force the next sweep to
5697
5716
  // re-verify immediately (fresh poolHourly can only re-prove the leak).
5698
5717
  if (match.outsideUsage?.outside) {
@@ -5905,7 +5924,17 @@ export class AccountManager {
5905
5924
  // Model-scoped: the probe must have MEASURED that family's bucket at the wall.
5906
5925
  const e = account.quota?.scopedWeekly?.[kind];
5907
5926
  const measured = e && e.reactive !== true && e.utilization != null && e.utilization >= CLAUDE_WALL_WEEKLY;
5908
- return measured ? (grants.find(g => appliesTo(g).includes(kind)) || null) : null;
5927
+ if (!measured) return null;
5928
+ // NARROWEST FIRST (2026-11-11, owner report): a grant that directly CLEARS the
5929
+ // general weekly (full-reset shape: clears includes 'seven_day') is the
5930
+ // account's most powerful card — never spend it at a model-only wall while a
5931
+ // model-only grant remains. gives_back_weekly does NOT make a grant broad
5932
+ // (the give-back is a side effect of the model reset, not a weekly refill —
5933
+ // the client's own rule treats it as an OR). Within one breadth, the
5934
+ // soonest-expiry sort above still wins so nothing rots.
5935
+ const clearsWeekly = g => (Array.isArray(g.clears) ? g.clears : []).includes('seven_day');
5936
+ const narrow = grants.find(g => !clearsWeekly(g) && appliesTo(g).includes(kind));
5937
+ return narrow || grants.find(g => appliesTo(g).includes(kind)) || null;
5909
5938
  }
5910
5939
 
5911
5940
  /** A claim SUCCEEDED: spend it in the stored listing at once (finding 1). Until
package/src/tui.js CHANGED
@@ -40,7 +40,7 @@ const NAME_W = 20; // a.name.slice(0, NAME_W).padEnd(NAME_W) — fits a
40
40
  const WHERE_W = 5; // 'Local' / 'Cloud' — where the account is provisioned
41
41
  const PROVIDER_W = 9; // providerLabel(a).padEnd(PROVIDER_W) — fits "Anthropic"
42
42
  const STATUS_W = 13; // rpad(status, STATUS_W) — fits "throttled 59s"
43
- const RESETS_W = 6; // 'Rst' column — FIXED width (fits '2~21d'); a variable
43
+ const RESETS_W = 8; // 'Rst' column — FIXED width (fits '2Fable' / '1~119d'); a variable
44
44
  // width ('0' vs '1~21d') shifted every quota bar per row.
45
45
  const ROW_PREFIX = ' '; // ' ' + sel(1) + cur(1) + ' ' — 4 cols before the name
46
46
 
@@ -2502,18 +2502,23 @@ export class TUI {
2502
2502
  for (const g of (rg.grants || [])) {
2503
2503
  if (!g || g.usableNow === false || g.paused || g.expired) continue;
2504
2504
  if (g.endsAt != null && g.endsAt <= now) continue; // live expiry
2505
- // The ONE shared scope answer (A1) — display reads the same
2506
- // classification as claim and lift. DISPLAY nuance (owner 2026-11-10
2507
- // "distinguish model-specific vs general"): a grant that refills a
2508
- // MODEL limit (scoped) shows under its model tag even when it ALSO
2509
- // gives back to the weekly — the give-back is a side effect, not the
2510
- // grant's identity. Only an unscoped general refiller counts general.
2505
+ // Display counts GRANTS by identity, not capabilities (owner
2506
+ // 2026-11-11: the screen showed "3Fable" while Anthropic's own screen
2507
+ // says "two fable and one regular weekly"). A grant that directly
2508
+ // clears the general weekly (full-reset shape: clears includes
2509
+ // 'seven_day') IS a weekly reset however much else it also clears —
2510
+ // count it general, once. Model-only grants count scoped; the
2511
+ // give-back side effect adds no display count (B3.1 nuance, 2026-11-10).
2512
+ // Claim and lift still read appliesTo() — the full reset stays eligible
2513
+ // at a model wall, and narrow-first spending (2026-11-11) keeps it for
2514
+ // the weekly wall.
2511
2515
  const scopes = appliesTo(g);
2516
+ const clearsWeekly = (Array.isArray(g.clears) ? g.clears : []).includes('seven_day');
2512
2517
  const hasScoped = scopes.some(x => x !== 'general' && x !== 'session');
2513
- const hasGeneral = scopes.includes('general');
2514
2518
  const left = Math.max(0, Math.floor(g.resetsLeft ?? 1));
2515
- if (hasScoped) scoped += left;
2516
- else if (hasGeneral) general += left;
2519
+ if (clearsWeekly) general += left;
2520
+ else if (hasScoped) scoped += left;
2521
+ else if (scopes.includes('general')) general += left;
2517
2522
  else unknown += left;
2518
2523
  if (g.endsAt != null && g.endsAt < soonest) soonest = g.endsAt;
2519
2524
  }
@@ -2545,8 +2550,15 @@ export class TUI {
2545
2550
  }
2546
2551
 
2547
2552
  // Fit to EXACTLY RESETS_W: full form, then drop the suffix, then total+'*'.
2548
- let text = core + suffix;
2549
- if (text.length > RESETS_W) text = core;
2553
+ // OWNER READABILITY (2026-11-10: "What does the letter F mean? I have no
2554
+ // idea"): a bare F is undecodable shorthand — the 2026-08-27 no-glossary
2555
+ // rule says the cell says what it means in words. Model-scoped resets spell
2556
+ // the model: '2Fable' / '1Opus'. RESETS_W grows to fit '99Fable' (8) so the
2557
+ // word is never truncated into a mystery tag again; plain counts keep the
2558
+ // compact n~Xd form.
2559
+ const coreFable = core.replace(/F\b/, 'Fable');
2560
+ let text = coreFable + suffix;
2561
+ if (text.length > RESETS_W) text = coreFable;
2550
2562
  if (text.length > RESETS_W) text = `${total}*`.slice(0, RESETS_W);
2551
2563
  if (notFresh) text = (text + '?').length <= RESETS_W ? text + '?' : `${total}?`.slice(0, RESETS_W);
2552
2564
  resetsCell = rpad(total > 0 && !notFresh ? green(text) : gray(text), RESETS_W);