@clastres/groundcontrol 0.1.4 → 0.1.5

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/daemon.mjs +10 -2
  2. package/package.json +3 -3
package/daemon.mjs CHANGED
@@ -54,7 +54,7 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
54
54
  process.exit(0);
55
55
  }
56
56
  if (process.argv.includes('--version')) {
57
- console.log('0.1.4');
57
+ console.log('0.1.5');
58
58
  process.exit(0);
59
59
  }
60
60
 
@@ -710,7 +710,10 @@ async function handleCommand(cmd) {
710
710
  let lastPongAt = Date.now();
711
711
 
712
712
  function connect() {
713
- ws = new WebSocket(`${RELAY}/ch/${CHANNEL}?role=host`);
713
+ // handshakeTimeout: a dial that never completes would otherwise sit in
714
+ // CONNECTING forever without firing close, freezing the retry loop.
715
+ ws = new WebSocket(`${RELAY}/ch/${CHANNEL}?role=host`, { handshakeTimeout: 15_000 });
716
+ lastPongAt = Date.now();
714
717
  ws.on('open', () => { lastPongAt = Date.now(); console.log('[daemon] connected to relay'); sendSnapshot(true); });
715
718
  ws.on('pong', () => { lastPongAt = Date.now(); });
716
719
  ws.on('message', (data) => {
@@ -743,6 +746,11 @@ setInterval(() => {
743
746
  console.log('[daemon] stale relay link, forcing reconnect');
744
747
  ws.terminate();
745
748
  }
749
+ } else if (ws && ws.readyState === 0 && Date.now() - lastPongAt > 65_000) {
750
+ // Backstop for a handshake stuck past its timeout; terminate fires the
751
+ // close handler, which schedules the next retry.
752
+ console.log('[daemon] connect attempt hung, forcing reconnect');
753
+ ws.terminate();
746
754
  }
747
755
  }, 20_000);
748
756
  try { fs.watch(SESSIONS_DIR, () => sendSnapshot()); } catch {}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@clastres/groundcontrol",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "See and command your Claude Code sessions from your iPhone. Pairs the Ground Control app with the agents running on this Mac, end to end encrypted.",
5
5
  "bin": {
6
- "groundcontrol": "./bin/groundcontrol.mjs"
6
+ "groundcontrol": "bin/groundcontrol.mjs"
7
7
  },
8
8
  "type": "module",
9
9
  "engines": {
@@ -26,4 +26,4 @@
26
26
  "homepage": "https://groundcontrol.chat",
27
27
  "author": "Carlos Lastres",
28
28
  "license": "MIT"
29
- }
29
+ }