@tigorhutasuhut/claude-retry 0.1.6 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist/monitor.js +13 -17
  2. package/package.json +1 -1
package/dist/monitor.js CHANGED
@@ -47,33 +47,29 @@ async function stepState(state, screenText, now, injectContinue, marginSeconds,
47
47
  const limited = match(screenText).limited;
48
48
  const { usage } = await resolveAccountUsage(snapshot, resolvePaneAccount, target);
49
49
  const marginMs = (marginSeconds ?? 60) * 1000;
50
- // 1. Banner gonelimit cleared / claude exited / user already continued / pane reused
50
+ // Banner absent → claude exited / user already continued / pane id reused → nothing to continue.
51
51
  if (!limited) {
52
52
  state.status = 'monitoring';
53
53
  state.waitUntil = 0;
54
54
  logger(`${label} wait abandoned (banner gone)`);
55
55
  return 'monitoring';
56
56
  }
57
- // 2. Account known and NOT limitedstale banner persisting drop
58
- if (usage !== undefined && !usage.limited) {
59
- state.status = 'monitoring';
60
- state.waitUntil = 0;
61
- logger(`${label} wait abandoned (account not limited)`);
62
- return 'monitoring';
63
- }
64
- // 3. Account known, still limited, with a fresh resetsAtMs → refresh waitUntil
57
+ // Account still limited with a known reset keep waitUntil aligned to the live reset time.
65
58
  if (usage !== undefined && usage.limited && usage.resetsAtMs !== null) {
66
59
  state.waitUntil = usage.resetsAtMs + marginMs;
67
60
  }
68
- // 4. Timer not elapsed keep waiting
69
- if (now < state.waitUntil) {
70
- return 'rate-limited';
61
+ // The limit is over when the account quota has cleared (early/real reset) OR the timer elapsed.
62
+ const accountCleared = usage !== undefined && !usage.limited;
63
+ const timerElapsed = now >= state.waitUntil;
64
+ if (accountCleared || timerElapsed) {
65
+ await injectContinue();
66
+ state.status = 'monitoring';
67
+ state.waitUntil = 0;
68
+ logger(`${label} reset reached — injected continue`);
69
+ return 'retried';
71
70
  }
72
- // 5. Elapsed + banner still present (+ account limited or unknown)inject
73
- await injectContinue();
74
- state.status = 'monitoring';
75
- state.waitUntil = 0;
76
- return 'retried';
71
+ // Still limited, before resetkeep waiting.
72
+ return 'rate-limited';
77
73
  }
78
74
  // state.status === 'monitoring'
79
75
  const result = match(screenText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigorhutasuhut/claude-retry",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Monitor Claude CLI in a zellij pane, auto-inject continue on rate-limit",
5
5
  "type": "module",
6
6
  "license": "MIT",