maxpool 1.24.60 → 1.24.62

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.60",
3
+ "version": "1.24.62",
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",
@@ -488,12 +488,12 @@ export class AccountManager {
488
488
  index,
489
489
  name: acct.name,
490
490
  type: acct.type,
491
- provider: acct.provider || (acct.type === 'provider' ? 'provider' : acct.type === 'pool' ? 'pool' : 'anthropic'),
491
+ provider: acct.provider || (acct.type === 'provider' ? 'provider' : 'anthropic'),
492
492
  accountUuid: acct.accountUuid || null,
493
493
  credential: acct.accessToken || acct.authToken || acct.apiKey,
494
494
  upstream: acct.upstream || null,
495
495
  authHeader: acct.authHeader || null,
496
- profiles: acct.profiles || (acct.type === 'provider' || acct.type === 'pool' ? ['all'] : ['claude', 'all']),
496
+ profiles: acct.profiles || (acct.type === 'provider' ? ['all'] : ['claude', 'all']),
497
497
  priority: Number.isFinite(acct.priority) ? acct.priority : 0,
498
498
  // USAGE CAP (owner-directed 2026-08-26): reserve capacity on this account —
499
499
  // the proxy benches it at capUtilization of BOTH the 5h and 7d windows, keeping
@@ -1077,14 +1077,6 @@ export class AccountManager {
1077
1077
  if (!l || l.lastError || l.lastOkAt == null) return false;
1078
1078
  if (account.refreshDead || account.status === 'error') return false;
1079
1079
  }
1080
- // Pool link: available only while its last poll succeeded AND the remote has a
1081
- // usable account — a down/empty team pool must not swallow requests that local
1082
- // accounts could serve.
1083
- if (account.type === 'pool') {
1084
- const link = account._link;
1085
- if (!link || link.lastError || link.lastOkAt == null) return false;
1086
- if (!link.summary || link.summary.usable < 1) return false;
1087
- }
1088
1080
  const now = options.now ?? Date.now();
1089
1081
 
1090
1082
  // Check rate limit expiry
@@ -1401,7 +1393,11 @@ export class AccountManager {
1401
1393
  }
1402
1394
  const now = Date.now();
1403
1395
  if (now < this.queueState.rampUntil && now - this.queueState.lastAdmissionAt < 250) return false;
1404
- this.queueState.waiting.shift();
1396
+ // Remove THIS ticket, not the head: with the head-skip above, the admitted ticket
1397
+ // may not be waiting[0]. shift() here dropped the stuck head's ticket and left the
1398
+ // admitted one queued (found 2026-10-31 re-reading the shipped change).
1399
+ const pos = this.queueState.waiting.findIndex(t => t.id === ticket.id);
1400
+ if (pos >= 0) this.queueState.waiting.splice(pos, 1);
1405
1401
  this.queueState.bytes = Math.max(0, this.queueState.bytes - (ticket.bytes || 0));
1406
1402
  this.queueState.lastAdmissionAt = now;
1407
1403
  requestInfo.queueTicket = null;
@@ -2505,7 +2501,7 @@ export class AccountManager {
2505
2501
  if (!this._isRequestCompatible(account, profile, requestInfo)) return false;
2506
2502
  // Cloud mirrors egress from the cloud's own IP — this machine's upstream throttle
2507
2503
  // and local queue fairness don't describe them.
2508
- const providerLike = account.type === 'provider' || account.type === 'pool' || Boolean(account.remote);
2504
+ const providerLike = account.type === 'provider' || Boolean(account.remote);
2509
2505
  if (
2510
2506
  !providerLike
2511
2507
  && this.queueState.waiting.length
@@ -2547,7 +2543,7 @@ export class AccountManager {
2547
2543
  const incompatible = this._effectiveIncompatible(requestInfo).incompatible;
2548
2544
  // An incompatible session is pinned to its provider family — no mode overrides that.
2549
2545
  if (incompatible) {
2550
- const isHome = (account.type === 'provider' || account.type === 'pool')
2546
+ const isHome = (account.type === 'provider')
2551
2547
  && (mode === 'prefer-zai' ? account.provider === 'zai'
2552
2548
  : mode === 'prefer-kimi' ? account.provider === 'kimi' : true);
2553
2549
  return isHome ? 0 : base;
@@ -2765,11 +2761,18 @@ export class AccountManager {
2765
2761
 
2766
2762
  _isRequestCompatible(account, profile, requestInfo = {}) {
2767
2763
  if (!this._matchesProfile(account, profile)) return false;
2768
- // A pool link carries Anthropic-API traffic only (/v1/…). Browser noise
2764
+ // A cloud mirror carries Anthropic-API traffic only (/v1/…). Browser noise
2769
2765
  // (favicon, stray GETs) must never be forwarded — on the remote it finds no
2770
2766
  // route, queues up to the hold window, and pins a link lease the whole time
2771
2767
  // (live-rehearsal 2026-10-29: 4 favicon GETs showed as "4 running").
2772
- if (account.type === 'pool' && !String(requestInfo.path || '').startsWith('/v1/')) return false;
2768
+ if (account.remote && !String(requestInfo.path || '').startsWith('/v1/')) return false;
2769
+ // A cloud mirror carries Anthropic-API traffic only (/v1/…). Browser noise
2770
+ // (favicon, stray GETs) must never be forwarded — on the remote it finds no
2771
+ // route, queues up to the hold window, and pins a link lease the whole time
2772
+ // (live-rehearsal 2026-10-29: 4 favicon GETs showed as "4 running"). This guard
2773
+ // used to key on the aggregate type:'pool' row; mirrors (account.remote) are the
2774
+ // only link rows now, so it moves to them.
2775
+
2773
2776
 
2774
2777
  // Kimi (Moonshot) 400s on images Anthropic/GLM accept ("failed to decode
2775
2778
  // image") — and a provider 400 is TERMINAL (not retried to another account), so
@@ -3008,21 +3011,6 @@ export class AccountManager {
3008
3011
  // unchanged balancing logic — sees it as busy as it really is.
3009
3012
  const inflight = account.activeWeight + reqWeight + (account._remoteOtherLoad || 0);
3010
3013
  const refillMult = this._fastRefillMultiplier(account);
3011
- if (account.type === 'pool' && account._link) {
3012
- // Utilization = the cloud's own reported fraction of usable accounts spent
3013
- // (weekly windows), so a near-exhausted cloud pool de-preferences like a
3014
- // near-exhausted local account rather than pretending to be empty-fresh.
3015
- const link = account._link;
3016
- const remoteUtil = link.summary && link.summary.total
3017
- ? (link.summary.total - link.summary.usable) / link.summary.total : 0;
3018
- // Same shape as a provider's weekly utilization cost, keyed to remote load.
3019
- const remoteLoad = Math.max(account.activeWeight, link.status?.scheduler?.globalInFlight || 0);
3020
- return (
3021
- remoteLoad * this.scheduler.concurrencyWeight
3022
- + Math.max(0, remoteLoad - this.scheduler.perAccountConcurrencyTarget) * this.scheduler.capPenaltyWeight
3023
- + remoteUtil * this.scheduler.capPenaltyWeight
3024
- );
3025
- }
3026
3014
 
3027
3015
  // DOMINANT term: in-flight concurrency. Short-term throttling is driven by
3028
3016
  // how many requests pile on one account, so least-loaded-first spread is
@@ -4878,24 +4866,6 @@ export class AccountManager {
4878
4866
  this._remoteIdentities = ids;
4879
4867
  }
4880
4868
 
4881
- /** Add (or update) the routable account row for a pool link. */
4882
- upsertPoolAccount(link) {
4883
- let a = this.accounts.find(x => x.type === 'pool' && x.name === link.name);
4884
- if (!a) {
4885
- this.upsertRuntimeAccount({
4886
- name: link.name, type: 'pool', provider: 'pool',
4887
- authToken: link.key, upstream: String(link.url).replace(/\/+$/, ''),
4888
- profiles: ['claude', 'all'], priority: 0, configSourced: true,
4889
- });
4890
- a = this.accounts.find(x => x.type === 'pool' && x.name === link.name);
4891
- }
4892
- a.credential = link.key;
4893
- a.upstream = String(link.url).replace(/\/+$/, '');
4894
- a._link = link;
4895
- a.configSourced = true;
4896
- return a;
4897
- }
4898
-
4899
4869
  /** The linked pool's LIVE row for a benched local account (by identity), or null.
4900
4870
  * The local copy's own quota/counters go stale the moment it's benched — the
4901
4871
  * display must read the cloud's numbers (owner 2026-10-29: "I don't know if I can
package/src/screen.html CHANGED
@@ -129,7 +129,7 @@ h1{font-size:22px;margin:0;letter-spacing:-.3px}
129
129
  var five = q.unified5h != null ? q.unified5h : q.providerSes;
130
130
  var week = q.unified7d != null ? q.unified7d : q.providerWk;
131
131
  return '<div class="acct' + (a.refreshDead ? ' dead' : '') + '">' +
132
- '<div><div class="name">' + esc(a.name) + '</div><div class="sub">' + esc(a.type === 'pool' ? 'Team pool' : (a.provider || (a.type === 'oauth' ? 'Claude' : a.type))) +
132
+ '<div><div class="name">' + esc(a.name) + '</div><div class="sub">' + esc(a.provider || (a.type === 'oauth' ? 'Claude' : a.type)) +
133
133
  (a.inFlight ? ' · ' + a.inFlight + ' running' : '') + '</div></div>' +
134
134
  '<div class="bars">' + bar('5h', five) + bar('7d', week) + '</div>' +
135
135
  '<span class="state ' + st[0] + '">' + st[1] + '</span></div>';
package/src/server.js CHANGED
@@ -849,7 +849,7 @@ async function forwardRequest(
849
849
  // request to it with the person's key, a stepped hop header, and the client's
850
850
  // session header preserved — the remote pool does its own account selection,
851
851
  // so no body rewriting, no credential substitution.
852
- if (account.type === 'pool' || account.remote) {
852
+ if (account.remote) {
853
853
  const hop = nextHopCount(headerValue(req.headers, HOP_HEADER));
854
854
  if (hop == null) {
855
855
  accountManager.releaseAccount(lease, { neutral: true });
package/src/tui.js CHANGED
@@ -50,7 +50,6 @@ function whereCell(a) {
50
50
  }
51
51
 
52
52
  function providerLabel(a) {
53
- if (a.type === 'pool') return 'Team pool';
54
53
 
55
54
  const key = a.provider || (a.type === 'provider' ? 'provider' : 'anthropic');
56
55
  const label = PROVIDER_LABELS[key] || (key.charAt(0).toUpperCase() + key.slice(1));
@@ -2101,8 +2100,6 @@ export class TUI {
2101
2100
  // effectively off (owner 2026-10-29: "should it hide the local ones that are
2102
2101
  // in the cloud... they're effectively disabled as well"). No separate key.
2103
2102
  if (this.hideDisabled && this.am.accounts[i]?.poolBenchedBy) { hidden++; continue; }
2104
- // The legacy single team-pool row is superseded by per-account cloud rows.
2105
- if (this.am.accounts[i]?.type === 'pool') continue;
2106
2103
  lines.push(this._renderAcct(i, bw, showBoth));
2107
2104
  }
2108
2105
  if (hidden > 0) {