@infernetprotocol/cli 0.1.60 → 0.1.61

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/commands/start.js +15 -6
  2. package/package.json +7 -7
package/commands/start.js CHANGED
@@ -108,6 +108,18 @@ function removeSocketFile() {
108
108
  try { unlinkSync(getDaemonSocketPath()); } catch { /* ignore */ }
109
109
  }
110
110
 
111
+ // Exit paths clean up only what is still ours: when another daemon has since started, the pidfile
112
+ // holds its pid and the socket is its listener. Deleting them made that daemon unreachable.
113
+ function ownsPidFile() {
114
+ try { return readFileSync(getDaemonPidPath(), 'utf8').trim() === String(process.pid); } catch { return false; }
115
+ }
116
+
117
+ async function removeOwnPidAndSocket() {
118
+ if (!ownsPidFile()) return;
119
+ removeSocketFile();
120
+ await removePidFile();
121
+ }
122
+
111
123
  // ---------------------------------------------------------------------------
112
124
  // Entry point — branch between "spawn detached" and "run foreground loop".
113
125
  // ---------------------------------------------------------------------------
@@ -1376,8 +1388,7 @@ async function runDaemon(args, ctx) {
1376
1388
  if (p2pServer) { try { p2pServer.close(); } catch {} }
1377
1389
  if (healthServer) { try { healthServer.close(); } catch {} }
1378
1390
  try { await shutdownEngine(); } catch {}
1379
- removeSocketFile();
1380
- await removePidFile();
1391
+ await removeOwnPidAndSocket();
1381
1392
  process.stdout.write('bye\n');
1382
1393
  process.exit(0);
1383
1394
  };
@@ -1519,8 +1530,7 @@ async function runDaemon(args, ctx) {
1519
1530
  if (ipcServer) { try { ipcServer.close(); } catch {} }
1520
1531
  if (p2pServer) { try { p2pServer.close(); } catch {} }
1521
1532
  if (healthServer) { try { healthServer.close(); } catch {} }
1522
- removeSocketFile();
1523
- await removePidFile();
1533
+ await removeOwnPidAndSocket();
1524
1534
  return 0;
1525
1535
  }
1526
1536
 
@@ -1619,8 +1629,7 @@ async function runDaemon(args, ctx) {
1619
1629
  if (p2pServer) try { p2pServer.close(); } catch {}
1620
1630
  if (healthServer) try { healthServer.close(); } catch {}
1621
1631
  try { await withTimeout(shutdownEngine(), SHUTDOWN_DEADLINE_MS, 'engine shutdown'); } catch {}
1622
- removeSocketFile();
1623
- await removePidFile();
1632
+ await removeOwnPidAndSocket();
1624
1633
 
1625
1634
  // Small grace period so OS reclaims the ports before the new process binds.
1626
1635
  await new Promise((r) => setTimeout(r, 500));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,12 +30,12 @@
30
30
  "ora": "^9.4.0",
31
31
  "react": "^17.0.2",
32
32
  "react-blessed": "^0.7.2",
33
- "@infernetprotocol/auth": "0.1.60",
34
- "@infernetprotocol/deploy-providers": "0.1.60",
35
- "@infernetprotocol/engine": "0.1.60",
36
- "@infernetprotocol/config": "0.1.60",
37
- "@infernetprotocol/rpc-adapter": "0.1.60",
38
- "@infernetprotocol/gpu": "0.1.60"
33
+ "@infernetprotocol/config": "0.1.61",
34
+ "@infernetprotocol/deploy-providers": "0.1.61",
35
+ "@infernetprotocol/engine": "0.1.61",
36
+ "@infernetprotocol/gpu": "0.1.61",
37
+ "@infernetprotocol/auth": "0.1.61",
38
+ "@infernetprotocol/rpc-adapter": "0.1.61"
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",