@madarco/agentbox 0.18.0 → 0.20.0
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 +118 -0
- package/README.md +4 -3
- package/dist/_cloud-attach-THTN4CFZ.js +18 -0
- package/dist/{chunk-U7IZS2ZP.js → chunk-3VFY3N4A.js} +1388 -234
- package/dist/chunk-3VFY3N4A.js.map +1 -0
- package/dist/{chunk-XWBFWUY2.js → chunk-52LKNUY7.js} +6 -3
- package/dist/chunk-52LKNUY7.js.map +1 -0
- package/dist/{chunk-6QFPYU4Z.js → chunk-7K2A3NLE.js} +8 -5
- package/dist/chunk-7K2A3NLE.js.map +1 -0
- package/dist/{chunk-5BO6SGMI.js → chunk-7RWFYLF3.js} +194 -34
- package/dist/chunk-7RWFYLF3.js.map +1 -0
- package/dist/{chunk-IA6YHH52.js → chunk-MODNW54N.js} +6 -3
- package/dist/{chunk-IA6YHH52.js.map → chunk-MODNW54N.js.map} +1 -1
- package/dist/{chunk-46NXCJ6Z.js → chunk-NXX3KQZ6.js} +2 -2
- package/dist/{chunk-3JXSW6PN.js → chunk-P6UT5XGE.js} +2 -2
- package/dist/{chunk-OG4KMYOJ.js → chunk-ZX6DTA4X.js} +276 -56
- package/dist/chunk-ZX6DTA4X.js.map +1 -0
- package/dist/{dist-CFSKUAS5.js → dist-3PLT2EK2.js} +17 -3
- package/dist/{dist-T7ESSBCZ.js → dist-3WFNXXPE.js} +20 -6
- package/dist/dist-3WFNXXPE.js.map +1 -0
- package/dist/{dist-3UYQZOAO.js → dist-7ELDXBAG.js} +19 -6
- package/dist/dist-7ELDXBAG.js.map +1 -0
- package/dist/{dist-4BHW7DCO.js → dist-C3YRC3PP.js} +10 -5
- package/dist/dist-C3YRC3PP.js.map +1 -0
- package/dist/{dist-7BS2JS27.js → dist-CZ6CRADC.js} +18 -7
- package/dist/dist-CZ6CRADC.js.map +1 -0
- package/dist/index.js +1218 -560
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
- package/package.json +4 -4
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
- package/runtime/docker/packages/ctl/dist/bin.cjs +255 -169
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
- package/runtime/docker/packages/sandbox-docker/scripts/claude-managed-settings.json +4 -4
- package/runtime/e2b/agentbox-dockerd-start +145 -0
- package/runtime/e2b/agentbox-setup-skill.md +1 -1
- package/runtime/e2b/attach-helper.cjs +23 -2
- package/runtime/e2b/claude-managed-settings.json +4 -4
- package/runtime/e2b/ctl.cjs +255 -169
- package/runtime/e2b/scripts/build-template.sh +22 -5
- package/runtime/hetzner/agentbox-dockerd-start +13 -0
- package/runtime/hetzner/agentbox-setup-skill.md +1 -1
- package/runtime/hetzner/claude-managed-settings.json +4 -4
- package/runtime/hetzner/ctl.cjs +255 -169
- package/runtime/relay/bin.cjs +267 -63
- package/runtime/vercel/agentbox-dockerd-start +145 -0
- package/runtime/vercel/agentbox-setup-skill.md +1 -1
- package/runtime/vercel/claude-managed-settings.json +4 -4
- package/runtime/vercel/ctl.cjs +255 -169
- package/runtime/vercel/custom-system-CLAUDE.md +5 -4
- package/runtime/vercel/scripts/provision.sh +20 -5
- package/share/agentbox-setup/SKILL.md +1 -1
- package/share/host-skills/agentbox/SKILL.md +4 -4
- package/share/host-skills/agentbox-info/SKILL.md +6 -6
- package/share/host-skills/codex/agentbox.md +12 -4
- package/share/host-skills/opencode/agentbox.md +2 -2
- package/dist/_cloud-attach-3UC3IL62.js +0 -16
- package/dist/chunk-5BO6SGMI.js.map +0 -1
- package/dist/chunk-6QFPYU4Z.js.map +0 -1
- package/dist/chunk-OG4KMYOJ.js.map +0 -1
- package/dist/chunk-U7IZS2ZP.js.map +0 -1
- package/dist/chunk-XWBFWUY2.js.map +0 -1
- package/dist/dist-3UYQZOAO.js.map +0 -1
- package/dist/dist-4BHW7DCO.js.map +0 -1
- package/dist/dist-7BS2JS27.js.map +0 -1
- package/dist/dist-T7ESSBCZ.js.map +0 -1
- /package/dist/{_cloud-attach-3UC3IL62.js.map → _cloud-attach-THTN4CFZ.js.map} +0 -0
- /package/dist/{chunk-46NXCJ6Z.js.map → chunk-NXX3KQZ6.js.map} +0 -0
- /package/dist/{chunk-3JXSW6PN.js.map → chunk-P6UT5XGE.js.map} +0 -0
- /package/dist/{dist-CFSKUAS5.js.map → dist-3PLT2EK2.js.map} +0 -0
- /package/dist/{prepared-state-MQHD3M5F-OVABNV66.js.map → prepared-state-MQHD3M5F-5ZMCNY43.js.map} +0 -0
|
@@ -3114,7 +3114,7 @@ var init_chunk_YVJLTAM3 = __esm({
|
|
|
3114
3114
|
stderr: result.stderr
|
|
3115
3115
|
};
|
|
3116
3116
|
const payload = JSON.stringify(body);
|
|
3117
|
-
await new Promise((
|
|
3117
|
+
await new Promise((resolve3, reject) => {
|
|
3118
3118
|
const headers = {
|
|
3119
3119
|
"Content-Type": "application/json",
|
|
3120
3120
|
"Content-Length": Buffer.byteLength(payload).toString(),
|
|
@@ -3134,7 +3134,7 @@ var init_chunk_YVJLTAM3 = __esm({
|
|
|
3134
3134
|
},
|
|
3135
3135
|
(res) => {
|
|
3136
3136
|
res.resume();
|
|
3137
|
-
if ((res.statusCode ?? 0) >= 200 && (res.statusCode ?? 0) < 300)
|
|
3137
|
+
if ((res.statusCode ?? 0) >= 200 && (res.statusCode ?? 0) < 300) resolve3();
|
|
3138
3138
|
else reject(new Error(`bridge/action-result \u2192 ${String(res.statusCode)}`));
|
|
3139
3139
|
}
|
|
3140
3140
|
);
|
|
@@ -3239,7 +3239,7 @@ var init_chunk_YVJLTAM3 = __esm({
|
|
|
3239
3239
|
const transport = isHttps ? import_https.request : import_http.request;
|
|
3240
3240
|
const port = url.port.length > 0 ? Number.parseInt(url.port, 10) : isHttps ? 443 : 80;
|
|
3241
3241
|
const timeoutMs = this.fastModePolls > 0 ? FAST_REQUEST_TIMEOUT_MS : REQUEST_TIMEOUT_MS;
|
|
3242
|
-
return new Promise((
|
|
3242
|
+
return new Promise((resolve3, reject) => {
|
|
3243
3243
|
const headers = {
|
|
3244
3244
|
Authorization: `Bearer ${this.deps.bridgeToken}`,
|
|
3245
3245
|
Accept: "application/json"
|
|
@@ -3268,7 +3268,7 @@ var init_chunk_YVJLTAM3 = __esm({
|
|
|
3268
3268
|
}
|
|
3269
3269
|
try {
|
|
3270
3270
|
const parsed = JSON.parse(text);
|
|
3271
|
-
|
|
3271
|
+
resolve3({
|
|
3272
3272
|
actions: Array.isArray(parsed.actions) ? parsed.actions : [],
|
|
3273
3273
|
events: Array.isArray(parsed.events) ? parsed.events : [],
|
|
3274
3274
|
status: parsed.status ?? null,
|
|
@@ -10744,12 +10744,12 @@ var require_isexe = __commonJS({
|
|
|
10744
10744
|
if (typeof Promise !== "function") {
|
|
10745
10745
|
throw new TypeError("callback not provided");
|
|
10746
10746
|
}
|
|
10747
|
-
return new Promise(function(
|
|
10747
|
+
return new Promise(function(resolve3, reject) {
|
|
10748
10748
|
isexe(path6, options || {}, function(er, is) {
|
|
10749
10749
|
if (er) {
|
|
10750
10750
|
reject(er);
|
|
10751
10751
|
} else {
|
|
10752
|
-
|
|
10752
|
+
resolve3(is);
|
|
10753
10753
|
}
|
|
10754
10754
|
});
|
|
10755
10755
|
});
|
|
@@ -10816,27 +10816,27 @@ var require_which = __commonJS({
|
|
|
10816
10816
|
opt = {};
|
|
10817
10817
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
10818
10818
|
const found = [];
|
|
10819
|
-
const step = (i2) => new Promise((
|
|
10819
|
+
const step = (i2) => new Promise((resolve3, reject) => {
|
|
10820
10820
|
if (i2 === pathEnv.length)
|
|
10821
|
-
return opt.all && found.length ?
|
|
10821
|
+
return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
|
|
10822
10822
|
const ppRaw = pathEnv[i2];
|
|
10823
10823
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
10824
10824
|
const pCmd = path6.join(pathPart, cmd);
|
|
10825
10825
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
10826
|
-
|
|
10826
|
+
resolve3(subStep(p, i2, 0));
|
|
10827
10827
|
});
|
|
10828
|
-
const subStep = (p, i2, ii) => new Promise((
|
|
10828
|
+
const subStep = (p, i2, ii) => new Promise((resolve3, reject) => {
|
|
10829
10829
|
if (ii === pathExt.length)
|
|
10830
|
-
return
|
|
10830
|
+
return resolve3(step(i2 + 1));
|
|
10831
10831
|
const ext = pathExt[ii];
|
|
10832
10832
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
10833
10833
|
if (!er && is) {
|
|
10834
10834
|
if (opt.all)
|
|
10835
10835
|
found.push(p + ext);
|
|
10836
10836
|
else
|
|
10837
|
-
return
|
|
10837
|
+
return resolve3(p + ext);
|
|
10838
10838
|
}
|
|
10839
|
-
return
|
|
10839
|
+
return resolve3(subStep(p, i2, ii + 1));
|
|
10840
10840
|
});
|
|
10841
10841
|
});
|
|
10842
10842
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -11201,14 +11201,14 @@ async function tryReviveDaemon(socketPath) {
|
|
|
11201
11201
|
}
|
|
11202
11202
|
async function connectOnce(opts) {
|
|
11203
11203
|
const sock = (0, import_node_net.createConnection)(opts.socketPath);
|
|
11204
|
-
await new Promise((
|
|
11204
|
+
await new Promise((resolve3, reject) => {
|
|
11205
11205
|
const timer = setTimeout(() => {
|
|
11206
11206
|
sock.destroy();
|
|
11207
11207
|
reject(new Error(`connect ${opts.socketPath} timed out`));
|
|
11208
11208
|
}, opts.timeoutMs ?? 3e3);
|
|
11209
11209
|
sock.once("connect", () => {
|
|
11210
11210
|
clearTimeout(timer);
|
|
11211
|
-
|
|
11211
|
+
resolve3();
|
|
11212
11212
|
});
|
|
11213
11213
|
sock.once("error", (err) => {
|
|
11214
11214
|
clearTimeout(timer);
|
|
@@ -11388,14 +11388,55 @@ var claudeSessionCommand = new Command("claude-session").description("Report whe
|
|
|
11388
11388
|
}
|
|
11389
11389
|
});
|
|
11390
11390
|
|
|
11391
|
+
// src/session-pointer.ts
|
|
11392
|
+
var import_node_fs2 = require("fs");
|
|
11393
|
+
var import_node_os = require("os");
|
|
11394
|
+
var import_node_path = require("path");
|
|
11395
|
+
var SESSION_POINTER_DIR = (0, import_node_path.join)((0, import_node_os.homedir)(), ".local", "state", "agentbox");
|
|
11396
|
+
var CLAUDE_SESSION_POINTER = (0, import_node_path.join)(SESSION_POINTER_DIR, "claude-session");
|
|
11397
|
+
var CODEX_ACTIVE_MARKER = (0, import_node_path.join)(SESSION_POINTER_DIR, "codex-active");
|
|
11398
|
+
function writePointer(path6, content) {
|
|
11399
|
+
try {
|
|
11400
|
+
(0, import_node_fs2.mkdirSync)((0, import_node_path.dirname)(path6), { recursive: true });
|
|
11401
|
+
(0, import_node_fs2.writeFileSync)(path6, content, "utf8");
|
|
11402
|
+
} catch {
|
|
11403
|
+
}
|
|
11404
|
+
}
|
|
11405
|
+
function recordClaudeSessionId(id) {
|
|
11406
|
+
if (!/^[0-9a-fA-F][0-9a-fA-F-]{7,}$/.test(id)) return;
|
|
11407
|
+
writePointer(CLAUDE_SESSION_POINTER, `${id}
|
|
11408
|
+
`);
|
|
11409
|
+
}
|
|
11410
|
+
function markCodexActive() {
|
|
11411
|
+
writePointer(CODEX_ACTIVE_MARKER, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
11412
|
+
`);
|
|
11413
|
+
}
|
|
11414
|
+
function clearPointer(path6) {
|
|
11415
|
+
try {
|
|
11416
|
+
(0, import_node_fs2.rmSync)(path6, { force: true });
|
|
11417
|
+
} catch {
|
|
11418
|
+
}
|
|
11419
|
+
}
|
|
11420
|
+
function clearClaudeSessionPointer() {
|
|
11421
|
+
clearPointer(CLAUDE_SESSION_POINTER);
|
|
11422
|
+
}
|
|
11423
|
+
function clearCodexMarker() {
|
|
11424
|
+
clearPointer(CODEX_ACTIVE_MARKER);
|
|
11425
|
+
}
|
|
11426
|
+
|
|
11391
11427
|
// src/commands/claude-state.ts
|
|
11392
|
-
var claudeStateCommand = new Command("claude-state").description("Report Claude activity state to the box supervisor (used by hooks)").argument("<state>", `one of: ${CLAUDE_ACTIVITY_STATES.join(", ")}`).option("--socket <path>", "unix socket path", DEFAULT_SOCKET_PATH).option("--payload-stdin", "parse Claude Code's hook JSON from stdin (PreToolUse plan/question)").option("--clear-pending", "force-clear a sticky end-plan/question state (PostToolUse cleanup)").action(async (state, opts) => {
|
|
11428
|
+
var claudeStateCommand = new Command("claude-state").description("Report Claude activity state to the box supervisor (used by hooks)").argument("<state>", `one of: ${CLAUDE_ACTIVITY_STATES.join(", ")}`).option("--socket <path>", "unix socket path", DEFAULT_SOCKET_PATH).option("--payload-stdin", "parse Claude Code's hook JSON from stdin (PreToolUse plan/question)").option("--clear-pending", "force-clear a sticky end-plan/question state (PostToolUse cleanup)").option("--capture-session", "record the hook's session_id to the box's session pointer").option("--clear-session", "drop the box's session pointer (SessionEnd)").action(async (state, opts) => {
|
|
11393
11429
|
try {
|
|
11394
11430
|
if (!CLAUDE_ACTIVITY_STATES.includes(state)) {
|
|
11395
11431
|
process.exit(0);
|
|
11396
11432
|
}
|
|
11433
|
+
if (opts.clearSession) clearClaudeSessionPointer();
|
|
11397
11434
|
const typedState = state;
|
|
11398
|
-
const
|
|
11435
|
+
const raw = opts.payloadStdin || opts.captureSession ? await readStdinJson() : null;
|
|
11436
|
+
if (opts.captureSession && typeof raw?.session_id === "string") {
|
|
11437
|
+
recordClaudeSessionId(raw.session_id);
|
|
11438
|
+
}
|
|
11439
|
+
const extracted = opts.payloadStdin ? extractPayload(typedState, raw) : void 0;
|
|
11399
11440
|
const payload = { ...extracted ?? {} };
|
|
11400
11441
|
if (opts.clearPending) payload.clearPending = true;
|
|
11401
11442
|
const hasField = payload.plan !== void 0 || payload.question !== void 0 || payload.clearPending !== void 0;
|
|
@@ -11443,33 +11484,33 @@ function normalizeQuestion(raw) {
|
|
|
11443
11484
|
return out;
|
|
11444
11485
|
}
|
|
11445
11486
|
function readStdinJson() {
|
|
11446
|
-
return new Promise((
|
|
11487
|
+
return new Promise((resolve3) => {
|
|
11447
11488
|
if (process.stdin.isTTY) {
|
|
11448
|
-
|
|
11489
|
+
resolve3(null);
|
|
11449
11490
|
return;
|
|
11450
11491
|
}
|
|
11451
11492
|
const chunks = [];
|
|
11452
11493
|
const cap = setTimeout(() => {
|
|
11453
11494
|
process.stdin.removeAllListeners();
|
|
11454
|
-
|
|
11495
|
+
resolve3(null);
|
|
11455
11496
|
}, 1e3);
|
|
11456
11497
|
cap.unref();
|
|
11457
11498
|
process.stdin.on("data", (b) => chunks.push(b));
|
|
11458
11499
|
process.stdin.on("end", () => {
|
|
11459
11500
|
clearTimeout(cap);
|
|
11460
11501
|
if (chunks.length === 0) {
|
|
11461
|
-
|
|
11502
|
+
resolve3(null);
|
|
11462
11503
|
return;
|
|
11463
11504
|
}
|
|
11464
11505
|
try {
|
|
11465
|
-
|
|
11506
|
+
resolve3(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
11466
11507
|
} catch {
|
|
11467
|
-
|
|
11508
|
+
resolve3(null);
|
|
11468
11509
|
}
|
|
11469
11510
|
});
|
|
11470
11511
|
process.stdin.on("error", () => {
|
|
11471
11512
|
clearTimeout(cap);
|
|
11472
|
-
|
|
11513
|
+
resolve3(null);
|
|
11473
11514
|
});
|
|
11474
11515
|
});
|
|
11475
11516
|
}
|
|
@@ -11511,7 +11552,7 @@ function postRpc(method, params, opts = {}) {
|
|
|
11511
11552
|
const isHttps = url.protocol === "https:";
|
|
11512
11553
|
const transport = isHttps ? import_node_https.request : import_node_http.request;
|
|
11513
11554
|
const port = url.port.length > 0 ? Number.parseInt(url.port, 10) : isHttps ? 443 : 80;
|
|
11514
|
-
return new Promise((
|
|
11555
|
+
return new Promise((resolve3) => {
|
|
11515
11556
|
const req = transport(
|
|
11516
11557
|
{
|
|
11517
11558
|
host: url.hostname,
|
|
@@ -11539,14 +11580,14 @@ function postRpc(method, params, opts = {}) {
|
|
|
11539
11580
|
} catch {
|
|
11540
11581
|
parsed = null;
|
|
11541
11582
|
}
|
|
11542
|
-
|
|
11583
|
+
resolve3({ status: status2, parsed, raw: text, internalExitCode: null });
|
|
11543
11584
|
});
|
|
11544
11585
|
}
|
|
11545
11586
|
);
|
|
11546
11587
|
req.on("error", (err) => {
|
|
11547
11588
|
process.stderr.write(`${prefix}: ${String(err.message ?? err)}
|
|
11548
11589
|
`);
|
|
11549
|
-
|
|
11590
|
+
resolve3({ status: 0, parsed: null, raw: "", internalExitCode: 126 });
|
|
11550
11591
|
});
|
|
11551
11592
|
req.write(body);
|
|
11552
11593
|
req.end();
|
|
@@ -11580,14 +11621,14 @@ function buildCpParams(boxPath, hostPath, opts) {
|
|
|
11580
11621
|
return params;
|
|
11581
11622
|
}
|
|
11582
11623
|
var cpCommand = new Command("cp").description("Copy a file/dir between this box and the host (gated by user prompt on the host wrapper)").addCommand(
|
|
11583
|
-
new Command("toHost").description("Copy box:<boxPath> -> host:<hostPath>").argument("<boxPath>", "source path inside the container").argument("<hostPath>", "destination
|
|
11624
|
+
new Command("toHost").description("Copy box:<boxPath> -> host:<hostPath>").argument("<boxPath>", "source path inside the container").argument("<hostPath>", "destination on the host (relative resolves against the box workspace)").option("--no-recursive", "reserved; current implementation is always recursive (docker cp -a)").option("--exclude <pattern>", "exclude paths matching <pattern> (repeatable)", collectExclude, []).option("--no-default-excludes", "keep heavy dirs the host drops by default (.git, node_modules, ...)").option("-y, --yes", "copy even if the source is over the host size limit").action(async (boxPath, hostPath, opts) => {
|
|
11584
11625
|
const code = await postRpcAndExit("cp.toHost", buildCpParams(boxPath, hostPath, opts), {
|
|
11585
11626
|
errorPrefix: "agentbox-ctl cp"
|
|
11586
11627
|
});
|
|
11587
11628
|
process.exit(code);
|
|
11588
11629
|
})
|
|
11589
11630
|
).addCommand(
|
|
11590
|
-
new Command("fromHost").description("Copy host:<hostPath> -> box:<boxPath>").argument("<hostPath>", "source
|
|
11631
|
+
new Command("fromHost").description("Copy host:<hostPath> -> box:<boxPath>").argument("<hostPath>", "source on the host (relative resolves against the box workspace)").argument("<boxPath>", "destination path inside the container").option("--no-recursive", "reserved; current implementation is always recursive (docker cp -a)").option("--exclude <pattern>", "exclude paths matching <pattern> (repeatable)", collectExclude, []).option("--no-default-excludes", "keep heavy dirs the host drops by default (.git, node_modules, ...)").option("-y, --yes", "copy even if the source is over the host size limit").action(async (hostPath, boxPath, opts) => {
|
|
11591
11632
|
const code = await postRpcAndExit("cp.fromHost", buildCpParams(boxPath, hostPath, opts), {
|
|
11592
11633
|
errorPrefix: "agentbox-ctl cp"
|
|
11593
11634
|
});
|
|
@@ -11669,6 +11710,7 @@ var BUILT_IN_DEFAULTS = {
|
|
|
11669
11710
|
vercelVcpus: 2,
|
|
11670
11711
|
vercelTimeoutMs: 27e5,
|
|
11671
11712
|
vercelNetworkPolicy: "",
|
|
11713
|
+
e2bTimeoutMs: 27e5,
|
|
11672
11714
|
cpMaxBytes: 100 * 1024 * 1024
|
|
11673
11715
|
},
|
|
11674
11716
|
checkpoint: {
|
|
@@ -11952,6 +11994,11 @@ var KEY_REGISTRY = [
|
|
|
11952
11994
|
type: "int",
|
|
11953
11995
|
description: "Max session length (ms) for new --provider vercel boxes before the VM auto-snapshots; persistent mode auto-resumes on the next call. Default 2700000 (45 min, the Hobby ceiling). Vercel-only."
|
|
11954
11996
|
},
|
|
11997
|
+
{
|
|
11998
|
+
key: "box.e2bTimeoutMs",
|
|
11999
|
+
type: "int",
|
|
12000
|
+
description: "Session timeout (ms) a new --provider e2b box is created with, before E2B auto-pauses it on inactivity. The host keepalive loop pushes this forward while the agent is working. Default 2700000 (45 min); the Hobby tier caps total session at ~1 h regardless. E2B-only."
|
|
12001
|
+
},
|
|
11955
12002
|
{
|
|
11956
12003
|
key: "box.cpMaxBytes",
|
|
11957
12004
|
type: "int",
|
|
@@ -13306,13 +13353,13 @@ var handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
|
13306
13353
|
};
|
|
13307
13354
|
|
|
13308
13355
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/options.js
|
|
13309
|
-
var
|
|
13356
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
13310
13357
|
var import_node_process8 = __toESM(require("process"), 1);
|
|
13311
13358
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
13312
13359
|
|
|
13313
13360
|
// ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
13314
13361
|
var import_node_process5 = __toESM(require("process"), 1);
|
|
13315
|
-
var
|
|
13362
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
13316
13363
|
|
|
13317
13364
|
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
13318
13365
|
function pathKey(options = {}) {
|
|
@@ -13329,7 +13376,7 @@ function pathKey(options = {}) {
|
|
|
13329
13376
|
// ../../node_modules/.pnpm/unicorn-magic@0.3.0/node_modules/unicorn-magic/node.js
|
|
13330
13377
|
var import_node_util4 = require("util");
|
|
13331
13378
|
var import_node_child_process3 = require("child_process");
|
|
13332
|
-
var
|
|
13379
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
13333
13380
|
var import_node_url2 = require("url");
|
|
13334
13381
|
var execFileOriginal = (0, import_node_util4.promisify)(import_node_child_process3.execFile);
|
|
13335
13382
|
function toPath(urlOrPath) {
|
|
@@ -13338,12 +13385,12 @@ function toPath(urlOrPath) {
|
|
|
13338
13385
|
function traversePathUp(startPath) {
|
|
13339
13386
|
return {
|
|
13340
13387
|
*[Symbol.iterator]() {
|
|
13341
|
-
let currentPath =
|
|
13388
|
+
let currentPath = import_node_path2.default.resolve(toPath(startPath));
|
|
13342
13389
|
let previousPath;
|
|
13343
13390
|
while (previousPath !== currentPath) {
|
|
13344
13391
|
yield currentPath;
|
|
13345
13392
|
previousPath = currentPath;
|
|
13346
|
-
currentPath =
|
|
13393
|
+
currentPath = import_node_path2.default.resolve(currentPath, "..");
|
|
13347
13394
|
}
|
|
13348
13395
|
}
|
|
13349
13396
|
};
|
|
@@ -13358,27 +13405,27 @@ var npmRunPath = ({
|
|
|
13358
13405
|
execPath: execPath2 = import_node_process5.default.execPath,
|
|
13359
13406
|
addExecPath = true
|
|
13360
13407
|
} = {}) => {
|
|
13361
|
-
const cwdPath =
|
|
13408
|
+
const cwdPath = import_node_path3.default.resolve(toPath(cwd));
|
|
13362
13409
|
const result = [];
|
|
13363
|
-
const pathParts = pathOption.split(
|
|
13410
|
+
const pathParts = pathOption.split(import_node_path3.default.delimiter);
|
|
13364
13411
|
if (preferLocal) {
|
|
13365
13412
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
13366
13413
|
}
|
|
13367
13414
|
if (addExecPath) {
|
|
13368
13415
|
applyExecPath(result, pathParts, execPath2, cwdPath);
|
|
13369
13416
|
}
|
|
13370
|
-
return pathOption === "" || pathOption ===
|
|
13417
|
+
return pathOption === "" || pathOption === import_node_path3.default.delimiter ? `${result.join(import_node_path3.default.delimiter)}${pathOption}` : [...result, pathOption].join(import_node_path3.default.delimiter);
|
|
13371
13418
|
};
|
|
13372
13419
|
var applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
13373
13420
|
for (const directory of traversePathUp(cwdPath)) {
|
|
13374
|
-
const pathPart =
|
|
13421
|
+
const pathPart = import_node_path3.default.join(directory, "node_modules/.bin");
|
|
13375
13422
|
if (!pathParts.includes(pathPart)) {
|
|
13376
13423
|
result.push(pathPart);
|
|
13377
13424
|
}
|
|
13378
13425
|
}
|
|
13379
13426
|
};
|
|
13380
13427
|
var applyExecPath = (result, pathParts, execPath2, cwdPath) => {
|
|
13381
|
-
const pathPart =
|
|
13428
|
+
const pathPart = import_node_path3.default.resolve(cwdPath, toPath(execPath2), "..");
|
|
13382
13429
|
if (!pathParts.includes(pathPart)) {
|
|
13383
13430
|
result.push(pathPart);
|
|
13384
13431
|
}
|
|
@@ -13427,10 +13474,10 @@ var ExecaSyncError = class extends Error {
|
|
|
13427
13474
|
setErrorName(ExecaSyncError, ExecaSyncError.name);
|
|
13428
13475
|
|
|
13429
13476
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/signal.js
|
|
13430
|
-
var
|
|
13477
|
+
var import_node_os4 = require("os");
|
|
13431
13478
|
|
|
13432
13479
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js
|
|
13433
|
-
var
|
|
13480
|
+
var import_node_os3 = require("os");
|
|
13434
13481
|
|
|
13435
13482
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/realtime.js
|
|
13436
13483
|
var getRealtimeSignals = () => {
|
|
@@ -13448,7 +13495,7 @@ var SIGRTMIN = 34;
|
|
|
13448
13495
|
var SIGRTMAX = 64;
|
|
13449
13496
|
|
|
13450
13497
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js
|
|
13451
|
-
var
|
|
13498
|
+
var import_node_os2 = require("os");
|
|
13452
13499
|
|
|
13453
13500
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/core.js
|
|
13454
13501
|
var SIGNALS = [
|
|
@@ -13739,7 +13786,7 @@ var normalizeSignal = ({
|
|
|
13739
13786
|
}) => {
|
|
13740
13787
|
const {
|
|
13741
13788
|
signals: { [name]: constantSignal }
|
|
13742
|
-
} =
|
|
13789
|
+
} = import_node_os2.constants;
|
|
13743
13790
|
const supported = constantSignal !== void 0;
|
|
13744
13791
|
const number = supported ? constantSignal : defaultNumber;
|
|
13745
13792
|
return { name, number, description, supported, action, forced, standard };
|
|
@@ -13788,7 +13835,7 @@ var getSignalByNumber = (number, signals2) => {
|
|
|
13788
13835
|
};
|
|
13789
13836
|
};
|
|
13790
13837
|
var findSignalByNumber = (number, signals2) => {
|
|
13791
|
-
const signal = signals2.find(({ name }) =>
|
|
13838
|
+
const signal = signals2.find(({ name }) => import_node_os3.constants.signals[name] === number);
|
|
13792
13839
|
if (signal !== void 0) {
|
|
13793
13840
|
return signal;
|
|
13794
13841
|
}
|
|
@@ -13822,13 +13869,13 @@ var normalizeSignalInteger = (signalInteger, optionName) => {
|
|
|
13822
13869
|
throw new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.
|
|
13823
13870
|
${getAvailableSignals()}`);
|
|
13824
13871
|
};
|
|
13825
|
-
var getSignalsIntegerToName = () => new Map(Object.entries(
|
|
13872
|
+
var getSignalsIntegerToName = () => new Map(Object.entries(import_node_os4.constants.signals).reverse().map(([signalName, signalInteger]) => [signalInteger, signalName]));
|
|
13826
13873
|
var signalsIntegerToName = getSignalsIntegerToName();
|
|
13827
13874
|
var normalizeSignalName = (signalName, optionName) => {
|
|
13828
|
-
if (signalName in
|
|
13875
|
+
if (signalName in import_node_os4.constants.signals) {
|
|
13829
13876
|
return signalName;
|
|
13830
13877
|
}
|
|
13831
|
-
if (signalName.toUpperCase() in
|
|
13878
|
+
if (signalName.toUpperCase() in import_node_os4.constants.signals) {
|
|
13832
13879
|
throw new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);
|
|
13833
13880
|
}
|
|
13834
13881
|
throw new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.
|
|
@@ -13836,8 +13883,8 @@ ${getAvailableSignals()}`);
|
|
|
13836
13883
|
};
|
|
13837
13884
|
var getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.
|
|
13838
13885
|
Available signal numbers: ${getAvailableSignalIntegers()}.`;
|
|
13839
|
-
var getAvailableSignalNames = () => Object.keys(
|
|
13840
|
-
var getAvailableSignalIntegers = () => [...new Set(Object.values(
|
|
13886
|
+
var getAvailableSignalNames = () => Object.keys(import_node_os4.constants.signals).sort().map((signalName) => `'${signalName}'`).join(", ");
|
|
13887
|
+
var getAvailableSignalIntegers = () => [...new Set(Object.values(import_node_os4.constants.signals).sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))].join(", ");
|
|
13841
13888
|
var getSignalDescription = (signal) => signalsByName[signal].description;
|
|
13842
13889
|
|
|
13843
13890
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/kill.js
|
|
@@ -14010,8 +14057,8 @@ var disconnect = (anyProcess) => {
|
|
|
14010
14057
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/deferred.js
|
|
14011
14058
|
var createDeferred = () => {
|
|
14012
14059
|
const methods = {};
|
|
14013
|
-
const promise = new Promise((
|
|
14014
|
-
Object.assign(methods, { resolve:
|
|
14060
|
+
const promise = new Promise((resolve3, reject) => {
|
|
14061
|
+
Object.assign(methods, { resolve: resolve3, reject });
|
|
14015
14062
|
});
|
|
14016
14063
|
return Object.assign(promise, methods);
|
|
14017
14064
|
};
|
|
@@ -14533,7 +14580,7 @@ var killAfterTimeout = async (subprocess, timeout, context, { signal }) => {
|
|
|
14533
14580
|
|
|
14534
14581
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/node.js
|
|
14535
14582
|
var import_node_process6 = require("process");
|
|
14536
|
-
var
|
|
14583
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
14537
14584
|
var mapNode = ({ options }) => {
|
|
14538
14585
|
if (options.node === false) {
|
|
14539
14586
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -14552,7 +14599,7 @@ var handleNodeOption = (file, commandArguments, {
|
|
|
14552
14599
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
14553
14600
|
}
|
|
14554
14601
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
14555
|
-
const resolvedNodePath =
|
|
14602
|
+
const resolvedNodePath = import_node_path4.default.resolve(cwd, normalizedNodePath);
|
|
14556
14603
|
const newOptions = {
|
|
14557
14604
|
...options,
|
|
14558
14605
|
nodePath: resolvedNodePath,
|
|
@@ -14562,7 +14609,7 @@ var handleNodeOption = (file, commandArguments, {
|
|
|
14562
14609
|
if (!shouldHandleNode) {
|
|
14563
14610
|
return [file, commandArguments, newOptions];
|
|
14564
14611
|
}
|
|
14565
|
-
if (
|
|
14612
|
+
if (import_node_path4.default.basename(file, ".exe") === "node") {
|
|
14566
14613
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
14567
14614
|
}
|
|
14568
14615
|
return [
|
|
@@ -14651,12 +14698,12 @@ var ENCODING_ALIASES = {
|
|
|
14651
14698
|
var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encoding}"` : String(encoding);
|
|
14652
14699
|
|
|
14653
14700
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/cwd.js
|
|
14654
|
-
var
|
|
14655
|
-
var
|
|
14701
|
+
var import_node_fs3 = require("fs");
|
|
14702
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
14656
14703
|
var import_node_process7 = __toESM(require("process"), 1);
|
|
14657
14704
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
14658
14705
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
14659
|
-
return
|
|
14706
|
+
return import_node_path5.default.resolve(cwdString);
|
|
14660
14707
|
};
|
|
14661
14708
|
var getDefaultCwd = () => {
|
|
14662
14709
|
try {
|
|
@@ -14673,7 +14720,7 @@ var fixCwdError = (originalMessage, cwd) => {
|
|
|
14673
14720
|
}
|
|
14674
14721
|
let cwdStat;
|
|
14675
14722
|
try {
|
|
14676
|
-
cwdStat = (0,
|
|
14723
|
+
cwdStat = (0, import_node_fs3.statSync)(cwd);
|
|
14677
14724
|
} catch (error) {
|
|
14678
14725
|
return `The "cwd" option is invalid: ${cwd}.
|
|
14679
14726
|
${error.message}
|
|
@@ -14703,7 +14750,7 @@ var normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
14703
14750
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
14704
14751
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
14705
14752
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
14706
|
-
if (import_node_process8.default.platform === "win32" &&
|
|
14753
|
+
if (import_node_process8.default.platform === "win32" && import_node_path6.default.basename(file, ".exe") === "cmd") {
|
|
14707
14754
|
commandArguments.unshift("/q");
|
|
14708
14755
|
}
|
|
14709
14756
|
return { file, commandArguments, options };
|
|
@@ -15678,7 +15725,7 @@ var handleResult = (result, verboseInfo, { reject }) => {
|
|
|
15678
15725
|
};
|
|
15679
15726
|
|
|
15680
15727
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/handle-sync.js
|
|
15681
|
-
var
|
|
15728
|
+
var import_node_fs5 = require("fs");
|
|
15682
15729
|
|
|
15683
15730
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/type.js
|
|
15684
15731
|
var getStdioItemType = (value, optionName) => {
|
|
@@ -16008,7 +16055,7 @@ var normalizeStdioSync = (stdioArray, buffer, verboseInfo) => stdioArray.map((st
|
|
|
16008
16055
|
var isOutputPipeOnly = (stdioOption) => stdioOption === "pipe" || Array.isArray(stdioOption) && stdioOption.every((item) => item === "pipe");
|
|
16009
16056
|
|
|
16010
16057
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/native.js
|
|
16011
|
-
var
|
|
16058
|
+
var import_node_fs4 = require("fs");
|
|
16012
16059
|
var import_node_tty2 = __toESM(require("tty"), 1);
|
|
16013
16060
|
var handleNativeStream = ({ stdioItem, stdioItem: { type }, isStdioArray, fdNumber, direction, isSync }) => {
|
|
16014
16061
|
if (!isStdioArray || type !== "native") {
|
|
@@ -16042,7 +16089,7 @@ var getTargetFd = ({ value, optionName, fdNumber, direction }) => {
|
|
|
16042
16089
|
if (import_node_tty2.default.isatty(targetFdNumber)) {
|
|
16043
16090
|
throw new TypeError(`The \`${optionName}: ${serializeOptionValue(value)}\` option is invalid: it cannot be a TTY with synchronous methods.`);
|
|
16044
16091
|
}
|
|
16045
|
-
return { type: "uint8Array", value: bufferToUint8Array((0,
|
|
16092
|
+
return { type: "uint8Array", value: bufferToUint8Array((0, import_node_fs4.readFileSync)(targetFdNumber)), optionName };
|
|
16046
16093
|
};
|
|
16047
16094
|
var getTargetFdNumber = (value, fdNumber) => {
|
|
16048
16095
|
if (value === "inherit") {
|
|
@@ -16375,8 +16422,8 @@ var addProperties = {
|
|
|
16375
16422
|
var addPropertiesSync = {
|
|
16376
16423
|
input: {
|
|
16377
16424
|
...addProperties,
|
|
16378
|
-
fileUrl: ({ value }) => ({ contents: [bufferToUint8Array((0,
|
|
16379
|
-
filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array((0,
|
|
16425
|
+
fileUrl: ({ value }) => ({ contents: [bufferToUint8Array((0, import_node_fs5.readFileSync)(value))] }),
|
|
16426
|
+
filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array((0, import_node_fs5.readFileSync)(file))] }),
|
|
16380
16427
|
fileNumber: forbiddenIfSync,
|
|
16381
16428
|
iterable: ({ value }) => ({ contents: [...value] }),
|
|
16382
16429
|
string: ({ value }) => ({ contents: [value] }),
|
|
@@ -16722,7 +16769,7 @@ var validateSerializable = (newContents) => {
|
|
|
16722
16769
|
};
|
|
16723
16770
|
|
|
16724
16771
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/io/output-sync.js
|
|
16725
|
-
var
|
|
16772
|
+
var import_node_fs6 = require("fs");
|
|
16726
16773
|
|
|
16727
16774
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/verbose/output.js
|
|
16728
16775
|
var shouldLogOutput = ({ stdioItems, encoding, verboseInfo, fdNumber }) => fdNumber !== "all" && isFullVerbose(verboseInfo, fdNumber) && !BINARY_ENCODINGS.has(encoding) && fdUsesVerbose(fdNumber) && (stdioItems.some(({ type, value }) => type === "native" && PIPED_STDIO_VALUES.has(value)) || stdioItems.every(({ type }) => TRANSFORM_TYPES.has(type)));
|
|
@@ -16846,10 +16893,10 @@ var writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
|
16846
16893
|
for (const { path: path6, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
|
|
16847
16894
|
const pathString = typeof path6 === "string" ? path6 : path6.toString();
|
|
16848
16895
|
if (append || outputFiles.has(pathString)) {
|
|
16849
|
-
(0,
|
|
16896
|
+
(0, import_node_fs6.appendFileSync)(path6, serializedResult);
|
|
16850
16897
|
} else {
|
|
16851
16898
|
outputFiles.add(pathString);
|
|
16852
|
-
(0,
|
|
16899
|
+
(0, import_node_fs6.writeFileSync)(path6, serializedResult);
|
|
16853
16900
|
}
|
|
16854
16901
|
}
|
|
16855
16902
|
};
|
|
@@ -17293,7 +17340,7 @@ var duplex = () => new import_node_stream2.Duplex({ read() {
|
|
|
17293
17340
|
var handleDummyPromise = async (error, verboseInfo, options) => handleResult(error, verboseInfo, options);
|
|
17294
17341
|
|
|
17295
17342
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/handle-async.js
|
|
17296
|
-
var
|
|
17343
|
+
var import_node_fs7 = require("fs");
|
|
17297
17344
|
var import_node_buffer3 = require("buffer");
|
|
17298
17345
|
var import_node_stream3 = require("stream");
|
|
17299
17346
|
var handleStdioAsync = (options, verboseInfo) => handleStdio(addPropertiesAsync, options, verboseInfo, false);
|
|
@@ -17317,8 +17364,8 @@ var addProperties2 = {
|
|
|
17317
17364
|
var addPropertiesAsync = {
|
|
17318
17365
|
input: {
|
|
17319
17366
|
...addProperties2,
|
|
17320
|
-
fileUrl: ({ value }) => ({ stream: (0,
|
|
17321
|
-
filePath: ({ value: { file } }) => ({ stream: (0,
|
|
17367
|
+
fileUrl: ({ value }) => ({ stream: (0, import_node_fs7.createReadStream)(value) }),
|
|
17368
|
+
filePath: ({ value: { file } }) => ({ stream: (0, import_node_fs7.createReadStream)(file) }),
|
|
17322
17369
|
webStream: ({ value }) => ({ stream: import_node_stream3.Readable.fromWeb(value) }),
|
|
17323
17370
|
iterable: ({ value }) => ({ stream: import_node_stream3.Readable.from(value) }),
|
|
17324
17371
|
asyncIterable: ({ value }) => ({ stream: import_node_stream3.Readable.from(value) }),
|
|
@@ -17327,8 +17374,8 @@ var addPropertiesAsync = {
|
|
|
17327
17374
|
},
|
|
17328
17375
|
output: {
|
|
17329
17376
|
...addProperties2,
|
|
17330
|
-
fileUrl: ({ value }) => ({ stream: (0,
|
|
17331
|
-
filePath: ({ value: { file, append } }) => ({ stream: (0,
|
|
17377
|
+
fileUrl: ({ value }) => ({ stream: (0, import_node_fs7.createWriteStream)(value) }),
|
|
17378
|
+
filePath: ({ value: { file, append } }) => ({ stream: (0, import_node_fs7.createWriteStream)(file, append ? { flags: "a" } : {}) }),
|
|
17332
17379
|
webStream: ({ value }) => ({ stream: import_node_stream3.Writable.fromWeb(value) }),
|
|
17333
17380
|
iterable: forbiddenIfAsync,
|
|
17334
17381
|
asyncIterable: forbiddenIfAsync,
|
|
@@ -18648,11 +18695,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
18648
18695
|
const promises = weakMap.get(stream);
|
|
18649
18696
|
const promise = createDeferred();
|
|
18650
18697
|
promises.push(promise);
|
|
18651
|
-
const
|
|
18652
|
-
return { resolve:
|
|
18698
|
+
const resolve3 = promise.resolve.bind(promise);
|
|
18699
|
+
return { resolve: resolve3, promises };
|
|
18653
18700
|
};
|
|
18654
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
18655
|
-
|
|
18701
|
+
var waitForConcurrentStreams = async ({ resolve: resolve3, promises }, subprocess) => {
|
|
18702
|
+
resolve3();
|
|
18656
18703
|
const [isSubprocessExit] = await Promise.race([
|
|
18657
18704
|
Promise.allSettled([true, subprocess]),
|
|
18658
18705
|
Promise.all([false, ...promises])
|
|
@@ -19254,8 +19301,11 @@ var PLACEHOLDER_KEYS = [
|
|
|
19254
19301
|
"AGENTBOX_BOX_KIND",
|
|
19255
19302
|
"AGENTBOX_HOST_WORKSPACE",
|
|
19256
19303
|
"AGENTBOX_PROJECT_ROOT",
|
|
19257
|
-
// Convenience: the
|
|
19258
|
-
//
|
|
19304
|
+
// Convenience: the host this box is reachable at. Derived from
|
|
19305
|
+
// AGENTBOX_BOX_NAME as `<box-name>.localhost` when not set explicitly (the
|
|
19306
|
+
// portless host for docker/hetzner). Public-URL cloud providers
|
|
19307
|
+
// (vercel/daytona/e2b) set it explicitly at boot to the real preview host
|
|
19308
|
+
// (e.g. `<sub>.vercel.run`), which then wins over the derived fallback.
|
|
19259
19309
|
"AGENTBOX_BOX_HOST"
|
|
19260
19310
|
];
|
|
19261
19311
|
var PLACEHOLDER_SET = new Set(PLACEHOLDER_KEYS);
|
|
@@ -19765,8 +19815,8 @@ var HostActionQueue = class {
|
|
|
19765
19815
|
params,
|
|
19766
19816
|
createdAt: new Date(this.now()).toISOString()
|
|
19767
19817
|
};
|
|
19768
|
-
return new Promise((
|
|
19769
|
-
this.map.set(id, { action, resolve:
|
|
19818
|
+
return new Promise((resolve22) => {
|
|
19819
|
+
this.map.set(id, { action, resolve: resolve22, delivered: false });
|
|
19770
19820
|
});
|
|
19771
19821
|
}
|
|
19772
19822
|
/**
|
|
@@ -19899,11 +19949,11 @@ var PendingPrompts = class {
|
|
|
19899
19949
|
return true;
|
|
19900
19950
|
}
|
|
19901
19951
|
add(boxId, ev) {
|
|
19902
|
-
return new Promise((
|
|
19952
|
+
return new Promise((resolve22) => {
|
|
19903
19953
|
this.entries.set(ev.id, {
|
|
19904
19954
|
ev,
|
|
19905
19955
|
boxId,
|
|
19906
|
-
resolve:
|
|
19956
|
+
resolve: resolve22,
|
|
19907
19957
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
19908
19958
|
});
|
|
19909
19959
|
});
|
|
@@ -20210,7 +20260,7 @@ function runHostBinary(connector, argv, cwd, timeoutMs) {
|
|
|
20210
20260
|
`
|
|
20211
20261
|
});
|
|
20212
20262
|
}
|
|
20213
|
-
return new Promise((
|
|
20263
|
+
return new Promise((resolve22) => {
|
|
20214
20264
|
const child = (0, import_child_process.spawn)(connector.hostBin, [...argv], {
|
|
20215
20265
|
cwd,
|
|
20216
20266
|
env,
|
|
@@ -20222,7 +20272,7 @@ function runHostBinary(connector, argv, cwd, timeoutMs) {
|
|
|
20222
20272
|
const finish = (exitCode) => {
|
|
20223
20273
|
if (settled) return;
|
|
20224
20274
|
settled = true;
|
|
20225
|
-
|
|
20275
|
+
resolve22({ exitCode, stdout, stderr });
|
|
20226
20276
|
};
|
|
20227
20277
|
const timer = setTimeout(() => {
|
|
20228
20278
|
child.kill("SIGTERM");
|
|
@@ -20427,7 +20477,7 @@ async function probeGh() {
|
|
|
20427
20477
|
return null;
|
|
20428
20478
|
}
|
|
20429
20479
|
function runHostGh(args, cwd, timeoutMs = GH_RPC_TIMEOUT_MS) {
|
|
20430
|
-
return new Promise((
|
|
20480
|
+
return new Promise((resolve22) => {
|
|
20431
20481
|
const child = (0, import_child_process2.spawn)("gh", args, {
|
|
20432
20482
|
cwd,
|
|
20433
20483
|
env: process.env,
|
|
@@ -20439,7 +20489,7 @@ function runHostGh(args, cwd, timeoutMs = GH_RPC_TIMEOUT_MS) {
|
|
|
20439
20489
|
const finish = (exitCode) => {
|
|
20440
20490
|
if (settled) return;
|
|
20441
20491
|
settled = true;
|
|
20442
|
-
|
|
20492
|
+
resolve22({ exitCode, stdout, stderr });
|
|
20443
20493
|
};
|
|
20444
20494
|
const timer = setTimeout(() => {
|
|
20445
20495
|
child.kill("SIGTERM");
|
|
@@ -20503,7 +20553,7 @@ async function checkoutGuards(hostMainRepo, registeredBranches) {
|
|
|
20503
20553
|
return null;
|
|
20504
20554
|
}
|
|
20505
20555
|
function runGitProbe(args) {
|
|
20506
|
-
return new Promise((
|
|
20556
|
+
return new Promise((resolve22) => {
|
|
20507
20557
|
const child = (0, import_child_process2.spawn)("git", args, { env: process.env, stdio: ["ignore", "pipe", "pipe"] });
|
|
20508
20558
|
let stdout = "";
|
|
20509
20559
|
let stderr = "";
|
|
@@ -20514,10 +20564,10 @@ function runGitProbe(args) {
|
|
|
20514
20564
|
stderr += c3.toString("utf8");
|
|
20515
20565
|
});
|
|
20516
20566
|
child.on("error", (err) => {
|
|
20517
|
-
|
|
20567
|
+
resolve22({ exitCode: 127, stdout, stderr: stderr + String(err.message ?? err) });
|
|
20518
20568
|
});
|
|
20519
20569
|
child.on("close", (code) => {
|
|
20520
|
-
|
|
20570
|
+
resolve22({ exitCode: code ?? -1, stdout, stderr });
|
|
20521
20571
|
});
|
|
20522
20572
|
});
|
|
20523
20573
|
}
|
|
@@ -20944,6 +20994,17 @@ async function lookupCloudBox(boxId) {
|
|
|
20944
20994
|
}
|
|
20945
20995
|
return { workspacePath: hit.box.workspacePath, cloudSandboxId: sid };
|
|
20946
20996
|
}
|
|
20997
|
+
async function boxWorkspacePath(boxId) {
|
|
20998
|
+
const state = await readState();
|
|
20999
|
+
const hit = findBox(boxId, state);
|
|
21000
|
+
return hit.kind === "ok" ? hit.box.workspacePath : void 0;
|
|
21001
|
+
}
|
|
21002
|
+
function resolveHostPath(workspacePath, hostPath) {
|
|
21003
|
+
if ((0, import_path5.isAbsolute)(hostPath)) return hostPath;
|
|
21004
|
+
if (hostPath === "~") return (0, import_os4.homedir)();
|
|
21005
|
+
if (hostPath.startsWith("~/")) return (0, import_path5.join)((0, import_os4.homedir)(), hostPath.slice(2));
|
|
21006
|
+
return workspacePath ? (0, import_path5.resolve)(workspacePath, hostPath) : (0, import_path5.resolve)(hostPath);
|
|
21007
|
+
}
|
|
20947
21008
|
var cloudCpModule;
|
|
20948
21009
|
async function loadCloudCp() {
|
|
20949
21010
|
if (cloudCpModule) return cloudCpModule;
|
|
@@ -20972,27 +21033,28 @@ async function runCpRpc(action, deps) {
|
|
|
20972
21033
|
};
|
|
20973
21034
|
}
|
|
20974
21035
|
const direction = action.method === "cp.toHost" ? "box -> host" : "host -> box";
|
|
21036
|
+
const lookup = await lookupCloudBox(deps.boxId);
|
|
21037
|
+
const hostAbs = resolveHostPath(lookup.workspacePath, params.hostPath);
|
|
20975
21038
|
if (deps.prompts && deps.subscribers) {
|
|
20976
21039
|
const verdict = await askPrompt(deps.prompts, deps.subscribers, deps.boxId, {
|
|
20977
21040
|
kind: "confirm",
|
|
20978
21041
|
message: `Allow cp (${direction}) on ${deps.boxName ?? deps.boxId}?`,
|
|
20979
|
-
detail: action.method === "cp.toHost" ? `${params.boxPath} -> ${
|
|
21042
|
+
detail: action.method === "cp.toHost" ? `${params.boxPath} -> ${hostAbs}` : `${hostAbs} -> ${params.boxPath}`,
|
|
20980
21043
|
defaultAnswer: "n",
|
|
20981
21044
|
context: {
|
|
20982
21045
|
command: action.method,
|
|
20983
|
-
argv: [params.boxPath,
|
|
21046
|
+
argv: [params.boxPath, hostAbs]
|
|
20984
21047
|
}
|
|
20985
21048
|
});
|
|
20986
21049
|
if (verdict.answer !== "y") {
|
|
20987
21050
|
return { exitCode: 10, stdout: "", stderr: "denied by user\n" };
|
|
20988
21051
|
}
|
|
20989
21052
|
}
|
|
20990
|
-
const lookup = await lookupCloudBox(deps.boxId);
|
|
20991
21053
|
const backend = await resolveCloudBackend(deps.backendName);
|
|
20992
21054
|
const handle = { sandboxId: lookup.cloudSandboxId };
|
|
20993
21055
|
const cp = await loadCloudCp();
|
|
20994
21056
|
try {
|
|
20995
|
-
const result = action.method === "cp.toHost" ? await cp.downloadFromCloudBox(backend, handle, params.boxPath,
|
|
21057
|
+
const result = action.method === "cp.toHost" ? await cp.downloadFromCloudBox(backend, handle, params.boxPath, hostAbs) : await cp.uploadToCloudBox(backend, handle, hostAbs, params.boxPath);
|
|
20996
21058
|
return { exitCode: 0, stdout: `${result.finalPath}
|
|
20997
21059
|
`, stderr: "" };
|
|
20998
21060
|
} catch (err) {
|
|
@@ -21068,7 +21130,7 @@ async function runDownloadRpc(action, deps) {
|
|
|
21068
21130
|
const backend = await resolveCloudBackend(deps.backendName);
|
|
21069
21131
|
const handle = { sandboxId: lookup.cloudSandboxId };
|
|
21070
21132
|
const cp = await loadCloudCp();
|
|
21071
|
-
const hostDst = typeof params.hostPath === "string" && params.hostPath.length > 0 ? params.hostPath : lookup.workspacePath;
|
|
21133
|
+
const hostDst = typeof params.hostPath === "string" && params.hostPath.length > 0 ? resolveHostPath(lookup.workspacePath, params.hostPath) : lookup.workspacePath;
|
|
21072
21134
|
try {
|
|
21073
21135
|
const result = await cp.pullCloudDirContents(backend, handle, "/workspace", hostDst);
|
|
21074
21136
|
return { exitCode: 0, stdout: `${result.finalPath}
|
|
@@ -21302,7 +21364,7 @@ function send(res, status2, body, contentType = "application/json") {
|
|
|
21302
21364
|
}
|
|
21303
21365
|
}
|
|
21304
21366
|
async function readJsonBody(req) {
|
|
21305
|
-
return new Promise((
|
|
21367
|
+
return new Promise((resolve22, reject) => {
|
|
21306
21368
|
let total = 0;
|
|
21307
21369
|
const chunks = [];
|
|
21308
21370
|
req.on("data", (chunk) => {
|
|
@@ -21317,11 +21379,11 @@ async function readJsonBody(req) {
|
|
|
21317
21379
|
req.on("end", () => {
|
|
21318
21380
|
const text = Buffer.concat(chunks).toString("utf8");
|
|
21319
21381
|
if (text.length === 0) {
|
|
21320
|
-
|
|
21382
|
+
resolve22({});
|
|
21321
21383
|
return;
|
|
21322
21384
|
}
|
|
21323
21385
|
try {
|
|
21324
|
-
|
|
21386
|
+
resolve22(JSON.parse(text));
|
|
21325
21387
|
} catch (err) {
|
|
21326
21388
|
reject(err instanceof Error ? err : new Error(String(err)));
|
|
21327
21389
|
}
|
|
@@ -21555,7 +21617,9 @@ function createRelayServer(opts) {
|
|
|
21555
21617
|
return;
|
|
21556
21618
|
}
|
|
21557
21619
|
const direction = body.method === "cp.toHost" ? "box -> host" : "host -> box";
|
|
21558
|
-
const
|
|
21620
|
+
const workspacePath = await boxWorkspacePath(reg.boxId);
|
|
21621
|
+
const hostAbs = resolveHostPath(workspacePath, params.hostPath);
|
|
21622
|
+
const pathDetail = body.method === "cp.toHost" ? `${params.boxPath} -> ${hostAbs}` : `${hostAbs} -> ${params.boxPath}`;
|
|
21559
21623
|
const detailParts = [pathDetail];
|
|
21560
21624
|
if (params.exclude && params.exclude.length > 0) {
|
|
21561
21625
|
detailParts.push(`exclude: ${params.exclude.join(", ")}`);
|
|
@@ -21569,14 +21633,17 @@ function createRelayServer(opts) {
|
|
|
21569
21633
|
defaultAnswer: "n",
|
|
21570
21634
|
context: {
|
|
21571
21635
|
command: body.method,
|
|
21572
|
-
argv: [params.boxPath,
|
|
21636
|
+
argv: [params.boxPath, hostAbs]
|
|
21573
21637
|
}
|
|
21574
21638
|
});
|
|
21575
21639
|
if (verdict.answer !== "y") {
|
|
21576
21640
|
send(res, 500, { exitCode: 10, stdout: "", stderr: "denied by user\n" });
|
|
21577
21641
|
return;
|
|
21578
21642
|
}
|
|
21579
|
-
const result = await handleCpRpc(reg, body.method, params
|
|
21643
|
+
const result = await handleCpRpc(reg, body.method, params, {
|
|
21644
|
+
hostPath: hostAbs,
|
|
21645
|
+
cwd: workspacePath
|
|
21646
|
+
});
|
|
21580
21647
|
const status2 = result.exitCode === 0 ? 200 : 500;
|
|
21581
21648
|
send(res, status2, result);
|
|
21582
21649
|
return;
|
|
@@ -22007,10 +22074,10 @@ data: {"ts":"${(/* @__PURE__ */ new Date()).toISOString()}"}
|
|
|
22007
22074
|
},
|
|
22008
22075
|
close: async () => {
|
|
22009
22076
|
if (pollers) await pollers.stopAll();
|
|
22010
|
-
await new Promise((
|
|
22077
|
+
await new Promise((resolve22, reject) => {
|
|
22011
22078
|
server.close((err) => {
|
|
22012
22079
|
if (err) reject(err);
|
|
22013
|
-
else
|
|
22080
|
+
else resolve22();
|
|
22014
22081
|
});
|
|
22015
22082
|
});
|
|
22016
22083
|
}
|
|
@@ -22247,7 +22314,7 @@ async function handleIntegrationRpc(method, reg, params, prompts, subscribers, h
|
|
|
22247
22314
|
}
|
|
22248
22315
|
return runHostIntegration(connector, opDesc, args, worktree.hostMainRepo);
|
|
22249
22316
|
}
|
|
22250
|
-
async function handleCpRpc(reg, method, params) {
|
|
22317
|
+
async function handleCpRpc(reg, method, params, opts) {
|
|
22251
22318
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
22252
22319
|
if (!entry) {
|
|
22253
22320
|
return {
|
|
@@ -22261,8 +22328,8 @@ async function handleCpRpc(reg, method, params) {
|
|
|
22261
22328
|
for (const pat of params.exclude ?? []) flags.push("--exclude", pat);
|
|
22262
22329
|
if (params.defaultExcludes === false) flags.push("--no-default-excludes");
|
|
22263
22330
|
if (params.yes) flags.push("--yes");
|
|
22264
|
-
const argv = method === "cp.toHost" ? [process.execPath, entry, "cp", boxRef,
|
|
22265
|
-
return runHostCommand(argv, CP_RPC_TIMEOUT_MS);
|
|
22331
|
+
const argv = method === "cp.toHost" ? [process.execPath, entry, "cp", boxRef, opts.hostPath, ...flags] : [process.execPath, entry, "cp", opts.hostPath, boxRef, ...flags];
|
|
22332
|
+
return runHostCommand(argv, CP_RPC_TIMEOUT_MS, opts.cwd);
|
|
22266
22333
|
}
|
|
22267
22334
|
async function handleDownloadRpc(reg, kind) {
|
|
22268
22335
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
@@ -22276,7 +22343,8 @@ async function handleDownloadRpc(reg, kind) {
|
|
|
22276
22343
|
const argv = [process.execPath, entry, "download"];
|
|
22277
22344
|
if (kind !== "workspace") argv.push(kind);
|
|
22278
22345
|
argv.push(reg.name, "-y");
|
|
22279
|
-
|
|
22346
|
+
const cwd = await boxWorkspacePath(reg.boxId);
|
|
22347
|
+
return runHostCommand(argv, DOWNLOAD_RPC_TIMEOUT_MS, cwd);
|
|
22280
22348
|
}
|
|
22281
22349
|
async function handleCheckpointRpc(reg, params) {
|
|
22282
22350
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
@@ -22303,16 +22371,20 @@ function isOpenableUrl(value) {
|
|
|
22303
22371
|
}
|
|
22304
22372
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
22305
22373
|
}
|
|
22306
|
-
function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS) {
|
|
22307
|
-
return new Promise((
|
|
22374
|
+
function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS, cwd) {
|
|
22375
|
+
return new Promise((resolve22) => {
|
|
22308
22376
|
const [cmd, ...rest] = argv;
|
|
22309
22377
|
if (!cmd) {
|
|
22310
|
-
|
|
22378
|
+
resolve22({ exitCode: 64, stdout: "", stderr: "empty command" });
|
|
22311
22379
|
return;
|
|
22312
22380
|
}
|
|
22313
22381
|
const child = (0, import_child_process3.spawn)(cmd, rest, {
|
|
22314
22382
|
env: process.env,
|
|
22315
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
22383
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
22384
|
+
// Default to the relay daemon's CWD when unset (legacy behaviour); callers
|
|
22385
|
+
// that know the box pass its workspace so relative host paths + project
|
|
22386
|
+
// config resolve against the box, not whatever dir launched the relay.
|
|
22387
|
+
...cwd ? { cwd } : {}
|
|
22316
22388
|
});
|
|
22317
22389
|
let stdout = "";
|
|
22318
22390
|
let stderr = "";
|
|
@@ -22320,7 +22392,7 @@ function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS) {
|
|
|
22320
22392
|
const finish = (exitCode) => {
|
|
22321
22393
|
if (settled) return;
|
|
22322
22394
|
settled = true;
|
|
22323
|
-
|
|
22395
|
+
resolve22({ exitCode, stdout, stderr });
|
|
22324
22396
|
};
|
|
22325
22397
|
const timer = setTimeout(() => {
|
|
22326
22398
|
child.kill("SIGTERM");
|
|
@@ -22348,11 +22420,11 @@ relay: command timed out after ${String(timeoutMs)}ms
|
|
|
22348
22420
|
}
|
|
22349
22421
|
async function startRelayServer(opts) {
|
|
22350
22422
|
const handle = createRelayServer(opts);
|
|
22351
|
-
await new Promise((
|
|
22423
|
+
await new Promise((resolve22, reject) => {
|
|
22352
22424
|
handle.server.once("error", reject);
|
|
22353
22425
|
handle.server.listen(opts.port, opts.host ?? "0.0.0.0", () => {
|
|
22354
22426
|
handle.server.removeListener("error", reject);
|
|
22355
|
-
|
|
22427
|
+
resolve22();
|
|
22356
22428
|
});
|
|
22357
22429
|
});
|
|
22358
22430
|
return handle;
|
|
@@ -22361,6 +22433,7 @@ var QUEUE_DIR = (0, import_path6.join)(STATE_DIR2, "queue");
|
|
|
22361
22433
|
var TERMINAL_RETENTION_MS = 60 * 60 * 1e3;
|
|
22362
22434
|
var SWEEP_INTERVAL_MS = 60 * 1e3;
|
|
22363
22435
|
var QUEUE_LOGS_DIR = (0, import_path6.join)(STATE_DIR2, "logs");
|
|
22436
|
+
var FAILURE_BACKOFF_MS = 5 * 6e4;
|
|
22364
22437
|
|
|
22365
22438
|
// src/config.ts
|
|
22366
22439
|
var import_promises19 = require("fs/promises");
|
|
@@ -23038,16 +23111,16 @@ function matchState(pane) {
|
|
|
23038
23111
|
return null;
|
|
23039
23112
|
}
|
|
23040
23113
|
function defaultCapturePane(sessionName) {
|
|
23041
|
-
return new Promise((
|
|
23114
|
+
return new Promise((resolve3) => {
|
|
23042
23115
|
const child = (0, import_node_child_process7.spawn)("tmux", ["capture-pane", "-p", "-t", sessionName], {
|
|
23043
23116
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23044
23117
|
});
|
|
23045
23118
|
let stdout = "";
|
|
23046
23119
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
23047
|
-
child.on("error", () =>
|
|
23120
|
+
child.on("error", () => resolve3(null));
|
|
23048
23121
|
child.on("close", (code) => {
|
|
23049
|
-
if (code === 0)
|
|
23050
|
-
else
|
|
23122
|
+
if (code === 0) resolve3(stdout);
|
|
23123
|
+
else resolve3(null);
|
|
23051
23124
|
});
|
|
23052
23125
|
});
|
|
23053
23126
|
}
|
|
@@ -23098,16 +23171,16 @@ function matchWaiting(pane) {
|
|
|
23098
23171
|
return WAITING_PATTERNS.some((re) => re.test(region));
|
|
23099
23172
|
}
|
|
23100
23173
|
function defaultCapturePane2(sessionName) {
|
|
23101
|
-
return new Promise((
|
|
23174
|
+
return new Promise((resolve3) => {
|
|
23102
23175
|
const child = (0, import_node_child_process8.spawn)("tmux", ["capture-pane", "-p", "-t", sessionName], {
|
|
23103
23176
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23104
23177
|
});
|
|
23105
23178
|
let stdout = "";
|
|
23106
23179
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
23107
|
-
child.on("error", () =>
|
|
23180
|
+
child.on("error", () => resolve3(null));
|
|
23108
23181
|
child.on("close", (code) => {
|
|
23109
|
-
if (code === 0)
|
|
23110
|
-
else
|
|
23182
|
+
if (code === 0) resolve3(stdout);
|
|
23183
|
+
else resolve3(null);
|
|
23111
23184
|
});
|
|
23112
23185
|
});
|
|
23113
23186
|
}
|
|
@@ -23116,21 +23189,21 @@ function defaultCapturePane2(sessionName) {
|
|
|
23116
23189
|
var import_node_child_process9 = require("child_process");
|
|
23117
23190
|
var import_node_crypto = require("crypto");
|
|
23118
23191
|
var import_node_events15 = require("events");
|
|
23119
|
-
var
|
|
23192
|
+
var import_node_fs8 = require("fs");
|
|
23120
23193
|
var import_promises22 = require("fs/promises");
|
|
23121
|
-
var
|
|
23194
|
+
var import_node_path8 = require("path");
|
|
23122
23195
|
|
|
23123
23196
|
// src/state-dir.ts
|
|
23124
23197
|
var import_promises20 = require("fs/promises");
|
|
23125
|
-
var
|
|
23198
|
+
var import_node_path7 = require("path");
|
|
23126
23199
|
async function resolveWritableStateDir(want = DEFAULT_STATE_DIR, logDir = DEFAULT_LOG_DIR, ensureSubdir = "tasks", onNotice) {
|
|
23127
23200
|
try {
|
|
23128
|
-
await (0, import_promises20.mkdir)((0,
|
|
23201
|
+
await (0, import_promises20.mkdir)((0, import_node_path7.join)(want, ensureSubdir), { recursive: true });
|
|
23129
23202
|
return want;
|
|
23130
23203
|
} catch {
|
|
23131
|
-
const fallback = (0,
|
|
23204
|
+
const fallback = (0, import_node_path7.join)(logDir, "state");
|
|
23132
23205
|
try {
|
|
23133
|
-
await (0, import_promises20.mkdir)((0,
|
|
23206
|
+
await (0, import_promises20.mkdir)((0, import_node_path7.join)(fallback, ensureSubdir), { recursive: true });
|
|
23134
23207
|
onNotice?.(`${want} not writable, using ${fallback}`);
|
|
23135
23208
|
return fallback;
|
|
23136
23209
|
} catch {
|
|
@@ -23389,7 +23462,7 @@ var Ring = class {
|
|
|
23389
23462
|
};
|
|
23390
23463
|
function resolveCwd(unitCwd, baseCwd) {
|
|
23391
23464
|
if (!unitCwd) return baseCwd;
|
|
23392
|
-
return unitCwd.startsWith("/") ? unitCwd : (0,
|
|
23465
|
+
return unitCwd.startsWith("/") ? unitCwd : (0, import_node_path8.join)(baseCwd, unitCwd);
|
|
23393
23466
|
}
|
|
23394
23467
|
function spawnArgs(cmd) {
|
|
23395
23468
|
if (typeof cmd === "string") return { bin: "bash", args: ["-c", cmd] };
|
|
@@ -23465,13 +23538,13 @@ var ServiceRunner = class extends import_node_events15.EventEmitter {
|
|
|
23465
23538
|
const child = this.child;
|
|
23466
23539
|
if (child && child.exitCode === null) {
|
|
23467
23540
|
child.kill("SIGTERM");
|
|
23468
|
-
await new Promise((
|
|
23541
|
+
await new Promise((resolve3) => {
|
|
23469
23542
|
const timer = setTimeout(() => {
|
|
23470
23543
|
if (child.exitCode === null) child.kill("SIGKILL");
|
|
23471
23544
|
}, 5e3);
|
|
23472
23545
|
child.once("exit", () => {
|
|
23473
23546
|
clearTimeout(timer);
|
|
23474
|
-
|
|
23547
|
+
resolve3();
|
|
23475
23548
|
});
|
|
23476
23549
|
});
|
|
23477
23550
|
}
|
|
@@ -23511,7 +23584,7 @@ var ServiceRunner = class extends import_node_events15.EventEmitter {
|
|
|
23511
23584
|
const spec = this.spec;
|
|
23512
23585
|
const cwd = resolveCwd(spec.cwd, this.opts.cwd);
|
|
23513
23586
|
if (!this.logStream) {
|
|
23514
|
-
this.logStream = (0,
|
|
23587
|
+
this.logStream = (0, import_node_fs8.createWriteStream)((0, import_node_path8.join)(this.opts.logDir, `${spec.name}.log`), {
|
|
23515
23588
|
flags: "a"
|
|
23516
23589
|
});
|
|
23517
23590
|
this.logStream.on("error", (err) => {
|
|
@@ -23715,7 +23788,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23715
23788
|
}
|
|
23716
23789
|
ensureLogStream() {
|
|
23717
23790
|
if (this.logStream) return;
|
|
23718
|
-
this.logStream = (0,
|
|
23791
|
+
this.logStream = (0, import_node_fs8.createWriteStream)((0, import_node_path8.join)(this.opts.logDir, `${this.spec.name}.log`), {
|
|
23719
23792
|
flags: "a"
|
|
23720
23793
|
});
|
|
23721
23794
|
this.logStream.on("error", (err) => {
|
|
@@ -23728,11 +23801,11 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23728
23801
|
return (0, import_node_crypto.createHash)("sha256").update(payload).digest("hex");
|
|
23729
23802
|
}
|
|
23730
23803
|
markerPath() {
|
|
23731
|
-
return (0,
|
|
23804
|
+
return (0, import_node_path8.join)(this.opts.stateDir, "tasks", this.spec.name);
|
|
23732
23805
|
}
|
|
23733
23806
|
/** Run the `run_once.check` probe. Resolves true when it exits 0. */
|
|
23734
23807
|
runCheck(command, cwd) {
|
|
23735
|
-
return new Promise((
|
|
23808
|
+
return new Promise((resolve3) => {
|
|
23736
23809
|
let child;
|
|
23737
23810
|
try {
|
|
23738
23811
|
child = this.spawnFn("bash", ["-c", command], {
|
|
@@ -23745,7 +23818,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23745
23818
|
"stderr",
|
|
23746
23819
|
`[ctl] run_once check spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
23747
23820
|
);
|
|
23748
|
-
|
|
23821
|
+
resolve3(false);
|
|
23749
23822
|
return;
|
|
23750
23823
|
}
|
|
23751
23824
|
const onLine = (stream) => (chunk) => {
|
|
@@ -23755,8 +23828,8 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23755
23828
|
};
|
|
23756
23829
|
child.stdout?.on("data", onLine("stdout"));
|
|
23757
23830
|
child.stderr?.on("data", onLine("stderr"));
|
|
23758
|
-
child.on("error", () =>
|
|
23759
|
-
child.on("exit", (code) =>
|
|
23831
|
+
child.on("error", () => resolve3(false));
|
|
23832
|
+
child.on("exit", (code) => resolve3(code === 0));
|
|
23760
23833
|
});
|
|
23761
23834
|
}
|
|
23762
23835
|
/** Returns a human reason if the task is already satisfied (skip), else null. */
|
|
@@ -23776,7 +23849,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23776
23849
|
async writeMarker(cwd) {
|
|
23777
23850
|
const marker = this.markerPath();
|
|
23778
23851
|
try {
|
|
23779
|
-
await (0, import_promises22.mkdir)((0,
|
|
23852
|
+
await (0, import_promises22.mkdir)((0, import_node_path8.join)(this.opts.stateDir, "tasks"), { recursive: true });
|
|
23780
23853
|
await (0, import_promises22.writeFile)(marker, `${this.commandHash(cwd)}
|
|
23781
23854
|
`, "utf8");
|
|
23782
23855
|
} catch (err) {
|
|
@@ -24039,11 +24112,11 @@ var Supervisor = class extends import_node_events15.EventEmitter {
|
|
|
24039
24112
|
const targets = args.units && args.units.length > 0 ? args.units : this.autostartNames();
|
|
24040
24113
|
const timeoutMs = args.timeoutMs ?? 6e4;
|
|
24041
24114
|
if (targets.length === 0 || this.areAllReady(targets)) return { ready: true };
|
|
24042
|
-
return new Promise((
|
|
24115
|
+
return new Promise((resolve3) => {
|
|
24043
24116
|
const onChange = () => {
|
|
24044
24117
|
if (this.areAllReady(targets)) {
|
|
24045
24118
|
cleanup();
|
|
24046
|
-
|
|
24119
|
+
resolve3({ ready: true });
|
|
24047
24120
|
}
|
|
24048
24121
|
};
|
|
24049
24122
|
const cleanup = () => {
|
|
@@ -24053,7 +24126,7 @@ var Supervisor = class extends import_node_events15.EventEmitter {
|
|
|
24053
24126
|
const timer = setTimeout(() => {
|
|
24054
24127
|
cleanup();
|
|
24055
24128
|
const d = this.diagnose(targets);
|
|
24056
|
-
|
|
24129
|
+
resolve3({ ready: false, timedOut: d.notYet, failed: d.failed });
|
|
24057
24130
|
}, timeoutMs);
|
|
24058
24131
|
this.on("change", onChange);
|
|
24059
24132
|
});
|
|
@@ -24304,7 +24377,7 @@ function normalizeTask(t) {
|
|
|
24304
24377
|
};
|
|
24305
24378
|
}
|
|
24306
24379
|
async function readLogFile(logDir, service, tail) {
|
|
24307
|
-
const path6 = (0,
|
|
24380
|
+
const path6 = (0, import_node_path8.join)(logDir, `${service}.log`);
|
|
24308
24381
|
let text;
|
|
24309
24382
|
try {
|
|
24310
24383
|
text = await (0, import_promises22.readFile)(path6, "utf8");
|
|
@@ -24326,14 +24399,14 @@ async function readLogFile(logDir, service, tail) {
|
|
|
24326
24399
|
// src/socket.ts
|
|
24327
24400
|
var import_node_net4 = require("net");
|
|
24328
24401
|
var import_promises23 = require("fs/promises");
|
|
24329
|
-
var
|
|
24402
|
+
var import_node_path9 = require("path");
|
|
24330
24403
|
|
|
24331
24404
|
// src/status-reporter.ts
|
|
24332
24405
|
var import_node_child_process11 = require("child_process");
|
|
24333
24406
|
|
|
24334
24407
|
// src/tmux.ts
|
|
24335
24408
|
var import_node_child_process10 = require("child_process");
|
|
24336
|
-
var
|
|
24409
|
+
var import_node_os5 = require("os");
|
|
24337
24410
|
var MAX_TITLE_LEN = 120;
|
|
24338
24411
|
function sanitizePaneTitle(raw, ctx) {
|
|
24339
24412
|
const t = raw.trim();
|
|
@@ -24345,14 +24418,14 @@ function sanitizePaneTitle(raw, ctx) {
|
|
|
24345
24418
|
return t.length > MAX_TITLE_LEN ? t.slice(0, MAX_TITLE_LEN) : t;
|
|
24346
24419
|
}
|
|
24347
24420
|
function runTool(cmd, args) {
|
|
24348
|
-
return new Promise((
|
|
24421
|
+
return new Promise((resolve3) => {
|
|
24349
24422
|
const child = (0, import_node_child_process10.spawn)(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
24350
24423
|
let stdout = "";
|
|
24351
24424
|
let stderr = "";
|
|
24352
24425
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
24353
24426
|
child.stderr.on("data", (b) => stderr += b.toString("utf8"));
|
|
24354
|
-
child.on("error", () =>
|
|
24355
|
-
child.on("close", (code) =>
|
|
24427
|
+
child.on("error", () => resolve3({ exitCode: 127, stdout, stderr }));
|
|
24428
|
+
child.on("close", (code) => resolve3({ exitCode: code ?? -1, stdout, stderr }));
|
|
24356
24429
|
});
|
|
24357
24430
|
}
|
|
24358
24431
|
async function probeAgentSession(sessionName) {
|
|
@@ -24378,7 +24451,7 @@ async function probeAgentSession(sessionName) {
|
|
|
24378
24451
|
sessionName,
|
|
24379
24452
|
"#{pane_title}"
|
|
24380
24453
|
]);
|
|
24381
|
-
const title = pt.exitCode === 0 ? sanitizePaneTitle(pt.stdout, { hostname: (0,
|
|
24454
|
+
const title = pt.exitCode === 0 ? sanitizePaneTitle(pt.stdout, { hostname: (0, import_node_os5.hostname)(), sessionName }) : null;
|
|
24382
24455
|
return { running: true, sessionName, startedAt, title };
|
|
24383
24456
|
}
|
|
24384
24457
|
|
|
@@ -24394,6 +24467,11 @@ var StatusReporter = class {
|
|
|
24394
24467
|
claudeUpdatedAt = null;
|
|
24395
24468
|
claudePlan;
|
|
24396
24469
|
claudeQuestion;
|
|
24470
|
+
codexMarked = false;
|
|
24471
|
+
// Last-seen tmux liveness per agent, for the running→stopped edge that clears
|
|
24472
|
+
// the session pointer/marker (see snapshot()).
|
|
24473
|
+
lastClaudeRunning = false;
|
|
24474
|
+
lastCodexRunning = false;
|
|
24397
24475
|
codexState = "unknown";
|
|
24398
24476
|
codexUpdatedAt = null;
|
|
24399
24477
|
opencodeState = "unknown";
|
|
@@ -24463,6 +24541,10 @@ var StatusReporter = class {
|
|
|
24463
24541
|
setCodexState(state) {
|
|
24464
24542
|
this.codexState = state;
|
|
24465
24543
|
this.codexUpdatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
24544
|
+
if (!this.codexMarked) {
|
|
24545
|
+
this.codexMarked = true;
|
|
24546
|
+
markCodexActive();
|
|
24547
|
+
}
|
|
24466
24548
|
this.schedulePush();
|
|
24467
24549
|
}
|
|
24468
24550
|
setOpencodeState(state) {
|
|
@@ -24510,6 +24592,10 @@ var StatusReporter = class {
|
|
|
24510
24592
|
const claudeSession2 = await probeAgentSession(this.sessionName);
|
|
24511
24593
|
const codexSession = await probeAgentSession(DEFAULT_CODEX_SESSION_NAME);
|
|
24512
24594
|
const opencodeSession = await probeAgentSession(DEFAULT_OPENCODE_SESSION_NAME);
|
|
24595
|
+
if (this.lastClaudeRunning && !claudeSession2.running) clearClaudeSessionPointer();
|
|
24596
|
+
if (this.lastCodexRunning && !codexSession.running) clearCodexMarker();
|
|
24597
|
+
this.lastClaudeRunning = claudeSession2.running;
|
|
24598
|
+
this.lastCodexRunning = codexSession.running;
|
|
24513
24599
|
const status2 = {
|
|
24514
24600
|
schema: BOX_STATUS_SCHEMA,
|
|
24515
24601
|
boxId: this.boxId,
|
|
@@ -24557,12 +24643,12 @@ async function collectPorts(supervisor) {
|
|
|
24557
24643
|
}));
|
|
24558
24644
|
}
|
|
24559
24645
|
function run(cmd, args) {
|
|
24560
|
-
return new Promise((
|
|
24646
|
+
return new Promise((resolve3) => {
|
|
24561
24647
|
const child = (0, import_node_child_process11.spawn)(cmd, args, { stdio: ["ignore", "pipe", "ignore"] });
|
|
24562
24648
|
let stdout = "";
|
|
24563
24649
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
24564
|
-
child.on("error", () =>
|
|
24565
|
-
child.on("close", (code) =>
|
|
24650
|
+
child.on("error", () => resolve3({ exitCode: 127, stdout }));
|
|
24651
|
+
child.on("close", (code) => resolve3({ exitCode: code ?? -1, stdout }));
|
|
24566
24652
|
});
|
|
24567
24653
|
}
|
|
24568
24654
|
async function discoverListeningPorts() {
|
|
@@ -24588,7 +24674,7 @@ async function discoverListeningPorts() {
|
|
|
24588
24674
|
|
|
24589
24675
|
// src/socket.ts
|
|
24590
24676
|
async function startServer(opts) {
|
|
24591
|
-
await (0, import_promises23.mkdir)((0,
|
|
24677
|
+
await (0, import_promises23.mkdir)((0, import_node_path9.dirname)(opts.socketPath), { recursive: true });
|
|
24592
24678
|
await (0, import_promises23.unlink)(opts.socketPath).catch(() => {
|
|
24593
24679
|
});
|
|
24594
24680
|
const server = (0, import_node_net4.createServer)((sock) => {
|
|
@@ -24598,11 +24684,11 @@ async function startServer(opts) {
|
|
|
24598
24684
|
sock.end();
|
|
24599
24685
|
});
|
|
24600
24686
|
});
|
|
24601
|
-
await new Promise((
|
|
24687
|
+
await new Promise((resolve3, reject) => {
|
|
24602
24688
|
server.once("error", reject);
|
|
24603
24689
|
server.listen(opts.socketPath, () => {
|
|
24604
24690
|
server.removeListener("error", reject);
|
|
24605
|
-
|
|
24691
|
+
resolve3();
|
|
24606
24692
|
});
|
|
24607
24693
|
});
|
|
24608
24694
|
await (0, import_promises23.chmod)(opts.socketPath, 432).catch(() => {
|
|
@@ -24846,14 +24932,14 @@ function startBoxRelayForwarder(opts) {
|
|
|
24846
24932
|
});
|
|
24847
24933
|
req.pipe(upstreamReq);
|
|
24848
24934
|
});
|
|
24849
|
-
return new Promise((
|
|
24935
|
+
return new Promise((resolve3, reject) => {
|
|
24850
24936
|
const onError = (err) => {
|
|
24851
24937
|
reject(err);
|
|
24852
24938
|
};
|
|
24853
24939
|
server.once("error", onError);
|
|
24854
24940
|
server.listen(opts.port, "127.0.0.1", () => {
|
|
24855
24941
|
server.removeListener("error", onError);
|
|
24856
|
-
|
|
24942
|
+
resolve3({
|
|
24857
24943
|
url: `http://127.0.0.1:${String(opts.port)}`,
|
|
24858
24944
|
close: () => new Promise((res) => {
|
|
24859
24945
|
server.close(() => res());
|
|
@@ -25162,26 +25248,26 @@ function buildParams(opts, extra) {
|
|
|
25162
25248
|
return params;
|
|
25163
25249
|
}
|
|
25164
25250
|
function runLocalGit(args, cwd) {
|
|
25165
|
-
return new Promise((
|
|
25251
|
+
return new Promise((resolve3) => {
|
|
25166
25252
|
const child = (0, import_node_child_process12.spawn)("git", args, { cwd, stdio: "inherit" });
|
|
25167
|
-
child.on("close", (code) =>
|
|
25253
|
+
child.on("close", (code) => resolve3(code ?? 1));
|
|
25168
25254
|
child.on("error", (err) => {
|
|
25169
25255
|
process.stderr.write(`agentbox-ctl git: ${String(err.message ?? err)}
|
|
25170
25256
|
`);
|
|
25171
|
-
|
|
25257
|
+
resolve3(126);
|
|
25172
25258
|
});
|
|
25173
25259
|
});
|
|
25174
25260
|
}
|
|
25175
25261
|
function hasGitIdentity(cwd) {
|
|
25176
|
-
return new Promise((
|
|
25262
|
+
return new Promise((resolve3) => {
|
|
25177
25263
|
const child = (0, import_node_child_process12.spawn)("git", ["config", "user.email"], {
|
|
25178
25264
|
cwd,
|
|
25179
25265
|
stdio: ["ignore", "pipe", "ignore"]
|
|
25180
25266
|
});
|
|
25181
25267
|
let out = "";
|
|
25182
25268
|
child.stdout.on("data", (c3) => out += c3.toString("utf8"));
|
|
25183
|
-
child.on("close", (code) =>
|
|
25184
|
-
child.on("error", () =>
|
|
25269
|
+
child.on("close", (code) => resolve3(code === 0 && out.trim().length > 0));
|
|
25270
|
+
child.on("error", () => resolve3(false));
|
|
25185
25271
|
});
|
|
25186
25272
|
}
|
|
25187
25273
|
var gitCommand = new Command("git").description("Git operations that need host credentials (routed through the agentbox relay)").addCommand(
|
|
@@ -25320,7 +25406,7 @@ function isHttpUrl(value) {
|
|
|
25320
25406
|
}
|
|
25321
25407
|
}
|
|
25322
25408
|
function openInBoxBrowser(url) {
|
|
25323
|
-
return new Promise((
|
|
25409
|
+
return new Promise((resolve3) => {
|
|
25324
25410
|
const child = (0, import_node_child_process13.spawn)("agent-browser", ["open", "--headed", url], { stdio: "inherit" });
|
|
25325
25411
|
const timer = setTimeout(() => {
|
|
25326
25412
|
child.kill("SIGTERM");
|
|
@@ -25328,18 +25414,18 @@ function openInBoxBrowser(url) {
|
|
|
25328
25414
|
`agentbox-ctl open: agent-browser timed out after ${String(OPEN_TIMEOUT_MS)}ms
|
|
25329
25415
|
`
|
|
25330
25416
|
);
|
|
25331
|
-
|
|
25417
|
+
resolve3(124);
|
|
25332
25418
|
}, OPEN_TIMEOUT_MS);
|
|
25333
25419
|
if (typeof timer.unref === "function") timer.unref();
|
|
25334
25420
|
child.on("close", (code) => {
|
|
25335
25421
|
clearTimeout(timer);
|
|
25336
|
-
|
|
25422
|
+
resolve3(code ?? 1);
|
|
25337
25423
|
});
|
|
25338
25424
|
child.on("error", (err) => {
|
|
25339
25425
|
clearTimeout(timer);
|
|
25340
25426
|
process.stderr.write(`agentbox-ctl open: ${String(err.message ?? err)}
|
|
25341
25427
|
`);
|
|
25342
|
-
|
|
25428
|
+
resolve3(126);
|
|
25343
25429
|
});
|
|
25344
25430
|
});
|
|
25345
25431
|
}
|
|
@@ -25361,7 +25447,7 @@ var import_promises25 = require("fs/promises");
|
|
|
25361
25447
|
// src/secret.ts
|
|
25362
25448
|
var import_node_crypto2 = require("crypto");
|
|
25363
25449
|
var import_promises24 = require("fs/promises");
|
|
25364
|
-
var
|
|
25450
|
+
var import_node_path10 = require("path");
|
|
25365
25451
|
var SECRET_RE = /\{\{\s*AGENTBOX_AUTO_SECRET(?::([A-Za-z0-9_-]+))?\s*\}\}/g;
|
|
25366
25452
|
var SECRET_BYTES = 32;
|
|
25367
25453
|
function generateSecret() {
|
|
@@ -25380,7 +25466,7 @@ async function resolveAutoSecrets(content, opts = {}) {
|
|
|
25380
25466
|
"secrets",
|
|
25381
25467
|
(msg) => opts.onLog?.(msg)
|
|
25382
25468
|
);
|
|
25383
|
-
const dir = (0,
|
|
25469
|
+
const dir = (0, import_node_path10.join)(base, "secrets");
|
|
25384
25470
|
for (const name of names) named.set(name, await loadOrCreateSecret(dir, name, opts.onLog));
|
|
25385
25471
|
}
|
|
25386
25472
|
return content.replace(
|
|
@@ -25389,7 +25475,7 @@ async function resolveAutoSecrets(content, opts = {}) {
|
|
|
25389
25475
|
);
|
|
25390
25476
|
}
|
|
25391
25477
|
async function loadOrCreateSecret(dir, name, onLog) {
|
|
25392
|
-
const file = (0,
|
|
25478
|
+
const file = (0, import_node_path10.join)(dir, name);
|
|
25393
25479
|
try {
|
|
25394
25480
|
const existing = (await (0, import_promises24.readFile)(file, "utf8")).trim();
|
|
25395
25481
|
if (existing.length > 0) return existing;
|