arena-bridge 0.7.16 → 0.7.18
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/README.md +34 -8
- package/package.json +4 -4
- package/src/app.mjs +3 -0
- package/src/cli.mjs +2 -0
- package/src/direct.mjs +1 -1
- package/src/hub.mjs +1 -1
- package/src/mcp.mjs +1 -1
- package/src/service.mjs +77 -16
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.7.18
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Service reinstall is queued as an independent one-shot launchd job, so stopping the bridge does not kill its own installer. Submission errors are reported, and reload outcome is recorded separately.
|
|
11
|
+
- Native helper forwards SIGINT as SIGINT and SIGTERM as SIGTERM; signal handling and child exit status verified on macOS.
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
- Clarified permission names, update caveats and screen-capture verification; recorded service lifecycle follow-up plan.
|
|
15
|
+
|
|
16
|
+
## 0.7.17
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- The permission list of macOS shows the name of the app and not `node`. The background service now
|
|
20
|
+
starts through a small helper inside the signed app bundle, so macOS gives the screen and the
|
|
21
|
+
accessibility permissions to «Arena Bridge». Without the app the service starts the old way, so the
|
|
22
|
+
command line only installation keeps working.
|
|
23
|
+
|
|
7
24
|
## 0.7.16
|
|
8
25
|
|
|
9
26
|
### Fixed
|
package/README.md
CHANGED
|
@@ -319,12 +319,37 @@ Apple Silicon. Готовые сборки для обеих архитекту
|
|
|
319
319
|
|
|
320
320
|
### Разрешения macOS
|
|
321
321
|
|
|
322
|
-
Мосту нужны два
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
Мосту нужны два разрешения в «Конфиденциальность и безопасность»:
|
|
323
|
+
|
|
324
|
+
- **Запись экрана и системного аудио** → включите **Arena Bridge**.
|
|
325
|
+
- **Универсальный доступ (Accessibility)** → включите **arena-bridge-agent**.
|
|
326
|
+
|
|
327
|
+
Это части одного приложения. После изменения разрешений может потребоваться перезапуск службы.
|
|
328
|
+
Старую запись `node` удаляйте только после проверки снимков и дерева элементов (`mac_see`).
|
|
329
|
+
Успешное сохранение PNG ещё не доказывает доступ: на снимке должно быть содержимое окон,
|
|
330
|
+
а не только обои. Без Accessibility снимок может работать, но дерево элементов будет пустым.
|
|
331
|
+
|
|
332
|
+
После установки приложения переустановите службу (`arena-bridge service install` с прежними
|
|
333
|
+
параметрами туннеля), чтобы она использовала помощник внутри бандла
|
|
334
|
+
(`Contents/Helpers/arena-bridge-agent`). Без приложения CLI продолжает работать, но названия
|
|
335
|
+
записей разрешений могут отличаться.
|
|
336
|
+
|
|
337
|
+
Стабильный путь к интерпретатору снижает риск потери разрешений, но не гарантирует их сохранение
|
|
338
|
+
после изменения подписи, пути или обновления приложения. Проверяйте разрешения для реально
|
|
339
|
+
запущенной установки. В частности, обновление ad-hoc-подписанного помощника может оставить
|
|
340
|
+
переключатели включёнными, но фактически лишить процесс доступа: выключите и снова включите
|
|
341
|
+
**Arena Bridge** в записи экрана и **arena-bridge-agent** в Accessibility, затем перезапустите службу.
|
|
342
|
+
Если это не помогло, удалите только эти две записи кнопкой «−» и добавьте заново через «+»:
|
|
343
|
+
`/Applications/Arena Bridge.app` и
|
|
344
|
+
`/Applications/Arena Bridge.app/Contents/Helpers/arena-bridge-agent` соответственно.
|
|
345
|
+
Не храните резервные сборки с тем же bundle id как зарегистрированные `.app`:
|
|
346
|
+
это затрудняет выбор нужной установки.
|
|
347
|
+
|
|
348
|
+
Переустановка службы выполняется отдельным одноразовым системным заданием через несколько
|
|
349
|
+
секунд после команды. Это позволяет переустанавливать мост через сам мост. `scheduled` означает
|
|
350
|
+
только постановку задания, не успешный запуск. Результат загрузки службы — в
|
|
351
|
+
`~/.arena-bridge/service-reload.status`, ошибки — в `~/.arena-bridge/logs/service-reload.err.log`.
|
|
352
|
+
Проверяйте также `arena-bridge service status` и `/health`: `loaded` ещё не гарантирует работу туннеля.
|
|
328
353
|
|
|
329
354
|
### Как переименовать
|
|
330
355
|
|
|
@@ -332,12 +357,13 @@ Apple Silicon. Готовые сборки для обеих архитекту
|
|
|
332
357
|
|
|
333
358
|
| Файл | Что там |
|
|
334
359
|
| --- | --- |
|
|
335
|
-
| `src/app.mjs` | `APP_NAME`, `APP_ID`, `SERVICE_LABEL` — для командной строки |
|
|
360
|
+
| `src/app.mjs` | `APP_NAME`, `APP_ID`, `SERVICE_LABEL`, `AGENT_NAME` — для командной строки |
|
|
336
361
|
| `arena_bridge/app.py` | то же самое для Python |
|
|
337
362
|
| `macos/ArenaBridge/Sources/AppInfo.swift` | то же самое для приложения; `build.sh` берёт имя отсюда |
|
|
338
363
|
|
|
339
364
|
Фоновая служба в «Системных настройках → Вход» называется так же, как приложение, а не
|
|
340
|
-
«node» или «python»: запускает её
|
|
365
|
+
«node» или «python»: запускает её помощник внутри бандла приложения, а без приложения — небольшой
|
|
366
|
+
скрипт `~/.arena-bridge/Arena Bridge`.
|
|
341
367
|
|
|
342
368
|
---
|
|
343
369
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arena-bridge",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.18",
|
|
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": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"node": ">=18"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"test": "node test/smoke.mjs && node test/browser.test.mjs && node test/mac.test.mjs",
|
|
23
|
-
"test:node": "node test/smoke.mjs && node test/browser.test.mjs && node test/mac.test.mjs",
|
|
24
|
-
"test:python": "python3 test/test_bridge.py && python3 test/test_browser.py && python3 test/test_mac.py",
|
|
22
|
+
"test": "node test/smoke.mjs && node test/browser.test.mjs && node test/mac.test.mjs && node test/service.test.mjs",
|
|
23
|
+
"test:node": "node test/smoke.mjs && node test/browser.test.mjs && node test/mac.test.mjs && node test/service.test.mjs",
|
|
24
|
+
"test:python": "python3 test/test_bridge.py && python3 test/test_browser.py && python3 test/test_mac.py && python3 test/test_service.py",
|
|
25
25
|
"pack:check": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
package/src/app.mjs
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -495,7 +495,9 @@ function cmdService(args) {
|
|
|
495
495
|
authtoken: args.flags.authtoken,
|
|
496
496
|
port: args.flags.port,
|
|
497
497
|
});
|
|
498
|
+
if (!res.ok) throw new Error(res.detail);
|
|
498
499
|
console.log(`\u2713 service installed: ${res.plist}`);
|
|
500
|
+
console.log(' reload scheduled in 3 seconds; check: arena-bridge service status');
|
|
499
501
|
console.log(' the bridge now starts with the system and keeps a public URL alive');
|
|
500
502
|
console.log(' current URL: arena-bridge url');
|
|
501
503
|
return;
|
package/src/direct.mjs
CHANGED
package/src/hub.mjs
CHANGED
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.7.
|
|
51
|
+
serverInfo: { name: 'arena-bridge', version: '0.7.18' },
|
|
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.',
|
package/src/service.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
2
3
|
import os from 'node:os';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { execFileSync } from 'node:child_process';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
7
|
import { CONFIG_DIR, ensureDirs } from './config.mjs';
|
|
7
|
-
import { APP_NAME, SERVICE_LABEL as LABEL } from './app.mjs';
|
|
8
|
+
import { APP_NAME, SERVICE_LABEL as LABEL, AGENT_NAME } from './app.mjs';
|
|
8
9
|
|
|
9
10
|
export function plistPath() {
|
|
10
11
|
return path.join(os.homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
@@ -18,6 +19,38 @@ export function runnerPath() {
|
|
|
18
19
|
return path.join(CONFIG_DIR, APP_NAME);
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The app bundle that holds the helper. It gives the screen and the accessibility
|
|
24
|
+
* permissions to the app and not to the node binary.
|
|
25
|
+
*/
|
|
26
|
+
export function appBundlePath() {
|
|
27
|
+
const explicit = process.env.ARENA_BRIDGE_APP;
|
|
28
|
+
const candidates = explicit
|
|
29
|
+
? [explicit]
|
|
30
|
+
: [
|
|
31
|
+
path.join('/Applications', `${APP_NAME}.app`),
|
|
32
|
+
path.join(os.homedir(), 'Applications', `${APP_NAME}.app`),
|
|
33
|
+
];
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
if (candidate && fs.existsSync(path.join(candidate, 'Contents', 'Info.plist'))) return candidate;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The helper inside the bundle starts the bridge. macOS gives the permissions to the
|
|
42
|
+
* app that starts the request, so the system settings show the name of the app.
|
|
43
|
+
*/
|
|
44
|
+
export function agentPath() {
|
|
45
|
+
const bundle = appBundlePath();
|
|
46
|
+
if (!bundle) return null;
|
|
47
|
+
const helper = path.join(bundle, 'Contents', 'Helpers', AGENT_NAME);
|
|
48
|
+
try {
|
|
49
|
+
fs.accessSync(helper, fs.constants.X_OK);
|
|
50
|
+
return fs.statSync(helper).isFile() ? helper : null;
|
|
51
|
+
} catch { return null; }
|
|
52
|
+
}
|
|
53
|
+
|
|
21
54
|
/**
|
|
22
55
|
* The node of the version manager lives in a folder that every new shell creates and that is
|
|
23
56
|
* deleted afterwards. macOS binds a permission to the exact file, so a service that starts from
|
|
@@ -67,13 +100,29 @@ exec "${stableNode()}" "${cliEntry()}" "$@"
|
|
|
67
100
|
`;
|
|
68
101
|
}
|
|
69
102
|
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The command the service starts. The helper inside the app bundle gives the screen and the
|
|
105
|
+
* accessibility permissions to the app, so the system settings show its name. Without the app
|
|
106
|
+
* the service starts the wrapper script.
|
|
107
|
+
*/
|
|
108
|
+
export function programArguments({ bin, domain, authtoken, port } = {}) {
|
|
72
109
|
const extra = [];
|
|
73
110
|
if (bin) extra.push('--bin', String(bin));
|
|
74
111
|
if (domain) extra.push('--domain', String(domain));
|
|
75
112
|
if (authtoken) extra.push('--authtoken', String(authtoken));
|
|
76
113
|
if (port) extra.push('--port', String(port));
|
|
114
|
+
const helper = agentPath();
|
|
115
|
+
if (helper) return [helper, stableNode(), cliEntry(), 'tunnel', ...extra];
|
|
116
|
+
return [runnerPath(), 'tunnel', ...extra];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function xml(value) {
|
|
120
|
+
return String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function plistXml(options = {}) {
|
|
124
|
+
const logs = logDir();
|
|
125
|
+
const program = programArguments(options);
|
|
77
126
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
78
127
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
79
128
|
<plist version="1.0">
|
|
@@ -81,17 +130,15 @@ export function plistXml({ bin, domain, authtoken, port } = {}) {
|
|
|
81
130
|
<key>Label</key><string>${LABEL}</string>
|
|
82
131
|
<key>ProgramArguments</key>
|
|
83
132
|
<array>
|
|
84
|
-
<string>${
|
|
85
|
-
<string>tunnel</string>
|
|
86
|
-
${extra.map((a) => ` <string>${a}</string>`).join('\n')}
|
|
133
|
+
${program.map((a) => ` <string>${xml(a)}</string>`).join('\n')}
|
|
87
134
|
</array>
|
|
88
135
|
<key>RunAtLoad</key><true/>
|
|
89
136
|
<key>KeepAlive</key><true/>
|
|
90
|
-
<key>StandardOutPath</key><string>${path.join(logs, 'bridge.log')}</string>
|
|
91
|
-
<key>StandardErrorPath</key><string>${path.join(logs, 'bridge.err.log')}</string>
|
|
137
|
+
<key>StandardOutPath</key><string>${xml(path.join(logs, 'bridge.log'))}</string>
|
|
138
|
+
<key>StandardErrorPath</key><string>${xml(path.join(logs, 'bridge.err.log'))}</string>
|
|
92
139
|
<key>EnvironmentVariables</key>
|
|
93
140
|
<dict>
|
|
94
|
-
<key>PATH</key><string>${servicePath()}</string>
|
|
141
|
+
<key>PATH</key><string>${xml(servicePath())}</string>
|
|
95
142
|
</dict>
|
|
96
143
|
</dict>
|
|
97
144
|
</plist>
|
|
@@ -113,18 +160,32 @@ export function serviceStatus() {
|
|
|
113
160
|
return { installed, running, plist: plistPath(), detail: out.trim().slice(0, 600) };
|
|
114
161
|
}
|
|
115
162
|
|
|
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
|
+
|
|
116
165
|
export function serviceInstall(options = {}) {
|
|
117
166
|
ensureDirs();
|
|
118
167
|
fs.mkdirSync(logDir(), { recursive: true });
|
|
119
|
-
|
|
120
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
168
|
+
fs.mkdirSync(path.dirname(plistPath()), { recursive: true });
|
|
121
169
|
fs.writeFileSync(runnerPath(), runnerScript(), { mode: 0o755 });
|
|
122
170
|
fs.chmodSync(runnerPath(), 0o755);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
171
|
+
const plist = plistPath();
|
|
172
|
+
fs.writeFileSync(`${plist}.tmp`, plistXml(options), { mode: 0o600 });
|
|
173
|
+
fs.renameSync(`${plist}.tmp`, plist);
|
|
174
|
+
const job = `${LABEL}.reload.${randomUUID()}`;
|
|
175
|
+
const script = path.join(CONFIG_DIR, `${job}.sh`);
|
|
176
|
+
const status = path.join(CONFIG_DIR, 'service-reload.status');
|
|
177
|
+
fs.writeFileSync(script, reloadScript, { mode: 0o700 });
|
|
178
|
+
fs.writeFileSync(status, 'scheduled\n', { mode: 0o600 });
|
|
179
|
+
try {
|
|
180
|
+
execFileSync('launchctl', ['submit', '-l', job, '-o', path.join(logDir(), 'service-reload.log'),
|
|
181
|
+
'-e', path.join(logDir(), 'service-reload.err.log'), '--', '/bin/sh', script,
|
|
182
|
+
`gui/${process.getuid()}/${LABEL}`, plist, status, job], { encoding: 'utf8', timeout: 20000 });
|
|
183
|
+
} catch (e) {
|
|
184
|
+
fs.rmSync(script, { force: true });
|
|
185
|
+
fs.writeFileSync(status, 'submission failed\n');
|
|
186
|
+
return { ok: false, plist, detail: String(e.stderr || e.message).slice(0, 400) };
|
|
187
|
+
}
|
|
188
|
+
return { ok: true, scheduled: true, plist, status, detail: 'reload scheduled; check service status and service-reload.status' };
|
|
128
189
|
}
|
|
129
190
|
|
|
130
191
|
export function serviceUninstall() {
|