maxpool 1.24.89 → 1.24.90
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 +16 -3
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -1890,6 +1890,16 @@ export class AccountManager {
|
|
|
1890
1890
|
st.graceUntil = Math.max(st.graceUntil ?? 0, now + LIFT_GRACE_MS);
|
|
1891
1891
|
}
|
|
1892
1892
|
|
|
1893
|
+
/** A FULL lift (a held reset that refills the whole week) makes the weekly window
|
|
1894
|
+
* not scarce: the pool picks the cheapest account, so pricing a lifted 0.97 on
|
|
1895
|
+
* its weekly usage made it worst-of-pool and starved it (reports, live
|
|
1896
|
+
* 2026-11-12). Weekly pace/utilization/pressure ignore it; the 5h window and the
|
|
1897
|
+
* load terms still apply. A give-back lift refills only what the model used, so
|
|
1898
|
+
* it keeps weekly pricing. */
|
|
1899
|
+
_weeklyRefilledByLift(account, now = Date.now()) {
|
|
1900
|
+
return this.capLiftActive(account, now) && account.capLift?.mode !== 'giveback';
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1893
1903
|
/** True while the account's usage cap is suspended by a held full-refill reset. */
|
|
1894
1904
|
capLiftActive(account, now = Date.now()) {
|
|
1895
1905
|
if (!account || account.enabled === false) return false;
|
|
@@ -3844,7 +3854,8 @@ export class AccountManager {
|
|
|
3844
3854
|
if (q.unified5h != null) {
|
|
3845
3855
|
scarcity = Math.max(scarcity, this._windowScarcity(q.unified5h, q.unified5hReset, FIVE_HOUR_MS, now));
|
|
3846
3856
|
}
|
|
3847
|
-
|
|
3857
|
+
const weeklyFree = this._weeklyRefilledByLift(account, now);
|
|
3858
|
+
if (q.unified7d != null && !weeklyFree) {
|
|
3848
3859
|
scarcity = Math.max(scarcity, this._windowScarcity(q.unified7d, q.unified7dReset, WEEK_MS, now));
|
|
3849
3860
|
}
|
|
3850
3861
|
if (q.tokensLimit != null && q.tokensRemaining != null && q.tokensLimit > 0) {
|
|
@@ -3859,7 +3870,7 @@ export class AccountManager {
|
|
|
3859
3870
|
if (q.providerSes != null) {
|
|
3860
3871
|
scarcity = Math.max(scarcity, this._windowScarcity(q.providerSes, q.providerSesReset, FIVE_HOUR_MS, now));
|
|
3861
3872
|
}
|
|
3862
|
-
if (q.providerWk != null) {
|
|
3873
|
+
if (q.providerWk != null && !weeklyFree) {
|
|
3863
3874
|
scarcity = Math.max(scarcity, this._windowScarcity(q.providerWk, q.providerWkReset, WEEK_MS, now));
|
|
3864
3875
|
}
|
|
3865
3876
|
return scarcity;
|
|
@@ -3895,7 +3906,7 @@ export class AccountManager {
|
|
|
3895
3906
|
// signal (the actual fix) while capacity dying at reset stays free (the
|
|
3896
3907
|
// invariant the older tests pin). Unknown/absent reset → face value, same as
|
|
3897
3908
|
// _accountScarcity. Turn the flag off to restore session-only exactly.
|
|
3898
|
-
if (this.scheduler.weeklyAwareScoring !== false) {
|
|
3909
|
+
if (this.scheduler.weeklyAwareScoring !== false && !this._weeklyRefilledByLift(account, now)) {
|
|
3899
3910
|
if (q.unified7d != null) {
|
|
3900
3911
|
util = Math.max(util, this._windowScarcity(q.unified7d, q.unified7dReset, WEEK_MS, now));
|
|
3901
3912
|
}
|
|
@@ -4100,6 +4111,7 @@ export class AccountManager {
|
|
|
4100
4111
|
_weeklyState(account) {
|
|
4101
4112
|
const rawState = this._weeklyRawState(account);
|
|
4102
4113
|
if (rawState === 'unknown' || rawState === 'exhausted' || rawState === 'capped') return rawState;
|
|
4114
|
+
if (this._weeklyRefilledByLift(account)) return rawState;
|
|
4103
4115
|
|
|
4104
4116
|
const pressure = Math.max(clamp01(account.quota.unified7d ?? 0), this._effectiveWeeklyUsage(account));
|
|
4105
4117
|
if (pressure >= this.scheduler.weeklyCriticalThreshold) return 'critical';
|
|
@@ -4209,6 +4221,7 @@ export class AccountManager {
|
|
|
4209
4221
|
// Provider quota lives in separate fields — see _weeklyRawState.
|
|
4210
4222
|
if (account.type === 'provider') return this._weeklyRawState(account, now);
|
|
4211
4223
|
if (account.quota.unified7d == null) return 'unknown';
|
|
4224
|
+
if (this._weeklyRefilledByLift(account, now)) return this._weeklyRawState(account, now);
|
|
4212
4225
|
const effective = this._effectiveWeeklyUsage(account);
|
|
4213
4226
|
if (effective >= this.scheduler.weeklyExhaustedThreshold) return 'exhausted';
|
|
4214
4227
|
if (effective >= this.scheduler.weeklyCriticalThreshold) return 'critical';
|