maxpool 1.24.30 → 1.24.31
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 +16 -0
package/package.json
CHANGED
package/src/reset-policy.js
CHANGED
|
@@ -34,6 +34,13 @@
|
|
|
34
34
|
* R5 PACE — at most ONE redeem per account per evaluation. The caller invokes the
|
|
35
35
|
* policy each poll cycle; the deterministic z.ai requestId makes an accidental
|
|
36
36
|
* double-fire harmless, but the policy still returns a single action.
|
|
37
|
+
*
|
|
38
|
+
* R6 WAIT FOR THE FREE REFILL (owner, 2026-10-23) — a wall redeem (R1) burns a card
|
|
39
|
+
* that z.ai's free weekly refill is about to make redundant: when the refill
|
|
40
|
+
* lands <24h away and weekly util < 0.98, HOLD the card. At >= 0.98 redeem
|
|
41
|
+
* immediately — the owner is never blocked waiting for a free refill that is
|
|
42
|
+
* merely hours away. Dying-value redeems (R2) are exempt: an expiring card's
|
|
43
|
+
* value cannot survive a wait.
|
|
37
44
|
*/
|
|
38
45
|
export const POLICY = {
|
|
39
46
|
wallWeekly: 0.90, // weekly at 90% = at the wall
|
|
@@ -41,6 +48,8 @@ export const POLICY = {
|
|
|
41
48
|
dyingWindowMs: 24 * 3600 * 1000, // redeem-don't-save horizon
|
|
42
49
|
dyingMinUtilWeekly: 0.30, // below this a dying weekly refill buys too little
|
|
43
50
|
dyingMinUtilSes: 0.50, // 5h refills are cheap capacity; demand more waste first
|
|
51
|
+
freeRefillWaitMs: 24 * 3600 * 1000, // R6: hold a wall redeem this close to the free refill
|
|
52
|
+
freeRefillImmediate: 0.98, // R6: ...unless this full — never block the owner
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
function msLeft(t, now) { return t == null ? Infinity : t - now; }
|
|
@@ -70,6 +79,13 @@ export function decideZai(account, cards, now = Date.now()) {
|
|
|
70
79
|
const dying = msLeft(weeklyCard.expiresAt, now) < POLICY.dyingWindowMs
|
|
71
80
|
&& worst >= POLICY.dyingMinUtilWeekly;
|
|
72
81
|
if (atWall || dying) {
|
|
82
|
+
// R6: a wall redeem waits when the FREE weekly refill is imminent and the
|
|
83
|
+
// account isn't critically full (dying-value redeems stay exempt above).
|
|
84
|
+
if (atWall && !dying && q.providerWkReset != null
|
|
85
|
+
&& msLeft(q.providerWkReset, now) < POLICY.freeRefillWaitMs
|
|
86
|
+
&& wkUtil < POLICY.freeRefillImmediate) {
|
|
87
|
+
return null; // hold — the free refill lands before the card would matter
|
|
88
|
+
}
|
|
73
89
|
return { kind: 'card', card: weeklyCard, resetType: 'WEEK',
|
|
74
90
|
reason: atWall ? 'weekly at wall' : 'dying value' };
|
|
75
91
|
}
|