maxpool 1.24.73 → 1.24.74
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 +14 -1
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -2340,6 +2340,13 @@ export class AccountManager {
|
|
|
2340
2340
|
if (switched) {
|
|
2341
2341
|
console.log(`[Maxpool] Switched to account "${best.name}"`);
|
|
2342
2342
|
}
|
|
2343
|
+
// Evidence for the next cache measurement: one line each time a KNOWN
|
|
2344
|
+
// conversation leaves its last account (bounded by moves, not by requests).
|
|
2345
|
+
const ckey = this._affinityKey(requestInfo);
|
|
2346
|
+
const lastName = ckey ? this.conversationLastAccount.get(ckey) : null;
|
|
2347
|
+
if (lastName && lastName !== best.name) {
|
|
2348
|
+
console.log(`[Maxpool] conversation moved: ${lastName} → ${best.name} (${requestInfo.bodyBytes ?? '?'}B)`);
|
|
2349
|
+
}
|
|
2343
2350
|
return best;
|
|
2344
2351
|
}
|
|
2345
2352
|
}
|
|
@@ -3205,6 +3212,12 @@ export class AccountManager {
|
|
|
3205
3212
|
if (base <= 0 || this.scheduler.routingMode === 'sticky') return 0;
|
|
3206
3213
|
const key = this._affinityKey(requestInfo);
|
|
3207
3214
|
if (!key || this.conversationLastAccount.get(key) !== account.name) return 0;
|
|
3215
|
+
// Scale with the CONVERSATION'S SIZE too: losing the cache costs the prefix a
|
|
3216
|
+
// hop re-writes, and requestInfo.bodyBytes ≈ prefix + this turn. Checkpoint
|
|
3217
|
+
// 2026-11-08 11:07Z: a flat 400 cut full re-writes only 18.9%→14.8% of turns —
|
|
3218
|
+
// the rest were 100K-500K-token conversations whose single in-flight turn
|
|
3219
|
+
// already outweighed it. 1x below 150KB, rising to 3x at 450KB+.
|
|
3220
|
+
const sizeMult = Math.min(3, Math.max(1, (requestInfo.bodyBytes || 0) / 150_000));
|
|
3208
3221
|
// No readable quota (Kimi's coding key is console-only) → nothing would ever
|
|
3209
3222
|
// release the hold before a 429; give such rows plain balancing (red-team r1).
|
|
3210
3223
|
if (account.type === 'provider' && account.quota?.providerQuotaSource === 'console-only') return 0;
|
|
@@ -3224,7 +3237,7 @@ export class AccountManager {
|
|
|
3224
3237
|
? this._fastRefillMultiplier(account, { capFloor: true }) : refillMult;
|
|
3225
3238
|
const unit = this.scheduler.concurrencyWeight * refillMult + this.scheduler.capPenaltyWeight * safetyMult;
|
|
3226
3239
|
const fullUnit = this.scheduler.concurrencyWeight + this.scheduler.capPenaltyWeight;
|
|
3227
|
-
return base * Math.min(1, unit / fullUnit);
|
|
3240
|
+
return base * sizeMult * Math.min(1, unit / fullUnit);
|
|
3228
3241
|
}
|
|
3229
3242
|
|
|
3230
3243
|
/**
|