maxpool 1.24.48 → 1.24.50
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/reset-policy.js +11 -23
package/package.json
CHANGED
package/src/reset-policy.js
CHANGED
|
@@ -65,14 +65,10 @@ export function decideZai(account, cards, now = Date.now()) {
|
|
|
65
65
|
const wkUtil = wk; const sesUtil = ses;
|
|
66
66
|
|
|
67
67
|
const weeklyCards = (cards.weekly || []).filter(c => !c.expired && c.recordId != null);
|
|
68
|
-
const sesCards = (cards.fiveHour || []).filter(c => !c.expired && c.recordId != null);
|
|
69
68
|
// R4: soonest expiry first inside each class.
|
|
70
69
|
weeklyCards.sort((a, b) => (a.expiresAt ?? Infinity) - (b.expiresAt ?? Infinity));
|
|
71
|
-
sesCards.sort((a, b) => (a.expiresAt ?? Infinity) - (b.expiresAt ?? Infinity));
|
|
72
70
|
|
|
73
71
|
const weeklyCard = weeklyCards[0] || null;
|
|
74
|
-
const sesCard = sesCards[0] || null;
|
|
75
|
-
let weeklyHeld = false; // R6: weekly card HELD for the free refill (5h branch may still fire)
|
|
76
72
|
|
|
77
73
|
// --- weekly card: clears BOTH windows (z.ai docs; measured: glm1 100%->0% both)
|
|
78
74
|
if (weeklyCard) {
|
|
@@ -83,13 +79,10 @@ export function decideZai(account, cards, now = Date.now()) {
|
|
|
83
79
|
if (atWall || dying) {
|
|
84
80
|
// R6: a wall redeem waits when the FREE weekly refill is imminent and the
|
|
85
81
|
// account isn't critically full (dying-value redeems stay exempt above).
|
|
86
|
-
// A HELD weekly card is spendable-redundant, not absent: the 5h branch below
|
|
87
|
-
// may still fire (red-team: holding must not starve a 5h wall — the 5h card
|
|
88
|
-
// sits redundant behind the free refill anyway, so spending it is pure gain).
|
|
89
82
|
if (atWall && !dying && q.providerWkReset != null
|
|
90
83
|
&& msLeft(q.providerWkReset, now) < POLICY.freeRefillWaitMs
|
|
91
84
|
&& wkUtil < POLICY.freeRefillImmediate) {
|
|
92
|
-
|
|
85
|
+
/* HELD for the free refill — do not redeem */
|
|
93
86
|
} else {
|
|
94
87
|
return { kind: 'card', card: weeklyCard, resetType: 'WEEK',
|
|
95
88
|
reason: atWall ? 'weekly at wall' : 'dying value' };
|
|
@@ -97,17 +90,10 @@ export function decideZai(account, cards, now = Date.now()) {
|
|
|
97
90
|
}
|
|
98
91
|
}
|
|
99
92
|
|
|
100
|
-
// --- 5h card:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const dying = msLeft(sesCard.expiresAt, now) < POLICY.dyingWindowMs
|
|
105
|
-
&& (sesUtil ?? 0) >= POLICY.dyingMinUtilSes;
|
|
106
|
-
if (atWall || dying) {
|
|
107
|
-
return { kind: 'card', card: sesCard, resetType: 'FIVE_HOUR',
|
|
108
|
-
reason: atWall ? 'session at wall' : 'dying value' };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
93
|
+
// --- 5h card: NEVER SPENT (owner, 2026-10-30: "never spend resets on session
|
|
94
|
+
// limits, only on weekly"). The 5h window refills ~33x per week on its own, so a
|
|
95
|
+
// 5h card buys minutes of capacity at the cost of a scarce card. Historically
|
|
96
|
+
// both the atWall and dying-value branches spent them; both are gone.
|
|
111
97
|
return null;
|
|
112
98
|
}
|
|
113
99
|
|
|
@@ -128,13 +114,15 @@ export function decideClaude(account, listing, now = Date.now()) {
|
|
|
128
114
|
const sesUtil = q.unified5h ?? null;
|
|
129
115
|
const clearsWk = chosen.clears?.includes('seven_day');
|
|
130
116
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
// Owner, 2026-10-30: "never spend resets on session limits, only on weekly."
|
|
118
|
+
// A grant that clears ONLY the session window is never spent, at wall or dying.
|
|
119
|
+
if (!clearsWk) return null;
|
|
120
|
+
|
|
121
|
+
const atWall = wkUtil != null && wkUtil >= POLICY.wallWeekly;
|
|
134
122
|
|
|
135
123
|
// use_requires_limit: some grants may only fire AT the wall (server-enforced).
|
|
136
124
|
const dying = msLeft(chosen.endsAt, now) < POLICY.dyingWindowMs
|
|
137
|
-
&& Math.max(wkUtil ?? 0, sesUtil ?? 0) >=
|
|
125
|
+
&& Math.max(wkUtil ?? 0, sesUtil ?? 0) >= POLICY.dyingMinUtilWeekly;
|
|
138
126
|
// A requires-limit grant cannot be redeemed pre-wall even for dying value.
|
|
139
127
|
if (atWall || (dying && !chosen.requiresLimit)) {
|
|
140
128
|
return { kind: 'grant', grant: chosen, reason: atWall ? 'at wall' : 'dying value' };
|