maxpool 1.8.5 → 1.8.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "Multi-account Claude Code proxy with adaptive, rate-aware load balancing across Claude accounts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -34,6 +34,17 @@ const SAME_BOUNDARY_MS = 5_000;
34
34
  const MAX_CYCLES_PER_WINDOW = 50;
35
35
  const MAX_DAY_BUCKETS = 10;
36
36
 
37
+ // Demote a pre-v3 closed cycle: unverifiable (every one predates the joined-mid-window
38
+ // fix) AND untrustworthy in its timestamps (the v1.8.4 advance-close could date a row
39
+ // hours into the future — live: a row ending 19:54 while the clock read 15:02). Also
40
+ // CLAMPS a future endedAt to startedAt so the stored row itself stops violating
41
+ // invariants after migration, not just the averages.
42
+ function demote(c) {
43
+ const fixed = { ...c, complete: false, partialReason: 'pre-v3-unverified' };
44
+ if (fixed.endedAt > Date.now() + 60_000) fixed.endedAt = fixed.startedAt;
45
+ return fixed;
46
+ }
47
+
37
48
  export class CapacityLedger {
38
49
  constructor({ now = () => Date.now() } = {}) {
39
50
  this._now = now;
@@ -55,9 +66,9 @@ export class CapacityLedger {
55
66
  for (const [name, rec] of Object.entries(payload.accounts || {})) {
56
67
  migrated.accounts[name] = {
57
68
  ses: { open: rec.ses?.open || null,
58
- closed: (rec.ses?.closed || []).map(c => ({ ...c, complete: false, partialReason: 'pre-v3-unverified' })) },
69
+ closed: (rec.ses?.closed || []).map(c => demote(c)) },
59
70
  wk: { open: rec.wk?.open || null,
60
- closed: (rec.wk?.closed || []).map(c => ({ ...c, complete: false, partialReason: 'pre-v3-unverified' })) },
71
+ closed: (rec.wk?.closed || []).map(c => demote(c)) },
61
72
  days: rec.days || {},
62
73
  };
63
74
  }