shellway 0.6.4 → 0.6.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/package.json +1 -1
  2. package/shellway.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shellway",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Shellway agent: lets ChatGPT, Claude and Cursor work on this computer through the Shellway relay.",
5
5
  "type": "module",
6
6
  "bin": {
package/shellway.js CHANGED
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  import { execFileSync, execFile } from 'node:child_process';
8
8
  import { readFile, writeFile, appendFile, readdir, stat, lstat, mkdir, rename, cp, rm } from 'node:fs/promises';
9
9
 
10
- const AGENT_VERSION = '0.6.4'; // keep equal to agent/package.json
10
+ const AGENT_VERSION = '0.6.5'; // keep equal to agent/package.json
11
11
  if (Number(process.versions.node.split('.')[0]) < 22) {
12
12
  console.error(`Shellway needs Node.js 22 or newer (you have ${process.versions.node}). Get it at https://nodejs.org`);
13
13
  process.exit(1);
@@ -898,8 +898,9 @@ function start() {
898
898
  const t = Date.now(), slept = t - lastTick > 45_000; lastTick = t;
899
899
  const w = current; if (!w || w.readyState !== 1) return;
900
900
  if (slept) return reconnectNow('Computer woke up');
901
+ // 0.6.5: check the buffer BEFORE sending (right after send() it always holds the new frame, so 0.6.4 reconnected every minute)
902
+ if (w.bufferedAmount > 0) { w._stuck = (w._stuck || 0) + 1; if (w._stuck >= 4) return reconnectNow('Connection stuck'); } else w._stuck = 0;
901
903
  try { w.send('{"type":"keepalive"}'); } catch { return reconnectNow('Connection lost'); }
902
- if (w.bufferedAmount > 0) { w._stuck = (w._stuck || 0) + 1; if (w._stuck >= 4) reconnectNow('Connection stuck'); } else w._stuck = 0;
903
904
  }, 15_000);
904
905
  const connect = async () => {
905
906
  if (!(await tokenValid(conf))) { console.error('This device was removed or its token is invalid. Pair again.'); process.exit(78); }