@madarco/agentbox 0.10.1 → 0.11.1
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 +44 -0
- package/dist/{_cloud-attach-2DGI6FUA.js → _cloud-attach-45ECDTRL.js} +4 -4
- package/dist/{chunk-MTVI44DW.js → chunk-ECLLV5JH.js} +6 -3
- package/dist/chunk-ECLLV5JH.js.map +1 -0
- package/dist/{chunk-M2UWJKFA.js → chunk-MXXXKJYS.js} +5 -5
- package/dist/chunk-MXXXKJYS.js.map +1 -0
- package/dist/{chunk-I7NOGCL4.js → chunk-PZ2TJF2U.js} +23 -11
- package/dist/chunk-PZ2TJF2U.js.map +1 -0
- package/dist/{chunk-I24B6AXR.js → chunk-R5XIDQFR.js} +6 -3
- package/dist/chunk-R5XIDQFR.js.map +1 -0
- package/dist/{chunk-PWUVHPN6.js → chunk-SNTHHWKY.js} +7 -3
- package/dist/chunk-SNTHHWKY.js.map +1 -0
- package/dist/{chunk-LEV3KICD.js → chunk-ZGVMN54V.js} +6 -3
- package/dist/{chunk-LEV3KICD.js.map → chunk-ZGVMN54V.js.map} +1 -1
- package/dist/{chunk-CDKVD6UO.js → chunk-ZJXTIH6C.js} +119 -87
- package/dist/chunk-ZJXTIH6C.js.map +1 -0
- package/dist/{dist-SBCQVFCE.js → dist-ASLPRUQR.js} +3 -3
- package/dist/{dist-BD5QJRDC.js → dist-PTJ6CEQY.js} +5 -5
- package/dist/{dist-SJHY3HYN.js → dist-RAZP76VX.js} +5 -5
- package/dist/{dist-BNI5PQYK.js → dist-WMQDMTWS.js} +5 -5
- package/dist/index.js +619 -546
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-O5M4NIN4.js → prepared-state-MQHD3M5F-KE4DT3GX.js} +2 -2
- package/package.json +4 -4
- package/runtime/docker/packages/ctl/dist/bin.cjs +5 -2
- package/runtime/hetzner/ctl.cjs +5 -2
- package/runtime/relay/bin.cjs +37 -19
- package/runtime/vercel/ctl.cjs +5 -2
- package/runtime/vercel/scripts/provision.sh +20 -0
- package/dist/chunk-CDKVD6UO.js.map +0 -1
- package/dist/chunk-I24B6AXR.js.map +0 -1
- package/dist/chunk-I7NOGCL4.js.map +0 -1
- package/dist/chunk-M2UWJKFA.js.map +0 -1
- package/dist/chunk-MTVI44DW.js.map +0 -1
- package/dist/chunk-PWUVHPN6.js.map +0 -1
- /package/dist/{_cloud-attach-2DGI6FUA.js.map → _cloud-attach-45ECDTRL.js.map} +0 -0
- /package/dist/{dist-SBCQVFCE.js.map → dist-ASLPRUQR.js.map} +0 -0
- /package/dist/{dist-BD5QJRDC.js.map → dist-PTJ6CEQY.js.map} +0 -0
- /package/dist/{dist-SJHY3HYN.js.map → dist-RAZP76VX.js.map} +0 -0
- /package/dist/{dist-BNI5PQYK.js.map → dist-WMQDMTWS.js.map} +0 -0
- /package/dist/{prepared-state-MQHD3M5F-O5M4NIN4.js.map → prepared-state-MQHD3M5F-KE4DT3GX.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
readPreparedDockerState,
|
|
7
7
|
resolveContextFiles,
|
|
8
8
|
writePreparedDockerState
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SNTHHWKY.js";
|
|
10
10
|
export {
|
|
11
11
|
DOCKERFILE_PATH,
|
|
12
12
|
computeDockerContextFingerprint,
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
resolveContextFiles,
|
|
16
16
|
writePreparedDockerState
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=prepared-state-MQHD3M5F-
|
|
18
|
+
//# sourceMappingURL=prepared-state-MQHD3M5F-KE4DT3GX.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madarco/agentbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Launch Claude Code, Codex, and other coding agents in isolated sandboxes",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marco D'Alia",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"typescript": "^5.7.2",
|
|
60
60
|
"vitest": "^2.1.8",
|
|
61
61
|
"@agentbox/config": "0.0.0",
|
|
62
|
-
"@agentbox/core": "0.0.0",
|
|
63
62
|
"@agentbox/ctl": "0.0.0",
|
|
64
|
-
"@agentbox/
|
|
63
|
+
"@agentbox/core": "0.0.0",
|
|
65
64
|
"@agentbox/sandbox-cloud": "0.0.0",
|
|
65
|
+
"@agentbox/relay": "0.0.0",
|
|
66
66
|
"@agentbox/sandbox-core": "0.0.0",
|
|
67
|
-
"@agentbox/sandbox-hetzner": "0.0.0",
|
|
68
67
|
"@agentbox/sandbox-daytona": "0.0.0",
|
|
69
68
|
"@agentbox/sandbox-docker": "0.0.0",
|
|
69
|
+
"@agentbox/sandbox-hetzner": "0.0.0",
|
|
70
70
|
"@agentbox/sandbox-vercel": "0.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
@@ -18457,6 +18457,9 @@ function findBox(idOrName, state) {
|
|
|
18457
18457
|
if (byContainer) return { kind: "ok", box: byContainer };
|
|
18458
18458
|
return { kind: "none" };
|
|
18459
18459
|
}
|
|
18460
|
+
function hostOpenCommand() {
|
|
18461
|
+
return process.platform === "linux" ? "xdg-open" : "open";
|
|
18462
|
+
}
|
|
18460
18463
|
|
|
18461
18464
|
// ../config/dist/index.js
|
|
18462
18465
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -19583,7 +19586,7 @@ async function runBrowserOpenMirror(action, deps) {
|
|
|
19583
19586
|
);
|
|
19584
19587
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
19585
19588
|
const { spawn: spawn52 } = await import("child_process");
|
|
19586
|
-
const child = spawn52(
|
|
19589
|
+
const child = spawn52(hostOpenCommand(), [url], { stdio: "ignore", detached: true });
|
|
19587
19590
|
child.unref();
|
|
19588
19591
|
}
|
|
19589
19592
|
} catch (err) {
|
|
@@ -20303,7 +20306,7 @@ function createRelayServer(opts) {
|
|
|
20303
20306
|
{ ttlMs: BROWSER_OPEN_PROMPT_TTL_MS }
|
|
20304
20307
|
).then((verdict) => {
|
|
20305
20308
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
20306
|
-
void runHostCommand([
|
|
20309
|
+
void runHostCommand([hostOpenCommand(), url2], BROWSER_OPEN_RPC_TIMEOUT_MS);
|
|
20307
20310
|
}
|
|
20308
20311
|
}).catch(() => {
|
|
20309
20312
|
});
|
package/runtime/hetzner/ctl.cjs
CHANGED
|
@@ -18457,6 +18457,9 @@ function findBox(idOrName, state) {
|
|
|
18457
18457
|
if (byContainer) return { kind: "ok", box: byContainer };
|
|
18458
18458
|
return { kind: "none" };
|
|
18459
18459
|
}
|
|
18460
|
+
function hostOpenCommand() {
|
|
18461
|
+
return process.platform === "linux" ? "xdg-open" : "open";
|
|
18462
|
+
}
|
|
18460
18463
|
|
|
18461
18464
|
// ../config/dist/index.js
|
|
18462
18465
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -19583,7 +19586,7 @@ async function runBrowserOpenMirror(action, deps) {
|
|
|
19583
19586
|
);
|
|
19584
19587
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
19585
19588
|
const { spawn: spawn52 } = await import("child_process");
|
|
19586
|
-
const child = spawn52(
|
|
19589
|
+
const child = spawn52(hostOpenCommand(), [url], { stdio: "ignore", detached: true });
|
|
19587
19590
|
child.unref();
|
|
19588
19591
|
}
|
|
19589
19592
|
} catch (err) {
|
|
@@ -20303,7 +20306,7 @@ function createRelayServer(opts) {
|
|
|
20303
20306
|
{ ttlMs: BROWSER_OPEN_PROMPT_TTL_MS }
|
|
20304
20307
|
).then((verdict) => {
|
|
20305
20308
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
20306
|
-
void runHostCommand([
|
|
20309
|
+
void runHostCommand([hostOpenCommand(), url2], BROWSER_OPEN_RPC_TIMEOUT_MS);
|
|
20307
20310
|
}
|
|
20308
20311
|
}).catch(() => {
|
|
20309
20312
|
});
|
package/runtime/relay/bin.cjs
CHANGED
|
@@ -18026,6 +18026,9 @@ function findBox(idOrName, state) {
|
|
|
18026
18026
|
if (byContainer) return { kind: "ok", box: byContainer };
|
|
18027
18027
|
return { kind: "none" };
|
|
18028
18028
|
}
|
|
18029
|
+
function hostOpenCommand() {
|
|
18030
|
+
return process.platform === "linux" ? "xdg-open" : "open";
|
|
18031
|
+
}
|
|
18029
18032
|
|
|
18030
18033
|
// src/gh.ts
|
|
18031
18034
|
var import_node_child_process6 = require("child_process");
|
|
@@ -18594,7 +18597,7 @@ async function runBrowserOpenMirror(action, deps) {
|
|
|
18594
18597
|
);
|
|
18595
18598
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
18596
18599
|
const { spawn: spawn6 } = await import("child_process");
|
|
18597
|
-
const child = spawn6(
|
|
18600
|
+
const child = spawn6(hostOpenCommand(), [url], { stdio: "ignore", detached: true });
|
|
18598
18601
|
child.unref();
|
|
18599
18602
|
}
|
|
18600
18603
|
} catch (err) {
|
|
@@ -19574,7 +19577,7 @@ function createRelayServer(opts) {
|
|
|
19574
19577
|
{ ttlMs: BROWSER_OPEN_PROMPT_TTL_MS }
|
|
19575
19578
|
).then((verdict) => {
|
|
19576
19579
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
19577
|
-
void runHostCommand([
|
|
19580
|
+
void runHostCommand([hostOpenCommand(), url2], BROWSER_OPEN_RPC_TIMEOUT_MS);
|
|
19578
19581
|
}
|
|
19579
19582
|
}).catch(() => {
|
|
19580
19583
|
});
|
|
@@ -21071,57 +21074,72 @@ async function defaultCountWorkingBoxes(registry, statusStore, idleGraceMs) {
|
|
|
21071
21074
|
sinceCreateMs: msSince2(b.createdAt)
|
|
21072
21075
|
};
|
|
21073
21076
|
});
|
|
21074
|
-
|
|
21077
|
+
const count2 = countWorkingSlots(entries, idleGraceMs);
|
|
21075
21078
|
let jobs;
|
|
21076
21079
|
try {
|
|
21077
21080
|
jobs = await loadQueue();
|
|
21078
21081
|
} catch {
|
|
21079
21082
|
return count2;
|
|
21080
21083
|
}
|
|
21084
|
+
return count2 + countInFlightCreateJobs(jobs, registeredIds);
|
|
21085
|
+
}
|
|
21086
|
+
function countInFlightCreateJobs(jobs, accountedBoxIds) {
|
|
21087
|
+
let n2 = 0;
|
|
21081
21088
|
for (const j of jobs) {
|
|
21082
21089
|
if (j.status !== "running") continue;
|
|
21083
|
-
if (j.boxId &&
|
|
21090
|
+
if (j.boxId && accountedBoxIds.has(j.boxId)) continue;
|
|
21084
21091
|
if (typeof j.pid === "number" && !processAlive(j.pid)) continue;
|
|
21085
|
-
|
|
21092
|
+
n2 += 1;
|
|
21086
21093
|
}
|
|
21087
|
-
return
|
|
21094
|
+
return n2;
|
|
21088
21095
|
}
|
|
21089
21096
|
var RUNNING_COUNT_CACHE_MS = 3e3;
|
|
21090
|
-
var
|
|
21097
|
+
var boxStateCache = null;
|
|
21091
21098
|
async function defaultCountRunningBoxes() {
|
|
21099
|
+
const { boxCount, stateIds } = await cachedBoxState();
|
|
21100
|
+
let jobs;
|
|
21101
|
+
try {
|
|
21102
|
+
jobs = await loadQueue();
|
|
21103
|
+
} catch {
|
|
21104
|
+
return boxCount;
|
|
21105
|
+
}
|
|
21106
|
+
return boxCount + countInFlightCreateJobs(jobs, stateIds);
|
|
21107
|
+
}
|
|
21108
|
+
async function cachedBoxState() {
|
|
21092
21109
|
const now = Date.now();
|
|
21093
|
-
if (
|
|
21094
|
-
return
|
|
21110
|
+
if (boxStateCache && boxStateCache.expiresAt > now) {
|
|
21111
|
+
return { boxCount: boxStateCache.boxCount, stateIds: boxStateCache.stateIds };
|
|
21095
21112
|
}
|
|
21096
|
-
const
|
|
21097
|
-
|
|
21098
|
-
return
|
|
21113
|
+
const fresh = await uncachedBoxStateCount();
|
|
21114
|
+
boxStateCache = { ...fresh, expiresAt: now + RUNNING_COUNT_CACHE_MS };
|
|
21115
|
+
return fresh;
|
|
21099
21116
|
}
|
|
21100
|
-
async function
|
|
21117
|
+
async function uncachedBoxStateCount() {
|
|
21101
21118
|
let boxes;
|
|
21102
21119
|
try {
|
|
21103
21120
|
boxes = (await readState(STATE_FILE)).boxes;
|
|
21104
21121
|
} catch {
|
|
21105
|
-
return 0;
|
|
21122
|
+
return { boxCount: 0, stateIds: /* @__PURE__ */ new Set() };
|
|
21106
21123
|
}
|
|
21107
|
-
|
|
21108
|
-
|
|
21124
|
+
const stateIds = new Set(boxes.map((b) => b.id));
|
|
21125
|
+
if (boxes.length === 0) return { boxCount: 0, stateIds };
|
|
21126
|
+
let boxCount = 0;
|
|
21109
21127
|
const dockerBoxes = [];
|
|
21110
21128
|
for (const b of boxes) {
|
|
21111
21129
|
const provider = b.provider ?? "docker";
|
|
21112
21130
|
if (provider === "docker") {
|
|
21113
21131
|
dockerBoxes.push(b);
|
|
21114
21132
|
} else {
|
|
21115
|
-
|
|
21133
|
+
boxCount += 1;
|
|
21116
21134
|
}
|
|
21117
21135
|
}
|
|
21118
21136
|
if (dockerBoxes.length > 0) {
|
|
21119
21137
|
const states = await Promise.all(dockerBoxes.map((b) => inspectDockerState(b.container)));
|
|
21120
21138
|
for (const s of states) {
|
|
21121
|
-
if (s === "running")
|
|
21139
|
+
if (s === "running") boxCount += 1;
|
|
21122
21140
|
}
|
|
21123
21141
|
}
|
|
21124
|
-
return
|
|
21142
|
+
return { boxCount, stateIds };
|
|
21125
21143
|
}
|
|
21126
21144
|
function inspectDockerState(containerName) {
|
|
21127
21145
|
return new Promise((resolveP) => {
|
package/runtime/vercel/ctl.cjs
CHANGED
|
@@ -18457,6 +18457,9 @@ function findBox(idOrName, state) {
|
|
|
18457
18457
|
if (byContainer) return { kind: "ok", box: byContainer };
|
|
18458
18458
|
return { kind: "none" };
|
|
18459
18459
|
}
|
|
18460
|
+
function hostOpenCommand() {
|
|
18461
|
+
return process.platform === "linux" ? "xdg-open" : "open";
|
|
18462
|
+
}
|
|
18460
18463
|
|
|
18461
18464
|
// ../config/dist/index.js
|
|
18462
18465
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -19583,7 +19586,7 @@ async function runBrowserOpenMirror(action, deps) {
|
|
|
19583
19586
|
);
|
|
19584
19587
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
19585
19588
|
const { spawn: spawn52 } = await import("child_process");
|
|
19586
|
-
const child = spawn52(
|
|
19589
|
+
const child = spawn52(hostOpenCommand(), [url], { stdio: "ignore", detached: true });
|
|
19587
19590
|
child.unref();
|
|
19588
19591
|
}
|
|
19589
19592
|
} catch (err) {
|
|
@@ -20303,7 +20306,7 @@ function createRelayServer(opts) {
|
|
|
20303
20306
|
{ ttlMs: BROWSER_OPEN_PROMPT_TTL_MS }
|
|
20304
20307
|
).then((verdict) => {
|
|
20305
20308
|
if (verdict.answer === "y" && !verdict.cancelled) {
|
|
20306
|
-
void runHostCommand([
|
|
20309
|
+
void runHostCommand([hostOpenCommand(), url2], BROWSER_OPEN_RPC_TIMEOUT_MS);
|
|
20307
20310
|
}
|
|
20308
20311
|
}).catch(() => {
|
|
20309
20312
|
});
|
|
@@ -235,6 +235,26 @@ fi
|
|
|
235
235
|
sudo -u vscode -H mkdir -p /home/vscode/.vnc
|
|
236
236
|
done_ "VNC stack (TigerVNC + websockify + noVNC)"
|
|
237
237
|
|
|
238
|
+
step "X11 clipboard tools (xclip + autocutsel, built from source)"
|
|
239
|
+
# xclip and autocutsel are NOT in the AL2023 repos (unlike Debian/Ubuntu where
|
|
240
|
+
# docker + hetzner apt-install them). They are load-bearing: xclip backs the
|
|
241
|
+
# host->box Ctrl+V image paste (apps/cli/src/lib/paste-image.ts), and autocutsel
|
|
242
|
+
# keeps the VNC CLIPBOARD/PRIMARY selections in sync (agentbox-vnc-start). Build
|
|
243
|
+
# both from source — all deps are in the AL2023 default repos. Fail loud: a
|
|
244
|
+
# missing binary is a silently broken feature, not a skippable convenience.
|
|
245
|
+
dnf install -y -q --allowerasing \
|
|
246
|
+
gcc make automake autoconf git \
|
|
247
|
+
libX11-devel libXmu-devel libXt-devel libXaw-devel
|
|
248
|
+
git clone --depth 1 https://github.com/astrand/xclip /tmp/xclip
|
|
249
|
+
( cd /tmp/xclip && autoreconf -i && ./configure --prefix=/usr/local && make && make install )
|
|
250
|
+
rm -rf /tmp/xclip
|
|
251
|
+
command -v xclip >/dev/null || { echo "provision.sh: xclip build failed"; exit 1; }
|
|
252
|
+
git clone --depth 1 https://github.com/sigmike/autocutsel /tmp/autocutsel
|
|
253
|
+
( cd /tmp/autocutsel && autoreconf -i && ./configure --prefix=/usr/local && make && make install )
|
|
254
|
+
rm -rf /tmp/autocutsel
|
|
255
|
+
command -v autocutsel >/dev/null || { echo "provision.sh: autocutsel build failed"; exit 1; }
|
|
256
|
+
done_ "X11 clipboard tools (xclip + autocutsel, built from source)"
|
|
257
|
+
|
|
238
258
|
step "agent CLIs (codex + opencode + agent-browser, global npm)"
|
|
239
259
|
npm install -g @openai/codex opencode-ai agent-browser 2>&1 | tail -3 || \
|
|
240
260
|
echo "provision.sh: one or more agent npm installs failed (continuing)"
|