shellway 0.7.2 → 0.7.3

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,4 +1,4 @@
1
- // Shellway browser extension (0.7.2).
1
+ // Shellway browser extension (0.7.3).
2
2
  // The Shellway app on this computer (the agent) talks to this extension through Chrome/Edge "native messaging":
3
3
  // the browser starts a small Shellway helper that is only allowed to talk to THIS extension. The AI never talks to the
4
4
  // extension directly; every request comes from the agent, which already checks the owner's safety rules.
@@ -95,6 +95,7 @@ async function onMessage(m) {
95
95
  connected = true; agentVersion = m.version || ''; lastError = ''; badge();
96
96
  // 0.7.2: the Shellway app refreshed this extension's folder (a newer version): reload once to use the new files.
97
97
  const mine = chrome.runtime.getManifest().version;
98
+ if (port) port.postMessage({ type: 'ext', version: mine }); // 0.7.3: tell the Shellway app which version runs here
98
99
  if (m.extVersion && m.extVersion !== mine) {
99
100
  const { reloadedFor } = await chrome.storage.local.get({ reloadedFor: '' });
100
101
  if (reloadedFor !== m.extVersion) { await chrome.storage.local.set({ reloadedFor: m.extVersion }); chrome.runtime.reload(); }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Shellway",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
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.2",
3
+ "version": "0.7.3",
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
@@ -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 } from 'node:crypto';
11
11
 
12
- const AGENT_VERSION = '0.7.2'; // keep equal to agent/package.json
12
+ const AGENT_VERSION = '0.7.3'; // 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);
@@ -980,7 +980,7 @@ const EXT_BRIDGE = join(CONF_DIR, 'extension-bridge.json');
980
980
  const NATIVE_NAME = 'com.getshellway.agent';
981
981
  const EXT_IDS = ['cepfcfgajaghchkamfmnhgcelblihndk']; // the unpacked extension (fixed by the key in its manifest)
982
982
  const EXT_OFF = 'The Shellway extension is not connected. On that computer: open Edge or Chrome, click the Shellway extension icon and turn it on. (First time: npx shellway@beta policy browser extension, then load the extension as shown.)';
983
- const ext = { sock: null, seq: 0, pending: new Map() };
983
+ const ext = { sock: null, seq: 0, pending: new Map(), version: '' };
984
984
  const extMode = () => { const p = loadPolicy(); return !!p && p.browser === 'extension'; };
985
985
  function extAttach(sock, rest) {
986
986
  if (ext.sock && ext.sock !== sock) { try { ext.sock.destroy(); } catch {} }
@@ -991,6 +991,7 @@ function extAttach(sock, rest) {
991
991
  while ((i = buf.indexOf('\n')) >= 0) {
992
992
  const line = buf.slice(0, i); buf = buf.slice(i + 1);
993
993
  let m; try { m = JSON.parse(line); } catch { continue; }
994
+ if (m && m.type === 'ext') { ext.version = String(m.version || '').slice(0, 20); continue; } // 0.7.3: version running in the browser
994
995
  const p = m && m.id !== undefined && ext.pending.get(m.id);
995
996
  if (!p) continue;
996
997
  ext.pending.delete(m.id); clearTimeout(p.timer);
@@ -1000,7 +1001,7 @@ function extAttach(sock, rest) {
1000
1001
  sock.on('data', (d) => { buf += d.toString('utf8'); take(); });
1001
1002
  const gone = () => {
1002
1003
  if (ext.sock !== sock) return;
1003
- ext.sock = null;
1004
+ ext.sock = null; ext.version = '';
1004
1005
  for (const p of ext.pending.values()) { clearTimeout(p.timer); p.no(new Error('The browser extension disconnected (the browser was closed or Shellway was turned off there).')); }
1005
1006
  ext.pending.clear();
1006
1007
  };
@@ -1128,7 +1129,8 @@ function installExtensionHost() {
1128
1129
  return { extDest: existsSync(extDest) ? extDest : null, agentFile };
1129
1130
  }
1130
1131
  const extConnected = () => !!ext.sock;
1131
- export { nativeHostManifest, nativeHostTargets, extJson, extCall, startExtBridge, extConnected, installExtensionHost, SNAPSHOT_JS };
1132
+ const extVersion = () => ext.version;
1133
+ export { nativeHostManifest, nativeHostTargets, extJson, extCall, startExtBridge, extConnected, extVersion, installExtensionHost, SNAPSHOT_JS };
1132
1134
  const browserPages = async () => (await cdpJson('/json/list')).filter((t) => t.type === 'page' && !String(t.url).startsWith('devtools:'));
1133
1135
  async function currentPage() {
1134
1136
  await ensureBrowser();
@@ -1358,7 +1360,8 @@ const browserHandlers = {
1358
1360
  return withPage(async (s) => { await evalJs(s, a === 'reload' ? 'location.reload()' : `history.${a}()`); return `${a === 'reload' ? 'Reloaded' : `Went ${a}`}.\n${await afterAction(s)}`; });
1359
1361
  }
1360
1362
  const list = await browserPages();
1361
- if (!list.length) return extMode() ? 'No Shellway AI tabs are open. (In the user\'s own browser the AI sees only the tabs it opened, unless the owner allows "my other tabs" in the Shellway extension.) Open one with browser_open.' : 'No tabs are open.';
1363
+ if (!list.length) return extMode() ? `No Shellway AI tabs are open${ext.version ? ` (Shellway extension v${ext.version})` : ''}. (In the user's own browser the AI sees only the tabs it opened, unless the owner allows "my other tabs" in the Shellway extension.) Open one with browser_open.` : 'No tabs are open.';
1364
+ if (a === 'list' && extMode()) return `(The user's own browser, Shellway extension${ext.version ? ' v' + ext.version : ''})\n` + list.map((t, i) => `${i + 1}. ${t.id === activeTarget ? '(active) ' : ''}${redactTitle(t.title, t.url) || '(no title)'} — ${redactUrl(t.url)}`).join('\n');
1362
1365
  if (a === 'list') return list.map((t, i) => `${i + 1}. ${t.id === activeTarget ? '(active) ' : ''}${redactTitle(t.title, t.url) || '(no title)'} — ${redactUrl(t.url)}`).join('\n');
1363
1366
  const t = list[(Number(index) | 0) - 1];
1364
1367
  if (!t) throw new Error(`No tab number ${index}. Use action "list" to see the tabs.`);