shellway 0.7.9 → 0.8.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/extension/manifest.json +1 -1
- package/package.json +1 -1
- package/shellway.js +24 -5
package/extension/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Shellway",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.1",
|
|
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
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.
|
|
12
|
+
const AGENT_VERSION = '0.8.1'; // 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);
|
|
@@ -1559,6 +1559,7 @@ async function tokenValid(conf) {
|
|
|
1559
1559
|
// the same conversation with Shellway over plain HTTPS requests (long-poll). It looks like a WebSocket to start(), so
|
|
1560
1560
|
// keepalives, receipts and reconnects work the same. Messages from Shellway carry a number and are acknowledged on the
|
|
1561
1561
|
// next poll, so an answer lost on the way is sent again and a repeat is ignored.
|
|
1562
|
+
const POLL_SEND_MS = Number(process.env.SHELLWAY_POLL_SEND_MS) || 10_000;
|
|
1562
1563
|
export class PollLink {
|
|
1563
1564
|
constructor(base, token, version) {
|
|
1564
1565
|
this.base = base; this.h = { authorization: `Bearer ${token}`, 'x-shellway-version': version };
|
|
@@ -1610,15 +1611,18 @@ export class PollLink {
|
|
|
1610
1611
|
while (this.outq.length && this.readyState === 1) {
|
|
1611
1612
|
const batch = this.outq.splice(0, 50);
|
|
1612
1613
|
try {
|
|
1613
|
-
|
|
1614
|
+
// 0.8.1 (customer 10396, 23 Nov): on his network about 1 upload in 10 stalls and never arrives (relay logged
|
|
1615
|
+
// HTTP 408 after 60 s). Answers and keepalives waited 30 s per try, so commands timed out and the link was
|
|
1616
|
+
// reset every 29 s. Now a stalled upload is given up after 10 s and sent again on a new request, up to 6 times.
|
|
1617
|
+
const r = await this._req(`/agent/poll/send?sid=${this.sid}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(batch) }, POLL_SEND_MS);
|
|
1614
1618
|
if (r.status === 410) { this._end(1006, 'closed by Shellway'); break; }
|
|
1615
1619
|
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
1616
1620
|
fails = 0;
|
|
1617
1621
|
} catch (e) {
|
|
1618
1622
|
if (this.readyState !== 1) break;
|
|
1619
1623
|
this.outq.unshift(...batch);
|
|
1620
|
-
if (++fails >=
|
|
1621
|
-
await new Promise((ok) => setTimeout(ok,
|
|
1624
|
+
if (++fails >= 6) { this._fail(e); this._end(1006, ''); break; }
|
|
1625
|
+
await new Promise((ok) => setTimeout(ok, 300));
|
|
1622
1626
|
}
|
|
1623
1627
|
}
|
|
1624
1628
|
} finally { this.sending = false; }
|
|
@@ -1637,6 +1641,21 @@ export class PollLink {
|
|
|
1637
1641
|
}
|
|
1638
1642
|
|
|
1639
1643
|
function start() {
|
|
1644
|
+
// 0.8.0 (customer 10396, 22 Nov): on Windows a program's output pipe can fail ("read ENOTCONN") right as it is
|
|
1645
|
+
// started; Node raised that as an unhandled error and the whole agent stopped. Pipe errors like this only affect that
|
|
1646
|
+
// one program, so log them and keep running; anything else still stops the agent (the service restarts it).
|
|
1647
|
+
if (!process.__swPipeGuard) {
|
|
1648
|
+
process.__swPipeGuard = true;
|
|
1649
|
+
process.on('uncaughtException', (e) => {
|
|
1650
|
+
const code = e && e.code, stack = String((e && e.stack) || '');
|
|
1651
|
+
if (['ENOTCONN', 'EPIPE', 'ECONNRESET', 'EBADF'].includes(code) && /child_process|tryReadStart|Socket\._read|spawn/.test(stack)) {
|
|
1652
|
+
console.error(`A program's output pipe failed (${code}); Shellway keeps running.`);
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
console.error(stack || e);
|
|
1656
|
+
process.exit(1);
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1640
1659
|
const conf = loadConf();
|
|
1641
1660
|
startExtBridge();
|
|
1642
1661
|
keepAwakeTick();
|
|
@@ -1784,7 +1803,7 @@ function start() {
|
|
|
1784
1803
|
const wait = Math.round(delay * (1 + Math.random() * 0.3));
|
|
1785
1804
|
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
1805
|
conn = null;
|
|
1787
|
-
setTimeout(connect, wait); delay = Math.min(delay * 2, 30_000);
|
|
1806
|
+
setTimeout(connect, wait); delay = Math.min(delay * 2, transport === 'poll' ? 5_000 : 30_000); // 0.8.0: HTTPS fallback retries within 5 s
|
|
1788
1807
|
};
|
|
1789
1808
|
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
1809
|
};
|