shellway 0.7.8 → 0.8.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Shellway",
4
- "version": "0.7.8",
4
+ "version": "0.8.0",
5
5
  "description": "Lets your AI (ChatGPT, Claude) use this browser through the Shellway app on your computer. Off until you turn it on.",
6
6
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnZWALJr6dwkQu7eX3reFbtgMAErsCyODHKnwz97XMKpR9bAz4+irBlJ2KEXD6ERZFjuKYqNZ2HLe0eQp5y9fWscyWeTUXNTstsFaymsb5C0aRcpW/dXRl2Dy9vQ7y7+ATH4SCxcckncfmEXt4GFQ6TtyPsctuQfYez6o9MHmwGaKwpCPaWmqfYqomy0yjzMCbCg2b0aP2+hDmOhc0KARhGVnzlZBIBSybtkpAmzXfUxMJHDD5ly3g6ScCcR+3Zf7SKyCfLMGSkwYwiJvvS4sNCtBzwKdDdbEh865T7H5NCS8GOhSt0hxkPPxpbTlXrWXINDiSkF00/b7ZToBRTmK4QIDAQAB",
7
7
  "minimum_chrome_version": "116",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shellway",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
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": {
@@ -29,5 +29,5 @@
29
29
  },
30
30
  "author": "Sandeep Kumar Saini",
31
31
  "license": "UNLICENSED",
32
- "shellwayStable": "0.6.7"
32
+ "shellwayStable": "0.7.7"
33
33
  }
