maxpool 1.24.41 → 1.24.42
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 +18 -0
- package/src/prober.js +5 -2
- package/src/server.js +5 -0
- package/src/tui.js +14 -2
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -4656,6 +4656,19 @@ export class AccountManager {
|
|
|
4656
4656
|
return a;
|
|
4657
4657
|
}
|
|
4658
4658
|
|
|
4659
|
+
/** The linked pool's LIVE row for a benched local account (by identity), or null.
|
|
4660
|
+
* The local copy's own quota/counters go stale the moment it's benched — the
|
|
4661
|
+
* display must read the cloud's numbers (owner 2026-10-29: "I don't know if I can
|
|
4662
|
+
* trust the session and weekly limits I'm seeing"). */
|
|
4663
|
+
remoteRowFor(account) {
|
|
4664
|
+
if (!account?.poolBenchedBy) return null;
|
|
4665
|
+
for (const l of this.poolLinks) {
|
|
4666
|
+
const row = (l.status?.accounts || []).find(ra => ra.name === account.poolBenchedBy);
|
|
4667
|
+
if (row) return { row, linkOk: l.lastOkAt != null && !l.lastError, linkName: l.name };
|
|
4668
|
+
}
|
|
4669
|
+
return null;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4659
4672
|
/** True when account is benched by the duplicate guard. */
|
|
4660
4673
|
isPoolBenched(account) {
|
|
4661
4674
|
return Boolean(account && account.poolBenchedBy);
|
|
@@ -4795,6 +4808,11 @@ export class AccountManager {
|
|
|
4795
4808
|
refreshDead: Boolean(ra.refreshDead),
|
|
4796
4809
|
quota: ra.quota || null,
|
|
4797
4810
|
status: ra.status || null,
|
|
4811
|
+
inFlight: ra.inFlight || 0,
|
|
4812
|
+
completedRequests: ra.completedRequests || 0,
|
|
4813
|
+
failedRequests: ra.failedRequests || 0,
|
|
4814
|
+
lastError: ra.lastError || null,
|
|
4815
|
+
load: ra.load || null,
|
|
4798
4816
|
})),
|
|
4799
4817
|
})),
|
|
4800
4818
|
sessions: {
|
package/src/prober.js
CHANGED
|
@@ -202,7 +202,9 @@ export class Prober {
|
|
|
202
202
|
// OWNER GATE (2026-09-30): disabled accounts are excluded from listing AND
|
|
203
203
|
// redemption entirely — a readable key on a disabled account (someone else
|
|
204
204
|
// uses it) is not authority to act.
|
|
205
|
-
|
|
205
|
+
// A duplicate-guard-benched copy never redeems: the team pool owns that key now,
|
|
206
|
+
// and two pools redeeming one key would burn two cards for one reset.
|
|
207
|
+
if (account.enabled !== false && account.credential && !account.poolBenchedBy) {
|
|
206
208
|
if (account.provider === 'zai' && this.am.applyResetCards) {
|
|
207
209
|
try {
|
|
208
210
|
const cards = await this._withTimeout(this.cardsFn(account.credential));
|
|
@@ -226,7 +228,8 @@ export class Prober {
|
|
|
226
228
|
* else legitimately using the key is WHY the account is benched. */
|
|
227
229
|
async _checkOutsideUsage(account, now = this._now()) {
|
|
228
230
|
try {
|
|
229
|
-
|
|
231
|
+
// Benched duplicate: the team pool's traffic on this key is NOT outside usage.
|
|
232
|
+
if (account.provider !== 'zai' || !account.credential || account.enabled === false || account.poolBenchedBy) return;
|
|
230
233
|
const last = account._outsideCheckedAt || 0;
|
|
231
234
|
if (now - last < OUTSIDE_CHECK_MS) return;
|
|
232
235
|
const data = await this._withTimeout(this.zaiUsageFn(account.credential, { now }));
|
package/src/server.js
CHANGED
|
@@ -741,6 +741,11 @@ async function forwardRequest(
|
|
|
741
741
|
for (const [k, v] of Object.entries(req.headers)) {
|
|
742
742
|
const lk = k.toLowerCase();
|
|
743
743
|
if (HOP_BY_HOP_HEADERS.has(lk) || lk === 'content-length' || lk === 'host' || lk === 'connection') continue;
|
|
744
|
+
// NEVER forward the client's provider credentials to a linked pool (live finding
|
|
745
|
+
// 2026-10-29: `cc all` sends x-maxpool-zai-token / x-maxpool-kimi-token and the
|
|
746
|
+
// cloud pool turned them into runtime accounts — a key the owner had disabled
|
|
747
|
+
// locally went live remotely). The remote pool owns its own accounts.
|
|
748
|
+
if (/^x-maxpool-(zai|kimi)-/.test(lk)) continue;
|
|
744
749
|
linkHeaders[k] = v;
|
|
745
750
|
}
|
|
746
751
|
linkHeaders[HOP_HEADER] = String(hop);
|
package/src/tui.js
CHANGED
|
@@ -45,6 +45,7 @@ const ROW_PREFIX = ' '; // ' ' + sel(1) + cur(1) + ' ' — 4 cols before the
|
|
|
45
45
|
const PROVIDER_LABELS = { anthropic: 'Anthropic', zai: 'z.ai', kimi: 'Moonshot', openai: 'OpenAI', codex: 'Codex', grok: 'Grok', xai: 'Grok' };
|
|
46
46
|
function providerLabel(a) {
|
|
47
47
|
if (a.type === 'pool') return 'Team pool';
|
|
48
|
+
if (a._cloud) return (PROVIDER_LABELS[a.provider] || a.provider || 'Cloud').slice(0, PROVIDER_W - 1) + '☁';
|
|
48
49
|
const key = a.provider || (a.type === 'provider' ? 'provider' : 'anthropic');
|
|
49
50
|
const label = PROVIDER_LABELS[key] || (key.charAt(0).toUpperCase() + key.slice(1));
|
|
50
51
|
return label.slice(0, PROVIDER_W);
|
|
@@ -2109,7 +2110,15 @@ export class TUI {
|
|
|
2109
2110
|
}
|
|
2110
2111
|
|
|
2111
2112
|
_renderAcct(idx, bw, showBoth) {
|
|
2112
|
-
|
|
2113
|
+
let a = this.am.accounts[idx];
|
|
2114
|
+
// A row benched by the duplicate guard renders the CLOUD's live copy (status,
|
|
2115
|
+
// bars, in-flight, request counts) — never the stale local snapshot. Identity
|
|
2116
|
+
// and name stay local so the row doesn't move.
|
|
2117
|
+
const remote = this.am.remoteRowFor?.(a);
|
|
2118
|
+
if (remote) {
|
|
2119
|
+
a = { ...a, ...remote.row, name: a.name, index: a.index, poolBenchedBy: a.poolBenchedBy,
|
|
2120
|
+
_cloud: true, _cloudOk: remote.linkOk, enabled: true };
|
|
2121
|
+
}
|
|
2113
2122
|
// Highlight the ACTIVE account(s) — drives BOTH the ► marker and the green
|
|
2114
2123
|
// "active" status color. In manual mode that's the single pinned account (all
|
|
2115
2124
|
// traffic goes there). In automatic load-balancing there is no single "current"
|
|
@@ -2146,7 +2155,9 @@ export class TUI {
|
|
|
2146
2155
|
// the one running the recovery probe as "probing" and the rest "waiting"
|
|
2147
2156
|
// (the pool-wide throttle banner above conveys the cause).
|
|
2148
2157
|
const upstreamBlocking = a.type !== 'provider' && this.am._isUpstreamThrottleBlocking?.();
|
|
2149
|
-
let effectiveStatus = a.
|
|
2158
|
+
let effectiveStatus = a._cloud
|
|
2159
|
+
? (a._cloudOk ? a.status : 'cloud-down')
|
|
2160
|
+
: (a.poolBenchedBy ? 'pool-benched' : (a.enabled === false ? 'disabled' : a.status));
|
|
2150
2161
|
if (a.enabled !== false && upstreamBlocking && a.status === 'active') {
|
|
2151
2162
|
effectiveStatus = a.inFlight > 0 ? 'probing' : 'waiting';
|
|
2152
2163
|
}
|
|
@@ -2198,6 +2209,7 @@ export class TUI {
|
|
|
2198
2209
|
case 'paused': status = yellow('paused'); break;
|
|
2199
2210
|
case 'disabled': status = red('✕ disabled'); break;
|
|
2200
2211
|
case 'pool-benched': status = gray('⟐ team pool'); break;
|
|
2212
|
+
case 'cloud-down': status = red('⟐ cloud ✕'); break;
|
|
2201
2213
|
// Disabled AND needs re-login — both facts matter, and DISABLED LEADS.
|
|
2202
2214
|
// The owner's question that drove this (2026-09-30): "when I disable the account
|
|
2203
2215
|
// and then the token expires, does it show disabled or reauth? It needs to
|