maxpool 1.24.0 → 1.24.2

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 +43 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.24.0",
3
+ "version": "1.24.2",
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
@@ -32,6 +32,8 @@ const vw = s => strip(s).length;
32
32
  const NAME_W = 20; // a.name.slice(0, NAME_W).padEnd(NAME_W) — fits a full email like 2solarmax@gmail.com (19)
33
33
  const PROVIDER_W = 9; // providerLabel(a).padEnd(PROVIDER_W) — fits "Anthropic"
34
34
  const STATUS_W = 13; // rpad(status, STATUS_W) — fits "throttled 59s"
35
+ const RESETS_W = 3; // 'Rst' column — banked limit resets (cards/grants) the
36
+ // pool can auto-redeem; '0' when none, count when some.
35
37
  const ROW_PREFIX = ' '; // ' ' + sel(1) + cur(1) + ' ' — 4 cols before the name
36
38
 
37
39
  // Human provider name for the accounts-table "Provider" column. account.provider
@@ -60,6 +62,7 @@ function acctHeader(W) {
60
62
  + 'Account'.padEnd(NAME_W) + ' '
61
63
  + 'Provider'.padEnd(PROVIDER_W) + ' '
62
64
  + 'Status'.padEnd(STATUS_W) + ' '
65
+ + 'Rst'.padEnd(RESETS_W) + ' '
63
66
  + quota;
64
67
  }
65
68
 
@@ -265,20 +268,6 @@ function settingsTags(am, a) {
265
268
  else if (a.subscriptionGone) tags.push(red('no sub'));
266
269
  return tags; // disabled: never show card inventory either (owner gate)
267
270
  }
268
- // Available limit resets — the pool redeems these automatically per policy
269
- // (reset-policy.js). Shown so the owner can see banked value before it expires.
270
- const rc = a?.resetCards;
271
- if (rc) {
272
- const live5 = (rc.fiveHour || []).filter(c => !c.expired).length;
273
- const liveW = (rc.weekly || []).filter(c => !c.expired).length;
274
- if (liveW) tags.push(green(`reset wk×${liveW}`));
275
- if (live5) tags.push(green(`reset 5h×${live5}`));
276
- }
277
- const rg = a?.resetGrants;
278
- if (rg?.eligible) {
279
- const live = (rg.grants || []).filter(g => g.usableNow && !g.expired).length;
280
- if (live) tags.push(green(`reset×${live}`));
281
- }
282
271
  return tags;
283
272
  }
284
273
 
@@ -2147,8 +2136,46 @@ export class TUI {
2147
2136
  // Widened from 10 to fit "throttled 59s" so the quota bars stay column-aligned.
2148
2137
  status = rpad(status, STATUS_W);
2149
2138
 
2139
+ // Rst column — banked limit resets (owner request 2026-09-30: a separate
2140
+ // column showing 0 or the count). z.ai cards + Claude cedar_ember grants,
2141
+ // not-yet-expired, on ENABLED accounts only: a disabled account's resets are
2142
+ // not ours to spend, and showing a count there would imply otherwise.
2143
+ let resetsCell;
2144
+ {
2145
+ let n = 0;
2146
+ if (a.enabled !== false) {
2147
+ const rc = a.resetCards;
2148
+ if (rc) n += (rc.fiveHour || []).filter(c => !c.expired).length
2149
+ + (rc.weekly || []).filter(c => !c.expired).length;
2150
+ const rg = a.resetGrants;
2151
+ if (rg?.eligible) n += (rg.grants || []).filter(g => g.usableNow && !g.expired).length;
2152
+ }
2153
+ // Expiry rides with the count when it's tight: "1~2d" = 1 reset, expires in ~2 days.
2154
+ // Claude grants end mid-Oct (weeks out) — a day-count would be noise; only the
2155
+ // SOONEST-expiring card under 7 days gets a suffix, so the column stays narrow
2156
+ // and the number it carries still answers "use it or lose it?".
2157
+ let suffix = '';
2158
+ if (n > 0) {
2159
+ let soonest = Infinity;
2160
+ const rc = a.resetCards;
2161
+ if (rc) for (const c of [...(rc.fiveHour || []), ...(rc.weekly || [])]) {
2162
+ if (!c.expired && c.expiresAt != null && c.expiresAt < soonest) soonest = c.expiresAt;
2163
+ }
2164
+ const rg = a.resetGrants;
2165
+ if (rg?.eligible) for (const g of (rg.grants || [])) {
2166
+ if (g.usableNow && !g.expired && g.endsAt != null && g.endsAt < soonest) soonest = g.endsAt;
2167
+ }
2168
+ const days = soonest === Infinity ? null : (soonest - Date.now()) / 86400_000;
2169
+ if (days != null && days < 7) {
2170
+ suffix = days < 1 ? '~' + Math.max(1, Math.round(days * 24)) + 'h'
2171
+ : '~' + Math.max(1, Math.round(days)) + 'd';
2172
+ }
2173
+ }
2174
+ resetsCell = rpad(n > 0 ? green(String(n) + suffix) : gray('0'), RESETS_W + (suffix ? 2 : 0));
2175
+ }
2176
+
2150
2177
  if (a.type === 'provider') {
2151
- return this._renderProviderAcct(sel, cur, name, type, status, a, bw, showBoth);
2178
+ return this._renderProviderAcct(sel, cur, name, type, status + ' ' + resetsCell, a, bw, showBoth);
2152
2179
  }
2153
2180
 
2154
2181
  // Quota ratios — prefer unified (Claude Max), fall back to standard (API key)
@@ -2171,7 +2198,7 @@ export class TUI {
2171
2198
  t2 = t1;
2172
2199
  }
2173
2200
 
2174
- let line = ` ${sel}${cur} ${name} ${type} ${status} ${l1} ${bar(r1, bw, t1)}`;
2201
+ let line = ` ${sel}${cur} ${name} ${type} ${status} ${resetsCell} ${l1} ${bar(r1, bw, t1)}`;
2175
2202
  if (showBoth) {
2176
2203
  // "no weekly cap on this plan" is a DIFFERENT state from "not read yet", and
2177
2204
  // both render as an empty bar. Say which, so a healthy uncapped account