arena-bridge 0.5.0 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to this project are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and the project uses
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## 0.5.2
8
+
9
+ ### Fixed
10
+ - `arena-bridge update` now replaces the very installation it runs from (the npm prefix is
11
+ detected), survives a tarball install that left a conflicting link, and retries when the
12
+ registry metadata is ahead of the tarball.
13
+
14
+ ## 0.5.1
15
+
16
+ ### Fixed
17
+ - `setup` and `tunnel` now say how to install `cloudflared` when the binary is missing.
18
+
7
19
  ## 0.5.0
8
20
 
9
21
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arena-bridge",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Give a cloud AI agent (Arena.ai Agent Mode, Claude, Cursor, ...) controlled access to your own machine over HTTP/MCP: files, shell, Chrome and the macOS desktop, with an approval gate, trust windows and an audit log.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -200,6 +200,10 @@ async function cmdTunnel(args) {
200
200
  publicUrl = await urlPromise;
201
201
  } catch (e) {
202
202
  console.error(`✗ ${e.message}`);
203
+ if (String(e.message).includes('ENOENT')) {
204
+ console.error(` ${bin} is not installed. Install it (macOS: brew install cloudflared) or pass a path: --bin /path/to/cloudflared`);
205
+ console.error(' Any other tunnel works too: ngrok http 8787, tailscale funnel --bg 8787');
206
+ }
203
207
  try {
204
208
  child.kill();
205
209
  } catch {
package/src/direct.mjs CHANGED
@@ -29,7 +29,7 @@ export function createDirectServer(cfg, engine) {
29
29
  ok: true,
30
30
  mode: 'direct',
31
31
  device: cfg.device,
32
- version: '0.5.0',
32
+ version: '0.5.2',
33
33
  uptime_sec: Math.round(process.uptime()),
34
34
  });
35
35
  }
package/src/hub.mjs CHANGED
@@ -90,7 +90,7 @@ export function createHubServer(cfg) {
90
90
  return sendJson(res, 200, {
91
91
  ok: true,
92
92
  mode: 'hub',
93
- version: '0.5.0',
93
+ version: '0.5.2',
94
94
  devices: [...devices.keys()],
95
95
  });
96
96
  }
package/src/mcp.mjs CHANGED
@@ -48,7 +48,7 @@ export async function handleMcp(req, res, ctx) {
48
48
  mcpResponse(id, {
49
49
  protocolVersion: PROTOCOL_VERSION,
50
50
  capabilities: { tools: { listChanged: false } },
51
- serverInfo: { name: 'arena-bridge', version: '0.5.0' },
51
+ serverInfo: { name: 'arena-bridge', version: '0.5.2' },
52
52
  instructions:
53
53
  'Tools operate the user\'s own machine. Dangerous operations may return ' +
54
54
  'PROTECTED and require a local human approval.',
@@ -6,6 +6,21 @@ import { fileURLToPath } from 'node:url';
6
6
  const require = createRequire(import.meta.url);
7
7
  const PKG = 'arena-bridge';
8
8
 
9
+ /** The npm prefix the current installation lives in, so an update replaces this very copy. */
10
+ export function installPrefix() {
11
+ try {
12
+ const here = path.dirname(fileURLToPath(import.meta.url));
13
+ const parts = here.split(path.sep);
14
+ const idx = parts.lastIndexOf('node_modules');
15
+ if (idx < 1) return null;
16
+ let prefix = parts.slice(0, idx).join(path.sep);
17
+ if (prefix.endsWith(`${path.sep}lib`)) prefix = prefix.slice(0, -4);
18
+ return prefix || null;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
9
24
  export function packageInfo() {
10
25
  try {
11
26
  const here = path.dirname(fileURLToPath(import.meta.url));
@@ -65,7 +80,24 @@ export async function selfUpdate({ dryRun = false } = {}) {
65
80
  if (dryRun) {
66
81
  return { ok: true, upToDate: false, installed: info.version, latest, command: `npm i -g ${PKG}@latest` };
67
82
  }
68
- const res = await run('npm', ['i', '-g', `${PKG}@latest`]);
83
+ const prefix = installPrefix();
84
+ const install = (extra = []) =>
85
+ run('npm', ['i', '-g', ...(prefix ? ['--prefix', prefix] : []), ...extra, `${PKG}@${latest}`]);
86
+
87
+ let res = await run('npm', ['i', '-g', ...(prefix ? ['--prefix', prefix] : []), `${PKG}@latest`]);
88
+ if (!res.ok && /notarget|ETARGET|No matching version/i.test(res.stderr || '')) {
89
+ // the registry metadata can be ahead of the tarball for a moment after a publish
90
+ await new Promise((r) => setTimeout(r, 15000));
91
+ res = await install();
92
+ }
93
+ if (!res.ok && /EEXIST|already exists/i.test(res.stderr || '')) {
94
+ // a previous install from a tarball leaves a conflicting link in the global bin
95
+ res = await run('npm', ['i', '-g', ...(prefix ? ['--prefix', prefix] : []), '--force', `${PKG}@${latest}`]);
96
+ if (!res.ok) {
97
+ await run('npm', ['rm', '-g', ...(prefix ? ['--prefix', prefix] : []), PKG]);
98
+ res = await install();
99
+ }
100
+ }
69
101
  if (!res.ok) {
70
102
  return {
71
103
  ok: false,