package/shellway.js CHANGED
@@ -9,7 +9,7 @@ import { readFile, writeFile, appendFile, readdir, stat, lstat, mkdir, rename, c
9
9
  import { createServer as netServer, connect as netConnect } from 'node:net';
10
10
  import { randomBytes, timingSafeEqual, createHash } from 'node:crypto';
11
11
 
12
- const AGENT_VERSION = '0.7.8'; // keep equal to agent/package.json
12
+ const AGENT_VERSION = '0.8.0'; // keep equal to agent/package.json
13
13
  if (Number(process.versions.node.split('.')[0]) < 22) {
14
14
  console.error(`Shellway needs Node.js 22 or newer (you have ${process.versions.node}). Get it at https://nodejs.org`);
15
15
  process.exit(1);
@@ -1637,6 +1637,21 @@ export class PollLink {
1637
1637
  }
1638
1638
 
1639
1639
  function start() {
1640
+ // 0.8.0 (customer 10396, 22 Nov): on Windows a program's output pipe can fail ("read ENOTCONN") right as it is
1641
+ // started; Node raised that as an unhandled error and the whole agent stopped. Pipe errors like this only affect that
1642
+ // one program, so log them and keep running; anything else still stops the agent (the service restarts it).
1643
+ if (!process.__swPipeGuard) {
1644
+ process.__swPipeGuard = true;
1645
+ process.on('uncaughtException', (e) => {
1646
+ const code = e && e.code, stack = String((e && e.stack) || '');
1647
+ if (['ENOTCONN', 'EPIPE', 'ECONNRESET', 'EBADF'].includes(code) && /child_process|tryReadStart|Socket\._read|spawn/.test(stack)) {
1648
+ console.error(`A program's output pipe failed (${code}); Shellway keeps running.`);
1649
+ return;
1650
+ }
1651
+ console.error(stack || e);
1652
+ process.exit(1);
1653
+ });
1654
+ }
1640
1655
  const conf = loadConf();
1641
1656
  startExtBridge();
1642
1657
  keepAwakeTick();
@@ -1784,7 +1799,7 @@ function start() {
1784
1799
  const wait = Math.round(delay * (1 + Math.random() * 0.3));
1785
1800
  console.log(`Disconnected (code ${lastClose.code}${lastClose.why ? ' "' + lastClose.why + '"' : ''}, ${lastClose.clean ? 'clean' : 'not clean'}${opened ? `, lived ${lastClose.secs}s, ${lastClose.rx} messages / ${lastClose.ka} keepalive answers from Shellway, last one ${lastClose.quiet}s ago` : ', never opened'}${lastClose.err ? ', error: ' + lastClose.err : ''}). Retrying in ${Math.round(wait / 1000)}s…`);
1786
1801
  conn = null;
1787
- setTimeout(connect, wait); delay = Math.min(delay * 2, 30_000);
1802
+ setTimeout(connect, wait); delay = Math.min(delay * 2, transport === 'poll' ? 5_000 : 30_000); // 0.8.0: HTTPS fallback retries within 5 s
1788
1803
  };
1789
1804
  ws.onerror = (ev) => { const e = clean((ev && (ev.message || (ev.error && (ev.error.code || ev.error.message)))) || 'error'); if (conn && current === ws) conn.err = e; else console.error(`Connection error: ${e}`); };
1790
1805
  };
@@ -1931,7 +1946,10 @@ export async function doctor(opts = {}) {
1931
1946
  } catch (e) { add(null, `Certificate check: ${err(e)}`); }
1932
1947
  }
1933
1948
  // device token
1934
- try { const r = await fetch(server + '/agent/check', { headers: H, signal: AbortSignal.timeout(10_000) }); add(r.status !== 401, r.status === 401 ? 'Device token refused (this computer was removed)' : 'Device token accepted', 'This computer was removed from your account. Pair it again from the dashboard.'); }
1949
+ // 0.7.9: the relay also says when it keeps this computer on HTTPS (its live links kept freezing on this network).
1950
+ let httpsUntil = 0;
1951
+ try { const r = await fetch(server + '/agent/check', { headers: H, signal: AbortSignal.timeout(10_000) }); add(r.status !== 401, r.status === 401 ? 'Device token refused (this computer was removed)' : 'Device token accepted', 'This computer was removed from your account. Pair it again from the dashboard.');
1952
+ try { httpsUntil = Number((await r.json()).https_until) || 0; } catch {} }
1935
1953
  catch (e) { add(null, `Token check: ${err(e)}`); }
1936
1954
  // WebSocket round trip: hello + two keepalive answers. A request that reaches this test link is refused politely.
1937
1955
  const wsTest = () => new Promise((ok) => {
@@ -1948,9 +1966,11 @@ export async function doctor(opts = {}) {
1948
1966
  });
1949
1967
  const ws = await wsTest();
1950
1968
  const avg = (a) => (a.length ? Math.round(a.reduce((x, y) => x + y, 0) / a.length) : 0);
1969
+ const relayChoseHttps = httpsUntil * 1000 > Date.now();
1951
1970
  if (ws.ka >= 2) add(true, `WebSocket: connected, ${ws.ka}/2 answers (avg ${avg(ws.ms)} ms)`);
1952
- else if (ws.hello) add(false, `WebSocket: connected but ${ws.ka}/2 answers came back`, 'The live link opens but Shellway\'s answers are held on the way — typical for antivirus web protection, a VPN or a proxy. Add mcp.getshellway.com to its exceptions. (Shellway 0.7.7 switches to HTTPS by itself when this happens.)');
1953
- else add(false, `WebSocket: could not connect${ws.code ? ` (code ${ws.code})` : ''}${ws.why ? ': ' + ws.why : ''}`, 'The live WebSocket link is blocked on this computer or network. Shellway 0.7.7 uses its HTTPS fallback automatically; to use the faster link, allow mcp.getshellway.com in your antivirus / firewall / proxy.');
1971
+ else if (relayChoseHttps && !ws.hello) add(true, `WebSocket: not used — Shellway keeps this computer on HTTPS until ${new Date(httpsUntil * 1000).toISOString().slice(0, 16).replace('T', ' ')} UTC, because live links kept freezing on this network (this is expected)`);
1972
+ else if (ws.hello) add(false, `WebSocket: connected but ${ws.ka}/2 answers came back`, 'The live link opens but Shellway\'s answers are held on the way — typical for antivirus web protection, a VPN or a proxy. Add mcp.getshellway.com to its exceptions. (Shellway switches to HTTPS by itself when this happens.)');
1973
+ else add(false, `WebSocket: could not connect${ws.code ? ` (code ${ws.code})` : ''}${ws.why ? ': ' + ws.why : ''}`, 'The live WebSocket link is blocked on this computer or network. Shellway uses its HTTPS fallback automatically; to use the faster link, allow mcp.getshellway.com in your antivirus / firewall / proxy.');
1954
1974
  // HTTPS fallback round trip
1955
1975
  try {
1956
1976
  const s = t0();