@tensor.chat/companion 0.2.0 → 0.2.1

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/package.json +1 -1
  2. package/src/daemon.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensor.chat/companion",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Lets your tensor.chat AI use this machine: files, shell and internet through your own connection.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tensor.chat",
package/src/daemon.js CHANGED
@@ -274,6 +274,11 @@ function createDaemon({ serverUrl, token, shell, log, approvedRoots, approvedShe
274
274
  const code = res && res.statusCode;
275
275
  say(`server refused the connection (HTTP ${code})`);
276
276
  if (code === 401) { state.stopped = true; emitter.emit('unauthorized'); }
277
+ // With this listener in place, ws leaves the refused handshake open: no
278
+ // 'close' ever comes, so no reconnect either. A 502 from nginx while the
279
+ // server restarts left the device offline until the app was restarted
280
+ // (26.09.2026). End it here; 'close' then schedules the next try.
281
+ try { ws.terminate(); } catch (_) {}
277
282
  });
278
283
  ws.on('error', (e) => { say(`socket error: ${e.message}`); });
279
284
  ws.on('close', (code, reason) => {