maxpool 1.24.61 → 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 +1 -1
- package/src/account-manager.js +13 -47
- package/src/screen.html +1 -1
- package/src/server.js +1 -1
- package/src/tui.js +0 -3
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -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' :
|
|
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'
|
|
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
|
|
@@ -2509,7 +2501,7 @@ export class AccountManager {
|
|
|
2509
2501
|
if (!this._isRequestCompatible(account, profile, requestInfo)) return false;
|
|
2510
2502
|
// Cloud mirrors egress from the cloud's own IP — this machine's upstream throttle
|
|
2511
2503
|
// and local queue fairness don't describe them.
|
|
2512
|
-
const providerLike = account.type === 'provider' ||
|
|
2504
|
+
const providerLike = account.type === 'provider' || Boolean(account.remote);
|
|
2513
2505
|
if (
|
|
2514
2506
|
!providerLike
|
|
2515
2507
|
&& this.queueState.waiting.length
|
|
@@ -2551,7 +2543,7 @@ export class AccountManager {
|
|
|
2551
2543
|
const incompatible = this._effectiveIncompatible(requestInfo).incompatible;
|
|
2552
2544
|
// An incompatible session is pinned to its provider family — no mode overrides that.
|
|
2553
2545
|
if (incompatible) {
|
|
2554
|
-
const isHome = (account.type === 'provider'
|
|
2546
|
+
const isHome = (account.type === 'provider')
|
|
2555
2547
|
&& (mode === 'prefer-zai' ? account.provider === 'zai'
|
|
2556
2548
|
: mode === 'prefer-kimi' ? account.provider === 'kimi' : true);
|
|
2557
2549
|
return isHome ? 0 : base;
|
|
@@ -2769,11 +2761,18 @@ export class AccountManager {
|
|
|
2769
2761
|
|
|
2770
2762
|
_isRequestCompatible(account, profile, requestInfo = {}) {
|
|
2771
2763
|
if (!this._matchesProfile(account, profile)) return false;
|
|
2772
|
-
// A
|
|
2764
|
+
// A cloud mirror carries Anthropic-API traffic only (/v1/…). Browser noise
|
|
2773
2765
|
// (favicon, stray GETs) must never be forwarded — on the remote it finds no
|
|
2774
2766
|
// route, queues up to the hold window, and pins a link lease the whole time
|
|
2775
2767
|
// (live-rehearsal 2026-10-29: 4 favicon GETs showed as "4 running").
|
|
2776
|
-
if (account.
|
|
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
|
+
|
|
2777
2776
|
|
|
2778
2777
|
// Kimi (Moonshot) 400s on images Anthropic/GLM accept ("failed to decode
|
|
2779
2778
|
// image") — and a provider 400 is TERMINAL (not retried to another account), so
|
|
@@ -3012,21 +3011,6 @@ export class AccountManager {
|
|
|
3012
3011
|
// unchanged balancing logic — sees it as busy as it really is.
|
|
3013
3012
|
const inflight = account.activeWeight + reqWeight + (account._remoteOtherLoad || 0);
|
|
3014
3013
|
const refillMult = this._fastRefillMultiplier(account);
|
|
3015
|
-
if (account.type === 'pool' && account._link) {
|
|
3016
|
-
// Utilization = the cloud's own reported fraction of usable accounts spent
|
|
3017
|
-
// (weekly windows), so a near-exhausted cloud pool de-preferences like a
|
|
3018
|
-
// near-exhausted local account rather than pretending to be empty-fresh.
|
|
3019
|
-
const link = account._link;
|
|
3020
|
-
const remoteUtil = link.summary && link.summary.total
|
|
3021
|
-
? (link.summary.total - link.summary.usable) / link.summary.total : 0;
|
|
3022
|
-
// Same shape as a provider's weekly utilization cost, keyed to remote load.
|
|
3023
|
-
const remoteLoad = Math.max(account.activeWeight, link.status?.scheduler?.globalInFlight || 0);
|
|
3024
|
-
return (
|
|
3025
|
-
remoteLoad * this.scheduler.concurrencyWeight
|
|
3026
|
-
+ Math.max(0, remoteLoad - this.scheduler.perAccountConcurrencyTarget) * this.scheduler.capPenaltyWeight
|
|
3027
|
-
+ remoteUtil * this.scheduler.capPenaltyWeight
|
|
3028
|
-
);
|
|
3029
|
-
}
|
|
3030
3014
|
|
|
3031
3015
|
// DOMINANT term: in-flight concurrency. Short-term throttling is driven by
|
|
3032
3016
|
// how many requests pile on one account, so least-loaded-first spread is
|
|
@@ -4882,24 +4866,6 @@ export class AccountManager {
|
|
|
4882
4866
|
this._remoteIdentities = ids;
|
|
4883
4867
|
}
|
|
4884
4868
|
|
|
4885
|
-
/** Add (or update) the routable account row for a pool link. */
|
|
4886
|
-
upsertPoolAccount(link) {
|
|
4887
|
-
let a = this.accounts.find(x => x.type === 'pool' && x.name === link.name);
|
|
4888
|
-
if (!a) {
|
|
4889
|
-
this.upsertRuntimeAccount({
|
|
4890
|
-
name: link.name, type: 'pool', provider: 'pool',
|
|
4891
|
-
authToken: link.key, upstream: String(link.url).replace(/\/+$/, ''),
|
|
4892
|
-
profiles: ['claude', 'all'], priority: 0, configSourced: true,
|
|
4893
|
-
});
|
|
4894
|
-
a = this.accounts.find(x => x.type === 'pool' && x.name === link.name);
|
|
4895
|
-
}
|
|
4896
|
-
a.credential = link.key;
|
|
4897
|
-
a.upstream = String(link.url).replace(/\/+$/, '');
|
|
4898
|
-
a._link = link;
|
|
4899
|
-
a.configSourced = true;
|
|
4900
|
-
return a;
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
4869
|
/** The linked pool's LIVE row for a benched local account (by identity), or null.
|
|
4904
4870
|
* The local copy's own quota/counters go stale the moment it's benched — the
|
|
4905
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.
|
|
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.
|
|
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) {
|