@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.
- package/package.json +1 -1
- package/src/daemon.js +5 -0
package/package.json
CHANGED
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) => {
|