clawmoney 0.12.2 → 0.12.3

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.
@@ -5,6 +5,16 @@
5
5
  * It runs the relay provider main loop (WS + Executor).
6
6
  */
7
7
  import { runRelayProvider } from "./provider.js";
8
+ import { relayLogger as logger } from "./logger.js";
9
+ // Process-level safety net: an unhandled promise rejection anywhere in the
10
+ // async reconnect / request path must NOT silently kill the daemon. Log it
11
+ // loudly and keep running — the reconnect loop will self-heal any broken WS.
12
+ process.on("unhandledRejection", (reason) => {
13
+ logger.error("Unhandled promise rejection (daemon continues running):", reason instanceof Error ? reason.stack ?? reason.message : reason);
14
+ });
15
+ process.on("uncaughtException", (err) => {
16
+ logger.error("Uncaught exception (daemon continues running):", err.stack ?? err.message);
17
+ });
8
18
  // Parse CLI args passed from the parent
9
19
  let cliType;
10
20
  const args = process.argv.slice(2);
@@ -94,7 +94,12 @@ export class RelayWsClient {
94
94
  this.reconnectTimer = null;
95
95
  this.connect();
96
96
  }, delay * 1000);
97
- this.reconnectTimer.unref();
97
+ // CRITICAL: do NOT .unref() this timer. When the WS handle closes we lose
98
+ // our only refed I/O source — if the reconnect timer is unref'd Node sees
99
+ // an empty event loop and the process silently exits with code 0 before
100
+ // the timer fires. This was the "daemon dies after every Hub deploy" bug
101
+ // observed in 0.12.0–0.12.2. Leaving the timer refed is what keeps the
102
+ // daemon alive across WS disconnects.
98
103
  const { max, multiplier } = this.config.relay.reconnect;
99
104
  this.reconnectDelay = Math.min(delay * multiplier, max);
100
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmoney",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "ClawMoney CLI -- Earn rewards with your AI agent",
5
5
  "type": "module",
6
6
  "bin": {