arena-bridge 0.18.6 → 0.18.8
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 +17 -0
- package/package.json +1 -1
- package/src/browser.mjs +2 -2
- package/src/catalog.mjs +2 -2
- package/src/cli.mjs +19 -15
- package/src/config.mjs +2 -1
- package/src/errors.mjs +1 -1
- package/src/mac.mjs +1 -1
- package/src/policy.mjs +1 -11
- package/src/prompt.mjs +3 -4
- package/src/service.mjs +7 -1
- package/src/tunnel.mjs +1 -1
- package/src/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ 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.18.8
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Setup no longer tries to start the service when saving. The existing Start control remains responsible for starting it.
|
|
11
|
+
- Finder-launched macOS apps provide Node.js locations from common version managers to CLI subprocesses, fixing `env: node: No such file or directory`.
|
|
12
|
+
- Configured roots no longer act as a filesystem allowlist; protected sensitive paths, OS permissions, and approval gates remain in force.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Setup no longer asks for folder roots. Tunnel settings are saved to config and the service definition without loading or starting the service.
|
|
16
|
+
|
|
17
|
+
## 0.18.7
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- A tunnel that prints its address and exits at once no longer fails the start.
|
|
21
|
+
- Command and tool calls over HTTP return their results.
|
|
22
|
+
- Approving or denying a request through the local interface works.
|
|
23
|
+
|
|
7
24
|
## 0.18.6
|
|
8
25
|
|
|
9
26
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arena-bridge",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.8",
|
|
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/browser.mjs
CHANGED
|
@@ -1028,12 +1028,12 @@ export class BrowserManager {
|
|
|
1028
1028
|
{
|
|
1029
1029
|
name: 'chrome_screenshot',
|
|
1030
1030
|
description:
|
|
1031
|
-
'Capture a PNG screenshot of a tab. If "path" is given, the image is saved there (
|
|
1031
|
+
'Capture a PNG screenshot of a tab. If "path" is given, the image is saved there (at the requested path) ' +
|
|
1032
1032
|
'and the file can be read afterwards; otherwise the PNG is returned as base64.',
|
|
1033
1033
|
approval: false,
|
|
1034
1034
|
schema: S(
|
|
1035
1035
|
{
|
|
1036
|
-
path: { type: 'string', description: 'where to save the PNG (must be
|
|
1036
|
+
path: { type: 'string', description: 'where to save the PNG (must be at the requested path)' },
|
|
1037
1037
|
session_id: { type: 'string' },
|
|
1038
1038
|
tab_id: { type: 'string' },
|
|
1039
1039
|
full_page: { type: 'boolean' },
|
package/src/catalog.mjs
CHANGED
|
@@ -17,11 +17,11 @@ export function toolCatalog() {
|
|
|
17
17
|
name: 'bash',
|
|
18
18
|
description:
|
|
19
19
|
'Run a shell command on the remote machine. Returns stdout, stderr and the exit code. ' +
|
|
20
|
-
'Use absolute paths; the working directory defaults to the
|
|
20
|
+
'Use absolute paths; the working directory defaults to the configured base directory. This is a side-effecting operation and may require human approval.',
|
|
21
21
|
approval: true,
|
|
22
22
|
schema: S({
|
|
23
23
|
command: { type: 'string', description: 'Shell command to execute' },
|
|
24
|
-
cwd: { type: 'string', description: 'Working directory (must be
|
|
24
|
+
cwd: { type: 'string', description: 'Working directory (must be at the requested path)' },
|
|
25
25
|
timeout_sec: { type: 'number', description: 'Timeout in seconds (default 120, max 1800)' },
|
|
26
26
|
env: { type: 'object', description: 'Extra environment variables' },
|
|
27
27
|
}),
|
package/src/cli.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { cmdBrowser as _cmdBrowserImpl } from './cli/browser.mjs';
|
|
|
24
24
|
import { findChrome, listProfiles, resolveProfile, sanitizeProfile } from './browser.mjs';
|
|
25
25
|
import { COMPLETION_BASH, COMPLETION_ZSH, COMPLETION_FISH } from './completion.mjs';
|
|
26
26
|
import { packageInfo, latestVersion, compareVersions, selfUpdate } from './selfupdate.mjs';
|
|
27
|
-
import { serviceStatus, serviceInstall, serviceUninstall } from './service.mjs';
|
|
27
|
+
import { serviceStatus, serviceInstall, serviceConfigure, serviceUninstall } from './service.mjs';
|
|
28
28
|
import {
|
|
29
29
|
sendTelegram,
|
|
30
30
|
telegramSettings,
|
|
@@ -124,7 +124,7 @@ Commands:
|
|
|
124
124
|
Common options:
|
|
125
125
|
--mode direct|hub mode for "init"
|
|
126
126
|
--device NAME device name (default: hostname)
|
|
127
|
-
--root PATH[,PATH]
|
|
127
|
+
--root PATH[,PATH] legacy setting; does not restrict filesystem access
|
|
128
128
|
--port N listen port (default: 8787)
|
|
129
129
|
--host ADDR bind address (default: 127.0.0.1)
|
|
130
130
|
--hub URL hub base URL (for "connect" / init --mode hub)
|
|
@@ -157,6 +157,11 @@ function cmdInit(args) {
|
|
|
157
157
|
if (args.flags.host) cfg.host = String(args.flags.host);
|
|
158
158
|
if (args.flags.hub) cfg.hub = String(args.flags.hub);
|
|
159
159
|
if (args.flags['public-url']) cfg.publicUrl = String(args.flags['public-url']);
|
|
160
|
+
cfg.tunnel = { ...(cfg.tunnel || {}),
|
|
161
|
+
...(args.flags.bin ? { bin: String(args.flags.bin) } : {}),
|
|
162
|
+
...(args.flags.domain !== undefined ? { domain: String(args.flags.domain) || null } : {}),
|
|
163
|
+
...(args.flags.authtoken !== undefined ? { authtoken: String(args.flags.authtoken) || null } : {}),
|
|
164
|
+
};
|
|
160
165
|
if (args.flags.root) {
|
|
161
166
|
const values = Array.isArray(args.flags.root) ? args.flags.root : [args.flags.root];
|
|
162
167
|
const roots = values
|
|
@@ -700,15 +705,18 @@ function cmdRestart(args) {
|
|
|
700
705
|
|
|
701
706
|
function cmdService(args) {
|
|
702
707
|
const what = args._[1] || 'status';
|
|
703
|
-
if (what === 'install') {
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
+
if (what === 'install' || what === 'configure') {
|
|
709
|
+
const cfg = loadConfig();
|
|
710
|
+
const options = {
|
|
711
|
+
bin: args.flags.bin || cfg.tunnel?.bin,
|
|
712
|
+
domain: args.flags.domain !== undefined ? String(args.flags.domain) : cfg.tunnel?.domain,
|
|
713
|
+
authtoken: args.flags.authtoken || cfg.tunnel?.authtoken,
|
|
708
714
|
port: args.flags.port,
|
|
709
|
-
}
|
|
715
|
+
};
|
|
716
|
+
const res = what === 'configure' ? serviceConfigure(options) : serviceInstall(options);
|
|
710
717
|
if (!res.ok) throw new Error(res.detail);
|
|
711
|
-
console.log(`\u2713 service installed: ${res.plist}`);
|
|
718
|
+
console.log(`\u2713 service ${what === 'configure' ? 'configuration saved' : 'installed'}: ${res.plist}`);
|
|
719
|
+
if (what === 'configure') return;
|
|
712
720
|
console.log(' reload scheduled in 3 seconds; check: arena-bridge service status');
|
|
713
721
|
console.log(' the bridge now starts with the system and keeps a public URL alive');
|
|
714
722
|
console.log(' current URL: arena-bridge url');
|
|
@@ -845,8 +853,6 @@ function cmdConfig(args) {
|
|
|
845
853
|
if (sub === 'validate') {
|
|
846
854
|
const isJson = !!(args.flags.json);
|
|
847
855
|
const errs = [];
|
|
848
|
-
if (!cfg.roots || !cfg.roots.length) errs.push('roots is empty — run arena-bridge init --root ~/projects');
|
|
849
|
-
else for (const r of cfg.roots) { try { if (!fs.existsSync(r)) errs.push(`root not found: ${r}`); } catch {} }
|
|
850
856
|
if (!cfg.token) errs.push('token missing — run arena-bridge init');
|
|
851
857
|
if (!cfg.deviceToken) errs.push('deviceToken missing');
|
|
852
858
|
if (!Number.isFinite(Number(cfg.port)) || Number(cfg.port) < 1 || Number(cfg.port) > 65535) errs.push(`port invalid: ${cfg.port}`);
|
|
@@ -1034,18 +1040,16 @@ function cmdDoctor(args) {
|
|
|
1034
1040
|
}
|
|
1035
1041
|
const cfg = loadConfig();
|
|
1036
1042
|
const checks = [];
|
|
1037
|
-
checks.push({ name: 'config file', code: 'config_file', passed: fs.existsSync(path.join(CONFIG_DIR, 'config.json')), detail: CONFIG_DIR, hint: 'run arena-bridge init
|
|
1043
|
+
checks.push({ name: 'config file', code: 'config_file', passed: fs.existsSync(path.join(CONFIG_DIR, 'config.json')), detail: CONFIG_DIR, hint: 'run arena-bridge init' });
|
|
1038
1044
|
checks.push({ name: 'agent token', code: 'agent_token', passed: !!cfg.token, detail: cfg.token ? 'present' : 'MISSING', hint: 'run arena-bridge init' });
|
|
1039
1045
|
checks.push({ name: 'device token', code: 'device_token', passed: !!cfg.deviceToken, detail: cfg.deviceToken ? 'present' : 'MISSING', hint: 'run arena-bridge init' });
|
|
1040
1046
|
checks.push({ name: 'mode', code: 'mode', passed: !!cfg.mode, detail: cfg.mode, hint: '' });
|
|
1041
|
-
checks.push({ name: '
|
|
1047
|
+
checks.push({ name: 'filesystem paths', code: 'filesystem_paths', passed: true, detail: 'not restricted by configured roots', hint: '' });
|
|
1042
1048
|
checks.push({ name: 'approval gate', code: 'approval_gate', passed: cfg.requireApproval !== false, detail: cfg.requireApproval ? 'on' : 'OFF (dangerous)', hint: 'set requireApproval=true in config' });
|
|
1043
1049
|
checks.push({ name: 'shell', code: 'shell', passed: cfg.allowShell !== false, detail: cfg.allowShell ? 'on' : 'off', hint: '' });
|
|
1044
1050
|
checks.push({ name: 'protected paths', code: 'protected', passed: (cfg.protected || []).length > 0, detail: `${(cfg.protected || []).length} entries`, hint: '' });
|
|
1045
1051
|
// config validate as doctor checks
|
|
1046
1052
|
try {
|
|
1047
|
-
if (!cfg.roots || !cfg.roots.length) checks.push({ name: 'config roots', code: 'config_roots', passed: false, detail: 'empty', hint: 'run arena-bridge init --root ~/projects' });
|
|
1048
|
-
else for (const r of cfg.roots) if (!fs.existsSync(r)) checks.push({ name: `root ${r}`, code: 'config_root_missing', passed: false, detail: 'not found', hint: `mkdir -p ${r}` });
|
|
1049
1053
|
if (!cfg.token) checks.push({ name: 'config token', code: 'config_token', passed: false, detail: 'missing', hint: 'run arena-bridge init' });
|
|
1050
1054
|
if (!Number.isFinite(Number(cfg.port)) || Number(cfg.port) < 1 || Number(cfg.port) > 65535) checks.push({ name: 'config port', code: 'config_port', passed: false, detail: `invalid: ${cfg.port}`, hint: 'arena-bridge config set port 8787' });
|
|
1051
1055
|
} catch {}
|
package/src/config.mjs
CHANGED
|
@@ -19,7 +19,8 @@ export const DEFAULTS = {
|
|
|
19
19
|
deviceToken: null, // device token: only a device may use this
|
|
20
20
|
hub: null, // hub base URL, when mode=hub
|
|
21
21
|
device: os.hostname(), // this device's name
|
|
22
|
-
roots: [os.homedir()], //
|
|
22
|
+
roots: [os.homedir()], // retained for older configs; path access is not restricted by roots
|
|
23
|
+
tunnel: { bin: 'ngrok', domain: null, authtoken: null },
|
|
23
24
|
protected: [
|
|
24
25
|
'~/.arena-bridge',
|
|
25
26
|
'~/.ssh',
|
package/src/errors.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Generated from policy, engine, and http layers. Use via errorResponse()
|
|
3
3
|
|
|
4
4
|
export const ERROR_CODES = {
|
|
5
|
-
PROTECTED: { message: 'path is
|
|
5
|
+
PROTECTED: { message: 'path is invalid or inside a protected location', hint: 'check protected paths in config and macOS permissions', retryable: false },
|
|
6
6
|
INVALID_PATH: { message: 'path is required or malformed', hint: 'provide absolute path or ~/', retryable: false },
|
|
7
7
|
NOT_FOUND: { message: 'file or directory not found', hint: 'list_dir to see available paths', retryable: false },
|
|
8
8
|
IS_DIR: { message: 'path is a directory, expected file', hint: 'use list_dir for directories', retryable: false },
|
package/src/mac.mjs
CHANGED
|
@@ -261,7 +261,7 @@ export function macTools(cfg = {}) {
|
|
|
261
261
|
app: { type: 'string', description: 'application name, e.g. "Safari"' },
|
|
262
262
|
window_title: { type: 'string' },
|
|
263
263
|
mode: { type: 'string', description: 'screen (default) or window' },
|
|
264
|
-
path: { type: 'string', description: 'where to save the PNG (defaults
|
|
264
|
+
path: { type: 'string', description: 'where to save the PNG (defaults to the configured base directory)' },
|
|
265
265
|
include_raw: { type: 'boolean' },
|
|
266
266
|
},
|
|
267
267
|
[],
|
package/src/policy.mjs
CHANGED
|
@@ -88,8 +88,7 @@ export function isInside(child, parent) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* Path policy: protected locations are
|
|
92
|
-
* authorized root. Returns { ok, abs } or { ok:false, error:'PROTECTED', reason, abs }.
|
|
91
|
+
* Path policy: protected locations are denied; every other path is left to OS permissions. Returns { ok, abs } or { ok:false, error:'PROTECTED', reason, abs }.
|
|
93
92
|
*/
|
|
94
93
|
export function checkPath(p, cfg, base = process.cwd(), _opts = {}) {
|
|
95
94
|
let abs;
|
|
@@ -108,14 +107,5 @@ export function checkPath(p, cfg, base = process.cwd(), _opts = {}) {
|
|
|
108
107
|
};
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
|
-
const roots = (cfg.roots || []).map((r) => resolveConfigured(r, base));
|
|
112
|
-
if (!roots.some((r) => isInside(abs, r))) {
|
|
113
|
-
return {
|
|
114
|
-
ok: false,
|
|
115
|
-
abs,
|
|
116
|
-
error: 'PROTECTED',
|
|
117
|
-
reason: `path is outside the authorized roots (${roots.join(', ')})`,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
110
|
return { ok: true, abs };
|
|
121
111
|
}
|
package/src/prompt.mjs
CHANGED
|
@@ -80,7 +80,7 @@ ${toolsLine}
|
|
|
80
80
|
\`chrome_snapshot\` with \`{"mode": "ax"}\` returns roles, names and element states; \`chrome_screenshot\` is for when the DOM is ambiguous.
|
|
81
81
|
3. \`chrome_attach\` connects to the user's own Chrome (default port 9222, with their logged-in sessions).
|
|
82
82
|
Actions on an attached browser require a local approval — ask for it instead of retrying.
|
|
83
|
-
4. Screenshots: pass \`{"path": "shot.png"}\` to save the PNG
|
|
83
|
+
4. Screenshots: pass \`{"path": "shot.png"}\` to save the PNG at the requested path, then read it with \`file_get\`.
|
|
84
84
|
5. Named profiles keep their logins between runs: \`chrome_launch {"profile":"work"}\` opens
|
|
85
85
|
\`~/.arena-bridge/chrome-profiles/work\`. \`chrome_profiles\` lists them. The user logs in once with
|
|
86
86
|
\`arena-bridge browser login work\` on their machine — ask for that instead of trying to log in yourself.
|
|
@@ -95,7 +95,7 @@ ${toolsLine}
|
|
|
95
95
|
3. \`mac_apps\` and \`mac_windows\` show what is running; \`mac_app_launch\`/\`mac_app_focus\` open and switch.
|
|
96
96
|
4. If a capture or a click fails, run \`mac_permissions\` — macOS needs Screen Recording and
|
|
97
97
|
Accessibility permissions for the Arena Bridge app.
|
|
98
|
-
5. Screenshots are saved as PNG
|
|
98
|
+
5. Screenshots are saved as PNG at the requested path; read them back with \`file_get\`.
|
|
99
99
|
6. Stay out of the user's way: do not pass \`foreground\`, do not focus windows and do not move the
|
|
100
100
|
pointer unless the user asks for it. Background actions are delivered to the target window only.
|
|
101
101
|
7. \`mac_set\` writes a value straight into a control (no keystrokes, no focus change);
|
|
@@ -130,8 +130,7 @@ ${trustLine}
|
|
|
130
130
|
- \`APPROVAL_DENIED\` means the user said no: do not retry, ask what to do instead.
|
|
131
131
|
|
|
132
132
|
## Rules
|
|
133
|
-
1.
|
|
134
|
-
Reading or writing anything else returns \`PROTECTED\` — do not try to work around it.
|
|
133
|
+
1. Use the path the user specifies; there is no configured authorized-roots allowlist. Access is still subject to macOS permissions, protected sensitive locations, and approval requirements. Never work around an OS permission denial or a protected-location denial.
|
|
135
134
|
2. Side-effecting tools (bash, write/edit/delete, process start/kill, actions on the user's own
|
|
136
135
|
Chrome or on the desktop) may require a local human approval. When the answer contains
|
|
137
136
|
\`APPROVAL_PENDING\`, stop and follow the recovery hint; never ask to approve a closed id.
|
package/src/service.mjs
CHANGED
|
@@ -162,7 +162,7 @@ export function serviceStatus() {
|
|
|
162
162
|
|
|
163
163
|
export const reloadScript = "#!/bin/sh\nset -eu\nTARGET=$1\nPLIST=$2\nSTATUS=$3\nJOB=$4\nDOMAIN=${TARGET%/*}\nfinish() {\n code=$?\n trap - EXIT\n if [ \"$code\" -eq 0 ]; then printf 'loaded\\n' > \"$STATUS\"; else printf 'failed (%s)\\n' \"$code\" > \"$STATUS\"; fi\n rm -f \"$0\"\n /bin/launchctl remove \"$JOB\" >/dev/null 2>&1 || true\n exit \"$code\"\n}\ntrap finish EXIT\nprintf 'scheduled\\n' > \"$STATUS\"\nsleep 3\n/bin/launchctl enable \"$TARGET\"\nif /bin/launchctl print \"$TARGET\" >/dev/null 2>&1; then\n /bin/launchctl bootout \"$TARGET\"\nfi\nattempt=0\nuntil /bin/launchctl bootstrap \"$DOMAIN\" \"$PLIST\"; do\n attempt=$((attempt + 1))\n [ \"$attempt\" -lt 10 ] || exit 1\n sleep 1\ndone\n/bin/launchctl print \"$TARGET\" >/dev/null\n";
|
|
164
164
|
|
|
165
|
-
export function
|
|
165
|
+
export function serviceConfigure(options = {}) {
|
|
166
166
|
ensureDirs();
|
|
167
167
|
fs.mkdirSync(logDir(), { recursive: true });
|
|
168
168
|
fs.mkdirSync(path.dirname(plistPath()), { recursive: true });
|
|
@@ -171,6 +171,12 @@ export function serviceInstall(options = {}) {
|
|
|
171
171
|
const plist = plistPath();
|
|
172
172
|
fs.writeFileSync(`${plist}.tmp`, plistXml(options), { mode: 0o600 });
|
|
173
173
|
fs.renameSync(`${plist}.tmp`, plist);
|
|
174
|
+
return { ok: true, plist };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function serviceInstall(options = {}) {
|
|
178
|
+
const configured = serviceConfigure(options);
|
|
179
|
+
const plist = configured.plist;
|
|
174
180
|
const job = `${LABEL}.reload.${randomUUID()}`;
|
|
175
181
|
const script = path.join(CONFIG_DIR, `${job}.sh`);
|
|
176
182
|
const status = path.join(CONFIG_DIR, 'service-reload.status');
|
package/src/tunnel.mjs
CHANGED