arena-bridge 0.18.13 → 0.18.15
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 +12 -0
- package/package.json +1 -1
- package/src/catalog.mjs +2 -2
- package/src/direct.mjs +2 -2
- package/src/http.mjs +9 -3
- package/src/tunnel.mjs +30 -16
- package/src/version.mjs +1 -1
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.18.15
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Restored the Node handlers for background processes and path deletion after the catalog split.
|
|
11
|
+
- `/health` reports the configured bridge log size again.
|
|
12
|
+
- Oversized HTTP request bodies return a normal `413 PAYLOAD_TOO_LARGE` response instead of resetting the connection.
|
|
13
|
+
|
|
14
|
+
## 0.18.14
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- Orphaned tunnel cleanup finds tunnel processes on macOS as well: an interpreted command is named after its interpreter there, so the process table is matched by the head of the command line instead of the process name.
|
|
18
|
+
|
|
7
19
|
## 0.18.13
|
|
8
20
|
|
|
9
21
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arena-bridge",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.15",
|
|
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/catalog.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fsp from 'node:fs/promises';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
2
3
|
import os from 'node:os';
|
|
3
4
|
import fs from 'node:fs';
|
|
4
5
|
import path from 'node:path';
|
|
5
|
-
import { checkPath, resolveTarget } from './policy.mjs';
|
|
6
|
+
import { checkPath, resolveTarget, isInside } from './policy.mjs';
|
|
6
7
|
import { audit, saveArtifact, tailAudit, readArtifact, auditDir } from './audit.mjs';
|
|
7
8
|
import { clip, runShell } from './engine_helpers.mjs';
|
|
8
9
|
import { errorResponse } from './errors.mjs';
|
|
@@ -597,4 +598,3 @@ export function toolCatalog() {
|
|
|
597
598
|
},
|
|
598
599
|
];
|
|
599
600
|
}
|
|
600
|
-
|
package/src/direct.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { handleMcp } from './mcp.mjs';
|
|
|
7
7
|
import { buildPrompt } from './prompt.mjs';
|
|
8
8
|
import { listApprovals, decide, settle } from './approvals.mjs';
|
|
9
9
|
import { checkPath } from './policy.mjs';
|
|
10
|
-
import { loadConfig } from './config.mjs';
|
|
10
|
+
import { loadConfig, CONFIG_DIR } from './config.mjs';
|
|
11
11
|
import { tailAudit, readArtifact, auditDir, audit, auditPage, findEntry, lean, headCursor, LEVELS, pruneAudit, pruneArtifacts } from './audit.mjs';
|
|
12
12
|
import { reconcileTrust } from './trust.mjs';
|
|
13
13
|
import { describeSource, sourceOf, admitUnauthorized } from './source.mjs';
|
|
@@ -384,4 +384,4 @@ export function createDirectServer(cfg, engine, runtime = null) {
|
|
|
384
384
|
server.on('close', () => { poller?.stop(); clearInterval(maint); clearInterval(sweep); });
|
|
385
385
|
|
|
386
386
|
return server;
|
|
387
|
-
}
|
|
387
|
+
}
|
package/src/http.mjs
CHANGED
|
@@ -39,17 +39,23 @@ export function readBody(req, limit = 16 * 1024 * 1024) {
|
|
|
39
39
|
return new Promise((resolve, reject) => {
|
|
40
40
|
const chunks = [];
|
|
41
41
|
let len = 0;
|
|
42
|
+
let rejected = false;
|
|
42
43
|
req.on('data', (c) => {
|
|
44
|
+
if (rejected) return;
|
|
43
45
|
len += c.length;
|
|
44
46
|
if (len > limit) {
|
|
47
|
+
rejected = true;
|
|
45
48
|
reject(new Error('request body too large'));
|
|
46
|
-
req.destroy();
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
51
|
chunks.push(c);
|
|
50
52
|
});
|
|
51
|
-
req.on('end', () =>
|
|
52
|
-
|
|
53
|
+
req.on('end', () => {
|
|
54
|
+
if (!rejected) resolve(Buffer.concat(chunks));
|
|
55
|
+
});
|
|
56
|
+
req.on('error', (error) => {
|
|
57
|
+
if (!rejected) reject(error);
|
|
58
|
+
});
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
|
package/src/tunnel.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn, execFileSync } from 'node:child_process';
|
|
2
2
|
import net from 'node:net';
|
|
3
|
-
import { writePid, clearPid, readPid, pidAlive, pidName,
|
|
3
|
+
import { writePid, clearPid, readPid, pidAlive, pidName, stopPid } from './state.mjs';
|
|
4
4
|
|
|
5
5
|
/** Tunnel binaries this bridge may stop; anything else on the machine is untouchable. */
|
|
6
6
|
export const TUNNEL_NAMES = ['cloudflared', 'ngrok'];
|
|
@@ -26,27 +26,41 @@ export function listenerPid(port) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Pids of tunnel processes, optionally aimed at one local port. The first command line
|
|
31
|
+
* tokens name the binary: on macOS an interpreted command carries the interpreter first
|
|
32
|
+
* and the script path second, so both tokens are checked by basename.
|
|
33
|
+
*/
|
|
34
|
+
export function tunnelProcesses(port) {
|
|
35
|
+
let text = '';
|
|
36
|
+
try {
|
|
37
|
+
text = execFileSync('ps', ['-ax', '-o', 'pid=,args='], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
38
|
+
} catch {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const line of text.split('\n')) {
|
|
43
|
+
const m = /^\s*(\d+)\s+(\S.*)$/.exec(line);
|
|
44
|
+
if (!m) continue;
|
|
45
|
+
const args = m[2];
|
|
46
|
+
const head = args.split(/\s+/).slice(0, 2).map((t) => t.split('/').pop());
|
|
47
|
+
if (!head.some((name) => TUNNEL_NAMES.includes(name))) continue;
|
|
48
|
+
if (port !== undefined && !args.includes(`127.0.0.1:${port}`)) continue;
|
|
49
|
+
out.push(Number(m[1]));
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
29
54
|
/**
|
|
30
55
|
* Stop tunnel processes that serve exactly our local port: orphaned tunnels of a dead
|
|
31
56
|
* bridge generation. Tunnels of the user that point elsewhere keep running.
|
|
32
57
|
*/
|
|
33
58
|
export function killTunnelsForPort(port) {
|
|
34
|
-
const target = `127.0.0.1:${port}`;
|
|
35
59
|
const killed = [];
|
|
36
|
-
for (const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} catch {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
for (const pid of pids) {
|
|
44
|
-
const num = Number(pid);
|
|
45
|
-
if (!pidArgs(num).includes(target)) continue;
|
|
46
|
-
stopPid(num);
|
|
47
|
-
if (readPid('tunnel') === num) clearPid('tunnel', num);
|
|
48
|
-
killed.push(num);
|
|
49
|
-
}
|
|
60
|
+
for (const pid of tunnelProcesses(port)) {
|
|
61
|
+
stopPid(pid);
|
|
62
|
+
if (readPid('tunnel') === pid) clearPid('tunnel', pid);
|
|
63
|
+
killed.push(pid);
|
|
50
64
|
}
|
|
51
65
|
return killed;
|
|
52
66
|
}
|