arena-bridge 0.7.18 → 0.7.19
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 +8 -0
- package/README.md +5 -3
- package/package.json +4 -4
- package/src/approvals.mjs +24 -5
- package/src/direct.mjs +1 -1
- package/src/engine.mjs +2 -2
- package/src/hub.mjs +1 -1
- package/src/mac.mjs +3 -2
- package/src/mcp.mjs +1 -1
- package/src/prompt.mjs +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ 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.19
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Approval requests now become `timeout` or `expired` records on disk and cannot be accepted after they are no longer actionable.
|
|
11
|
+
- Stale pending requests expire when listed or decided; failed late approvals cannot open a trust window.
|
|
12
|
+
- Agent recovery hints explain that timed-out requests are closed and require a fresh call or trust window.
|
|
13
|
+
- An explicit Peekaboo path is authoritative rather than silently falling back to another installation.
|
|
14
|
+
|
|
7
15
|
## 0.7.18
|
|
8
16
|
|
|
9
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -452,8 +452,10 @@ arena-bridge browser close work # закрыть окно этого пр
|
|
|
452
452
|
* **Пути ограничены**: всё вне `roots` — `PROTECTED`. Защищённый список по умолчанию включает
|
|
453
453
|
`~/.ssh`, `~/.aws`, `~/.arena-bridge`, `~/.npmrc`, профили браузеров, ключи.
|
|
454
454
|
* **Подтверждения**: `bash`, запись, удаление, управление вашим Chrome и десктопом ждут
|
|
455
|
-
`arena-bridge approve <id>`.
|
|
456
|
-
|
|
455
|
+
`arena-bridge approve <id>`. Подтверждать нужно, пока вызов ожидает решения.
|
|
456
|
+
После `timeout` или `expired` запрос закрыт и его `approval_id` больше не принимается.
|
|
457
|
+
Для продолжения откройте `arena-bridge trust --for 1h` и повторите вызов один раз либо
|
|
458
|
+
согласуйте новый вызов, который пользователь подтвердит во время ожидания.
|
|
457
459
|
* **Журнал**: `~/.arena-bridge/audit.log` (JSONL) — кто, что и когда вызвал.
|
|
458
460
|
* **Транспорт**: сервер слушает `127.0.0.1`, наружу — только туннель с HTTPS.
|
|
459
461
|
|
|
@@ -548,7 +550,7 @@ arena_bridge/ тот же функционал на Python (stdlib only)
|
|
|
548
550
|
| `port 8787 is already in use` | остановите старый экземпляр (`Ctrl+C`) или `arena-bridge start --port 8788` |
|
|
549
551
|
| туннель не поднимается | `cloudflared` по умолчанию использует QUIC и может быть заблокирован — `arena-bridge tunnel --protocol http2` (это поведение по умолчанию) |
|
|
550
552
|
| агент не видит файлы | проверьте `arena-bridge doctor` и `roots` в `~/.arena-bridge/config.json`; вне `roots` всё равно `PROTECTED` |
|
|
551
|
-
| `APPROVAL_PENDING` |
|
|
553
|
+
| `APPROVAL_PENDING` | при `timeout`/`expired` старый запрос закрыт: согласуйте новый вызов или попросите открыть `arena-bridge trust --for 1h` |
|
|
552
554
|
| скриншоты не работают | `mac_permissions` — выдайте терминалу Screen Recording и Accessibility |
|
|
553
555
|
| `peekaboo_not_found` | поставьте Peekaboo или укажите путь: `arena-bridge init` + `peekabooPath` в конфиге |
|
|
554
556
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arena-bridge",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.19",
|
|
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 && 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",
|
|
22
|
+
"test": "node --test test/approvals.test.mjs && node test/smoke.mjs && node test/browser.test.mjs && node test/mac.test.mjs && node test/service.test.mjs",
|
|
23
|
+
"test:node": "node --test test/approvals.test.mjs && 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_approvals.py && 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/approvals.mjs
CHANGED
|
@@ -11,6 +11,16 @@ function fileOf(id) {
|
|
|
11
11
|
return path.join(APPROVALS_DIR, `${id}.json`);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function expireIfNeeded(file, rec, now = Date.now()) {
|
|
15
|
+
if (rec.status === 'pending' && rec.expiresAt && now >= rec.expiresAt) {
|
|
16
|
+
rec.status = 'expired';
|
|
17
|
+
rec.decidedAt = now;
|
|
18
|
+
rec.decidedBy = 'system';
|
|
19
|
+
fs.writeFileSync(file, JSON.stringify(rec, null, 2), { mode: 0o600 });
|
|
20
|
+
}
|
|
21
|
+
return rec;
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
export function listApprovals() {
|
|
15
25
|
if (!fs.existsSync(APPROVALS_DIR)) return [];
|
|
16
26
|
return fs
|
|
@@ -18,7 +28,8 @@ export function listApprovals() {
|
|
|
18
28
|
.filter((f) => f.endsWith('.json'))
|
|
19
29
|
.map((f) => {
|
|
20
30
|
try {
|
|
21
|
-
|
|
31
|
+
const file = path.join(APPROVALS_DIR, f);
|
|
32
|
+
return expireIfNeeded(file, JSON.parse(fs.readFileSync(file, 'utf8')));
|
|
22
33
|
} catch {
|
|
23
34
|
return null;
|
|
24
35
|
}
|
|
@@ -36,6 +47,7 @@ export function decide(id, decision, by = 'cli') {
|
|
|
36
47
|
} catch (e) {
|
|
37
48
|
return { ok: false, error: e.message };
|
|
38
49
|
}
|
|
50
|
+
rec = expireIfNeeded(file, rec);
|
|
39
51
|
if (rec.status !== 'pending') return { ok: false, error: `already ${rec.status}` };
|
|
40
52
|
rec.status = decision === 'approve' ? 'approved' : 'denied';
|
|
41
53
|
rec.decidedAt = Date.now();
|
|
@@ -117,10 +129,17 @@ export async function requestApproval(tool, args, cfg) {
|
|
|
117
129
|
continue;
|
|
118
130
|
}
|
|
119
131
|
if (cur.status === 'approved') return { approved: true, rec: cur };
|
|
120
|
-
if (cur.status
|
|
121
|
-
if (cur.expiresAt && Date.now()
|
|
122
|
-
return { approved: false, rec:
|
|
132
|
+
if (cur.status !== 'pending') return { approved: false, rec: cur };
|
|
133
|
+
if (cur.expiresAt && Date.now() >= cur.expiresAt) {
|
|
134
|
+
return { approved: false, rec: expireIfNeeded(fileOf(id), cur) };
|
|
123
135
|
}
|
|
124
136
|
}
|
|
125
|
-
|
|
137
|
+
const timedOut = expireIfNeeded(fileOf(id), JSON.parse(fs.readFileSync(fileOf(id), 'utf8')));
|
|
138
|
+
if (timedOut.status === 'pending') {
|
|
139
|
+
timedOut.status = 'timeout';
|
|
140
|
+
timedOut.decidedAt = Date.now();
|
|
141
|
+
timedOut.decidedBy = 'system';
|
|
142
|
+
fs.writeFileSync(fileOf(id), JSON.stringify(timedOut, null, 2), { mode: 0o600 });
|
|
143
|
+
}
|
|
144
|
+
return { approved: timedOut.status === 'approved', rec: timedOut };
|
|
126
145
|
}
|
package/src/direct.mjs
CHANGED
package/src/engine.mjs
CHANGED
|
@@ -685,11 +685,11 @@ export class Engine {
|
|
|
685
685
|
status,
|
|
686
686
|
pending,
|
|
687
687
|
reason: pending
|
|
688
|
-
? `
|
|
688
|
+
? `approval wait ended (${status}) for tool "${tool.name}"; this request is closed`
|
|
689
689
|
: `human ${status} tool "${tool.name}"`,
|
|
690
690
|
approval_id: approval.rec?.id || null,
|
|
691
691
|
hint: pending
|
|
692
|
-
? '
|
|
692
|
+
? 'This approval_id is closed and cannot be approved. Ask the user to open a trust window: arena-bridge trust --for 1h. Then retry the call once, or arrange a fresh call for approval while it is waiting.'
|
|
693
693
|
: 'The user declined this action. Do not retry it; ask what to do instead.',
|
|
694
694
|
};
|
|
695
695
|
}
|
package/src/hub.mjs
CHANGED
package/src/mac.mjs
CHANGED
|
@@ -18,8 +18,9 @@ const NOT_FOUND_HINT =
|
|
|
18
18
|
'peekaboo is not installed on this machine. Install it (macOS: brew install peekaboo, or download the release from https://github.com/openclaw/Peekaboo) and make sure the binary is on PATH.';
|
|
19
19
|
|
|
20
20
|
export function findPeekaboo(cfg = {}) {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
if (cfg.peekabooPath) return fs.existsSync(cfg.peekabooPath) ? cfg.peekabooPath : null;
|
|
22
|
+
const explicit = process.env.PEEKABOO_PATH;
|
|
23
|
+
if (explicit) return fs.existsSync(explicit) ? explicit : null;
|
|
23
24
|
for (const c of PEEKABOO_CANDIDATES) if (fs.existsSync(c)) return c;
|
|
24
25
|
for (const d of (process.env.PATH || '').split(path.delimiter)) {
|
|
25
26
|
if (!d) continue;
|
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.19' },
|
|
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/prompt.mjs
CHANGED
|
@@ -116,9 +116,10 @@ Use it when a step takes long or when you need a decision: one message is enough
|
|
|
116
116
|
|
|
117
117
|
## Approvals
|
|
118
118
|
${trustLine}
|
|
119
|
-
-
|
|
120
|
-
\`
|
|
121
|
-
|
|
119
|
+
- Approve requests while the call is waiting. A returned \`APPROVAL_PENDING\` with status
|
|
120
|
+
\`timeout\` or \`expired\` identifies a closed request: that \`approval_id\` cannot be approved.
|
|
121
|
+
Ask the user to open \`arena-bridge trust --for 1h\` before retrying once, or arrange a fresh
|
|
122
|
+
call that they can approve while it is waiting. \`GET /approvals\` includes historical records; only \`pending\` is actionable.
|
|
122
123
|
- \`APPROVAL_DENIED\` means the user said no: do not retry, ask what to do instead.
|
|
123
124
|
|
|
124
125
|
## Rules
|
|
@@ -126,8 +127,8 @@ ${trustLine}
|
|
|
126
127
|
Reading or writing anything else returns \`PROTECTED\` — do not try to work around it.
|
|
127
128
|
2. Side-effecting tools (bash, write/edit/delete, process start/kill, actions on the user's own
|
|
128
129
|
Chrome or on the desktop) may require a local human approval. When the answer contains
|
|
129
|
-
\`APPROVAL_PENDING\`,
|
|
130
|
-
|
|
130
|
+
\`APPROVAL_PENDING\`, stop and follow the recovery hint; never ask to approve a closed id.
|
|
131
|
+
Do not retry in a loop.
|
|
131
132
|
3. Work step by step: inspect before you change. Prefer \`read_file\`/\`list_dir\`/\`search_files\`
|
|
132
133
|
over blind shell commands. \`list_dir\` returns the top level only unless you ask for \`recursive\`.
|
|
133
134
|
4. Long-running work (dev servers, watchers) belongs in \`start_process\` + \`read_process_output\`,
|